-
Notifications
You must be signed in to change notification settings - Fork 0
Problem Solving Recipe
David Coleman edited this page Sep 23, 2016
·
1 revision
- Read it slowly.
- Read it again.
- Think to yourself, "what assumptions are hidden in this problem?" There are ALWAYS assumptions. Ask at least one question about those assumptions.
- If you are working alone (recording a video), just ask yourself, out loud.
- Identify input and outputs.
- Decide on your core data structure or data type.
- What are the start and end states of that data?
- How does that data "mutate" from start state to end state?
- Outline your state-changing logic in English pseudo-code.
- Re-read it, edit it, make it clear and precise.
- Outline your structure with one or more empty functions (aka stub functions).
- Give those stubs clear names.
- Fill in the main function body.
- Stub out helper functions if need be.
- Each function should ideally have a single purpose.
- It should do only one, small thing.
- That one thing is expressed clearly by the function's name.
- Test as you go.
- Each component (or "unit") -- for now, they are functions -- has a clear contract.
- Write an assertion
- Assert what behavior should be true about that component.