Principles for Reducing Software Complexity
Drawing on Ousterhout’s philosophy, the article defines software complexity as cognitive load multiplied by development effort and offers principles such as iterative design, layered architecture, deep modules, information hiding, and purposeful documentation to systematically reduce ripple effects, dependencies, and unknowns in code.
Based on John Ousterhout's "A Philosophy of Software Design", the article discusses how to reduce software complexity.
Complexity is defined from cognitive load and development effort, with a formula C = Σ(Cp * tp) where Cp is module complexity and tp is time weight.
Key factors contributing to complexity include modification ripple, cognitive burden, and unknown unknowns, often caused by code dependencies and obscurity.
General principles to tackle complexity:
Iterative design and continuous improvement.
Layered architecture: separate horizontal layers with clear interfaces.
Modular decomposition (e.g., micro‑services) to isolate concerns.
Rich documentation and comments to lower cognitive load.
Specific practices:
Avoid tactical programming; favor strategic design.
Design twice: provide multiple alternatives before finalizing.
Push complexity down to lower layers when possible.
Prefer deep modules (simple interfaces, powerful functionality) over shallow modules.
Balance generic vs. specialized modules.
Encapsulate information (information hiding).
Merge or split modules based on shared information and interface simplicity.
Write purposeful comments focusing on what and why, not how.
Code examples illustrate deep vs. shallow modules:
int open(const char* path, int flags, mode_t permissions); FileInputStream fileStream = new FileInputStream(fileName);
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream);
ObjectInputStream objectStream = new ObjectInputStream(bufferedStream); void delete(Cursor cursor);
void deleteSelection(Selection selection);
// can be merged into
void delete(Position start, Position end);The article concludes that these principles have practical value and are supported by other works such as "Code Complete" and "Refactoring".
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Meituan Technology Team
Over 10,000 engineers powering China’s leading lifestyle services e‑commerce platform. Supporting hundreds of millions of consumers, millions of merchants across 2,000+ industries. This is the public channel for the tech teams behind Meituan, Dianping, Meituan Waimai, Meituan Select, and related services.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
