I've been thinking a lot about ego lately, and how it applies to software development. Writing software – like any other human endeavor – is influenced by the need to be recognized and hopefully praised for our work. I am no different; it is most likely ego that drives me to release open source software and to refine it even when there is no direct benefit to be had for that work. In this respect, ego is beneficial as it compels me to writer better code, but in the context of a day-job work, ego is a liability.
Consider a developer who inherits a hefty code-base written by another company or a long-departed contractor. He peruses the code and deduces that he is a superior developer to the schmuck that put it together originally; his code would have solved the issues more elegantly and be more flexible.
Although most likely fueled by ego, he may be correct – the difference between a poor developer and a good developer can be several orders of magnitude in terms of code quality, but it is what he does next that may be driven by ego.
Functional code is functional code; if it is a black box that runs fast enough, does exactly what it says on the tin and has no unintended consequences then it is largely irrelevant how elegantly (or not) it is put together. But when the ego comes in to play the developer thinks to himself “my code would be vastly superior!” and he endeavors re-write it in some misguided attempt to show the original developer how to do it properly. Thats not to say that code should never be re-written, but just that a decision motivated by ego is most likely the wrong one.
Another trap that the ego can lay for the software engineer is that it can hide the point where code has become unmaintainably complex. Most developers will have worked with code that is so fiendish and sophisticated that only the original author has any chance of making changes to it, and even then it takes way to long to make modifications. This rarely occurs because the problem domain is so difficult that only an engineer savant could possibly create the solution – it occurs because as each new requirement is tacked on to the original solution the developer is thinking “No problem, I am smart enough to understand this”.
The best developers – in this blogger's humble opinion – are those that show a wee bit of humility. If you talk to experienced developers, well respected in their particular niche, you will probably find that although they show pride for their accomplishments they are acutely aware of mistakes they have made, often to the point of being embarrassed about their code.
I'm not suggesting that ego is always a bad thing, or that it is necessary to enter in to some Zen-like nihilistic state before sitting down to the keyboard and tapping out code, just that ego should be shelved until after the project has been completed – then is the time to punch the air and do hip thrusts at the monitor.