Book Review, Craftsmanship, Old Website

On Coding Well

December 11, 2012

In an attempt to improve my writing abilities, I’ve been reading several writing books. The one recommended to me the most was “On Writing Well” by William Zinsser. The book is great, but something struck me early on that I wanted to share.

On Writing Well book cover

In the book, the author covers several principles to writing good English. They are Clarity, Simplicity, Brevity, and Humanity. While these made sense in writing, I was struck more by how well they related to the principles of writing good software. Specifically, the first three principles.

Clarity – “If it’s not clear you might as well not write it.”

The same could be said with most code. We spend most of our time maintaining software. The clearer it is the better. Being able to easily read and understand the code, as well as the design is crucial. We can better prevent bugs from happening. Not to mention prevent creating additional bugs accidentally with future changes.

Simplicity – “Simple is good.”

Street signs showing the KISS Principle

KISS. Not the band, but an acronym for the design principle known as “Keep it simple, stupid”. The idea being that systems work best when they are kept simple and that complexity should be avoided.

Arguably the most important thing a software developer can do. Simple designs and solutions lead to easier to maintain software. Developers are known for coming up with poor user interfaces that confuse users. Simple and intuitive design tends to solve this problem. The same applies to the guts of your software, where the developer themself is the user.

Brevity – “Short is always better than long.”

Short sentences are better than long sentences. Just as short objects are better than that five thousand line god class rotting in your software. Small, well defined objects are key to designing good software. They make the software easier to digest, test, and work with. This practice also aides the other principles by making the software simpler and the intent clearer.

Conclusion

Obviously there is overlap between the three principles, but each is still very important to good software design. No matter if it’s designing a new system or solving a bug in a legacy code base, these principles are essential. These aren’t the only principles to assist developers, but I find these three among the most worthwhile. Thoughts?

You Might Also Like