Program design

Pipey pipes

Visualize a program as machines and pipes sending data around.

Bonus: transactions

Teagan's Poet
Teagan's Poet

Bonus lessons are optional.

Let's write a basic transaction processing system (TPS - not that one). A TPS tracks business events, like sales, inventory control... the regular stuff of business operations.

Ray codes

Hey, Ray! Wanna do some coding?

Ray
Ray

Who, me?

The others are better at this.

Maybe, maybe not. Watching you work will help the people reading this learn from you.

Structure diagrams

Fu Wei Hsu's Jojo​
Fu Wei Hsu's Jojo​

Structure diagrams

Often, variables are glue that sticks code chunks to together. Here's the code again:

More functions

Define functions before you use them

Ray
Ray

I tried this, and got the error NameError: name 'rect_area' is not defined.

Functions

Python (and most languages) have a way to wrap code up so it can be called repeatedly: functions.

A function is a piece of code with a name. Other code calls the function when it wants something done.

Let's take the name tag program we wrote at the beginning of the course.