It’s almost the end of the day, and your motivation is shot. You power down your workstation and it spins down to silence with a sad little “euww…” sound. “I can always refactor,” you think. “Yeah, right. What a crock. This turd is now permanently entombed in the code base. It’ll be there long after I’m gone. Only way this gets fixed is if I personally keep track of it, and come in some weekend to do it. Even then, when I check in the change, I’m gonna have to listen to a load of crap from the PM about fixing code that was already working.” Your back is sore, and the knuckles of your fingers. You look out the window, and notice that it’s the evening of a really beautiful day, a day you didn’t experience. “What am I doing here?” you wonder.
Managers know nothing about what motivates developers. For managers, the code is just a thing, a means to an end. For devs, the code is a creation, knowledge crystallized into executable form using the power of thought.
To work on code is to invite it inside your mind. When you hold beautiful code in your mind, it draws you toward creativity and achievement, and away from awareness of the long hours of sitting, moving nothing but fingertips and eyeballs. It distracts you from the tight deadlines, the frustrating changes of plan, the silly decisions you can see coming ten miles off.
When you must hold a lump of ugly code in your mind, touch it and reach around inside it, it contaminates your thoughts like it’s covered with dirt or old oil. You want to be somewhere else, somewhere there is beauty and order, or at least coffee. Ugly code sucks the light out of your work day, leaving you feeling vaguely unclean, subtly disturbed, knowing the code is wrong. You try to rationalize it in the name of serving the customer, or of expediency, but that doesn’t help you ignore the essential wrongness of ugly code every time you have to look at it, every time you think about it.