Engineering Mentor Teaches OOP Concepts Using Sandwich-Making Before Any Coding
A software engineering mentor ran an experiment with an apprentice named John, aiming to build the conceptual foundation of Object-Oriented Programming without writing any code first. Using a sandwich-making exercise, the apprentice learned to distinguish entities, tools, containers, and operations, and discovered how actions trigger state transitions rather than creating entirely new objects. The exercise was then extended to a bank account model, through which the apprentice independently arrived at the principle of Command-Query Separation, distinguishing commands that mutate state from queries that only read it. A final challenge involving 100 cars in a racing simulation led the apprentice to conceptually discover the idea of a class as a reusable template. The mentor argues this design-first approach helps beginners move beyond memorizing syntax and develop genuine problem-decomposition skills.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in