|
12 | 12 | * [Chapter 9 - Unit Tests](#chapter9)
|
13 | 13 | * [Chapter 10 - Classes](#chapter10)
|
14 | 14 | * [Chapter 11 - Systems](#chapter11)
|
| 15 | +* [Chapter 12 - Systems](#chapter12) |
| 16 | +* [Chapter 13 - Concurrency](#chapter13) |
| 17 | +* [Chapter 14 - Successive Refinement](#chapter14) |
| 18 | +* [Chapter 15 - JUnit Internals](#chapter15) |
| 19 | +* [Chapter 16 - Refactoring SerialDate](#chapter15) |
15 | 20 |
|
16 | 21 |
|
17 | 22 | <a name="chapter1">
|
@@ -1103,4 +1108,61 @@ The Abstract Factory Pattern is an option for this kind of approach.
|
1103 | 1108 |
|
1104 | 1109 | ### Dependency Injection
|
1105 | 1110 |
|
1106 |
| -A powerful mechanism for separating construction from use is Dependency Injection (DI), the application of Inversion of control (IoC) to dependency management. Inversion of control moves secondary responsibilities from an object to other objects that are dedicated to the purpose, thereby supporting the Single Responsibility Principle. In context of dependency management, an object should not take responsibility for instantiating dependencies itself. Instead, it, should pass this responsibility to another "authoritative" mechanism, thereby inverting the control. Because setup is a global concern, this authoritative mechanism will usually be either the "main" routine or a special-purpose *container*. |
| 1111 | +A powerful mechanism for separating construction from use is Dependency Injection (DI), the application of Inversion of control (IoC) to dependency management. Inversion of control moves secondary responsibilities from an object to other objects that are dedicated to the purpose, thereby supporting the Single Responsibility Principle. In context of dependency management, an object should not take responsibility for instantiating dependencies itself. Instead, it, should pass this responsibility to another "authoritative" mechanism, thereby inverting the control. Because setup is a global concern, this authoritative mechanism will usually be either the "main" |
| 1112 | +routine or a special-purpose *container*. |
| 1113 | + |
| 1114 | +<a name="chapter12"> |
| 1115 | +<h1>Chapter 12 - Emergence</h1> |
| 1116 | +</a> |
| 1117 | + |
| 1118 | +According to Kent Beck, a design is "simple" if it follows these rules |
| 1119 | + |
| 1120 | +- Run all tests |
| 1121 | +- Contains no duplication |
| 1122 | +- Expresses the intent of programmers |
| 1123 | +- Minimizes the number of classes and methods |
| 1124 | + |
| 1125 | + |
| 1126 | +<a name="chapter13"> |
| 1127 | +<h1>Chapter 13 - Concurrency</h1> |
| 1128 | +</a> |
| 1129 | + |
| 1130 | +Concurrence is a decoupling strategy. It helps us decouple what gets fone from when it gets done. In single-threaded applications what and when are so strongly coupled that the state of the entire application can often be determined by looking at the stack backtrace. A programmer who debugs such a system can set a breakpoint, or a sequence of breakpoints, and know the state of the system by which breakpoints are hit. |
| 1131 | + |
| 1132 | +Decoupling what from when can dramatically improve both the throughput and structures of an application. From a structural point of view the application looks like many lit- tle collaborating computers rather than one big main loop. This can make the system easier to understand and offers some powerful ways to separate concerns. |
| 1133 | + |
| 1134 | +## Miths and Misconceptions |
| 1135 | +- Concurrency always improves performance. |
| 1136 | +Concurrency can sometimes improve performance, but only when there is a lot of wait time that can be shared between multiple threads or multiple processors. Neither situ- ation is trivial. |
| 1137 | +- Design does not change when writing concurrent programs. |
| 1138 | +In fact, the design of a concurrent algorithm can be remarkably different from the design of a single-threaded system. The decoupling of what from when usually has a huge effect on the structure of the system. |
| 1139 | +- Understanding concurrency issues is not important when working with a container such as a Web or EJB container. |
| 1140 | +In fact, you’d better know just what your container is doing and how to guard against the issues of concurrent update and deadlock described later in this chapter. |
| 1141 | +Here are a few more balanced sound bites regarding writing concurrent software: |
| 1142 | +- Concurrency incurs some overhead, both in performance as well as writing additional code. |
| 1143 | +- Correct concurrency is complex, even for simple problems. |
| 1144 | +- Concurrency bugs aren’t usually repeatable, so they are often ignored as one-offs instead of the true defects they are. |
| 1145 | +- Concurrency often requires a fundamental change in design strategy. |
| 1146 | + |
| 1147 | +# |
| 1148 | +<a name="chapter14"> |
| 1149 | +<h1>Chapter 14 - Successive Refinement</h1> |
| 1150 | +</a> |
| 1151 | +This chapter is a study case. It's recommendable to completely read it to understand more. |
| 1152 | + |
| 1153 | + |
| 1154 | +<a name="chapter15"> |
| 1155 | +<h1>Chapter 15 - JUnit Internals</h1> |
| 1156 | +</a> |
| 1157 | +This chapter analize the JUnit tool. It's recommendable to completely read it to understand more. |
| 1158 | + |
| 1159 | + |
| 1160 | +<a name="chapter16"> |
| 1161 | +<h1>Chapter 16 - Refactoring SerialDate</h1> |
| 1162 | +</a> |
| 1163 | +This chapter is a study case. It's recommendable to completely read it to understand more. |
| 1164 | + |
| 1165 | +<a name="chapter17"> |
| 1166 | +<h1>Chapter 17 - Smells and Heuristics</h1> |
| 1167 | +</a> |
| 1168 | +This chapter can be considered like a recap of the previous chapters. It has a list of good practices about all the elements of the clean code mentioned in the book. |
0 commit comments