Why do some developers make their code so complicated?

I’m following another developer on a site that I’m working on and I’m seeing the same old thing.. needless complication. I always wonder why developers see the need to make things so complicated. Sites built this way are difficult to program, enhance, and support.

And I’m not talking about extremely advanced functionality either.  The site I’m looking at today is a simple reporting application for clients to view their information.  It should be a very simple implementation, but it’s not at all.

[note class=”info”]Rumor has it that the previous developer went to jail.  I think he should be in jail for this mess of code he left behind.  At this point, it is probably easier to just start over from scratch than to fix what he left behind.[/note]

My theories:

  • They are building themselves job security by making it too complicated to follow
  • They don’t know how to make it simple and elegant
  • They like to impress themselves with how complicated a structure they can build
  • They want to write their version of “theoretically correct” code

None of these are good reasons, however.  I think good code should be:

  • Easy to follow
  • The simplest structure that gets the job done
  • Conceptually clean – you should be able to easily explain it

The bottom line is that code can be beautiful or it can be a nightmare. Any developer worth hiring should develop code to be followed. This means that they should think about these things, at a minimum:

  • Simple is better
  • Use standard structures
  • Comment anything outside of standard structures
  • Spend more time thinking about how the code should structured instead of just jumping right into it.
  • Work hard to simplify.  Then work harder to simplify.

[note class=”info”]Complexity doesn’t make you a great developer.  The sooner developers realize this they better off they will be.