Design, Input, Processing, and Output

Review of the Programming Workflow

What are steps involved in creating a program?

(hint: it's not just program something!)

  1. requirements
  2. implementation
  3. run the program
  4. check the output
  5. go back to step #2 (or possibly even #1!)

Programming Workflow Continued

Note that Starting Out with Python mentions a very similar workflow (ehhh… they're pretty much say the same thing; I'd accept either on an exam):

  1. design the program
  2. write the code
  3. correct syntax errors
  4. test the program
  5. correct logic errors (go back to step 1)

Some Steps are More Important Than Others

Which of these steps do you think is the most important?

  1. design the program
  2. write the code
  3. correct syntax errors
  4. test the program
  5. correct logic errors

Requirements Gathering / Design

It would seem like the most important part of programming is… well… programming. However, determining what you're programming and how you're going to do it is arguably more important! Before getting into code, you must:

Some Tools in Your Toolbox

Starting Out with Python introduces two tools to help start thinking about program design:

Pseudocode

Sometimes it's helpful to not have to deal with the syntax intricacies and implementation details with writing actual code.

measure the temperature of the room
if it's over the temperature threshold
	turn on the air conditioner

Flow Charts

Flow charts help graphically depict the steps involved in a process or program. Here are some common elements in a flow chart:

Flow Chart Elements

Fortune Telling Program

Imagine the following fortune telling program:

What is your question?
> What's the meaning of life?
42

The corresponding flow chart may look like…

Fortune Telling Program Flow Chart

Here's what the flow chart for the previous program might look like:

Fortune Telling Program Flow Chart

Make a Flow Chart for an ATM

ATM Flow Chart, Example 1

ATM v1

ATM Flow Chart, Example 2

ATM v2

Input, Processing, and Output

The majority of the programs that we write in class will consist of:

Which leads me to … Homework #1 (some basic input/output and processing)