chapter three
3 The Principles of Sound Structure: From Code That Works to Code That Lasts
This chapter covers
- Applying the foundational principles of sound structure, from Separation of Concerns to SOLID.
- Identifying "code smells" like low cohesion and tight coupling using simple analogies.
- Refactoring a single large method into clean, maintainable classes using the 5-step Architectural Thinking Process and the Single Responsibility Principle.
- Learning from our Hydra case study on taming a complex, duplicated system.
- Discovering the surprising origins of the ideas behind modern object-oriented design.
3.1 Introduction
In Chapter 2, we filled our architect's toolkit with the processes for making and defending decisions. We learned how to identify constraints, use the '-ilities' to define quality, and capture our choices in ADRs.
Now that we know how to decide, it's time to learn what to build.
This chapter shifts our focus from the decision-making process to the fundamental principles that create quality code. We're moving from the "why" to the "what." Here, we learn the difference between code that simply works and code that lasts. The goal is to create code that is easy to maintain, easy to change, and resilient to the pressures of changing business goals.