(from Chap. 4.3 of ThinkPython by Allen Downey)
A development plan is a process for writing programs.
There are several strategies for this.
- The “encapsulation and generalization” process can be useful if you don’t know ahead of time how to divide the program into functions. This approach lets you design as you go along. The steps are:
- Write a small program with no function definitions.
- Once you get the program working, encapsulate it in a function and give it a name.
- Generalize the function by adding appropriate parameters.
- Repeat steps 1–3 until you have a set of working functions. Copy and paste working code to avoid retyping (and re-debugging).
- Look for opportunities to improve the program by refactoring. For example, if you have similar code in several places, consider factoring it into an appropriately general function.