Composition Over Inheritance
Building complex objects by combining small, focused behaviors together rather than through deep class inheritance hierarchies.
Composition over inheritance is a design principle favoring building up complex object behavior by combining smaller, independent pieces (functions, mixins, or plain objects) rather than by creating deep class hierarchies where subclasses inherit and override behavior from parent classes. It's a design-level topic rather than a syntax quiz, and senior-level interviews often bring it up to gauge architectural judgment rather than just language trivia.
Inheritance is like building furniture by only ever taking one existing chair and modifying it into slightly different chairs each generation — eventually you're stuck if you need something that's part-chair, part-ladder. Composition is like building with modular LEGO pieces: you snap together exactly the capabilities you need for this specific object, without being constrained by what any single 'parent brick' looked like.