Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Short answer: writing step-by-step instructions for a robot exposes every assumption you forgot you were making. Blessed Emmanuel John chidera’s DEV Community article, posted September 19, 2026, uses that gap as a teaching device. It starts with a cheese sandwich, moves through entities, operations, and changing state, and ends at a C# class with properties, methods, and a constructor. This guide follows that same route, explains each step for someone new to C#, and marks where the exercise stops.

Start with instructions a robot can actually follow

The exercise opens with a direct challenge: “Write an algorithm that gives step-by-step instructions to assemble a cheese sandwich.” The imagined robot has bread, butter, a knife, a plate, and cheese, and nothing else to go on.

The author’s first attempt names the objects and then writes vague directions such as “take,” before combining ingredients with plus signs. The weakness is useful to study. A robot cannot safely infer which bread to take, how the butter should reach the bread, whether the knife is used at all, or what order the cheese goes on. The word “take” hides every physical detail that a person would fill in without noticing. A list of ingredients joined by plus signs names what goes into the sandwich but not how or where it is placed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where human assumptions hide

A person reading “make a cheese sandwich” silently supplies answers to questions the first draft leaves open. Writing the steps for a machine forces those answers into the open:

#1 Best Overall
OVENTE Electric Sandwich Maker, 750W Non-Stick Plates, Black GPS401B
  • HOT SANDWICHES IN MINUTES – Save your time in the morning and make healthy and perfectly toasted, gourmet pressed sandwiches. You can also quickly cook other meals like omelets and French toast.
  • SIMPLE & EFFICIENT – Made of heat-resistant stainless steel with a fast-heating element that provides even toasting. The power indicator light will let you know when the unit is on, while the preheat light lets you know when it’s ready to cook.
  • HASSLE-FREE CLEANING – The non-stick coating ensures effortless food release without bruising the bread and easier cleanup. Simply wipe with a clean damp cloth once they've cooled.
  • SPACE-SAVER – Features a compact and lightweight design making it the perfect option for dorm rooms, small apartments and all sized kitchens. This item will be a great addition to your kitchen countertop and it stands upright for storage taking up minimal cabinet space.
  • MAXIMUM SAFETY – The cool-touch locking handle allows heat to dissipate, preventing heating up and ensuring safe operation. Has anti-skid feet to prevent accidents.
  • Which bread? A slice from the loaf, a slice already on the plate, or both slices of a finished sandwich?
  • How is the butter moved? Is it scooped from a tub, and with what tool?
  • What happens to each tool? Does the knife stay in the butter, or is it reused for the cheese?
  • In what order? Does the butter go on before the cheese, and does the cheese sit on the bread or on the butter?
  • Where does the result end up? On the plate, in a box, or left on the counter?

Each question is a decision the program author has to make explicitly. Programming languages are no different: a computer runs what you wrote, not what you meant.

Name the things, then name the actions

The revised model sorts the nouns by the role each one plays. The article’s categories are the useful part for beginners, because the same distinction shows up later as properties and method parameters.

Role in the model Item Why the role matters
Entities Bread, butter, cheese These are the things whose condition the steps change.
Tool Knife Used by an action; it is not part of the finished sandwich.
Container Plate Where the assembly happens. It is context for the entities, separate from them.

Operations make each step explicit

The article defines named operations, SCOOP, SPREAD, and LAY, so each step says what is done and to what. One way to write the sandwich in those terms looks like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. SCOOP butter from the tub with the knife.
  2. SPREAD the butter onto the bread with the knife.
  3. LAY the cheese onto the buttered bread on the plate.

This is an illustration of how explicit steps read, not a complete robotics specification. It still answers the questions from the previous section: the inputs are named, the order is fixed, and the result is placed on a specific container.

Rank #2
Sale
Chefman Panini Press Grill and Gourmet Sandwich Maker Non-Stick Coated Plates, Opens 180 Degrees to Fit Any Type or Size of Food, Stainless Steel Surface and Removable Drip Tray, 4 Slice, Black
  • HUNGRY FOR A SANDWICH? With just the push of a button, this 4 Slice Grill-Panini Press Combo can be used to press your custom sandwich or open at 180 degrees for grilling burgers, steaks, veggies and anything else you’re craving quickly and easily! Use it as a panini press for perfectly crisped bread- no cooking spray required.
  • ADJUSTABLE FOR ANY OCCASION: Floating hinge adjusts to accommodate any size sandwich – thick or thin. The closed cooking surface is ideal for four sandwiches or two large paninis. Great for a quick meal, summer party or a family event. This unit is perfect for making breakfast, lunch, dinner and more!
  • COMPACT SIZE: Ideal for small kitchen spaces, dorm rooms, offices, and even bringing on road trips! The compact size takes up little counter or shelf space making storing your contact grill easy.
  • EASY TO CLEAN: The tilt-up, skid resistant feet allows the grease to run to the drain at the back of the closed panini maker. The non-stick coated grill plates and removable drip tray makes for effortless cleaning.
  • RESOURCES: UL approved with advanced safety technology for long lasting durability, & 1-year assurance provided by Chefman, so you can purchase worry-free - we've got your back! For information on how to use your product, scroll down for a PDF User Guide. 1000 Watts/120 Volts – RJ02-180-4

