Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 1.47 KB

README.md

File metadata and controls

24 lines (15 loc) · 1.47 KB

Hack Hours - 2021-11-24

The State Machine pattern

Oftentimes when programming, we end up with some gnarly, tangled, hard-to-reason-about conditional logic full of if-statements that deal with some internal state. What if there was a different way to tackle the problem, a design pattern that made it easier to reason about the logic?

Material

Design by "Wishful Thinking"

Code is a language used to plan things. In SICP this is called "design by wishful thinking". In other places, this is referred to as "top-down" design.

You start by pretending that you have a library of functions that do exactly what you want. You then write your program using those functions, and then go back and fill in the details afterwards. https://www.youtube.com/watch?v=amf5lTZ0UTc&t=3501s

Material

References