Chapter 3: The Principles of Sound Structure: From Code That Works to Code That Lasts
This chapter introduction previews the structural principles, code smells, refactoring example, and case studies covered later.
After this chapter you will be able to
- Reader Focused Maintainable Code. Explain why code that lasts should be optimized for the people who will read and change it, not just for the person writing it now.
- Focused separation of concerns. Explain that Separation of Concerns means each piece of code has one clear job, with database logic, UI logic, and business rules kept apart so changes are easier to make without disturbing unrelated code.
- Cohesion Within a Module. Explain how cohesion describes whether the parts of a module fit together, and distinguish a focused class from one with unrelated responsibilities.
- Dependencies Between Modules. Explain how coupling describes dependence between modules, and contrast easy-to-change connections with dependencies that make changes spread.
- Simple Conversation Coupling Test. Apply the section’s test to a client and service: inspect their interactions, then distinguish a few clear requests from detailed back-and-forth that signals tight coupling.
- Encapsulated Service Workflow. Explain why a repeated client-side sequence of service calls is a warning sign and what improves when the service owns that workflow.
- Four OOP Pillars. Distinguish encapsulation, abstraction, inheritance, and polymorphism as the OOP concepts presented here as enabling flexible, modular code.
- SOLID Checklist Purpose. Explain why the section presents SOLID as a checklist rather than rigid laws, and identify the structural goals it is meant to support.
- One Reason to Change. Explain that SRP gives a class one well-defined responsibility, so its parts serve the same purpose, and use distinct reasons for change to spot a violation.
- Costs of Tangled Responsibilities. Describe the practical problems caused when one class combines unrelated jobs, using the Player example.
- Separation Benefits and Tradeoff. Explain how separating Player, TacticsEngine, and PlayerRepository improves maintainability and testability, and state the cost the section accepts.
- Extension Through Stable Contracts. Explain that OCP keeps working code closed to modification while allowing new behavior through classes that follow a stable contract, as in adding plays without changing the Midfielder.
- Additive Change Payoffs. Justify the small upfront effort of defining a play contract by describing the benefits of adding each play in its own class.
- Behavioral substitutability of subclasses. Explain that a child object must work wherever its parent is expected without breaking the application. Use Bob the Goalie to show why inheriting from Player and providing the required method are not enough when behavior violates the parent's promise.
- Role-focused interface contracts. Explain the Interface Segregation Principle: a class should not have to implement methods irrelevant to its role, so interfaces should be small and focused.
- Costs of bloated interfaces. Trace how a combined field-player and goalie training interface forces Midfielder to provide useless methods and can turn an apparently valid contract into a runtime failure.
- Splitting contracts by responsibility. Describe how to spot a fat interface by asking whether a class must implement irrelevant methods, then explain why separating field-player and goalie training into focused contracts helps.
- Dependency direction through shared contracts. Explain that high-level modules and concrete low-level modules should both depend on an abstraction, while concrete details implement that abstraction. Use the Coach and player roles to describe what is inverted.
- Consequences of concrete coupling. Describe why tying the Coach directly to Forward and Midfielder makes isolated tests and changes difficult, and how a shared player contract addresses those problems.
- Change and maintenance priorities. Explain how likely change and future collaborators should guide design effort: make flexibility a priority where change is probable, and clarity a priority where others will work with the code.
- Fragility and boundary checks. Describe how to spot fragile assumptions, excessive coupling, and unclear responsibilities when reviewing a class or method, including what difficulty writing a unit test can reveal.
- All-in-one order processing. Explain why the OrderProcessor method is called a micro-monolith and what risk the section associates with its all-in-one approach.
- Spark and inquiry diagnosis. Explain how a small OrderProcessor change reveals a larger structural problem, and how the inquiry identifies its responsibilities, relevant context, and missing qualities.
- Separated responsibility sketch. Describe the proposed high-level sketch and how it expresses the desired separation of concerns before coding begins.
- Refactor tradeoff and decision. Distinguish the three options, justify the full refactor against the stated quality goals, and describe what the ADR records.
- Focused services and coordinator. Describe how the after-code separates work between small service classes with one job each and a high-level OrderService that directs their workflow.
- Defensible Refactor Tradeoff. Justify accepting a few extra files in return for maintainability, isolated testing, and a smaller blast radius in the refactored design.
- Duplicated Scorecard Maintenance Risk. Explain why shared sections in the 35 separate industry scorecards made a small calculation change difficult and risky.
- Cost of duplicated scorecards. Explain why copying scorecards was a costly shortcut rather than just a code-quality problem.
- Composability through component contracts. Describe how the replacement scorecards were assembled from components and why those components could be combined.
- Principles Across Architectural Scales. Explain how separation of concerns applies at different scales, using the OrderProcessor refactor and the 35-Headed Hydra case study to distinguish method-level from application-level decisions.
- Consistent Small Design Decisions. Explain why the section says a team can build good application architecture through consistent daily decisions about methods, classes, and components.
- Objects for changing systems. Explain why Simula’s creators modeled real-world systems as self-contained objects rather than one monolithic set of instructions. Describe how keeping a Patient’s data and behavior together helps isolate changes from a Doctor object.
- Extensibility without modifying existing code. Explain how Simula’s generic TreatmentRoom could handle different Patient types and why adding an EmergencyPatient without changing TreatmentRoom illustrates the Open/Closed Principle.
- Comment-Driven Structural Audit. Apply the structural audit to a long or intimidating method or class: comment each block without changing its logic, then read the comments alone to see whether they describe one focused job or several unrelated jobs.
- Cohesive and Loosely Coupled Components. Explain how separation of concerns leads to components whose internal parts are strongly related but whose connections do not depend on each other’s internal details.
- SOLID Checks and Shared Contracts. Describe the five SOLID checks summarized here and explain how abstractions or shared contracts help make code extensible and testable.
- Limited Blast Radius Through Daily Decisions. Explain why good architecture aims to contain the effects of a change or failure, and how applying structural principles consistently matters from methods to whole systems.
What it builds on
- Maintainability in Action: From Mess to Clarity (chapter 2) · Introduces maintainability as a quality of software.
- The “-ilities”: Your Vocabulary of Quality (chapter 2) · Maintainability and testability as software qualities
- Testability in Action: Breaking Dependencies (chapter 2) · Testability through breaking dependencies.
- The Myth of the “Perfect” Architecture (chapter 2) · Architecture choices need not follow a single perfect design.
- Architecture Decision Records (ADR) (chapter 2) · The use of an ADR to explain an earlier architectural decision.
Section by section
Introduction
This chapter introduction previews the structural principles, code smells, refactoring example, and case studies covered later.
Introduction
This introduction frames lasting code as code designed for future readers, rather than merely for immediate functionality.
- Reader Focused Maintainable Code: Explain why code that lasts should be optimized for the people who will read and change it, not just for the person writing it now.
Why it matters: Writing for future readers makes code easier for the team to understand, repair, and change.
Key terms: Maintainability, code that lasts
3.2 Separation of Concerns
This section explains how giving each piece of code one focused job makes unrelated parts of an application less likely to interfere with one another.
- Focused separation of concerns: Explain that Separation of Concerns means each piece of code has one clear job, with database logic, UI logic, and business rules kept apart so changes are easier to make without disturbing unrelated code.
Why it matters: Clear responsibilities make a small change less likely to cause a surprising problem elsewhere. - One job method check: Apply the section’s question, “What is the ONE job of this piece of code?”, to spot a method that may need splitting, such as one that both fetches user data and formats it for the screen.
Why it matters: The one-job question gives you a quick way to notice mixed responsibilities before adding more code.
Key terms: Separation of Concerns (SoC), concern, database logic, UI logic, business rules, ONE job, more focused methods
3.3 Cohesion and Coupling
This section uses cohesion and coupling to assess separation of concerns, then shows how avoiding hidden state changes can help preserve a sound structure.
- Cohesion Within a Module: Explain how cohesion describes whether the parts of a module fit together, and distinguish a focused class from one with unrelated responsibilities.
Why it matters: Cohesion helps you spot whether a class has a clear focus. - Dependencies Between Modules: Explain how coupling describes dependence between modules, and contrast easy-to-change connections with dependencies that make changes spread.
Why it matters: Coupling helps you recognize when a small change may ripple through the code. - Predictable State and Behavior: Describe how pure functions and immutable data avoid hidden changes, and why that helps keep classes predictable and easier to test or refactor.
Why it matters: Avoiding hidden state changes makes everyday classes easier to reason about and change.
Key terms: Cohesion, High Cohesion, Low Cohesion, Coupling, Loose Coupling, Tight Coupling, Pure Functions, Immutability, side effects, mutability
3.3.1 Exercise: The "Simple Conversation" Test for Coupling
This section teaches a code-reading test for tight coupling between two classes and explains why keeping a service’s workflow inside the service makes changes less disruptive.
- Simple Conversation Coupling Test: Apply the section’s test to a client and service: inspect their interactions, then distinguish a few clear requests from detailed back-and-forth that signals tight coupling.
Why it matters: The test helps you spot brittle interactions before deciding what to refactor. - Change Impact and Blast Radius: Explain what blast radius means and how the test uses likely changes to the service to judge the client’s dependence on it.
Why it matters: Thinking about change impact exposes dependencies that may not be obvious while the code still works. - Encapsulated Service Workflow: Explain why a repeated client-side sequence of service calls is a warning sign and what improves when the service owns that workflow.
Why it matters: Keeping the workflow inside its service makes the client easier to read and less likely to need changes when service internals change.
Key terms: Client, Service, simple conversation, deep interrogation, tight coupling, blast radius, clear boundaries, dependencies, secret recipe, Encapsulation
3.4 SOLID Principles
Introduces SOLID as a flexible checklist for changeable code by refreshing four OOP concepts and explaining how an object refers to itself.
- Four OOP Pillars: Distinguish encapsulation, abstraction, inheritance, and polymorphism as the OOP concepts presented here as enabling flexible, modular code.
Why it matters: These concepts provide the OOP foundation the section uses to introduce SOLID. - Object Self Reference: Explain how `this` or `self` identifies the particular object whose method is running, using the contact-editing example.
Why it matters: It explains why editing one contact changes that contact's phone number, not every contact's. - SOLID Checklist Purpose: Explain why the section presents SOLID as a checklist rather than rigid laws, and identify the structural goals it is meant to support.
Why it matters: It gives the reader a purpose for the principles before considering them individually.
Key terms: Encapsulation, Abstraction, Inheritance, Polymorphism, this, self, self-reference, instance, SOLID principles, pre-flight checklist
3.4.1 S – Single Responsibility Principle (SRP)
This section explains how the Single Responsibility Principle keeps each class focused on one reason to change, and why that separation makes changes and tests less risky.
- One Reason to Change: Explain that SRP gives a class one well-defined responsibility, so its parts serve the same purpose, and use distinct reasons for change to spot a violation.
Why it matters: Asking why a class might change gives you a practical way to recognize a class with too many jobs. - Costs of Tangled Responsibilities: Describe the practical problems caused when one class combines unrelated jobs, using the Player example.
Why it matters: A class can work today yet make tomorrow's changes unexpectedly costly. - Separation Benefits and Tradeoff: Explain how separating Player, TacticsEngine, and PlayerRepository improves maintainability and testability, and state the cost the section accepts.
Why it matters: The extra classes are a deliberate cost paid to make changes safer and tests easier.
Key terms: Single Responsibility Principle, SRP, one reason to change, high cohesion, Player, fragile, Testability, High Cognitive Load, merge conflicts, TacticsEngine
3.4.2 O - Open/Closed Principle (OCP)
This section explains how the Open/Closed Principle lets developers add behavior without repeatedly changing stable code, and why that tradeoff improves a system over time.
- Extension Through Stable Contracts: Explain that OCP keeps working code closed to modification while allowing new behavior through classes that follow a stable contract, as in adding plays without changing the Midfielder.
Why it matters: You can add a new play while leaving the working Midfielder code alone. - Growing Conditional Chain Costs: Describe why adding a branch to the Midfielder's existing play method for every feature becomes a poor long-term tradeoff.
Why it matters: A solution that is simple today can make every later feature slower and riskier. - Additive Change Payoffs: Justify the small upfront effort of defining a play contract by describing the benefits of adding each play in its own class.
Why it matters: The small cost of a contract can make later changes safer, easier to test, and easier to maintain.
Key terms: Open/Closed Principle, extension, modification, stable contracts, execute(), loose coupling, if/else, maintainability, reliability, blast radius
3.4.3 L – Liskov Substitution Principle (LSP)
Explains Liskov Substitution Principle as a behavioral promise, shows the cost of breaking it, and offers ways to recognize and test that promise.
- Behavioral substitutability of subclasses: Explain that a child object must work wherever its parent is expected without breaking the application. Use Bob the Goalie to show why inheriting from Player and providing the required method are not enough when behavior violates the parent's promise.
Why it matters: A class can compile and still surprise code that trusts its parent type. - Costs of broken substitution: Describe how a subclass that breaks its parent's promise creates runtime surprises and forces subtype-specific checks. Explain how this harms reliability and maintainability, while trustworthy substitutes let callers use the parent type without special cases.
Why it matters: Avoiding special cases keeps callers simpler and makes changes safer. - Forms of behavioral contracts: Describe a contract as a behavioral promise callers can rely on, whether expressed through an interface, an abstract class, or explicit runtime checks. State that LSP applies regardless of how the contract is expressed.
Why it matters: Behavioral promises still matter when a language cannot express them with a dedicated keyword. - Shared tests for subclasses: Apply the section's contract-testing check: run tests of the parent's promised behavior against each subclass, and identify a failing subclass as an LSP violation.
Why it matters: Shared behavioral tests can expose a false substitute that type checking alone accepts.
Key terms: Liskov Substitution Principle, LSP, behavioral substitute, parent class, child class, deceptive inheritance, polymorphism, Reliability, Maintainability, blast radius
3.4.4 I – Interface Segregation Principle (ISP)
Explains why role-focused interfaces prevent classes from making promises they cannot fulfill and how splitting a bloated interface improves clarity and reliability.
- Role-focused interface contracts: Explain the Interface Segregation Principle: a class should not have to implement methods irrelevant to its role, so interfaces should be small and focused.
Why it matters: A focused contract says only what a class can genuinely do. - Costs of bloated interfaces: Trace how a combined field-player and goalie training interface forces Midfielder to provide useless methods and can turn an apparently valid contract into a runtime failure.
Why it matters: A contract that compiles but contains unsupported methods can surprise future callers at runtime. - Splitting contracts by responsibility: Describe how to spot a fat interface by asking whether a class must implement irrelevant methods, then explain why separating field-player and goalie training into focused contracts helps.
Why it matters: Splitting contracts takes a little upfront work but leaves classes clearer and their promises more trustworthy.
Key terms: Interface Segregation Principle, fat interfaces, high cohesion, loose coupling, interface bloat, useless methods, Midfielder, practiceDivingSaves, maintainability, reliability
3.4.5 D – Dependency Inversion Principle (DIP)
This section explains how Dependency Inversion replaces direct reliance on concrete classes with shared contracts, improving testability and changeability when the tradeoff is worthwhile.
- Dependency direction through shared contracts: Explain that high-level modules and concrete low-level modules should both depend on an abstraction, while concrete details implement that abstraction. Use the Coach and player roles to describe what is inverted.
Why it matters: A shared contract lets the game plan stay separate from the particular players carrying it out. - Consequences of concrete coupling: Describe why tying the Coach directly to Forward and Midfielder makes isolated tests and changes difficult, and how a shared player contract addresses those problems.
Why it matters: The benefit of DIP becomes concrete when you need to test a game plan or add a player type without editing it. - Pragmatic cost of abstraction: Justify the small upfront effort of a shared contract when flexibility and testing matter, while describing situations where applying SOLID would add needless complexity.
Why it matters: Judging whether the abstraction pays for itself is more useful than applying SOLID mechanically.
Key terms: Dependency Inversion Principle, DIP, high-level modules, low-level modules, abstractions, shared contracts, tight coupling, testability, maintainability, mock
3.4.6 Real-World Design Questions to Ask
Provides practical questions for spotting where code needs flexibility, clarity, separation, and reliable contracts during design.
- Change and maintenance priorities: Explain how likely change and future collaborators should guide design effort: make flexibility a priority where change is probable, and clarity a priority where others will work with the code.
Why it matters: These questions help you spend design effort where it will help future changes and readers most. - Fragility and boundary checks: Describe how to spot fragile assumptions, excessive coupling, and unclear responsibilities when reviewing a class or method, including what difficulty writing a unit test can reveal.
Why it matters: These checks make structural problems easier to notice before they complicate changes and tests. - Extension without risky modification: Explain what the new-requirement question tests: whether behavior can be added without changing existing logic.
Why it matters: It helps you recognize when every new requirement would require a risky edit to existing logic. - Interface and subclass contract checks: Distinguish two contract warning signs: an interface that makes a class know about things it does not need, and a subclass that behaves surprisingly when passed in place of its parent.
Why it matters: Both questions can reveal contracts that look usable but create unnecessary obligations or surprising behavior.
Key terms: flexibility, clarity, maintainability, assumptions, tight coupling, separation, unit test, clear boundaries, extended, existing logic
3.5 In Action: “Before vs. After” SRP Refactor
Introduces an upcoming SRP refactor of order-processing code that appears sound on the surface but may hide architectural flaws.
3.5.1 The "Before" Code (The Monolithic Method)
This section defines a monolithic application and uses an all-in-one order-processing method to illustrate how combining distinct jobs can make code harder to change and riskier to test.
- Monolithic application structure: Describe a monolith as an application whose parts, from the user interface through business logic and database access, are developed and deployed as one self-contained package.
Why it matters: This distinguishes the structure of an application from the structure of one method inside it. - All-in-one order processing: Explain why the OrderProcessor method is called a micro-monolith and what risk the section associates with its all-in-one approach.
Why it matters: Spotting distinct jobs in one method helps explain why apparently straightforward code may be difficult to work with.
Key terms: monolith, single, unified unit, self-contained package, OrderProcessor, micro-monolith, all-in-one
3.5.2 The 5-Step Architectural Thinking Process in Action
This section applies a five-step architectural thinking process to turn a crowded OrderProcessor method into a defensible refactoring decision.
- Spark and inquiry diagnosis: Explain how a small OrderProcessor change reveals a larger structural problem, and how the inquiry identifies its responsibilities, relevant context, and missing qualities.
Why it matters: A refactor is easier to defend when you can name the problem and the qualities it needs to improve. - Separated responsibility sketch: Describe the proposed high-level sketch and how it expresses the desired separation of concerns before coding begins.
Why it matters: The sketch makes the intended boundaries visible before committing to code. - Refactor tradeoff and decision: Distinguish the three options, justify the full refactor against the stated quality goals, and describe what the ADR records.
Why it matters: Comparing alternatives against explicit goals makes the choice explainable to future teammates.
Key terms: Spark, Inquiry, ADR, Maintainability, Testability, OrderProcessor, Sketch, Validator, Payment, Inventory
3.5.3 The "After" Code (Separated Concerns)
The refactored design gives individual service classes focused jobs and uses an OrderService to coordinate their work.
- Focused services and coordinator: Describe how the after-code separates work between small service classes with one job each and a high-level OrderService that directs their workflow.
Why it matters: Separating the jobs makes the classes easier to understand, test, and maintain.
Key terms: single responsibility, individual service classes, high-level OrderService, workflow
3.5.4 The Payoff (The Defensible Decision)
This section explains why separating the refactored code into focused classes is a defensible tradeoff and offers a practical way to make the refactor safer.
- Defensible Refactor Tradeoff: Justify accepting a few extra files in return for maintainability, isolated testing, and a smaller blast radius in the refactored design.
Why it matters: The extra structure is worthwhile when it makes future changes safer and easier to test. - Safer IDE Assisted Refactoring: Describe how IDE refactor tools can help move code during this refactor without relying on manual cutting and pasting.
Why it matters: Using refactor tools helps keep the change itself from introducing avoidable errors.
Key terms: defensible decision, maintainability, testability, blast radius, high cohesion, Extract Method, Move to New File
3.6 Case Study: Taming the 35-Headed Hydra
The section recalls the constraints behind the bank’s credit scorecard rewrite and introduces a case study of how structural principles were used during the rebuild.
3.6.1 The Scorecard Nightmare
This section shows how repeated sections across 35 industry scorecards made even small changes slow and risky.
- Duplicated Scorecard Maintenance Risk: Explain why shared sections in the 35 separate industry scorecards made a small calculation change difficult and risky.
Why it matters: Duplicated sections turn a small fix into a search-and-update task where an omission can have serious consequences.
Key terms: scorecard, Cash Flow Analysis, duplicated code, inconsistent scoring
3.6.2 The Clarity Engineer's Diagnosis: The High Cost of Duplication
Diagnoses the business cost of duplicated scorecards and shows how reusable, composable components made changes faster and more reliable.
- Cost of duplicated scorecards: Explain why copying scorecards was a costly shortcut rather than just a code-quality problem.
Why it matters: The cost of a shortcut includes every difficult change that follows it. - Composability through component contracts: Describe how the replacement scorecards were assembled from components and why those components could be combined.
Why it matters: Agreed connections let a team build different scorecards from the same dependable parts. - Payoff from reliable reuse: Justify the investment in composable scorecards using the section’s examples of reuse, reliability, and change time.
Why it matters: A greater upfront investment can save substantial maintenance time later.
Key terms: Separation of Concerns, technical debt, Maintainability, Reliability, Total Cost of Ownership (TCO), Composability, high cohesion, loose coupling, standardized contracts, CashFlowAnalysisComponent
3.7 Zooming Out: The Fractal Nature of Good Architecture
This section shows how separation of concerns applies from individual methods to whole applications, and why consistent small design decisions add up to sound architecture.
- Principles Across Architectural Scales: Explain how separation of concerns applies at different scales, using the OrderProcessor refactor and the 35-Headed Hydra case study to distinguish method-level from application-level decisions.
Why it matters: It connects everyday code structure to the structure of an entire system. - Consistent Small Design Decisions: Explain why the section says a team can build good application architecture through consistent daily decisions about methods, classes, and components.
Why it matters: It makes architecture a practice of repeatable design choices, not just a one-time blueprint.
Key terms: Separation of Concerns, Single Responsibility Principle, High Cohesion, fractal, single responsibility, cohesive, loosely coupled, sound principles
3.8 The Dork Side: The First "Virtual Reality" - The Real Story Behind OOP
This section uses Simula’s origins to show how object-oriented design helps software accommodate changing, complex systems.
- Objects for changing systems: Explain why Simula’s creators modeled real-world systems as self-contained objects rather than one monolithic set of instructions. Describe how keeping a Patient’s data and behavior together helps isolate changes from a Doctor object.
Why it matters: Separating responsibilities makes changing systems easier to maintain. - Extensibility without modifying existing code: Explain how Simula’s generic TreatmentRoom could handle different Patient types and why adding an EmergencyPatient without changing TreatmentRoom illustrates the Open/Closed Principle.
Why it matters: The example makes extensibility concrete: a new case need not require editing code that already handles the existing ones.
Key terms: Simula, objects, Separation of Concerns, classes, inheritance, virtual methods, TreatmentRoom, Open/Closed Principle, polymorphism
3.9 Your “In-Action” Mission: Perform a Structural Audit
This section teaches a comment-only audit for spotting unrelated responsibilities in existing code, with AI as an optional second set of eyes.
- Comment-Driven Structural Audit: Apply the structural audit to a long or intimidating method or class: comment each block without changing its logic, then read the comments alone to see whether they describe one focused job or several unrelated jobs.
Why it matters: It gives you a safe way to spot mixed responsibilities before changing code. - AI as Audit Assistant: Explain how an AI assistant can help identify distinct responsibilities in the code while leaving the architectural judgment to the developer.
Why it matters: AI suggestions are useful only if you can judge whether they accurately describe the code.
Key terms: structural audit, Clarity Check, low cohesion, seams, distinct responsibilities, second set of eyes
3.10 Checklist
This checklist asks readers to recall the chapter’s structural design concepts without explaining them.
3.11 Recap
The recap connects separation of concerns, SOLID principles, and small structural decisions to code that is easier to change without widespread effects.
- Cohesive and Loosely Coupled Components: Explain how separation of concerns leads to components whose internal parts are strongly related but whose connections do not depend on each other’s internal details.
Why it matters: This gives you a way to describe what makes a codebase well organized. - SOLID Checks and Shared Contracts: Describe the five SOLID checks summarized here and explain how abstractions or shared contracts help make code extensible and testable.
Why it matters: These checks give you practical language for spotting code that will be hard to change or test. - Limited Blast Radius Through Daily Decisions: Explain why good architecture aims to contain the effects of a change or failure, and how applying structural principles consistently matters from methods to whole systems.
Why it matters: It connects everyday code decisions to the resilience of the wider system.
Key terms: Separation of Concerns, High Cohesion, Loose Coupling, SOLID, Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion, blast radius
Where this is used later
- Layered Architecture (chapter 4) · Provides the basic reason for separating different responsibilities when thinking in layers.
- 3. The Adapters (The Translators) (chapter 5) · The Open/Closed Principle named as the benefit of adding adapters without modifying the Core.
- 2. The Ports (The Interfaces) (chapter 5) · Helps explain why a port's interface is a contract its implementations must honor.
- The "Hotfix": The Square Peg in a Round Hole (chapter 7) · The section names the Interface Segregation Principle when describing the mismatch, without explaining the principle here.
- The Solution: Invert the Dependency! (chapter 4) · Provides the dependency-direction idea behind inverting dependencies for cross-cutting concerns.
- Inside, Ports, and Adapters (chapter 5) · Provides the idea of a core relying on contracts rather than concrete implementations.
- Why Is It So Important? (chapter 4) · Dependency Inversion Principle
- “After”: The Defensible Decision (Rich Domain, Thin Controller) (chapter 4) · The Dependency Inversion Principle used to make infrastructure depend on a domain contract.
Concepts explained in this chapter
- couplingCoupling is the degree of dependency between software components, with tight coupling requiring extensive knowledge of another component's operations or internal structure.
- contractAn API contract specifies the operations, data, and behavioral expectations governing communication between an API and its clients.
- separation of concernsSeparation of concerns is a design principle that reduces complexity by dividing a system into distinct parts with separate responsibilities and boundaries.
- cohesionCohesion is the degree to which the responsibilities within a software component belong together.
- blast radiusA blast radius is the extent to which a software failure, defect, outage, misconfiguration, security breach, or regulatory scope affects other components or the surrounding organization.
- single responsibility principleThe single responsibility principle is the design principle that a software unit should have one clearly focused responsibility and one primary reason to change.
- interfaceAn interface is a programming-language construct that defines a contract of operations without prescribing their implementation.
- Liskov Substitution PrincipleThe Liskov Substitution Principle is an object-oriented design principle requiring instances of a subtype to remain behaviorally usable wherever instances of its parent type are expected.
- abstractionAn abstraction is an interface or simplified representation that exposes relevant behavior while hiding implementation details.
- open-closed principleA software design principle stating that software entities should be open to extension but closed to modification.
- encapsulationEncapsulation is a design principle that keeps implementation details and process complexity inside the component responsible for them while restricting uncontrolled access to its state.
- SOLID principlesSOLID principles are a group of object-oriented design principles for improving software structure, flexibility, and maintainability.
- dependency inversionThe Dependency Inversion Principle states that high-level and low-level modules should depend on abstractions, while abstractions should not depend on implementation details.
- Interface Segregation PrincipleThe Interface Segregation Principle states that a class should not be required to depend on or implement interface methods it does not use.
- reason for changeA distinct requirement, action, or area of concern that can independently require a software unit to be modified.
- inheritanceInheritance is an object-oriented language feature that allows a new class to acquire properties and methods from an existing class.
- object-oriented programmingA programming paradigm that organizes software around objects containing state and behavior, commonly using classes, encapsulation, inheritance, and polymorphism.
- polymorphismPolymorphism is an object-oriented language feature allowing different objects to respond to the same operation according to their own implementations.
- interface bloatInterface bloat is an interface design problem in which one interface combines excessive or unrelated operations that force clients to depend on methods they do not need.
- refactoringRefactoring is the disciplined restructuring of existing code without changing its externally observable behavior.
- componentA component is a modular software unit that encapsulates related functionality and interacts with other units through defined boundaries.
- maintainabilityMaintainability is the degree to which software can be understood, corrected, modified, or extended efficiently over time.
- composabilityComposability is a system design principle in which components can be selected and assembled in various combinations to satisfy specific user requirements.
- five-step architectural thinking processA repeatable five-step method for analyzing software requests and making reasoned architectural decisions before implementation.
- dependency injectionInjection is the process of providing a dependency to the object that needs it.
- sketchA sketch is an informal architecture diagram that represents a system’s main responsibilities and relationships without the formality of a UML diagram.
- sparkThe Spark is the initial feature request or observed problem that starts architectural discovery.
- software architectureSoftware architecture comprises the significant structural and behavioral decisions that shape how a software system is built, deployed, and changed.
- classA programming construct that defines the properties and behavior shared by its object instances.
- defensible decisionA defensible decision is a technical choice supported by an explicit rationale that accounts for relevant benefits, costs, risks, and alternatives.
- testabilityTestability is the degree to which software can be easily tested to verify its behavior and correctness.
- tradeoffA tradeoff is a situation in which gaining a benefit requires accepting a cost, risk, or limitation elsewhere.
- monolithic architectureA software application developed and deployed as a single unified unit.
- contract testingAn individual test that verifies a component conforms to an agreed behavioral contract.
- architecture decision recordA document that records an architectural decision, its context, considered alternatives, and rationale.
- immutabilityImmutability is a system property in which deployed infrastructure is not modified in place but replaced with a new version when changes are required.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