State: the same bread, a different condition

The next idea is state. Plain bread and buttered bread are the same slice of bread after a SPREAD operation. The object persists, but its condition changes. In programming terms, that condition is its state: the set of facts that describe the object at a given moment.

Operations come in two kinds. Some change state, such as SPREAD changing plain bread into buttered bread. Others only inspect it, reading the current condition and leaving it alone. The rest of the exercise depends on keeping those two kinds separate.

Commands and queries: change the state, or ask about it

The article illustrates this with a bank account. It starts with a balance of $5,000, deposits $1,000, withdraws $500, and then checks the balance.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Step Operation Kind Balance afterward
0 Account opens Starting value $5,000
1 Deposit $1,000 Command (changes the balance) $6,000
2 Withdraw $500 Command (changes the balance) $5,500
3 Check balance Query (reads the balance) $5,500, unchanged

The author’s walkthrough reports $4,500 at the check. That figure equals the $5,000 start less the $500 withdrawal, so the deposit appears to have been left out of the reported result. The table uses the figure the arithmetic gives when all three operations are applied. The distinction the example makes does not depend on the exact number.

Rank #3
Sale
Cuisinart Panini Press and Grill, 1500W 5-in-1 Griddler, Dishwasher-Safe
  • SUPERIOR PERFORMANCE: The Cuisinart Griddler Indoor Grill offers five ways to grill as a contact grill, panini press, full grill, full griddle, and half grill/half griddle.
  • 5-IN-1 COOKING: This Cuisinart panini press and grill can handle everything from pancakes and sausages to grilled cheese to steaks, hamburgers, and panini.
  • DUAL TEMPERATURE CONTROLS: Adjustable temperature controls adjust from "warm" to "sear" in grill/panini mode, and from 200°F to 425°F in griddle mode, ensuring everything is perfectly cooked every time.
  • EASY TO CLEAN: The panini grill press sandwich maker includes a set of nonstick grill/griddle plates, removable drip tray, and a cleaning/scraping tool that’s dishwasher-safe for easy cleanup.
  • LIMITED 3-YEAR WARRANTY: The PFAS-free Cuisinart Griddler Indoor Grill comes with a limited 3-year warranty.

The article calls this Command-Query Separation. Deposit and withdraw are commands: they change the account and do not return a balance. Check is a query: it returns the balance and leaves the account as it was. The term is established in software design, and the article uses it for this distinction. The example illustrates the idea; it does not establish a universal rule that every query in every language is free of side effects.

Scaling up: one template, many cars

A single bank account is easy to track in your head. The article then asks how to represent 100 cars, each with its own speed, fuel level, and engine state, without rewriting the same behavior for every car. The answer is a shared template. The template is the class; each individual car is an instance of it, carrying its own values.

Microsoft Learn’s C# documentation describes the same relationship: “In C#, the definition of a type—a class, struct, or record—is like a blueprint that specifies what the type can do.” The class tutorial on Microsoft Learn adds that a class is a type representing an entity, with operations implemented through methods and properties, and that constructors initialize new objects. See the Classes and objects tutorial – C# for the full treatment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The blueprint analogy is an entry point, not a rule that every noun in a program must become a class. It helps you see why one definition can serve many objects, and it is enough to start the next section.

Rank #4
BLACK+DECKER 3-in-1 Waffle Iron, WM2000SD, Grill and Sandwich Press, Non-Stick Removable Plates, Space Saving Compact Design
  • INTERCHANGEABLE PLATES: Waffle, grill, and sandwich plates snap in easily. Securely attach both cooking plates while the appliance is cool, then close the lid before plugging it in.
  • PREHEAT INDICATOR LIGHT: The green ready light illuminates when the correct cooking temperature is reached and cycles on and off with the thermostat during use. Wait for the green light before adding food.
  • NONSTICK COOKING SURFACES: Removable nonstick plates help food release and are dishwasher-safe for easy cleanup. Avoid metal utensils, abrasive cleaners, and aerosol cooking sprays to help protect the coating.
  • HEAT-RESISTANT HANDLE: Use the heat-resistant handle to safely open and close the appliance while cooking. Always operate the unit in the closed position on a stable, level, heat-resistant surface.
  • COMPACT 3-IN-1 DESIGN: Prepare waffles, grilled foods, and toasted sandwiches with one space-saving appliance. The stainless-steel finish and removable plates make cooking, cleanup, and storage simple.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Mapping the model onto C#

