Clean Architecture: A Craftsman's Guide to Software Structure and Design
Rate it:
Open Preview
16%
Flag icon
Whenever anyone wants to know the balance of an account, we simply add up all the transactions for that account, from the beginning of time. This scheme requires no mutable variables.
16%
Flag icon
Event sourcing is a strategy wherein we store the transactions, but not the state. When state is required, we simply apply all the transactions from the beginning of time.
16%
Flag icon
If we have enough storage and enough processor power, we can make our applications entirely immutable—and, therefore, entirely functional.
16%
Flag icon
Structured programming is discipline imposed upon direct transfer of control.
16%
Flag icon
Object-oriented programming is discipline imposed upon indirect transfer of control.
16%
Flag icon
Functional programming is discipline imposed upon variable assignment.
16%
Flag icon
What we have learned over the last half-century is what not to do.
16%
Flag icon
The rules of software are the same today as they were in 1946, when Alan Turing wrote the very first code that would execute in an electronic computer.
17%
Flag icon
The tools have changed, and the hardware has changed, but the essence of software remains the same.
17%
Flag icon
Good software systems begin with clean code.
17%
Flag icon
On the one hand, if the bricks aren’t well made, the architecture of the building doesn’t matter much.
17%
Flag icon
On the other hand, you can make a substantial mess with...
This highlight has been truncated due to consecutive passage length restrictions.
17%
Flag icon
The SOLID principles tell us how to arrange our functions and data structures into classes, and how those classes should be interconnected.
17%
Flag icon
A class is simply a coupled grouping of functions and data.
17%
Flag icon
A module should have one, and only one, reason to change.
17%
Flag icon
A module should be responsible to one, and only one, user or stakeholder.
18%
Flag icon
A module should be responsible to one, and only one, actor.
18%
Flag icon
Cohesion is the force that binds together the code responsible to a single actor.
18%
Flag icon
Perhaps the best way to understand this principle is by looking at the symptoms of violating it.
18%
Flag icon
The SRP says to separate the code that different actors depend on.
19%
Flag icon
If component A should be protected from changes in component B, then component B should depend on component A.
22%
Flag icon
The Dependency Inversion Principle (DIP) tells us that the most flexible systems are those in which source code dependencies refer only to abstractions, not to concretions.
22%
Flag icon
Source code dependencies should not refer to concrete modules.
22%
Flag icon
It is the volatile concrete elements of our system that we want to avoid depending on.
22%
Flag icon
Every change to an abstract interface corresponds to a change to its concrete implementations.
22%
Flag icon
Conversely, changes to concrete implementations do not always, or even usually, require changes to the interfaces that they implement.
22%
Flag icon
Therefore interfaces are less volatile than i...
This highlight has been truncated due to consecutive passage length restrictions.
23%
Flag icon
Components are the units of deployment. They are the smallest entities that can be deployed as part of a system.
25%
Flag icon
The granule of reuse is the granule of release.
25%
Flag icon
Classes and modules that are grouped together into a component should be releasable together.
25%
Flag icon
Gather into components those classes that change for the same reasons and at the same times. Separate into different components those classes that change at different times and for different reasons.
25%
Flag icon
Just as the SRP says that a class should not contain multiples reasons to change, so the Common Closure Principle (CCP) says that a component should not have multiple reasons to change.
25%
Flag icon
If changes are confined to a single component, then we need to redeploy only the one changed component.
26%
Flag icon
The SRP tells us to separate methods into different classes, if they change for different reasons.
26%
Flag icon
The CCP tells us to separate classes into different components, if they change for different reasons.
26%
Flag icon
Gather together those things that change at the same times and for the same reasons. Separate those things that change at different times or for different reasons.
26%
Flag icon
Don’t force users of a component to depend on things they don’t need.
26%
Flag icon
Don’t depend on things you don’t need.
27%
Flag icon
Allow no cycles in the component dependency graph.
28%
Flag icon
It is always possible to break a cycle of components and reinstate the dependency graph as a DAG.
28%
Flag icon
When cycles occur, they must be broken somehow.
29%
Flag icon
Depend in the direction of stability.
29%
Flag icon
Any component that we expect to be volatile should not be depended on by a component that is difficult to change.
29%
Flag icon
Stability is related to the amount of work required to make a change.
29%
Flag icon
One sure way to make a software component difficult to change, is to make lots of other software components depend on it.
29%
Flag icon
If all the components in a system were maximally stable, the system would be unchangeable.
30%
Flag icon
A component should be as abstract as it is stable.
30%
Flag icon
Thus, if a component is to be stable, it should consist of interfaces and abstract classes so that it can be extended.
30%
Flag icon
The SAP and the SDP combined amount to the DIP for components.
30%
Flag icon
Either a class is abstract or it is not.