Lesson 1: Hello World

Beginner

In this lesson you will launch Phograph, load your first example, and run it. By the end you will understand the basic parts of the IDE and how a simple dataflow graph works.

The Phograph IDE

When you open Phograph you see a welcome screen with three choices:

The IDE has three panels:

Class Browser (sidebar) Graph Canvas (your dataflow diagram) Inspector (details) Console

The Class Browser on the left lists the project’s sections, methods, and classes. The Graph Canvas in the center is where you build and view dataflow diagrams. The Inspector on the right shows properties of the selected node. The Console at the bottom shows output from your program.

Loading Hello World

  1. Press Cmd+Shift+E to open the Example Browser.
  2. Under Getting Started, click Hello World.
  3. The graph loads on the canvas.

You should see three nodes connected by wires:

Inputs "Hello, World!" msg log Outputs input bar constant primitive output bar

What each node does

Constant node — produces a fixed value. Here, the string "Hello, World!". It has no inputs (data comes from nowhere) and one output pin at the bottom.

log primitive — a built-in operation that prints its input to the console. It has one input pin at the top and no outputs.

Wire — the line connecting the constant’s output to log’s input. Data flows downward through wires.

Running the program

Press Cmd+R (or use the Run > Run menu). Look at the console at the bottom. You should see:

[log] Hello, World!

The status bar says “Done”. Congratulations — you just ran your first Phograph program!

Tip The input bar and output bar are always present. They represent the method’s parameters and return values. This method has none of either, so the bars are empty.

How it works

  1. The engine looks at the main method.
  2. The constant node fires immediately (it has no inputs to wait for) and places "Hello, World!" on its output wire.
  3. The wire carries the string to the log node’s input pin.
  4. log now has all its inputs satisfied (just one), so it fires. It prints the value to the console.
  5. No more nodes to execute — the method is complete.

This is the dataflow execution model: each node fires when all its input data is available. You don’t specify the order — the data dependencies determine it automatically.

Exercise 1.1 — Change the message

  1. Click the "Hello, World!" constant node to select it.
  2. In the Inspector on the right, change the constant value to your own message.
  3. Press Cmd+R to run again.
  4. Verify your new message appears in the console.

Exercise 1.2 — Add a second log

  1. Right-click the canvas and choose I/O > log to insert a new log node.
  2. Right-click again and choose Constant to add a constant node. Set its value to "Goodbye!".
  3. Drag from the constant’s output pin (bottom circle) to the log’s input pin (top circle) to create a wire.
  4. Run (Cmd+R). Both messages should appear in the console.
Hint

Since the two log nodes have no data dependency between them, they may execute in either order. Both messages will appear, but the order is not guaranteed. This is a key property of dataflow: independent nodes can run in any order (or even in parallel).

Exercise 1.3 — Clear and explore

  1. Press Cmd+K to clear the console.
  2. Toggle the sidebar with Cmd+0.
  3. Toggle the inspector with Cmd+Option+0.
  4. Zoom in with Cmd+= and out with Cmd+-.
  5. Press Cmd+1 to fit the graph to the window.

Key Concepts