Learn

Architecture & pattern guides

Read the idea, build it on a Grid, prove it in a challenge. Short, practical guides — illustrated with RodGrid's own nodes — on system design, design patterns, flow modeling, and how to get the most out of the app.

All articles

Decisions & branching

How a Decision node splits a flow on a yes-or-no question, and how to chain Decisions so every value lands in exactly one outcome.

A reading of exactly 35

A sensor on a school roof reports PM2.5, the fine particles in the air, in micrograms per cubic metre. A dashboard shows each reading as one of three bands: good below 12, moderate from 12 up to but not including 35, poor from 35 up. (Round numbers for this example, not any agency's official table.) One reading through a first draft of the flow:

  1. The sensor reports 35.
  2. Below 12? answers no.
  3. Between 12 and 35? answers no, because its author meant strictly between.
  4. Above 35? answers no.
  5. That last no has no edge, because nobody expected it, so the reading never gets a band.

Each question looks fine on its own, and a reading of 12 falls through the same way. The draft also asks three questions where two would do.

Two answers, and only two

A Decision node evaluates a condition and routes the flow to one of two outputs, yes and no. Each branch then continues independently. It is the flowchart's if/else. On the Grid both exits are fixed and marked on the card: yes leaves from the bottom and no from the right, so write a title that reads naturally with those two words.

The question has to be one the flow can answer from what it already knows: Below 12? works because a step has already read the sensor. When the flow has to wait to find out, or should take several paths at once, a Decision is the wrong node; Gateways: parallel, inclusive & event covers those.

Two exits mean three or more mutually exclusive outcomes take a chain of Decisions, with one question fewer than there are outcomes. On the Grid no Gateway is a multi-way Decision: the Inclusive Gateway is for when several branches can hold at once, and a reading is in one band. So three bands take two questions:

Three bands from two questions

A reading leaves the chain at the first yes, and everything still in it after the last question is Poor, so nothing can fall out of the bottom. The 35 from the trace answers no twice and lands on Poor. All three bands run straight into End because End accepts many inputs; to rejoin them into a single normal step instead, use a Merge (Merge & path convergence).

Order and cut-offs

The order of the questions changes the result. Swap them, with Below 35? first. A reading of 8 answers yes and is shown as Moderate. Below 12? now sits on the no branch, where every reading is 35 or more, so it can never answer yes and Good is unreachable. The diagram still looks complete. Walk the bands in one direction instead: from the bottom, as here, or from the top, asking At least 35? first and At least 12? second.

Each cut-off is a choice too. Below 12? puts exactly 12 in Moderate, and Below 35? puts exactly 35 in Poor. Both rule the same way, so every value has one home.

The branch that cannot happen

The firmware team says every message carries a value, so the first draft had no path for a missing one. Then a message arrives with the field empty. If that reaches the chain as null in JavaScript, it compares as zero, Below 12? answers yes, and the dashboard shows clean air above a dead sensor. So the flow asks first, and Find the band below stands for the whole chain above:

A missing reading gets its own path

A branch you are tempted to leave unconnected because that case "can't happen" gets the same treatment: draw it, even if it only routes to an error path. Error handling & error boundaries covers a fuller failure path, and a no that goes back to read the sensor again is the subject of Loops & retries.

Scores to walk through by hand

Exam Grading Flow is this chain on a different number: read a score, map it to a letter grade through Decisions, handle a score that is out of range. With the diagram finished, trace these by hand on your own cut-offs, since the Challenge sets none. The numbers assume a 0 to 100 scale with a B starting at 70. No score should fall through without a branch:

  • each cut-off exactly, such as 70 for that B;
  • a value just below each cut-off, such as 69.5;
  • the lowest and highest valid scores: 0 and 100;
  • one value out of range on each side: -1 and 101.

Practice this