Archive

Posts Tagged ‘complexity’

Re: Code’s worst enemy

December 23rd, 2007

Yesterday, ironically the first day of my vacation, I was reading Steve Yegge’s blogpost about code’s worst enemy.

I often find myself intruiged by Steve’s blogposts, probably one of the few blogs on the Internet actually worth reading even if he is talking about something that does not interest you. When it comes to technical writings I often find myself in agreement with his ramblings, however the last blog post sits a little weird with me.

He starts by saying that the size of a codebase (the Lines Of Code, LOC for short) is possibly one of the worst things that can happen to a code base. Later on he starts ranting about Java in particular (seeing that his pet project, which suffered this ailment, is written in Java).

On one hand I have to agree, code bases which are very large (500K LOC as in his example) tend to be quite nasty to deal with, but I would have to disagree that this is the worst thing that can happen to code.

I have come across a lot of programmers in my own career, ranging from people who just started in this industry to well trained coding athletes who are versed in many different languages. The thing I notice most is that complexity is the key factor in making code bases unmanageable.

Young guns in our industry generally tend to write very complex code while the trained athletes choose to reduce complexity by keeping it simple. I guess this is just a learning process everyone goes through, when you are young you never have had to go back a few months/years after writing the code to do some alterations on it ;).

Having many lines of code to deal with is not a problem, as long as it is not too complex. Over the last few years I have also seen a lot of JavaScript code that is just too complex and thus too hard to handle by most minds, even though it did it in way less lines, so I don’t think rewriting a piece of software in a dynamic language just for the sake of reducing code size is the answer to anything.

The key to manageable code bases is a good coding athlete who has the discipline to keep it simple (and of course unit tested).

Code , , ,