BUILDER / PRACTICE
One meal.
Built one choice at a time.
You met Builder while creating reports. Now apply it to a meal-ordering flow.
YOUR MISSION / MEAL ORDERS
Keep the choices.
Protect the finished meal.
A customer chooses a base, a main, then optional toppings. Keep the draft between steps, reject an incomplete build, and return meals that survive later edits.
An ordinary constructor is enough when all choices arrive at once. Here, a draft grows over several steps before a deliberate build boundary. Finally, reuse those steps in a lunch recipe.
01 / DESIGN THE BUILDER
Make three design choices.
Keep a draft, define the build boundary, and decide what a finished meal owns.
Try your own design first. Hints and retries are unlimited.
02 / PREDICT · BUILD · COMPARE
A draft grows. A meal stays finished.
Build Rice + Tofu with Sesame. The finished meal should contain all three choices.
ONE BUILDER / CHOICES ACCUMULATE
No product yet- Base
- Not chosen
- Main
- Not chosen
- Toppings
- None
Waiting for build()
Your choices drive the result. Start a trace to test them.
Each test uses a fresh builder. The reuse test keeps one builder for both meals. Changing a design choice clears all verification.
See the code behind your design TypeScript
03 / TRANSFER THE IDEA
The same lunch, ordered again.
A popular lunch always uses Rice, Beans, Corn and Chili. Add a reusable recipe so callers do not repeat the construction steps.
This recipe plays the optional Director role: it coordinates existing steps. The builder still owns the draft, validation and product creation.
Choose the two required edits, then apply the recipe and follow its construction trace to finish.
First pass all three test cases with the same assembly.
Compare with a complete solution
No timer and no attempt limit. Try another assembly, use a hint, or reveal the answer when it helps.