Three Qualities that Every Piece of Code Should Have …
- It should solve a problem and thus it must be valuable to its users. In short, it should do what it must do and simply work.
- It should be very easy to change. Every piece of code is subject to change, so it should be darn easy to alter its behavior without complete rewrites. Some piece of software that is difficult to change should be fixed, even though it works correctly.
- It should unmistakably communicate its intent to the developers who need to maintain it. If this is not the case, then it should be fixed, even though it works correctly.
Most software I’ve seen throughout my career as a developer only satisfies the first category. Heck, I’ve even seen a lot of code that doesn’t even has any of these qualities.
The second item is something that almost every business implicitly demands, but that is also never added to the requirements.
As for the the third quality, most developers think that its all about writing code but they are wrong. Its all about reading the code. This is why I believe in fluent interfaces and DSL’s (and by DSL, I mean the one-and-only language DSL and not the inferior graphical DSL as popularized by Microsoft).
Are there some additional qualities that I missed?