You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clean-code/notes.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -290,6 +290,39 @@ Readability is perhaps even more important in unit tests than it is in productio
290
290
> **Dependency Inversion Principle (DIP)** -> classes should depend upon abstractions, not on concrete details
291
291
292
292
# 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**
0 commit comments