Code Simplicity Takeaways

Code Simplicity is a good book if you are wondering how to simplify a new or existing software so it is more maintainable and easier to develop. In a nutshell, only-as-needed design and incremental development are the two foundations of simplicity.

Only-as-needed design

By designing based on what is known now, the design can be created as simple as it needed to be. Simple design where components are broken down to its minimal requirement also tends to be simpler to extend, change, fix, or remove from a system. Simple design also eases new programmers into the system and speeds up their time to start contributing.

Simple design might come from re-using existing solutions that might only fit most of the requirements rather than creating new ones that fit all requirements. When a system is using a maintained library or technology, it outsources a complex part that is not part of its purpose. However, be careful of libraries or technologies that lock the system into their environment that migrating to a different technology is difficult. A pattern used throughout the library only needed to be learned once by new programmers for similar cases which helps speed up onboarding.

When programmers try to predict the future, they are creating a system that is more complex than currently needed, or called over-engineering. This additional complexity most likely becomes a tech debt that someone has to deal with in the future. Worse, it is a tech debt no one understands where it came from and why it was created.

Simple design can only be achieved when the programmer/team truly understands what a system is for. By understanding the purpose of a system, the simplest solution or design can be selected. If the system already exists, then the programmer could work their way towards the desired simple design.

When asking how simple it should be, the answer is “stupid, dump simple” for the target reader/programmer. Don’t assume they would have context of the system beforehand. Ensure that by reading the code or documentation, a new programmer can easily understand it without need to look up additional references.

Incremental development

By developing incrementally, the system can be used faster by users and, in turn, receive feedback faster too. This feedback is then used as a signal whether the current requirement is in line with the user's need or not.

Incremental development also ensures that the programmer only creates what is needed specifically during the increment even when the end goal is a huge system addition or changes. It makes the scope of the design smaller on each change which in turn makes it more manageable.

If you have an existing (or even legacy) codebase, incremental development is used to improve the codebase and system towards the design of what it should be. Don’t improve everything all at once so that you won’t have resources to maintain existing systems. That would mean the system is being held for development for a long time and requirements for the system might change during that time. Instead, focus on small changes and improve it incrementally.

 ✼ ✼ ✼

This book does not cover any specific solution that can be used for all kinds of problems. The author mentioned that this is something the reader (assuming a programmer) should study for. The suggestion is to learn design patterns, how to deal with legacy code, and programming tools so a programmer has an arsenal of tools that can be chosen for a problem. But even a programmer is not equipped with extensive knowledge of design yet, this book is a good guide on how to use future design knowledge wisely.

You can find more information about the book here: https://www.codesimplicity.com/book/

Comments

Popular posts from this blog

Experiment #1: Can JavaScript run something like a concurrent thread/process? No.

Ruby on Rails Time, Date, DateTime Cheatsheet

SQL WHERE and HAVING clause (with examples)