The Nature of Complexity
Lecture Notes for CS 190
Winter 2018
John Ousterhout
- Reading: Chapters 1-2 of book
- What is complexity?
- Anything related to the structure of a system that makes it hard to
work on the development of that system
- Apparent complexity is what matters: what a developer
experiences at a particular moment
- Doesn't necessarily correlate with system size or number of features
- It's about the common case
- Judged by readers of code, not the writer
- Symptoms of complexity
- Change amplification: a simple change requires many code modifications.
- Cognitive load: have to load a lot of information in your mind
in order to make a change.
- Unknown unknowns: there's important information you need to know
before making a change, but not obvious where to find it, or even
that it is needed.
- What makes systems complicated?
- Dependencies: one piece of code is tightly coupled with another
- If one changes, the other must change also
- Obscurity: not clear how things work or why the code is the
way it is
- The opposite of obscure is obvious: a developer's first guess
about how it works or what to do will be correct.
- Good software design reduces apparent complexity:
- Minimize dependencies: modular design
- Make system structure and behavior obvious
- Complexity is incremental:
- No one thing makes a system complicated
- It's an accumulation of thousands of small dependencies and obscurities
- Once complexity arises, hard to eliminate
- Must adopt a zero-tolerance attitude: everything matters.