The design recipe is here to help you design programs properly. When beginning to solve a new problem, the first question to ask yourself is: do I need a new type of data? If so, follow the steps in the Data column for every new type of data you need. When writing functions, follow the steps in the Function column for every function you write.
Below are helpful questions to ask yourself when tackling a specific step of the DR:
What do I need to keep track of?
How many cases are there?
In each case, do I need to keep track of more than one thing? (if so, I need a struct or list)
In each case, how do I encapsulate what I need to keep track of? (number? some other struct? list? etc.)
What about this data is potentially unclear/needs to be explained?
Are there units? (grid vs. pixel, for example)
Have I covered every case of the data definition?
Do I have relevant examples for testing for the functions I know I need?
How many cases of the data are there?
How do I tell them apart?
What data can I pull out at the top level of those cases?
Are the pieces of data I can pull out complex with their own template that I should call to (possibly self referential)?
What pieces of data does this function need to take in?
What are their types?
What does this function output and what is its type?
What is this function doing?
Have I covered every case?
Have I covered edge cases?
Do the tests I have convince me my function is properly written?
Can what I’m trying to achieve be broken down into multiple steps (i.e. should I use helpers)?
What template do I use?