Do lines of code matter…

messy vs clean

Recently while having a discussion about how to keep code clean,  the person with whom I was talking stated “if we were to manage our code that way our lines of code would be huge…” or something to that effect  🙂

I agree that lines of code can make an impact on the overall health and sustainability of the code; however, here a few things that I would offer up that matter more than the number of lines of code:

  1. The code’s focus – how many problems is the code attempting to solve
  2. The code’s simplicity – how cleaver is the code, does is it do exactly what you think it will do if you were to only read the names of it’s various parts,
  3. The code’s testability – how easy is the code to verify when changes are necessary,
  4. The code’s coupling – how many other areas of code will need to be tested if I were to change the code, and
  5. The code’s resiliency – how impacted will this code be when other code changes

My suspicion is that the individual that I was talking with had encountered some crazy code that was hard to maintain, hard to triage, hard to test, brittle, and hard to understand over the course of their time working in code.

Generally, code like this is also huge; but, if an overall solution’s line count is huge and the individual pieces of code are focused, simple to read, highly testable, loosely coupled and resilient to change, the size of the overall solution will matter much less.

That’s my take, let me know what you think.

Advertisements