Every year, I pull out the holiday lights and always (so far) receive a pleasant surprise. "Wow, look how organized these lines of lights are!" Bundled, neatly folded up, tied in key points.
And that's when I remember that the year before, when I put them away, I took extra time to do it right. Undoubtedly, other needs pressed -- lots of cleanup, snow to be shoveled, an urgent need for more exercise -- which is why, honestly, it never fails to surprise me when I take them out again.
Why don't we treat our code equally well? People shove code in, sometimes with little regard to ever using it again. Bad names, broken formatting, long run-on functions, no design considerations, etc. It's a giant knot of holiday lights the next time someone opens the box.
There are 3 main reasons. The reason you might hear most often -- "I was in a hurry" -- doesn't hold up. Time pressures rarely put a gun to our head. When NYSE goes down -- now those coders have an excuse!
The rest fall into these buckets:
1. Tragedy of the commons. Whether you do your part or not doesn't affect you that much. Rather, it contributes or detracts from the group good. So, you prefer to spend your time on things that will benefit you more directly. In other words, your box of lights goes into a community pile, from which you'll pick a random one next year. The best way to combat this is by cultivating a group culture that values well-written code.
2. Discipline is difficult. The temptation to slide by, just this once, draws you in. You worked hard at it every day this month, you've earned the right to just shove something together and go home early this time. If you're feeling this way, you're probably a bit burned out. Take a break. Take a day off if possible.
3. I just don't care. Often because the gain is too far away. In other words, anyone who shoves their lights in the box without any effort to be organized, knowing they'll be the one pulling it out in a year. This is the hardest one to overcome; the guy is crapping in his own yard, what can you do? Sometimes, appealing to professionalism can help.
Of course, it goes almost without saying that the extra time I spent putting the lights in carefully was easily repaid by the short time it took to get them strung up again this year. And now I can relax.
No comments:
Post a Comment