Thursday, June 2, 2011

Does work encourage bad habits?

"these virtues are formed in man by his doing the actions" -- Aristotle, Nicomachean Ethics
Sometimes I wonder about programming as a job. Does having to add new functionality as fast as possible change how I act when programming for fun? Does having to follow the patterns and decisions others have laid out before me close my mind to better ideas when I'm working on my own projects? At home, I can polish a rough working prototype into something works well and that I'm proud of. At work, I often struggle with what's already there to do even the simplest things and I rarely want others to know I had a hand in the final result.

I'm able to use TTD, BDD, constructor injection, profiling, and all kinds of other techniques on my side projects but for some reason, trying those things at work brings only frustration. They don't work with the frameworks we use, the processes we use, other people don't like them, we don't have time to do it that way, or I'd have to rewrite large sections of code just to get it to work. I work with a lot of smart people and, over the last 6 or 7 years, they've created a product that deals with an amazing amount of externally imposed complexity, but the best advice of the best developers rarely helps. My best attempts almost always fall far short and if statements and hard coding rule the day; I consider it a good day if I'm able to use polymorphism instead of scattered if statements.

One small example: I recently noticed my git commits are too large and include too many changes - just like at work. It's like that at work because of the source control tool and our processes for dealing with it encourage few large commits rather than many small ones. It's very frustrating to try and determine what changed in a file, finding that 60 lines changed, then finding that 50 of those lines were just formatting, and the other 10 lines were for several different reasons. Small and focused commits can prevent this, but if you're not in the habit of doing that, then you forget about it even when you have the chance to. I'm beginning to wonder how much of what I do is due to habits that serve me well enough at work but that I don't want to carry into my personal projects.

No comments:

Post a Comment