- 1 current stop: learning
- 2 upcoming
- 3 upcoming
- 4 upcoming
- 5 upcoming
Finish after stop 5
Stop 1 of 5 · Parts counter at the bike shop
Trick to keep in mind+3 XP
Same if/elif ladder in many places? Climb it once, inside a factory.
The pain behind a repeated type check is that every caller must know which concrete class to build. A factory moves that decision into one place: callers say what they need and receive something that does the job. A new format then means editing one function. A builder is for step-by-step assembly, and a singleton is for exactly one instance, neither of which this is about.
Read it once, then a question tests whether the trick stuck.