Skip to main content

We Reinvented OOP by Making a Sandwich Before Code

Discover how an engineering mentorship program taught object-oriented programming fundamentals using a sandwich and a bank account before writing C#.

AI-written
Inewgen
20 Sep 2026Source: Dev.to3 min read (0 views)
Share
We Reinvented OOP by Making a Sandwich Before Code

Stock photo for illustration only, not from the actual event

Font size
  • Taught OOP fundamentals to an apprentice by building a sandwich before any C# code.
  • Overcame tutorial hell by decomposing physical actions and ambiguous verbs.
  • Discovered Command-Query Separation independently through bank account operations.
  • Understood classes and object instances using a 100-car racing simulation problem.

A weak developer stares at an empty .cs file and starts typing syntax until the red squiggly lines disappear, whereas a true software engineer designs the system before touching a compiler. Most programming tutorials rush straight into syntax, leaving beginners trapped in tutorial hell the second they face a blank screen knowing keywords without problem decomposition skills.

Inside an engineering mentorship program, an experiment was conducted with an apprentice named John to build the entire conceptual foundation of Object-Oriented Programming (OOP) without writing a single line of C# first, sharpening real problem-solving skills step by step.

The first challenge involved programming an autonomous robot with zero real-world knowledge using bread, butter, a knife, a plate, and cheese to write a step-by-step assembly algorithm for a cheese sandwich, mapping items from A to E and combining them onto a plate.

kitchen table ingredients sandwich preparation

Stock photo for illustration only, not from the actual event

When reviewed like a senior engineer reviewing a pull request, three major bugs surfaced: undefined verbs like take which confuse a mechanical actuator, the commutativity fallacy assuming physical assembly works like algebraic addition, and container leakage where the plate execution environment gets conflated with the sandwich data payload.

Never miss the latest news?

Subscribe to get news summaries by email - not often enough to be annoying.

โฆษณา

This teaching methodology highlights the core philosophy of software architecture: separating physical intuition from code syntax. By treating real-world actions as state transitions and data payloads, beginners develop rigorous mental models that prevent logical bugs before syntax ever enters the editor.

For attempt number two, the apprentice successfully separated ingredients from tools and containers, defining operational verbs and state transitions. Testing this model against a bank account with 5,000 dollars across four operations led directly to the discovery of Command-Query Separation.

4Bank operations tested
100Cars in racing simulation

The final scalability challenge required designing 100 cars on a track without repeating accelerate functions 100 times, prompting the apprentice to define a single car template to stamp out individual instances with separate numbers.

"You create a single car template. The template defines what every car HAS and what every car DOES. Then you stamp out 100 individual cars from that template, each holding its own numbers."

John

Source: Dev.to

Comments

Leave a Comment
0/2000

Found something wrong in this article? Report an issue with this article