Object-Oriented Design for maintainability
Applying these two items will push the system’s architecture to where the business domain is isolated from its technical dependencies. e.g., databases, user interfaces,
Then write bridges between the application core and each technical domain.
Separation of Concerns
You keep software soft by leaving as many options open as possible.The options that need to be open are the things that support the application.[¹]
Changing behavior in a system shouldn’t trigger a hunt in every part of the system to make that change.
A code-smell describes this condition’s name as Shotgun Surgery[²].
Separation of concerns opens options in a software system. In practical terms, it is the separation of Business rules and Technical details.
Business rules describe the operations, definitions, and constraints that apply to an organization. Business rules define business constraints; thus, business rules are what make the business money.[¹]
Everything unrelated to the business is considered implementation or technical details. The database, the query language, and even the schema are technical details that have nothing to do with the business rules or the UI[¹]
Encapsulation
In Object-Oriented Programming, encapsulation refers to the combination of related data and behavior.
Encapsulation ensures that the behavior of an object can only be affected through its API.
Encapsulation control how much a change to an object will impact other parts of the system. It ensures that there are no unexpected dependencies between unrelated components.
Encapsulation conceals how an object implements its functionality behind the abstraction of its API.
The combination of APIs defines the higher-level abstraction that ignores lower-level details unrelated to the task.
Higher Level Abstraction
Humans reduce cognitive complexity by working at higher levels of abstractions.
Combining different components is more effective than manipulating variables and control flows.
Components are only develop when a higher-level abstraction exist for people to discuss and improve.
The goal is to define an API that describes the relationship between domain components and the outside world.
— —
[¹]: Robert C. Martin (2018): Clean architecture: a craftsman’s guide to software structure and design(https://www.amazon.com/Clean-Architecture-Craftsmans-Software-Structure-ebook-dp-B075LRM681/dp/B075LRM681/ref=mt_other?_encoding=UTF8&me=&qid=)
[²]: Shotgun Surgery: https://refactoring.guru/smells/shotgun-surgery