HAP sitting at a laptop, ready to learn about representing logic

Station 2: Communicating Logic

Turning ideas into shared representations

Welcome to Station 2! After Station 1, I was feeling pretty good about describing behavior in plain language. Then I tried explaining my Secret Number Game idea to Grace Hopper.

"So the game picks a number, and then you guess, and then it tells you if you're right..." I started. Grace listened carefully, then asked me to repeat it. Halfway through, I realized I was explaining it differently than I had before.

I know I’m a robot, and everyone expects robots to be perfectly logical. The truth is, I still make mistakes, and that made me want to understand how I could become better at thinking things through.

Prof. Teeters overheard me struggling. "Writing good code is all about the logic. If your logic only exists in your head," she said, "it can't be reviewed, shared, or improved. Pseudocode and flowcharts can give your ideas a shape."

I guess if using logic doesn't happen automatically for me, a robot, it might not happen for others as well. We have to learn computational thinking—how to break ideas down, describe behavior, and slow our thinking—before we can start becoming a good coder. Let me show you some tools that can help turn invisible ideas into something shareable... 🟠

What You'll Learn at This Station

HAP's Discovery: I used to think my ideas were clear because they made sense to me. But when I tried to share them, I realized that logic living only in my head couldn't be reviewed, questioned, or improved. Here are the three insights that changed how I communicate my thinking.

📝 Logic Is Invisible Until You Write It

Think → Write → Then Code

Ideas in your head can shift and change without you noticing. Writing them down makes them concrete and reviewable.

🔄 Same Idea, Different Representations

Text or Visual, Same Logic

The same logic can be written as text (pseudocode) or drawn as a diagram (flowchart). Neither is more correct—they're different views of the same thinking.

🤝 Clarity Enables Collaboration

Unwritten Logic Breaks

When logic is written down, others can follow it, find gaps, and suggest improvements. Unwritten logic can't be shared or fixed.

HAP looking confused while studying a map

HAP's Confession:

  • I explained my game idea out loud to Grace, but when she tried to follow it, she interpreted it completely differently than I meant.
  • I thought my logic was "obvious"—until I tried to write it down and realized I was skipping steps without noticing. 😳
  • I changed my explanation each time Grace asked me to repeat it, which meant my logic was never actually consistent.

Why Write Logic Down?

In Station 1, we learned to describe behavior clearly in our heads. But here's what I discovered: logic that only exists in your head has some serious problems.

It Changes Without You Noticing

Every time I explained my game, I said it slightly differently. Written logic stays the same until you deliberately change it.

Others Can't Review It

If my logic is only in my head, no one else can check it for mistakes. Written logic can be examined and questioned.

You Can't See the Gaps

My brain filled in missing steps automatically. When I wrote things down, the gaps became obvious.

It Can't Be Improved

How can someone suggest a better approach if they can't see your current one? Written logic invites collaboration.

🟠 HAP's Insight:

Prof. Teeters told me: "Developers don't write things down because they have bad memories. They write things down because written logic can be reviewed, shared, and improved. Logic in your head can only be guessed at."

Two Ways to Represent Logic

Prof. Teeters introduced me to two tools that developers use to write down logic before they write code. These aren't coding tools—they're thinking and communication tools.

Pseudocode (Text)

Logic written as plain-language instructions with a simple structure. It reads like a recipe: step by step, with clear decisions marked.

Flowcharts (Visual)

Logic drawn as shapes connected by arrows. You can see the entire flow at once, including where paths branch and rejoin.

Same Logic, Different Views

Both represent the exact same behavior. Pseudocode is easier to read aloud; flowcharts show the big picture at a glance.

Neither Is "More Correct"

Some people prefer text, others prefer diagrams. Real developers use both depending on the situation and audience.

The Secret Number Game in Pseudocode

Remember the Secret Number Game from Station 1? Here's how it looks when written as pseudocode. Notice how each line describes one clear action or decision.

Pseudocode representation:
BEGIN
    DISPLAY "Welcome to the Secret Number Game!"
    DISPLAY "I am thinking of a number."
    DISPLAY "Can you guess what it is?"

    INPUT guess

    IF guess is correct THEN
        DISPLAY "You win!"
    ELSE
        DISPLAY "Wrong guess. Try again next time!"
    ENDIF

    DISPLAY "Thanks for playing!"
END

BEGIN and END

These markers show where the program starts and finishes. Everything between them happens in order, from top to bottom.

DISPLAY

Shows a message to the player. The exact text appears in quotation marks—this is the program "talking" to the user.

INPUT

Pauses and waits for the player to type something. Whatever they type gets stored with the label guess.

IF / THEN / ELSE / ENDIF

A decision point. Only ONE of the two paths will happen—never both. The condition is written in plain language: "guess is correct".

Indentation Shows Structure:

