
Writing
Prefer Composition Over Inheritance
Composition keeps a configuration provider's capabilities limited to what its project needs. The refactor uses self-contained settings providers, a shallow base, and restrained reuse.

Topic
Separating behavior from state, deciding what may be inherited, and keeping types honest about what they hold.
13 pages

Writing
Composition keeps a configuration provider's capabilities limited to what its project needs. The refactor uses self-contained settings providers, a shallow base, and restrained reuse.

Writing
Create instances for state or polymorphism and use inheritance for a common consumer. Static behavior and composition can keep testing from dictating every class's shape.

Writing
Business operations are easier to trace when immutable DTOs carry facts and stateless managers validate inputs and coordinate work through named methods at the call site.

Writing
C# construction order determines which fields are ready. Field initializers, constructor chaining, virtual dispatch and static initialization explain what runs when.

Writing
Choose static classes when instances serve no purpose. Shared type state, autonomous methods and immutable inputs explain the discipline that makes them useful.

Writing
Specific exceptions preserve failure meaning, causes, and context. A shallow C# hierarchy, Gateway translation, and middleware enrichment carry diagnostic records across service boundaries.

Writing
Dependency injection exposes private collaborators to callers when used for every internal relationship. Keep classes self-contained and let business code choose real variation.

Writing
A Factory selects and constructs a concrete descendant while callers program to an interface through the base class's public contract. C# thumbnailers show selection and polymorphic dispatch.

Writing
A model should express required fields, genuine absence, and distinct variants in its type. Python unions and C# records encode those promises, while boundaries check external values.

Chapter
Internal by default, behavior-only classes against state-only types, the two sanctioned uses of interfaces, and closing concrete descendants.

Chapter
Two kinds of class and why that separation holds, no inheritance for extension, and naming conventions for polymorphic types.

Chapter
Annotations as intent rather than decoration: None used deliberately, dictionaries kept out of method boundaries, and capability types that tell the truth.

Writing
Factory Method lets consumer subclasses choose dependencies through an overridable creation hook. C# examples show its two class families and distinguish it from a separate Factory.