Profile picture of Jim Pruetting

A Philosophy of Software Design

The Complexity Problem

The Nature of Complexity

Working Code Isn’t Enough

Modules Should Be Deep

Information Hiding and Leakage

General-Purpose Modules are Deeper

Different Layer, Different Abstraction

Pull Complexity Downwards

Better Together or Better Apart?

Define Errors Out of Existence

Design it Twice

Why Write Comments? The Four Excuses

Comments Should Describe Things that Aren’t Obvious from the Code

Choosing Names

Write The Comments First (Use Comments as Part of the Design Process)

Modifying Existing Code

Consistency

Code Should be Obvious

Designing for Performance

Conclusion

Key Takeaways

  1. Complexity is the enemy: Design software primarily to reduce complexity
  2. Deep modules: Create components with simple interfaces but powerful functionality
  3. Strategic programming: Invest time upfront to save more time later
  4. Information hiding: Conceal implementation details to allow independent modification
  5. Pull complexity down: Make interfaces simple even if it means more complex implementations
  6. Comments matter: Write them to explain things not obvious from the code
  7. Design it twice: Consider multiple approaches before implementing
  8. Consistency: Maintain consistent patterns and conventions
  9. Incremental improvement: Apply good design principles with every code change
  10. Obviousness: Write code whose behavior is clear to new readers