Sato's Thoughts and Writings

Book Review: A Philosophy of Software Design

When we develop software, we face the challenge of complexity. Our decisions and designs determine how we manage it. This book aims to help us better address this complexity.

Stragic coding vs tactical coding

Strategic planning in writing code is much better than tactical coding. Tactical coding emphasizes simply getting working code, while strategic coding focuses on defining how to code to achieve that working code effectively. Complexity reveals itself over time in tactical coding, and this accumulated complexity often backfires, hindering progress. In contrast, with strategic coding, you might start slower, but you gain full flexibility to extend and expand your code without major complexities.

Complexity results from the accumulation of dependency and obscurity.

Modularity

In Object-Oriented Programming (OOP), modules are often considered classes with interfaces that offer specific functionalities. Separate functions and methods can also be considered modules.

Modularity is a way to at least isolate complexities into smaller blocks. Modules should be as independent as possible, though their constant interaction often prevents full independence. Modules are typically sections of code with specific responsibilities. Each module needs clear structures, which can be achieved through methods like abstraction.

Deep Modules

A deep module has a simple interface but offers complex functionality. It excels at hiding complexity from the user.

Shallow Modules

A shallow module does not hide its implementation and has a complex interface without concealing much complexity. While some modules cannot be simplified and are sometimes unavoidable, generally, such modules are not ideal.

Classits's misunderstadning

I often heard a concept from software engineers about avoiding long classes or functions. They would set a limit for the number of lines a class should contain. In reality, having multiple classes instead of fewer can be counterproductive, only increasing complexity without offering significant help.