Notice how the lines inside BEGIN/END are indented (pushed to the right)? And the lines inside IF/ELSE are indented even more? This isn't decoration—it's visual structure.

  • Indented lines belong to the thing above them. The DISPLAY and INPUT lines belong inside the main program (between BEGIN and END).
  • Deeper indentation means "inside of inside." The "You win!" message is indented extra because it's inside the IF, which is already inside the main program.
  • Matching indentation levels show parallel options. "You win!" and "Wrong guess" are at the same level because they're the two choices inside the IF/ELSE.

Grace pointed out that I could read the structure just by looking at the left edge, without reading any words. The shape of the indentation tells you what belongs together.

🟠 What I Noticed:

When I read the pseudocode out loud, it sounds like I'm telling someone the steps. "First, display a welcome message. Then, get input from the player. Then, if the guess is correct, display 'You win!'" It's like a recipe for the computer to follow. And the indentation shows me which steps are "sub-steps" of bigger steps—like an outline for an essay, but for logic.

I asked Grace about the uppercase words like BEGIN and DISPLAY. "Consistent formatting is not decoration," she said. "Code is read by humans far more often than it is written. Standard conventions—uppercase keywords, consistent indentation—reduce cognitive load, reveal errors, and allow teams to collaborate without debating style. Professional developers treat formatting as seriously as the logic itself."

The Secret Number Game as a Flowchart

The same logic can be drawn as a flowchart. Each shape represents a different type of step, and arrows show the flow from one step to the next.

Secret Number Game Flowchart A flowchart showing the logic flow of the Secret Number Game: start, display welcome messages, get player input, check if guess is correct, display win or lose message, then display thanks for playing. Main Main output "Welcome to the Secret Number Game!" output "Welcome to the Secret Number Game!" output "I am thinking of a number." output "I am thinking of a number." output "Can you guess what it is?" output "Can you guess what it is?" input guess input guess guess is correct guess is correct if + output "You win!" output "You win!" output "Thanks for playing!" output "Thanks for playing!" start start
The Secret Number Game as a flowchart

Flowchart Shape Guide:

  • Oval (yellow) — Start or end of the program
  • Rectangle (blue) — An action (display, input)
  • Diamond (purple) — A decision point (IF condition)
  • Arrows — Show which step comes next

Following the Flow

Start at the top oval and follow the arrows down. Each box is one step. When you hit a diamond, you choose a path based on the condition.

The Decision Diamond

The purple diamond asks "guess is correct?" with two exits: one for yes, one for no. This is the same IF/ELSE we saw in pseudocode.

Paths Rejoin

Both paths (win or lose) eventually lead to "Thanks for playing!" The flowchart makes this merging obvious.

The Big Picture

Unlike pseudocode, you can see the entire game at once. The visual makes the "fork in the road" nature of decisions really clear.

HAP giving a confident thumbs up

🟠 What I Noticed:

When Prof. Teeters showed me both versions, I noticed the flowchart makes the "fork in the road" really obvious. The diamond shape practically shouts "decision time!" But the pseudocode was much faster to create and easier to read out loud, like telling someone the steps. Prof. Teeters asked me which one I'd use to explain the game to a friend. I realized: it depends on the friend!

Comparing Representations

Here's how the same logic looks in both formats, side by side. Notice that every piece of pseudocode has a matching element in the flowchart.

BEGIN → Start Oval

The BEGIN keyword in pseudocode is the same as the "start" oval at the top of the flowchart.

DISPLAY → Blue Rectangle

Each DISPLAY line becomes a blue rectangle box showing the message.

IF/ELSE → Purple Diamond

The decision structure becomes a diamond with two paths branching out.

END → Converging Flow

The END keyword matches where all paths flow toward the final output.

🟠 The Key Takeaway:

The behavior is identical in both representations. The pseudocode says "IF guess is correct THEN display 'You win!' ELSE display 'Wrong guess.'" The flowchart shows the same thing with a diamond and two paths. Different format, same logic. That's the whole point!

Pseudocode is easier to read aloud, works well for step-by-step explanations, and shows the exact sequence of instructions—but you have to read it top to bottom to understand the flow. Flowcharts let you see the entire logic at a glance, make branching paths obvious, and help visual thinkers—but they take more space and can get messy with complex logic. Use whichever helps you think or communicate best for the situation.

🎓 Communicating Logic Quick Reference

1

Write It Down

Logic in your head can't be reviewed or improved. Written logic can be examined, questioned, and fixed by you and others.

2

Pseudocode = Text Logic

Pseudocode uses plain language with structure: BEGIN/END for boundaries, DISPLAY/INPUT for actions, IF/ELSE for decisions. Indentation shows what belongs inside what.

3

Flowcharts = Visual Logic

Flowcharts use shapes and arrows: ovals for start/end, rectangles for actions, diamonds for decisions. Follow the arrows to trace the flow.

4

Same Logic, Different Format

Pseudocode and flowcharts represent the same behavior. Neither is more correct—use whichever helps you think or communicate best.