Concept
Build behaviour by combining small objects and functions rather than deep class hierarchies. Composition keeps each piece testable and avoids the fragile base class problem.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Composition over inheritance doing its job.
type Logger = { log(message: string): void };
type Clock = { now(): Date };
class OrderService {
constructor(private readonly logger: Logger, private readonly clock: Clock) {}
place(order: Order) {
this.logger.log("placed at " + this.clock.now().toISOString());
}
}
new OrderService(console, { now: () => new Date() });Subclassing to reuse a single method, which drags in the whole parent and ties the two classes together. Pass the behaviour in as a dependency instead.
Your roadmap puts these before Composition over inheritance, unless you already know them.
Once a session shows you understand Composition over inheritance, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.