I'm not very stylish. I've been known to walk around in sandals and socks, jeans that had some sort of glitter applied that I couldn't see in the store where I bought them, a bathrobe for trips to get groceries, t-shirts with holes around the neck, t-shirts too small for me, and "Grandpa" jeans. Most of the nice clothes I wear are Christmas and birthday gifts from my mother (Thanks Mum!). In summary: I'm no sharp dressed man.
However, when it comes to programming, style is critical to me. I believe that there is a right way to structure code, and that way is clean. Clean implies organization, clarity, and leanness. There are a variety of simple rules I follow to achieve this: classes and methods with single responsibility, accurate naming, no comments, and a strong love of brevity only bowing to the critically important readability of the code.
The opposite to clean code is hacking, where you just piece together code and if it doesn't break, it's declared good.
The drawbacks to hacked together code (often called "spaghetti code") are:
Conversly, clean code requires a lot of thought, forcing the author to think carefully and analyze what their expressing. This is why clean code is so important and makes it easy to spot bugs, sustains a predictable development pace, is easy to maintain, and lowers the total cost of ownership.
Clean coding is a form of rigorous thinking. By being diligent in our thinking, we save energy and effort. I think this principle can be applied to a lot of things and in the next post we'll look at how this relates to the topic of business.Last modified on