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:
New Project (Cmd+N) — start from scratch
Open Project (Cmd+O) — load a .phograph.json file
Browse Examples (Cmd+Shift+E) — open a built-in example
The IDE has three panels:
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
Press Cmd+Shift+E to open the Example Browser.
Under Getting Started, click Hello World.
The graph loads on the canvas.
You should see three nodes connected by wires:
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
The engine looks at the main method.
The constant node fires immediately (it has no inputs to wait for) and places
"Hello, World!" on its output wire.
The wire carries the string to the log node’s input pin.
log now has all its inputs satisfied (just one), so it fires.
It prints the value to the console.
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
Click the "Hello, World!" constant node to select it.
In the Inspector on the right, change the constant value to your own message.
Press Cmd+R to run again.
Verify your new message appears in the console.
Exercise 1.2 — Add a second log
Right-click the canvas and choose I/O > log to insert a new log node.
Right-click again and choose Constant to add a constant node. Set its value to "Goodbye!".
Drag from the constant’s output pin (bottom circle) to the log’s input pin (top circle) to create a wire.
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
Press Cmd+K to clear the console.
Toggle the sidebar with Cmd+0.
Toggle the inspector with Cmd+Option+0.
Zoom in with Cmd+= and out with Cmd+-.
Press Cmd+1 to fit the graph to the window.
Key Concepts
Nodes are the building blocks. Each node is an operation.
Wires connect outputs to inputs. Data flows downward.
Execution is data-driven: a node fires when all its inputs arrive.
The input bar and output bar define a method’s interface.
A constant produces a fixed value with no inputs.
A primitive is a built-in operation (log, +, *, etc.).