Ask HN: Underperforming, feeling stuck

150 points by throwaway_stuck ↗ HN
What do you do if you feel you have all the advantages when it comes to programming -- intelligence, experience, passion, knowledge -- and yet they seem to desert you when you sit down to code?

One possibility is that I'm not as good as I think I am -- but I have had lots of validation. In the recent past (5 years) I've succeeded at some of the hardest interview processes in the world. I've written things that I'm proud of. I can speak as intelligently about code as any HNer.

Despite all this every time I sit down to code my brain turns to mush, somehow, and nothing gets done. I can always give my managers an intelligent explanation of why progress is so slow, but the thing is, progress is still slow. Lately I find myself making more and more beginner mistakes.

The weird thing is, I don't even feel burned out or depressed. I couldn't be happier with my current job. I'm just… stuck.

If something about this sounds familiar, feel free to offer advice. While psychological diagnoses may be right, at this point though I feel like there's something wrong in my practices.

I need some sort of professional help that doesn't exist. Someone to sit next to me all day and tell me what it is I'm doing that's burning up 8 hours a day without actually achieving anything.

134 comments

[ 1.4 ms ] story [ 240 ms ] thread
Burnout takes a lot of forms, has many stages and is felt differently by everyone.

Are you happy with your job - or just the salary that you get paid? Take some time and think about your motives for staying where you are.

Maybe you can look for advancement (challenge) that will help you to be renewed in your current job; maybe you simply need a change. If you do decide to move on to something new, I highly advise taking an extended break between the old and new... reset, refresh and revitalize.

You have to know what the problems are before you can solve them. Seems simple, but it's surprisingly common to overlook this one simple truth. Just ask yourself - what do you like about your current job?

This is serial. I've lost a couple of jobs in a row from this.

Luckily I still have a reputation earned from some years ago. Plus, I interview well. People still give me jobs.

Managers don't seem to have a response here. In my experience most managers only have one bit of information devoted to programmer ability (ROCKSTAR xor SUCKS). They have alternately told me to try harder, or threatened then fired me.

I had felt like I was deceiving employers so I took a nine month break and did an artistic project. However even with a whole day to do nothing but that, I wasn't able to achieve much. I worked with a small number of people and lef that project, and it got done, but not very well, even though it was my "full time" job. Still, I felt that I had had enough of a sabbatical, and also had made some progress in psychotherapy, so I returned to the workforce, only to run into the same problems I had before. I now think the psychotherapy was not addressing the right problems -- it's more about what I do than how I feel. And it's clear my attempt at a sabbatical didn't clear up the fundamental issues.

I have friends that are able to learn programming languages on the side or take blacksmithing courses and otherwise have full and exciting lives. In other words they have reserve energy. I am so behind on just the basic requirements for my project, I feel I can't do any of this. I schedule more and more and more and more time for work and yet still nothing gets done.

As for happiness with work; I have a pattern of working with codebases that are in great need of refactoring and I am feeling a great need to stretch out and do something more original. So that is a problem.

That said, the guy who sits next to me has enough energy to actually satisfy those needs both at work (gets managers to agree to major refactorings) and also code up some great things in his spare time. Whereas I'm perenially playing catch-up and my code is ugly.

Someone mentions this below, but, are you trying to engineer the most perfect elegant solution known to man when you could get by with something more simple?

Working with existing code that someone else wrote is harder than a new project. I've only really gotten into heavy testing in the last year or two, but having tests also improves confidence that your changes are not bringing down the entire system.

Finally, what I would say is you need to get into a habit of mentally stimulating yourself after work. I found that when I was in a rut, I thought that I was burnt out and needed to "veg out" more, but I later felt that vegging out only bred more laziness and more procrastination. Once I started to get my brain stimulated in any way, whether it was reading a book, or trying something to learn something new, the effects would carry over.

Summary, laziness breeds more laziness, and stimulation actually recharges you.

You took a sabbatical but you kept programming. That didn't address your burn out at all. You should have taken blacksmithing courses. :) It's not that they have reserve energy it's that they refresh themselves by changing modes.

Personally I'm pretty prone to burn out. I work as a developer and have lots of programming side projects I work on. My advantage is that I can sense the burn out and when it happens I stop all side projects and try to do mostly administrivia at work.

