iTranslated by AI
Ideas for Tackling Software Complexity
Just some notes on what I've been thinking about lately.
Simple Structure and Low Cognitive Load
If it's simple, humans can think using System 1, allowing for quick comprehension and judgment. If it's simple, even a single person's brain can understand a massive system. If you can grasp everything, you can understand where to add which function and where the cause of a bug might lie.
Just like the law of increasing entropy, all code naturally becomes complex if no effort is made. Simplicity is born as a result of effort.
Verbalizing simplicity.
- Composed of easy-to-understand terms
- Interfaces with redundant information stripped away (this is one aspect of abstraction)
- Abstractions with clear functions and responsibilities
- Appropriate granularity of abstraction
- Possessing symmetry
- Fractal structures where the structure remains similar even when changing magnification from macro to micro (this is part of symmetry)
Symmetry refers to having set patterns—for example, like the Model-View-Controller pattern where three actors appear before a single resource is displayed—or having a fixed directory structure. It also means that data handling in a DB is generally the same for similar resources.
A fractal structure is one where a self-repeating shape is copied and pasted, much like in an army where groups of 5 combine to form groups of 100, which then further combine to form groups of 1000. While not everything necessarily becomes fractal, if it can be achieved, it's possible to create a structure that is both simple and easy to grow.
Easy to Grow
To handle the scale of software:
- Utilize combinatorial explosion by combining well-designed small components
- Keep the core simple and make the periphery diverse, creating a tree-type workflow
- Create a modular structure where each part performs its role well and communicates with others, rather than building an all-purpose system
For example, the human body is composed of small cells combining to form organs (modularization), achieving complex functions.
To realize a tree-type workflow where the core is kept simple and the periphery is diverse:
- Avoid conditional branching in internal processing as much as possible, and cover diversity through interfaces (meaning I/O).
- If there are similar workflows, consider whether the interfaces (meaning abstraction) can be unified.
Discussion