3
High Level Question: Why is Software Hard?
Answer(s):•Complexity: Every conditional (“if”) doubles number of paths throughyour code, every bit of state doubles possible states
–Solution: reuse code with functions, avoid duplicate state variables
•Mutability: Software is easy to change.. Great for rapid fixes
.. Andrapid breakage
.. always one character away from a bug
–Solution: tidy, readable code, easy to understand by inspection.
Avoid code duplication; physically the same
logically thesame•Flexibility: Programming problems can be solved in many differentways. Few hard constraints
plenty of “rope”.
–Solution: discipline and idioms; don’t use all the rope