How to Design Programs Flashcards
1
Q
How to Design Programs
A good program comes with a short write-up that explains (4 things):
A
A short write-up that explains:
- what it does
- what inputs it expects
- what it produces
- assurance that it actually works
2
Q
How to Design Programs
Recipe for designing a function (5 steps):
A
In the comments:
- Express intention for representing information as data
- Write down a signature, a purpose statement, and a function header
- Illustrate the signature and purpose with functional examples
Then:
- Stub the body of the function
- Write and test the code
3
Q
How to Design Programs
When designing functions for a program it’s a good idea to have a wish list.
What does a wish list entry contain?
A
A meaningful name, a signature, and a purpose statement.
4
Q
How to Design Programs
Recipe for designing a program (4 steps):
A
- Define constants
- Design a data representation for all possible states (Choose simple forms of data)
- Design a number of functions
- Create a main function
5
Q
How to Design Programs
Good programmers establish ___________ for all aspects of their programs.
A
a single point of control