Another thing that's helpful for concentration is just getting enough sleep, enough exercise, and enough healthy foods. (Alan Turing used to run marathons, and a healthy heart does pump more oxygen to your brain...) :) This also can help burn off any leftover stress from a hard day of programming... (It's always good to get outside and relax for a bit.)
It's also wildly over-diagnosed. There are physiological reasons it can exist; there are also environmental reasons the symptoms can exist.
Don't worry and there is not a single programmer that cannot "concentrate". You probably got stuck in a job that demotivates you with possibly the wrong people around you.
You can also try and get active with something that has nothing to do with your main work, i.e, a hobby such as photography and see if it helps.
I've suffered a lot from this and I'm making progress. Here are some things that have helped:
a - Having a notebook with ideas and what I want to learn and my thoughts on stuff with dates. The date is a slap on the face to remind me how much time I lost to indecision. "Indecision is a decision".
An example: I wanted to brush up on my Maths and Physics (to have a stonger core). I started wondering which book would be best to read first and all the "ooh, look at this one.. Oooh, that one looks great" that goes with it. I started reading them chicken style (a bit of that one, a bit of that other one).
Before I knew it, months have gone by and I have accomplished nothing at all. I spent too much time doing everything but the very thing that I set out to do, forgetting three things:
1 - If I am as serious as I think I am, I would eventually read them all so why does it matter so much which one I read first?.
2 - In that period, I could have read them all if I had just picked one, finished it, and picked another to finish it too.
3- Parallelism is easier in love and reading many books on different topics than in reading books on the same topic.
This has taught me a lot about myself: I'm a smartass who wants to find a shorter path than a line segment(ooh, let's go ninja and bend the fabric of time).
Then again, Blaise Pascal once said: "I have only made this letter longer because I didn't have the leisure to make it shorter".
b - For the specific problem of reading books, completion, and retention: taking notes is helping tremendously. I used to either read without taking notes (still do when it's a book that I can somehow digest on the fly) or take notes with pen and paper and lose them later. I still scribble with a pen but also using LaTeX to write notes in the "Cornell format".
Here are my notes on a course called "Introduction to Marketing": https://j.mp/mrktgnts. When it's organized and neat like this and easily found, I find myself taking the thing more seriously and wanting to complete the book, etc.
Plus, from now on, I can share my notes on books I read, etc.
Another advantage of this format is that long after you have finished the book, you can test yourself by covering the right side (blue boxes) and trying to answer the questions in the red ones, instead of re-reading the whole book.
Btw,your notes look fantastic. I also did 20% of the intro to marketing course(surprise!). But the reason I dropped out of that was I thought there would be some internet marketing involved but there was none. While on the topic, I do have a surprisingly good track record of completing moocs.
I would like to get in further touch with you and talk about this in detail. If you are interested let me know your email.
I can't post mine here since this is a throwaway/anonymous account.:)
Mine is jugurtha dot hadjar at gmail dot com.
Just like everything else, really.