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

Subprocesses & reusable steps

Collapse a detailed section of a flow into one Subprocess step, call a routine shared by several flows with a Predefined Process, and stop nesting before the top level stops telling the story.

Where did the receipt go?

A car-rental company's return flow fit on one screen: the car comes back, someone inspects it, the agreement is closed, the customer gets a receipt. Then the inspection grew. Read the odometer, check the fuel, add a refuelling fee if the tank is short, walk around the car taking photos, compare them with the photos from pickup, decide whether anything is new. Eleven nodes now sit between "car returned" and "close rental", and a new agent who asks when the customer is emailed has to scroll past all of them to find out.

None of those eleven steps is wrong, and none of them is what the return flow is about. Collapse them into a Subprocess node titled "Inspect vehicle". It reads as a single step but stands for this flow's own nested detail, keeping the parent readable. Like a normal step it takes one input and emits one output.

The return flow, with its detail tucked away

Two kinds of box in the diagram stand for more than one step, and they say different things. "Inspect vehicle" is a Subprocess: its steps belong to the return flow and to nothing else, so they are drawn once, as a small flow of their own titled with the box's name. The box itself does not open into those steps; it is a single node, and the detail is a separate drawing beside it or on another Grid. "Notify customer" is a Predefined Process: a call to a routine defined elsewhere, which the return flow uses but does not own. It appears twice here, once on each branch, and both boxes call the same routine.

On the Grid the two shapes look almost alike, a box with two inner rails. In classic flowcharts both are drawn as the same double-sided box; RodGrid keeps them separate to say whether the detail lives in this flow or is a shared routine. Label the box so readers know which you mean.

Defined once, called from everywhere

Notifying a customer is not specific to returning a car. It picks the customer's channel, email or text message, fills in a template, sends it and records that it went out, and the return flow, the pickup flow and the extension flow all need exactly that. Inline those steps in each flow and they drift: the day the company adds a text-message fallback, someone updates two of the three copies, and customers who extend a rental never get the fallback. A Predefined Process keeps one definition and lets every flow call it, the way code calls a function instead of pasting its body.

The test between the two is ownership, not size. If the steps would change only when the return flow changes, they are this flow's detail: a Subprocess. If another flow calls them too, or another team owns them, they are a routine: a Predefined Process, and the caller depends only on what it passes in and what comes back. Predefined process, data & loops covers that symbol alongside the Data object and the Loop Limit. The Alert Evaluation & Auto-Remediation challenge asks for one directly: its automated remediation runbook is run as a Predefined Process, a routine the alerting flow calls but does not spell out.

One way out of the box

The inspection ends in a judgement: is there new damage? That answer sends the parent flow to two different places, and on the Grid a Subprocess has one way out. The damage cannot leave the box on an edge of its own. So the box's output carries the result, and the parent asks about it: "All clear?" sits right after "Inspect vehicle", in the parent, where a reader can see the flow split.

That gives a working rule for what may hide inside. A Decision whose branches meet again before the box ends can stay inside it: a short tank adds a fee, a full one does not, and both carry on to the photos. A judgement whose outcome sends the parent somewhere different can be made inside, but the Decision that routes on it has to show up in the parent, after the box. The same goes for failure. A step inside the box that can fail reports it through the single output, and the parent routes it to an Error Boundary, as Error handling & error boundaries draws it.

How deep to nest

Inside "Inspect vehicle", the photo comparison could itself become a Subprocess; a second level is usually fine when the inner box is also a self-contained chunk. The limit comes from the top, not the depth: someone reading only the parent should be able to say what happens to the car and every way the flow can end. If a reader has to open three boxes to learn that a damage claim can be opened at all, the claim has been hidden, not tidied.

A flow that is merely too long for one page needs an Off-page Connector, which splits the drawing without hiding anything, not a Subprocess; Connectors, off-page links & delays shows how.

Twelve nodes is all the ETL Pipeline Flow challenge gives you for an extract, a transform, a load split across parallel targets and merged again, a validation Decision, an error path and a summary document. Drawn step by step, the transform alone could eat much of that budget, and it is exactly the kind of section this article is about: one unit of work, owned by this pipeline, with nothing in it the parent needs to route on. Collapsed into one Subprocess, it leaves room for the parts the parent must show, and the top level reads extract, transform, load, validate, with the validation outcome decided in the parent and every End in sight.

Practice this