๐Ÿงฉ Design Patterns with Java
Home Chapters Examples Diagrams Bibliography GitHub โ†—
  1. Home
  2. Principles (SOLID, Martin)
Part 2 2 chapters

Principles (SOLID, Martin)

The five SOLID principles in modern Java terms: SRP/OCP/LSP first, then ISP/DIP and dependency injection without a framework.

Chapter 3

SOLID I: SRP / OCP / LSP

A freight-billing engine split along three SOLID principles: one reason to change per type under the Single Responsibility Principle, an InvoiceRule abstraction new rules can satisfy without an edit under the Open/Closed Principle, and a discount rule refined without breaking its parent's contract under Liskov Substitution.

30 minRead โ†’
Chapter 4

SOLID II: ISP / DIP and dependency injection without a framework

Splitting a fat interface into focused role interfaces, inverting the dependency between a high-level policy and a low-level detail, and wiring the resulting object graph by hand in idiomatic Java with no DI container.

30 minRead โ†’
โ† Previous part Recognizing Design Next part โ†’ The Java Substrate
Design Patterns with Java
Tutorial content: CC BY 4.0. Sample code: Apache 2.0.
Source on GitHub โ†—  ยท  File an issue โ†—