What Is a Program?

What Is a Program?

Carlos: Carla, did you catch that episode of Who Wants To Be a Zombie Hunter last night?

Carla: Pfft, no. I don’t watch that! If I could, I would defenestrate our TV.

Carlos: Defene—what? What’s the big deal with TV anyway?

Carla: Defenestrate. Look it up. Anyway, TV is just a way for THE MAN to tell you what to do, what to buy, and what to think. Why do you think they call it “television programming"? They are programming you, Carlos; You. are. a. robot.

Carlos: Pfft, man, whatever Carla. You are paranoid.

Carla: No, I’m just on the lookout for real zombies.

Compare Carla’s connotation of the term “television programming” with these denotations of the word “program” from dictionary.com:

pro·gram
    [proh-gram, -gruhm]
    noun
  1. a plan of action to accomplish a specified end: a school lunch program.
  2. a plan or schedule of activities, procedures, etc., to be followed.
  3. a radio or television performance or production.
  4. a list of items, pieces, performers, etc., in a musical, theatrical, or other entertainment.
  5. an entertainment with reference to its pieces or numbers: a program of American and French music.
  6. a planned, coordinated group of activities, procedures, etc., often for a specific purpose, or a facility offering such a series of activities: a drug rehabilitation program; a graduate program in linguistics.
  7. a prospectus or syllabus: a program of courses being offered.
  8. Computers:
    1. a systematic plan for the automatic solution of a problem by a computer.
    2. the precise sequence of instructions enabling a computer to solve a problem.

Think About It

How does the ambiguity of the word “program” seemingly support Carla’s paranoid theories of mind control? What do “mind control” and programming a computer have in common?

Structured Processes

The definitions cited in the previous activity have a few common themes. One such theme is that a program is a story. In fact, writing a computer program is a lot like writing a story. They both have beginnings and ends, and the interesting part is how they move from the beginning to the end.

Remember the days of elementary school, where you’d get an assignment like the following?

Sequence of Events

The following images represent various events in a story. Please number each image 1, 2, or 3 according to the logical sequence of events in the story. Follow up by writing a brief description of the scene in its proper order (at least 1 sentence per event).

These activities always deal with a specified process, where one event logically follows from another. In this particular example, there is some ambiguity regarding where the process begins. Let’s assume that the process begins with the seed packet image. Given that constraint, it only seems logical that our watermelon eater must cut the watermelon before eating it. So, our sequence of events looks like this:

Because programs (like our story) also need well-defined beginnings and ends, a number of discrete events, and some indication of the ordering of these events, many programmers use diagrams like the one above (called flowcharts) to plan their programs. (examples) Flowcharts are visual representations of structured processes—encompassing computer programs, stories and scripts, business models, and more.

You may find that flowcharting is helpful to you in planning out the sequence of events in your programs. For many text-based programming languages (like you will see later in this course), a flowchart provides a nice visual counterpoint to the program code itself. However, our programs for this module will be written primarily in Scratch, a visual programming language (VPL), which is structured similarly to a flowchart:

Scratch Flowchart