Too much code

Why writing too much code is a bad code smell.

I have two basic rules of thumb for determining if a solution is too complex:

  1. The responsible developer is struggling to explain their solution in plain English. Granted, not many developers are good at communicating, hence the need for the second check:
  2. If the solution has way too much new code in relation to the size of the new feature or fix being added.

At this stage in my career, I consider too much code to be a major bad code smell 1. I am more content with simple, elegant solutions, than overly complex ones. While it does not always hold true, I have also found that more experienced developers tend to write less code than their junior counterparts, and by being more efficient they deliver more feature throughput with less new bugs, as the more complex solutions lead to a greater likelihood of bugs.

References

John Collins

I have been writing about web technology and software development since 2001. I am the developer of the Alpha Framework for PHP, and the five.today personal productivity app. I love open source, technology, and economics.