I did stay in one programming job while burned out for over 2 years (this was before I realized what was it was). I produced practically nothing in that time but the act of sitting there trying to force my way through made the burn out get gradually worse. I stepped completely away from programming for about 30 months to get over it.

Another thing that made my burnout worse at that company was that the environment was so incredibly awful. Are you sure you're actually happy where you are, or do you say that because you fear being fired again? I would have said (and if fact did tell someone) that I loved my job during those dark two years, but it was because I felt worthless and unable to get anything better. I wasn't trying to trick the person that I told, I was trying to trick myself into believing it.

Working on existing, bad quality code is the biggest nightmare for me. My philosophy is to think about a problem a lot, and write as few and as concise code as possible. Even delete code if not necessary. I am working alone on 180.000 lines of really bad quality Java code with copy-pastes, and its own 'web framework' and using all the buzzword technologies like Spring everywhere. The business requirements are not that complicated (although boring like hell) 20.000 lines of really high quality code would solve the problem I think. It has been created by 3 people for not too much money. I've reached the point that it is impossible that I can ever refactor this alone, as there is no time for that an my manager is micromanaging very much. It is extremely hard to put in new features because I have no mental model for how to do things in this 'framework' (an undocumented mess. and I've spoken with the author: he could not explain the philosophy behind it.) I am so unmotivated that I go to math/programming forums and I solve math/algorithmization problems for some fun when I should work. At the darkest times I find out math quizzes for myself or just think about P vs. NP (which is depressing as there is no chance to solve that). But I need the money, and there are not much interesting jobs where I live.

And I feel that there are people who could be a bit better at what I do now: people with very very good memory. Maintaining a huge illogical mess needs very good memory and nothing else. I don't have very good memory. That's why I love logical and conciese solutions which have 'philosophy' behind them.

several strategies that have worked for me:

1. get yourself checked out for ADD. I'm not saying this is the problem, but it's easy to check for, and if it is the problem, there are drugs that can at least temporarily make the problem just go away. Now if this is something you've never experienced until just now, it's probably not ADD. But if you've had these sorts of problems on and off forever, (I know for me, my performance falls off a cliff after I've had a job for about a year.) ADD is something to check out.

2. Try pair programming. It works really well for me.

3. Move into management. Even if your organizational skills are not great, having the knowledge of the field gives you a pretty good leg up. If you manage your own company, you can hire people specifically to take care of the things you are no good at or hate. You can get a CS student to watch you code and kick your chair when you stop for under ten bucks an hour.

> it's easy to check for

Really? That's news to me. How do they check?

> Move into management

+1. The tech world needs more managers who actually know tech.

> Really? That's news to me. How do they check?

