Write Maintainable CodeHere’s another over-generalization: People in academia don’t have to live with the code they write. This was certainly true for the majority of my professors. I remember one case in particular. One day in class, a professor wrote a very long and complicated looking
forloop on the blackboard. The loop was peculiar because it didn’t have a body. All it had were the counter variable, the iteration condition, and the limit. After having us stare at it for a while, he gleefully explained that this loop reversed a linked list. That’s right, all of the logic required to traverse and reverse a linked list was cleverly embedded in the loop condition. Needless to say, this code was as comprehensible as it was debuggable: not at all. Yet our professor wasn’t the least bit bothered by either of those realities. On the contrary, he was proud of his cleverness. To make things worse, this episode had a pretty negative impact on my coding style, though I didn’t realize it at the time. I kept trying to write “clever” code (no matter how obtuse), because that’s what I thought was important. When you don’t have to live with the code you write, making it maintainable is not a big concern. On the other hand, as a working engineer, all you do is fix and enhance the same code base. Therefore, maintainability matters a lot more than pretty much everything else: performance, cleverness, etc.
You may also like:
Did you love / hate / were unmoved by this post?
Then show your support / disgust / indifference by following me on Twitter!