Program Design Divide and Conquer –Divide the program into separate tasks Functional Decomposition Top-Down Design –Divide an overall problem into discrete tasks, each of which can be coded in a single procedure!!!
Benefits of Functional Decomposition Large problems may be more easily divided into smaller tasks. A program is easier to maintain if each procedure can be tested separately. A top-down design lets you see how procedures are related to each other When the overall design is clear, it is easier to concentrate on the details of each part
Example Program Write a program that will display the numbers of a list example: given a list of 4 numbers (each having a value between 0 and 9), display the values, separated by a comma and a space. 1, 2, 3, 4
How do you go about doing this Divide and Conquer
Structure Chart for Displaying a List of Numbers on the Screen
Functional Decomposition of Printing Numbers to screen
Now combine blocks to write program Start with template Add instructions as needed to create working program Add enough comments so that you can reuse the code you write this week later (and also so that at the end of the semester, you can look at the code and quickly determine what the code does!).