About the Author |
|
xv | |
About the Technical Reviewer |
|
xvii | |
Introduction |
|
xix | |
|
|
1 | (34) |
|
Chapter 1 The SOLID Design Principles |
|
|
3 | (22) |
|
Single Responsibility Principle |
|
|
3 | (3) |
|
|
6 | (7) |
|
Liskov Substitution Principle |
|
|
13 | (2) |
|
Interface Segregation Principle |
|
|
15 | (6) |
|
|
20 | (1) |
|
Dependency Inversion Principle |
|
|
21 | (4) |
|
Chapter 2 The Functional Perspective |
|
|
25 | (10) |
|
|
25 | (2) |
|
Functional Literals in C# |
|
|
27 | (1) |
|
|
28 | (2) |
|
Functional Literals in F# |
|
|
30 | (2) |
|
|
32 | (1) |
|
Functional-Related Language Features |
|
|
33 | (2) |
|
Part II Creational Patterns |
|
|
35 | (96) |
|
|
37 | (36) |
|
|
37 | (3) |
|
|
40 | (1) |
|
|
41 | (1) |
|
|
41 | (1) |
|
|
42 | (2) |
|
Nested Builder and Immutability |
|
|
44 | (1) |
|
|
45 | (4) |
|
Builder Marker Interfaces |
|
|
49 | (2) |
|
Stepwise Builder (Wizard) |
|
|
51 | (5) |
|
|
56 | (2) |
|
Builder Extension with Recursive Generics |
|
|
58 | (4) |
|
|
62 | (3) |
|
|
65 | (3) |
|
|
68 | (1) |
|
|
69 | (1) |
|
|
70 | (3) |
|
|
73 | (20) |
|
|
73 | (2) |
|
|
75 | (1) |
|
Asynchronous Factory Method |
|
|
76 | (1) |
|
|
77 | (1) |
|
|
78 | (1) |
|
|
79 | (1) |
|
|
79 | (4) |
|
Delegate Factories in IoC |
|
|
83 | (2) |
|
Object Tracking and Bulk Replacements |
|
|
85 | (5) |
|
|
85 | (2) |
|
|
87 | (3) |
|
|
90 | (1) |
|
|
91 | (2) |
|
|
93 | (20) |
|
|
93 | (1) |
|
|
94 | (2) |
|
Deep Copying via Copy Construction |
|
|
96 | (1) |
|
|
97 | (1) |
|
Deep Copying with a Special Interface |
|
|
97 | (5) |
|
Deep Copying and Inheritance |
|
|
98 | (4) |
|
|
102 | (4) |
|
|
103 | (1) |
|
|
103 | (1) |
|
|
104 | (1) |
|
MemberwiseClone Is Not Terrible |
|
|
105 | (1) |
|
|
106 | (1) |
|
|
107 | (2) |
|
|
109 | (1) |
|
|
110 | (1) |
|
|
111 | (2) |
|
|
113 | (18) |
|
|
113 | (1) |
|
|
114 | (3) |
|
Lazy Loading and Thread Safety |
|
|
115 | (1) |
|
|
116 | (1) |
|
The Trouble with Singleton |
|
|
117 | (4) |
|
|
121 | (1) |
|
|
122 | (5) |
|
Uses in the NET Framework |
|
|
126 | (1) |
|
Singletons and Inversion of Control |
|
|
127 | (1) |
|
|
128 | (1) |
|
|
129 | (1) |
|
|
130 | (1) |
|
Part III Structural Patterns |
|
|
131 | (128) |
|
|
133 | (26) |
|
|
133 | (2) |
|
|
135 | (1) |
|
|
136 | (4) |
|
|
140 | (2) |
|
Property Adapter (Surrogate) |
|
|
142 | (2) |
|
|
144 | (8) |
|
Adapter in Dependency Injection |
|
|
152 | (3) |
|
|
155 | (1) |
|
Adapters in the NET Framework |
|
|
156 | (1) |
|
|
157 | (2) |
|
|
159 | (8) |
|
|
159 | (4) |
|
Dynamic Prototyping Bridge |
|
|
163 | (3) |
|
|
166 | (1) |
|
|
167 | (12) |
|
|
167 | (3) |
|
|
170 | (3) |
|
Shrink Wrapping the Composite |
|
|
173 | (2) |
|
|
175 | (3) |
|
|
178 | (1) |
|
|
179 | (26) |
|
|
180 | (2) |
|
|
182 | (3) |
|
|
185 | (1) |
|
Simulating Multiple Inheritance |
|
|
185 | (1) |
|
Multiple Inheritance with Interfaces |
|
|
186 | (3) |
|
Multiple Inheritance with Default Interface Members |
|
|
189 | (2) |
|
Dynamic Decorator Composition |
|
|
191 | (3) |
|
|
194 | (6) |
|
Static Decorator Composition |
|
|
200 | (1) |
|
|
201 | (1) |
|
|
202 | (3) |
|
|
205 | (14) |
|
|
206 | (5) |
|
Building a Trading Terminal |
|
|
211 | (1) |
|
|
212 | (2) |
|
|
214 | (2) |
|
|
216 | (2) |
|
|
218 | (1) |
|
|
219 | (8) |
|
|
219 | (3) |
|
|
222 | (3) |
|
Using Flyweights for Interop |
|
|
225 | (1) |
|
|
226 | (1) |
|
|
227 | (24) |
|
|
227 | (2) |
|
|
229 | (3) |
|
|
232 | (3) |
|
Composite Proxy with Array-Backed Properties |
|
|
235 | (2) |
|
|
237 | (3) |
|
|
240 | (2) |
|
Dynamic Proxy for Logging |
|
|
242 | (3) |
|
|
245 | (3) |
|
|
248 | (3) |
|
|
251 | (8) |
|
|
252 | (1) |
|
|
253 | (2) |
|
|
255 | (2) |
|
|
257 | (2) |
|
Part IV Behavioral Patterns |
|
|
259 | (198) |
|
Chapter 15 Chain of Responsibility |
|
|
261 | (12) |
|
|
261 | (1) |
|
|
262 | (3) |
|
|
265 | (5) |
|
Functional Chain of Responsibility |
|
|
270 | (1) |
|
|
271 | (2) |
|
|
273 | (14) |
|
|
273 | (1) |
|
Implementing the Command Pattern |
|
|
274 | (2) |
|
|
276 | (3) |
|
Composite Commands (aka Macros) |
|
|
279 | (4) |
|
|
283 | (2) |
|
Queries and Command-Query Separation |
|
|
285 | (1) |
|
|
285 | (2) |
|
|
287 | (18) |
|
|
288 | (1) |
|
Numeric Expression Evaluator |
|
|
289 | (7) |
|
|
290 | (2) |
|
|
292 | (4) |
|
|
296 | (1) |
|
Interpretation in the Functional Paradigm |
|
|
296 | (4) |
|
|
300 | (2) |
|
|
302 | (3) |
|
|
305 | (16) |
|
|
306 | (3) |
|
|
309 | (3) |
|
|
312 | (2) |
|
|
314 | (1) |
|
|
315 | (2) |
|
|
317 | (2) |
|
|
319 | (2) |
|
|
321 | (14) |
|
|
321 | (5) |
|
|
326 | (4) |
|
|
330 | (2) |
|
|
332 | (1) |
|
|
333 | (2) |
|
|
335 | (8) |
|
|
335 | (2) |
|
|
337 | (3) |
|
|
340 | (1) |
|
|
341 | (2) |
|
|
343 | (10) |
|
|
343 | (2) |
|
|
345 | (2) |
|
|
346 | (1) |
|
|
347 | (1) |
|
|
348 | (1) |
|
|
349 | (2) |
|
|
350 | (1) |
|
|
351 | (2) |
|
|
353 | (30) |
|
|
353 | (2) |
|
|
355 | (2) |
|
|
357 | (4) |
|
|
361 | (16) |
|
Basic Change Notification |
|
|
361 | (2) |
|
|
363 | (3) |
|
|
366 | (6) |
|
|
372 | (2) |
|
Case Study: Quadratic Equation Solver |
|
|
374 | (2) |
|
Circular Recalculation Limitations |
|
|
376 | (1) |
|
|
377 | (1) |
|
|
378 | (1) |
|
Declarative Subscriptions in Autofac |
|
|
378 | (4) |
|
|
382 | (1) |
|
|
383 | (18) |
|
State-Driven State Transitions |
|
|
384 | (3) |
|
|
387 | (3) |
|
Switch-Based State Machine |
|
|
390 | (2) |
|
Encoding Transitions with Switch Expressions |
|
|
392 | (2) |
|
State Machines with Stateless |
|
|
394 | (4) |
|
Types, Actions, and Ignoring Transitions |
|
|
395 | (1) |
|
|
396 | (1) |
|
|
397 | (1) |
|
|
397 | (1) |
|
Concurrent State Machines |
|
|
398 | (1) |
|
|
399 | (1) |
|
|
399 | (2) |
|
|
401 | (10) |
|
|
401 | (3) |
|
|
404 | (2) |
|
Equality and Comparison Strategies |
|
|
406 | (2) |
|
|
408 | (1) |
|
|
409 | (1) |
|
|
410 | (1) |
|
Chapter 25 Template Method |
|
|
411 | (6) |
|
|
411 | (2) |
|
|
413 | (2) |
|
Functional Template Method |
|
|
415 | (1) |
|
|
416 | (1) |
|
|
417 | (40) |
|
|
418 | (1) |
|
|
419 | (9) |
|
|
422 | (2) |
|
Functional Reflective Visitor (C#) |
|
|
424 | (2) |
|
Functional Reflective Visitor (F#) |
|
|
426 | (1) |
|
|
427 | (1) |
|
|
428 | (2) |
|
|
430 | (2) |
|
|
432 | (7) |
|
Abstract Classes and Virtual Methods |
|
|
435 | (2) |
|
|
437 | (1) |
|
Implementing an Additional Visitor |
|
|
437 | (2) |
|
Type Checks Are Unavoidable |
|
|
439 | (2) |
|
|
441 | (2) |
|
|
443 | (4) |
|
|
447 | (3) |
|
Reductions and Transforms |
|
|
450 | (4) |
|
|
454 | (1) |
|
|
455 | (2) |
Index |
|
457 | |