Guide Rails and Guard Rails
Photo by Jarek Ceborski on UnsplashA guide rail is the thing that keeps a tram or roller coaster on the right path. It limits the carriage to a single correct course of action. If the tram or roller coaster is not following the guide rail, something has gone wrong.
A guard rail is the thing along highways and other roads. It keeps you from going into danger. It doesn’t dictate your path, but it blocks off dangerous paths.
In software, this is the purpose of testing: to act as a guide rail and to tell you when you’ve gone off the rails. This is also why we have safeties and shields on heavy machinery: as a guard rail.
If we’re designing a product, we might intentionally bake in guard rails to keep end users from doing something not normally needed. A good guard rail can be bypassed with intention - because sometimes we do need to do the unexpected - but it’s meant to provide a warning. Accessing developer mode on Android pops up with a warning that serves as a guard rail: “Are you sure you want to do this? You don’t normally need to do this.”
Guide rails enforce a single path of action. They prevent deviation, and are less flexible than guard rails. A common example is a syringe that prevents the plunger from being retracted - it prevents the accidental drawing of air into the syringe. Guide rails are rarely the correct solution however, since the ability to deviate is usually a feature and a requirement.
Constructing guard rails and guide rails can be useful. It helps remove decisions from consideration and helps prevent the wrong things from happening. When designing, prefer guard rails to guide rails and allow guard rails to be bypassed. Humans frequently fail to predict the future.