Thanks to a book, named Code Simplicity, I finally realized one of the main things I love about programming so much.
Finally, after many years, I have discovered my passion! And that is: writing code that is easy to understand and maintain, and this boils down to keeping code as simple as possible.
The book analyzes the value of software, the effort needed to maintain it, and the desirability of the changes, even though we cannot be sure what the nature of these changes might be. And it comes to the conclusion that all code needs to change eventually, and the future cost of making these changes is more significant than the initial cost of development.
The book made me realize that the real cost in software is not in the development of it, but in the maintenance. By taking a little extra time and ensuring that code is maintainable, in the long run we save money.
And that is what I really enjoy about writing software. Once I get a program to work once, I don’t like to stop there, the way some people do. Instead, I like to take the time to look at what I’ve written and ask:
- Does it make sense?
- Could what it does be done any more simply?
- Is there any cruft, any dead, unused code?
- Will a new person understand it, quickly and easily?
- Will a new person fix or enhance it, quickly and easily?
- Will I understand it, quickly and easily, if I need to change it, in the middle of the night, a few years from now, or both?
To tell the truth, I actually have at times felt guilty about taking this extra step. After all, the program works, why spend more time on it? And of course there are times when I haven’t been able to take this extra step, and have regretted delivering something that I am not very proud of, something I know could be better, if only there was a bit more time.
This blog contains stories about the benefits of well-designed, easy to maintain code, and the hazards of poorly-designed, difficult to maintain code.
But I still encourage you to buy the book.