It seems I am fighting with myself. This has happened multiple times and seriously affects the quality of my life.
I am assigned a feature to implement, usually vague and something that I feel adds unnecessary complexity to the codebase. I try to reason with my managers, but usually their minds are already made up. I then struggle with finishing this feature, logging hours upon hours against it...not because it takes so long to code, but because I can't make myself do it and waste hours motivating myself to do it. Also I waste considerable amount of time trying to do things in the most readable, maintainable and simple way possible. This means weighing merits of different solutions and choosing one. I am a really hesitant decision maker, resulting in more wasted hours.
The haranguing part is that my managers don't fire me. They don't see how many hours I have wasted, how unmotivated I am. Instead they treat me as one of their most valued employees (oh the irony!).
(I am not in a position to change jobs at the moment. I am helping my BF's startup by doing this job.)
Have you been in such situations? How do you get in the zone and get it done when your entire being is revolting against the task?
First of all, isn't it a bit dramatic to say "your entire being opposes" your task? It's not like you're out committing genocide or something. You're programming, and you have to work on a crappy programming task. Every programmer who ever worked a professional job has had to do this at some point. If the very fiber of your soul is wrapped up in your employer's MegaAccounting Client V3.0 REST API, I'd recommend re-thinking your emotional attachment to your job.
That money you get every two weeks is called "compensation" because it is compensating you for your time, which you would probably otherwise spend doing something more pleasant. This is the realistic world of grown-up work life.
If your company's Marketing bone-head says the customers want a green oval button instead of a system-standard button, well, it's stupid, but I'd laugh at how much they're paying to get this ridiculous code written and just write the damn code. It's really not worth losing sleep or sanity over. Not being emotionally attached to your work allows you to shrug off the stupid stuff that Really Doesn't Matter.