Loading lesson…
Level 1 · Apprentice0 XP
Create families of related objects together, or copy a configured object instead of building it again.
Step 1 / 6
ProblemA UI kit has light and dark buttons, inputs and dialogs. Code creates them one by one with if (dark) everywhere. One screen shows a dark dialog with a light button.
← → step
Before this: Factory and Builder
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Build a WidgetFactory with light and dark implementations for Button and Dialog. Write a test that renders a screen with each factory and asserts every widget comes from the same theme.