Skip to content

Commit 18362e7

Browse files
committed
Finish ch11 notes
1 parent 230607e commit 18362e7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

clean-code/notes.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,39 @@ Readability is perhaps even more important in unit tests than it is in productio
290290
> **Dependency Inversion Principle (DIP)** -> classes should depend upon abstractions, not on concrete details
291291
292292
# Ch11. Systems
293+
## Separate constructing a system from using it
294+
> Software systems should separate the startup process, when the application objects are constructed and the dependencies are "wired" together, from the runtime logic that takes over after startup
295+
296+
- Startup process: *concern* that any application must address
297+
- *Separation of concerns*: one of the most important design techniques
298+
- Never let little, convenient idioms lead to modularity breakdown
299+
300+
## Separation of main
301+
### Factories
302+
- **ABSTRACT FACTORY**: pattern -> give the application control of *when* to build the object, but keep the details of that construction separate from the application code
303+
304+
### Dependency injection (DI)
305+
- Powerful mechanism for separating construction from use
306+
- Application of *Inversion of Control* (IoC) to dependency management
307+
- Moves secondary responsibilities from an object to other objects that are dedicated to the purpose (supporting SRP)
308+
- The invoking object doesn't control what kind of object is actually returned, but the invoking object still actively resolves the dependency
309+
> An object should not take responsibility for instantiating dependencies itself. Instead, it should pass this responsibility to another "authoritative" mechanism (inverting control). Setup is a global concern, this authoritative mechanism will be either the "main" routine or a special-purpose container
310+
311+
## Scaling up
312+
- **Myth**: we can get systems "right the first time"
313+
- Implement only today's stories -> then refactor and expand the system to implement new stories tomorrow = essence of iterative and incremental agility
314+
- TDD, refactoring, and the clean code they produce make this work at the code level
315+
- Software systems are unique compared to physical systems. Their archiectures can grow incrementally, **if we maintain the proper separation of concerns**
316+
317+
## Test drive the system architecture
318+
- **Big Design Up Front (BDUF)**: harmful because it inhibits adapting to change, due to psychological resistance to discarding prior effort and because of the way architecture choices influence subsequent thinking about the design
319+
320+
## Optimize decision making
321+
- Modularity and separation of concerns make decentralized management and decision making possible
322+
- Give responsibilities to the most qualified persons
323+
- **It is best to postpone decisions until the last possible moment** -> lets us make informed choices with the best possible information. A premature decision is a decision made with suboptimal knowledge
324+
325+
> Whether you are designing systems or individual modules, never forget to use **the simplest thing that can possibly work**
293326
294327
# Ch12. Emergence
295328

0 commit comments

Comments
 (0)