Typically diagnosis is made after an interview (about an hour) and questionnaires. If there's some doubt about the diagnosis you may need to bring in old school reports. It's also possible to diagnose using brain scans now (e.g http://www.sydneydevelopmentalclinic.com.au/brain_scanning.h...), and medication can be trialled and selected on the basis of an individual response to the medication (shown with another brain scan, or using testing, e.g http://www.sydneydevelopmentalclinic.com.au/medication_testi...).

My experience with a neurologist specializing in ADHD treatment:

1. The doctor will interview you and ask you about your history, all the way back to childhood. If you haven't had problems focusing, concentrating, etc. throughout your whole life (even as a child), the doctor might be skeptical.

2. They'll test you to make sure you're not having seizures.

3. They'll also test your focus, concentration and short term memory with a computer test called CPT (continuous performance test).

Assuming you have a history of ADHD symptoms, you currently have symptoms that are interfering with your life, and you do poorly on the computer test, the doctor will probably start some kind of treatment, probably using prescription stimulants.

That said, I'm sure there are a lot of other medical conditions that cause symptoms similar to ADHD's. You might end up learning you have some other problem entirely.

Depends on the doctor really.

The first doctor I tried wanted to have me see a shrink to get tested. The first visit cost me a $50 copay and then I had to have another visit to do the actual test, costing another $50 copay. I skipped that second visit and went to another doctor. (The shrink seemed like a quack anyhow).

My new doctor whipped out a giant book and started reading a battery of questions from the back of it. Based on the answers to those questions he determined I "met the requirements for treatment." Seemed a bit weak, but I didn't ask any questions since I knew I had already been through all the typical tests before. having been diagnosed as a child.

TLDR: YMMV. Just talk to the doc and see what he says.

>How do they check?

It's an interview process. But really, as far as I can tell, the check is "do the drugs make you hyper or do they make you focused" The only definition of ADD that I've heard that differs appreciably from simply being lazy sometimes is that people with ADD respond differently to stimulants. Jack up my nervous system enough and I'll actually lay down for a nap.

There is something called the TOVA test, Test Of Variance of Attention, or something like that.

It's like a very boring 10 minute video game. You click a button when a certain stimulus is presented on screen, but not when a different stimulus is presented. It measures your reaction times and your errors (click when you shouldn't, don't click when you should). Then the program does some statistical comparisons and prints out a report.

At least, that's what was done in 1993. Could be different now.

Combine that with a history. I imagine it's a lot easier to diagnose in adults, because so much more data is available. And the doctor doesn't have the pressure of diagnosing ADHD for a little kid whose parents are worried he'll get less out of school. As an adult, that damage is already done. ;^)

I second the ADHD check. This sounds like classic ADHD symptoms to me. Once you sort of reach that pinnacle you've been striving for, it's easy to lose the drive when you can relax and quit striving or when things are less challenging. You will find your motivation will wax and wane, week in and week out. You start avoiding the real work so much with distractions that it becomes painful just to face it and your own procrastination, which magnifies the symptoms by an order of magnitude.

Do NOT let this relatively easily solvable problem destroy your career. I made this mistake early on in my career and paid for it with a lost job. I'm glad things ended up the way they did, but it would have been better if I left there on good terms.

Even if medication is a temporary fix, it might be what this situation calls for. Often in life we have to chose the best of two evils, and your career is not something to put on the line. I know that I am way happier working 40 hours a week steady than I was when I would binge hack for 120 hours straight while riding a motivation wave.

If you can get yourself back into the groove and being productive, try to figure out what gives you motivation and try to work your way into a position that continuously feeds you these things. That's what I'm working towards.

> I second the ADHD check. This sounds like classic ADHD symptoms to me. Once you sort of reach that pinnacle you've been striving for, it's easy to lose the drive when you can relax and quit striving or when things are less challenging. You will find your motivation will wax and wane, week in and week out. You start avoiding the real work so much with distractions that it becomes painful just to face it and your own procrastination, which magnifies the symptoms by an order of magnitude.

Holy crap, you just described my life. There's no way I'm an extreme case, but maybe I really do have a little ADHD going on...?

I think everyone finds themselves with those thoughts and feelings.

I think that the lack of drive and focus is a symptom of something, in rare cases perhaps ADD/ADHD. However from personal experience I usually discover a core problem that was causing these symptoms. Resolving that problem takes care of the lack of motivation and focus.

Perhaps the specific work environment isn't for you. One job I worked directly out of university crushed my soul as a developer. As an intern I had vast responsibility and did a lot of interesting projects. Once I joined on fulltime, they were going through a restructuring period and I ended up doing trivial work putting out fires. Luckily they downsized a third of the company a few months later and I was fired - a blessing in disguise there. A week later I was running a small team doing innovative new projects at a large corp.

Often it can be outside factors in life that strangle your productivity. When my father was very sick and hospitalized, my work drastically suffered. I'd like to consider myself a strong individual whose outlook on life would allow me to deal with such events with ease. However, in the situation without knowing it at the time it was impacting my life. Instead of taking a few weeks off and dealing with the issues at hand, I threw myself into my work while my progress continued slowing exponentially. Eventually I was working 16 hours a day and writing 0 lines of code. I ended up quitting that job, and taking time to deal with my life.

Anyways, the moral of the story was stepping back and discovering the root cause of these symptoms can be very beneficial. Don't block it out with meds unless that is really the cause.

I agree with everything you say. Often there are other factors. It sounds like this is a consistent problem with OP though, and regardless of environment or lifestyle, he's still having issues.
>Anyways, the moral of the story was stepping back and discovering the root cause of these symptoms can be very beneficial. Don't block it out with meds unless that is really the cause.

If the meds fix the problem, and they have proven fairly safe, why not use them? (I mean, they aren't absolutely safe, but they are very safe compared to, say, driving to work every day.)

It's not a lifetime choice, either. You can decide that you need some help, and get it for the next six months, then stop and work on your personal issues. This is actually what I'm doing now (though, I'm nearing the end of my rest... it's time to get some work done.)

While we all have a little bit of it in us: let's face it, nobody wants to work on a dull project, ADHD symptoms become so exasperated in these scenarios that they become debilitating and self-destructive. The brain turning to mush that OP described hit it right on the head. The best litmus test I've found is to the conversation test:

"frequent shifts in conversation, not listening to others, not keeping one's mind on conversations"

I can have "black out" episodes where I impulsively and immediately walk away from conversations without finishing them, often with a little amnesia. I've asked my girlfriend a question, essentially immediately forgotten that I did so, and turned up the radio volume.

http://www.addforums.com/

No, it's normal, and blaming it on a medical condition is dangerous and not helping you fix it. Perhaps in some people it's due to ADHD, but in most it's not.
> You can get a CS student to watch you code and kick your chair when you stop for under ten bucks an hour.

Excellent idea.

I've often thought this would be useful. Someone standing behind me to slap me whenever I compulsively checked email for the second time in a minute, checked a news site to see if anything interesting had happened in the last five minutes, etc.
Pair programming is good advice - but then, I have a sneaking suspicion that the majority of what you find in Agile programming methodologies is pretty much designed at overcoming the problem that the OP describes.

I found that morning meetings with the other devs on the project, where we are all publicly assigned stories to complete in the day also helps - you don't want the rest of the team feeling like you're slacking off, so you push on through the distractions. But of course, you need the whole team to be on board, and indeed, you need a team!

As I often work alone, the Agile methodology that helps me the most is TDD. It helps me keep focused on what I need to do next. Conceptually it's similar to a TODO list, as suggested in other posts, but it has the advantage that you can't allow the tool itself to be a distraction (I've tried TODO lists, and I end up playing more with the list than with the work). With TDD, either you're writing tests, or you're writing the product code, but either way you are creating an artifact that is useful to the project.

As others said above I'd also suggest you try out pair programming (with a friend of yours). I find myself more relaxed when I'm with someone I can talk to, make jokes or just bitch about the things not working. When I feel stressed I change place with my friend and he continues with the code while I calm down. Also he might see mistakes you don't and helps you fix them right away avoiding the stress.

Another good strategy is to break everything down to small tasks. Tasks you can do in 30 minutes or less. Watching the list getting shorter makes you feel like you're doing something. I think this is part of the agile approach.

When I feel as you describe above I know it is time for a change (new job). The thing that bugs me though is that you say that you are happy with your current job - but maybe you are just lying to yourself (without realising it) because you feel comfortable?
My job is about as good as it gets. I believe in the work, the people are great, it's interesting and affects lots of people. The downside is the codebase is old and has problems, but I've seen far worse.

Part of me is itching to strike out on my own but if I don't have the discipline to even do halfway well at a job like this, how am I going to deal with a startup?

But maybe programming is not your real passion? I am in a similar situation right now yet again. I saw that after a year (two years max) I get bored with my job and couldn't care less and then I start looking around, change jobs and the circle begins again. This time I realized that I need to break out of this pattern because it is leading to nowhere. I am scared to start on my own, but maybe it is just what i need? Maybe if I am out of my comfort I will be actually forced to be active and do things instead of thinking about them and complain. So, maybe starting on your own is something you actually need, as well?
When was the last time you disconnected from programming? Holidays? Have you taken a halt and re-started? If you are getting nowhere, try to get two weeks off. If you can manage, a month. And keep away from programming for that time. You will crave coding after 2 weeks :D
See "this is serial" above. I took about 9 months off. Didn't really do any coding at all.
I agree, I always take one long holiday a year. 3 weeks when possible.
One of the spookiest things about burn out or stress of any kind is just how incredibly stealthy it is. It's impossible to self-diagnose in many cases. You can't trust your own evaluation at all.
I've had similar stuff happen to me. One trick that has helped to get me out of the rut is to go back to the basics. When I'm stuck I would find a textbook problem, from the very simple (reverse this array, etc) to the more complex (implement a red-black tree). I find these problems help get me back on track and give me useful tools that I might use some day.

I think there are two pieces to being effective at programming. If you have a clear idea of what you are trying to achieve, you can just bang out the code. Unfortunately, most of the time you are understanding the problem while you code it due to very ambiguous specs, so you just can't code as efficiently.

Last, but not least, tweak and tweak away. Write some code, take a walk, come back and take a look at it again. Review your own code thinking about where you are making mistakes, it'll give you a map of what to watch out for.

I can identify with elements of what you are going through, but I cannot add anything to explain the why behind them.

I remind myself though, that what you see in others around you is the polished exterior surface of their lives, which many times hide the tangled mess of cabling and crap inside. My point is you are comparing your messy insides to another person's polished exterior - hardly a fair comparison for you.

Best of luck

I get this sometimes. For me, it takes the right balance of something I'm excited about, having a lot to learn, and having drive from people whom I feel are pushing me in a direction that's better when I'm having trouble ramping up, but not in the way when I'm really rolling out code.

I've been doing most of that lately, though I can get into a dream state quite a bit where I want to make something really awesome that will slow things down a bit too far.

You're really lucky people are pushing you. I'd love to have that! Some of us are less fortunate, either because other associates are not interested in the projects you're working on, or because they're super busy in their own.

I don't get a lot of friends and associates asking about my progress, but I always make sure to reach out to them every so often to see how they are doing and offer myself as a resource if they need it for anything.

The beginner mistakes line stuck with me. What types of mistakes (specific examples)? This might be useful for me to know what is going on ewith you.
Big things like agreeing to start coding without requirements.

Little things like inconsistent return conventions or code disagreeing with documentation comment blocks.

People are referring me to classic coder texts like Code Complete. Okay, maybe I do need a review but I fucking read that book in the 90s. It's incredibly galling.

Definitely familiar. What I would suggest is to figure out what it is you're really getting hung up on. It has to be something more specific than "my brain turns to mush." Try writing down a description of the problem you think you're having. The act of rendering a thought into writing will often break a logjam for me.
I get hung up in a number of ways, but the most severe is when I'm trying to learn how the existing system works. I'll be listlessly paging back and forth between spaghetti code classes, and things get all fuzzy, and then it feels like I've spent enough time on this, and some sort of strategy to do my project occurs to me.

And then I try it, but it doesn't work because I still didn't understand the existing code. Rinse, repeat.

However, just the other week I decided somehow to FIGURE OUT HOW IT ALL WORKS, DAMMIT. I actually kept a glass of ice cubes next to my desk and pressed one to my head if I felt I was drifting, which worked surprisingly well. I realized that this codebase always had a lot of the functionality I had always wanted, hidden away in a particular method. I'd been staring right at it for months and it didn't click in my head.

I felt ashamed.

Hm, trying to load a huge ball of spaghetti code into your head is maybe not the best idea.

Personally I would only try to understand the parts I currently need.

Yes, in theory it would be nice to understand everything before you start. It would also be nice to understand quantum physics, and all sorts of other things. In real life, though, sometimes you have to compromise.

I've had the same experience with specifications, btw. Yes, I'll read the whole document before starting. But usually I only really understand it once I start implementing the details. (I am also not convinced that specs of several hundred pages are any use at all).

This sounds very familiar...

> Luckily I still have a reputation earned from some years ago.

You've been capable of doing good work in the past, but you're deeply critical of your current work:

> I felt ashamed. ... and my code is ugly.

When you try to work, do you start on an approach but then doubt it and lose momentum?

It could be anxiety. Here are some thoughts:

1. Remember that programming is difficult and takes time. Adjust your expectations to accept slow progress.

2. Refuse to churn, even if it means writing crap code. Consider everything you write at the outset of the project/day/feature to be a rough draft. You will return to revise it, so the rough draft can be utter crap.

3. Keep your focus on a small corner of the project. Seeing the big picture can help you design a higher quality system, but considering the big picture for too long or too often allows your mind to despair. Todo lists help, but the attitude of ignoring everything but the current task helps more.

Pay attention to what you're thinking about when your mind fuzzes out. Are you worrying about something? Learn to recognize the beginning of your focus dropping away.

You said this:

> it's more about what I do than how I feel ... at this point though I feel like there's something wrong in my practices.

I think you're wrong. You knew what to do in the past (you told us so) yet you fail at similar tasks today. Your "brain turns to mush" and you think it's practice that's lacking? Not doing TDD? Too many templates? Not knowing the latest design pattern?

It's in your mind.

One important thing to keep in mind is that progress doesn't always feel like progress. Trying something that turns out not to work might feel like a waste of time, but it's actually progress: now you know this doesn't work and you can try something else that is more likely to work. As long as you remember what didn't work and don't end up in loops where you keep trying the same non-working thing over and over again (which is harder than it sounds) you will sooner or later get it to work.
Try to build the simplest, crappiest thing you can think of. Leave perfectionism at work.
I wouldn't be so sure that perfectionism at work is such a good thing. Sooner or later you're going to hit the bottom line.
When I get this, I add extra constraints to make the problem harder. Switch to using VI editor instead of using Emacs like I normally do. Do an ambitious rewrite/refactoring, make it harder just to to add more FACTOR X. Having more unknown in a projekt makes it more rewarding imho, especially if you're turned on to constantly learning new things. It can be as simple as developing from a new platform (running some weird ass OS inside a VM and developing from that), or it can be (depending on project, writing it in some weird little language just for fun). You probably don't need less of a challenge, you need more of a challenge to get you really motivated.
Few things that have helped me:

1. Tim Ferriss's 4HWW suggestion to focus on one or two things a day and when you're doing one of those things, do it in one shot. Don't take any breaks, ready any news, or get lunch before you're done with it.

2. Scrum. The daily meetings and sprint demos have highly motivated to show what I've done. It's also hard to explain away bad performance when the burndown chart is falling behind because of you.

3. GTD tip: What's the next action? It feels great to boil big projects down to a next action. Sometimes great enough to actually start doing it. :)

4. Listen to some music. Sometimes this boosts my mood and motivates me to delve into a project. The trick is turning off the music once you get to the first problem that requires some deep thought.

Why did you post this on a throwaway account? Are you afraid that HN will think less of you if you posted on your real account? Not trying to be critical - these are honest questions here.
This is a public forum, not a closed community. Posting about a problem you are having publicly can put you at a disadvantage if your regular account is linkable to your real life name. For example, if a prospective employer googles his name and finds a post about how he's having trouble working, they may be less likely to hire him, even after he figures out the solution to his particular problems.
I think it's more to do with employers usually, might not be to happy about an employee that is admitting they probably shouldn't be getting things done at the rate that they are currently.
Sometimes, when you learn new things, your expectations of yourself grow faster than your practical skills. You read about great things, and then you want to be able to do those too, but your practical skills and experience hasn't caught up yet. Maybe it's that?
Same shit was happening to me for a while. I have 1 word for you: modafinil.
I think it's a common pattern, only perhaps the magnitude is worse in your case. I observed it on myself as well on other programmers back when doing a project management stint.

What helps me personally is having a notepad where I jolt down TODO items, to the most atomic level if possible. To give an idea what's on it here now:

  - probe for activity on the I2C bus
  - find the SIGCHLD problem
  - remove rectangle in the logo on web interface
  - follow up to a customer on his RFI
I.e. tiny bits of work that do not present much challenge separately, yet are actual, necessary things to be done. No deadlines, priorities, long descriptions, etc. No grand items like "add feature X" or "do complete test coverage". They are easy enough that I can complete at least one (but usually a bunch) in the day, and strike it out. Each time you do that, there is a modest tingle of gratification, so it helps to maintain working mood. Also, looking back at the list of completed items is reassuring.
When you know you need to "add feature X", what do you do? Write "itemize feature X" on your list, and then, when you come to it, sit there and think of a list of things to replace it with?
When you get to that point, you need to get input from the people that you are coding the feature for in the first place. Have a productive meeting with your manager to discuss what they want for feature X, for example. Then the more atomic parts of the todo list should become clear-er.
No, I don't do any meta stuff in the notebook, that would be silly. It's not a progress report, development plan or a Gantt chart. You don't show it to your peers or supervisors, you don't need to decieve anyone with it. The main purpose is self-accountability and keeping (loose) track of the things you need to approach. Micro-managing myself, so to say.

If I need to add a feature, I just come up with first obvious things that have to be done, and expand it as the problem works out or new circumstances arise. E.g. I had to add a protocol support (Modbus TCP & UDP) to the product, the list ended up like this (editorializing a bit):

  - get green light from the manager
  - read the spec for minimal conforming implementation
  - implement conforming request parsing
  - implement register read command
  - add application-specific bit X to a register
  - add application-specific bit Y to a register
  - implement UDP recv/send loop
  - test UDP part
  - implement TCP listener
  - test TCP part
  - fix zombie issue with TCP handler
  - test TCP part
  - build of product with the new feature
  - test the build
  - test the build vs real PLC
Perhaps everyone has at least some ideas what you should do when you begin on chunk of work X, so you just write them down, no matter how trivial.
Itemize feature X is often very difficult. Instead of itemizing all of feature X in one go, just figure out what the next item is that needs to be done to move towards feature X and write only that single item on the to do list.
That's programming. Recursively specifying problems until they're defined unambiguously in terms of solved problems. When you've reached the level of the features of your language and tools... that's your program.
Thinking in terms of "add feature X" is not breaking it down enough. No feature is an atomic piece of code...if it was, "add feature X" would be enough to implement it and you would be done. The trick is to keep breaking down "add feature X" until you have a list of todo items that are close enough to code that they are then trivial to implement.
That's exactly my approach. I spent a month on a project not really getting anywhere, putting things off and moving things 2/3 pixels in CSS code doing "work". I then bought a whiteboard, itemised in root-level terms the tasks I needed to get done, how I would achieve them, and then crossed them off when done.

I not only felt accountable to myself, but as I work alone, friends or family visiting me would ensure my checklist was being ticked off and ask questions on specific points ("why haven't you done that?" "because XYZ is taking longer than expected" etc...)

The list makes you answer questions about how you'll tackle the problem, it also allows you to think without staring at a screen which is beneficial.

I've had a lot of success with the pomodoro technique. You start with a todo list for the day and then do work in 25 minute chunks with 5 minutes off in between each chunk. I've found that giving myself those 5 minutes of time to deliberately not work makes it much easier to actually focus for the 25 minutes when I am working. It also forces you to look at what you're doing every 25 minutes so you don't head of down rabbit holes.
Its organized, efficient, and it works. And its masking the problem. You don't really want to do any of that - you want to be doing something meaningful and important.

So yes you can train yourself to be a wonderful cog in somebody else's machine. But consider the other advice here: find a better project. You have never actually been in charge of your career until you took a job that paid Less, because the project was better.

Become a farmer and grow your own veggies
It sounds like you're "under-stimulated"; try running your onw co for few months and come back on this thread. Maybe you're a lion in a cage?
Even if you are not good as you think. You may atleast know what usually can get done.

Try doing the easiest things first. That motivates you to do the next and the one after that. It also helps get you into some rhythm

Also, Try taking a break :). It helps

(comment deleted)
I think this could be one of the 2 things:

1. There is something else which is pre-occupying your subconscious mind. Probably something which you are trying to sideline as not a big deal, but subconsciously it is a big deal. Find out what that is and take care of it head-on. This will fix itself after that.

2. You might not see yourself being 'successfull' in this job over a longer term. For example, you want to do a startup and even though you need this job for the money, you still understand that your longer term interests are better served by quitting right now and doing a startup. It could be something else but essentialy what could be happenning is that your subconsious realizes that you doing this work is not getting you any closer to your longer term goals and hence it is revolting.

Do not seek to change yourself or your circumstances right now. Only seek to understand yourself - once you have done that these things will go away by themselves.

#2 is exactly what I've been going through for the past two years. I'm on my third job in that time, and I'm still miserable. All three jobs are ones most sane people would be THRILLED to have. Three very different environments, all with really great people. But it all comes back to the simple fact that it's not what I want/need/should be doing.
#1 is very true. This is beyond usual thinking and logic, but what's deep inside your subconscious plays a major role in your current state. I've ignored examining it for quite a while and BOOM! - I was unproductive, procrastinating, not able to concentrate, and what not. You'll be quite amazed by the fact that how irrelevant a thing could be lying in your subconscious. I suggest examining your life in great details and find out what's going wrong. And then immediately fix it!
Maybe you're just a bit lazy and somehow justifying it to yourself with some complicated theory. Spend time doing the mentally difficult tasks and stop being lazy.
If I were you I'd think that I'm missing something important. Skills and work is not the only existing thing in life. Judging from what you wrote about your self I don't think you have a problem there. In fact I'm sure you don't. Try to look at a bigger picture. There's definitely something missing in your life. Find out what. I bet it's not work related, but work is probably pointless without it. How old are you? What's next? Want family, kids? Climb Everest?...

And forget about this ADD crap. You are absolutely normal living thinking person.

You says it feels like there's something wrong with your practices. I'd agree. What are they?