ch09 - Chapter 9: Building Bigger Programs 1 2 How to...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 9: Building Bigger Programs 1 2 How to Design Larger Programs Building something larger requires good software engineering . Top-down : Start from requirements , then identify the pieces to write, then write the pieces. Bottom-up : Start building pieces you know, test them, combine them, and keep going until you have your program Debugging : Removing errors from your code. Testing : Because nothing complicated and man-made is flawless. Maintenance : By far, the most expensive part of any program. 3 Top-Down Design Start from a problem statement. What are you trying to do? Refine the problem statement. Use hierarchical decomposition to define subparts. Refine until you know how to write the programs. Use procedural abstraction so that higher-level functions are written in terms of lower-level functions. 4 Example Top-Down Design: An Adventure Game Top-level function: 1. Tell the user how to play the game. 2. Describe the room. 3. Get the players command. 4. Figure out the next room. 5. Return to Step 2, until the user Quits. 5 Two new functions printNow(): Takes a string as input, and prints it on the Command Area immediately. Print waits until the program is done. requestString(prompt): Takes a prompt string as input, accepts a string from the user in a dialog window, then returns the users input....
View Full Document

This note was uploaded on 02/22/2012 for the course CS 177 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 24

ch09 - Chapter 9: Building Bigger Programs 1 2 How to...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online