The article connects each idea from the sandwich and car examples to a C# construct. The table below restates that mapping with the car as the running case.

Model idea C# construct Car example
Car template Class class Car
Individual car with its own values Instance (object) new Car(40.0)
Speed and fuel Properties Speed, Fuel
Engine running or not Property IsEngineRunning
Changing state through behavior Methods StartEngine(), Accelerate(int)
Reading the speed Method (query) CheckSpeed()
Setting starting values Constructor Car(double fuel)

The article’s sample covers acceleration but not braking, so brake is not shown in the code below.

public class Car
{
    public int Speed { get; private set; }
    public double Fuel { get; private set; }
    public bool IsEngineRunning { get; private set; }

    public Car(double fuel)
    {
        Speed = 0;
        Fuel = fuel;
        IsEngineRunning = false;
    }

    public void StartEngine()
    {
        IsEngineRunning = true;
    }

    public void Accelerate(int amount)
    {
        if (!IsEngineRunning)
        {
            return;
        }

        Speed += amount;
    }

    public int CheckSpeed()
    {
        return Speed;
    }
}

// Usage
var car = new Car(40.0);
car.Accelerate(20);   // ignored: the engine is off
car.StartEngine();
car.Accelerate(20);   // Speed is now 20
int current = car.CheckSpeed();

Three things in this sample line up with the earlier ideas:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The constructor sets the starting state, so every new car begins with speed 0 and the engine off.
  • StartEngine changes the engine state, which is a command.
  • Accelerate refuses to change speed while the engine is off. That guard is a rule that prevents an invalid state. CheckSpeed only returns a value, which is a query.

The sample is illustrative. It has not been tested or hardened for production use. It stores fuel but does not yet use it in any rule, which leaves room for an exercise of your own.

Best Value
Cuisinart Sandwich Grill, Silver, WM-SW2N1NAS
  • Cooks 2 sandwiches, omelets or servings of French toast
  • Lock-down lid positions with food on plates to evenly brown both sides
  • Ready-to-Cook and Ready-to-Eat indicator lights
  • Raised ridges in cooking plates seal edges of bread or omelets to keep ingredients inside and divide sandwiches and updated plate design to reduce overflow
  • Nonstick baking plates wipe clean in seconds and includes cord storage

Four questions to ask before writing syntax

The article closes by recommending a set of prompts for any new model. They are not a formal checklist, but they are a practical habit:

  1. What entities exist in this problem?
  2. What state does each entity hold?
  3. Does each operation change that state or only read it?
  4. What rules prevent the state from becoming invalid?

Applied to the car, the answers are: a car, its speed, fuel, and engine state; the engine state and speed change under commands, while the speed check only reads; and the engine must be running before the car can accelerate.

Try it yourself

The article ends with a prompt worth taking seriously: “How would you explain variables and assignment to a complete beginner without using the word “variable”?” Try writing an explanation that uses a sandwich, a labeled box, or a bank balance, then check whether a beginner could follow it with no further help.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What this exercise does and does not show

  • It is one author’s teaching account. The exercise was run in an engineering mentorship program with an apprentice named John. The article does not report a research design, measured outcomes, or a comparison showing that the method improves learning. No statistic on effectiveness is given.
  • The criticism of beginner tutorials is opinion. The article’s view of “tutorial hell” is the author’s, not a measured finding.
  • It covers one slice of object-oriented design. Microsoft Learn’s Object-Oriented programming (C#) tutorial also covers abstraction, encapsulation, inheritance, and polymorphism, none of which the sandwich exercise addresses.
  • The physical model is deliberately weak. The plus-sign version is meant to show missing steps, not to suggest that addition is flawed.
  • The plate comparison is a metaphor. It helps separate an object from its surroundings, but it is not an explanation of how memory is managed.

The original article is worth reading in full for its sequence of steps: We Reinvented OOP by Making a Sandwich (Before Writing Any Code), by Blessed Emmanuel John chidera, DEV Community, September 19, 2026.

Choosing further practice

If the sandwich-and-car approach works for you, a beginner C# or object-oriented programming book can supply the structured exercises the article leaves out. When comparing options, check four things: the stated level (complete beginner or prior programming experience), whether the book is specific to C# or language-neutral OOP, how exercises are presented, and whether you prefer print or free online material.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.