Home > Work > Clean Architecture
41 " It is the volatile concrete elements of our system that we want to avoid depending on. Those are the modules that we are actively developing, and that are undergoing frequent change. "
― Robert C. Martin , Clean Architecture
42 " Architecture is the decisions that you wish you could get right early in a project, but that you are not necessarily more likely to get them right than any other. —Ralph Johnson "
43 " OO imposes discipline on indirect transfer of control. "
44 " Don’t refer to volatile concrete classes. Refer to abstract interfaces instead. This rule applies in all languages, whether statically or dynamically typed. It also puts severe constraints on the creation of objects and generally enforces the use of Abstract Factories. "
45 " Don’t derive from volatile concrete classes. This is a corollary to the previous rule, but it bears special mention. In statically typed languages, inheritance is the strongest, and most rigid, of all the source code relationships; consequently, it should be used with great care. In dynamically typed languages, inheritance is less of a problem, but it is still a dependency—and caution is always the wisest choice. "
46 " A good architecture comes from understanding it more as a journey than as a destination, more as an ongoing process of enquiry than as a frozen artifact. "
47 " Don’t override concrete functions. Concrete functions often require source code dependencies. When you override those functions, you do not eliminate those dependencies—indeed, you inherit them. To manage those dependencies, you should make the function abstract and create multiple implementations. "
48 " Architecture is a hypothesis, that needs to be proven by implementation and measurement. —Tom Gilb "
49 " Variables in functional languages do not vary. "
50 " Never mention the name of anything concrete and volatile. This is really just a restatement of the principle itself. "
51 " All race conditions, deadlock conditions, and concurrent update problems are due to mutable variables. You cannot have a race condition or a concurrent update problem if no variable is ever updated. You cannot have deadlocks without mutable locks. "
52 " The fact that OO languages provide safe and convenient polymorphism means that any source code dependency, no matter where it is, can be inverted. "
53 " This means that the UI and the database can be plugins to the business rules. It means that the source code of the business rules never mentions the UI or the database. "
54 " In Clojure, an atom is a special kind of variable whose value is allowed to mutate under very disciplined conditions that are enforced by the swap! function. "
55 " To comply with these rules, the creation of volatile concrete objects requires special handling. This caution is warranted because, in virtually all languages, the creation of an object requires a source code dependency on the concrete definition of that object. In most object-oriented languages, such as Java, we would use an Abstract Factory to manage this undesirable dependency. "
56 " To the software architect, however, the answer is clear: OO is the ability, through the use of polymorphism, to gain absolute control over every source code dependency in the system. It allows the architect to create a plugin architecture, in which modules that contain high-level policies are independent of modules that contain low-level details. The low-level details are relegated to plugin modules that can be deployed and developed independently from the modules that contain high-level policies. "
57 " 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. "
58 " Structured programming is discipline imposed upon direct transfer of control. "
59 " Object-oriented programming is discipline imposed upon indirect transfer of control. "
60 " Functional programming is discipline imposed upon variable assignment. "