E-Book, Englisch, 465 Seiten
Sarcar Design Patterns in C#
1. ed
ISBN: 978-1-4842-3640-6
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
A Hands-on Guide with Real-World Examples
E-Book, Englisch, 465 Seiten
ISBN: 978-1-4842-3640-6
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark
Get hands-on experience with each Gang of Four design pattern using the latest version of C# (Visual Studio Community 2017). For each of the patterns, you'll see at least one real-world scenario, a coding example, and a complete implementation including output.
In the first part of Design Patterns in C#, you will cover the 23 Gang of Four (GoF) design patterns, before moving onto some alternative design patterns, including the Simple Factory Pattern, the Null Object Pattern, and the MVC Pattern. The final part winds up with a conclusion and criticisms of design patterns with chapters on anti-patterns and memory leaks. By working through easy-to-follow examples, you will understand the concepts in depth and have a collection of programs to port over to your own projects.
Along the way, the author discusses the different creational, structural, and behavioral patterns and why such classifications are useful. In each of these chapters, there is a Q&A session that clears up any doubts and covers the pros and cons of each of these patterns.He finishes the book with FAQs that will help you consolidate your knowledge. This book presents the topic of design patterns in C# in such a way that anyone can grasp the idea.
What You Will LearnWork with each of the design patterns
Implement the design patterns in real-world applications
Select an alternative to these patterns by comparing their pros and cons
Use Visual Studio Community Edition 2017 to write code and generate output
Who This Book Is For
Software developers, software testers, and software architects.
Vaskaran Sarcar (ME (Software Engineering), MCA, B Sc. (Math)) is a Senior Software Engineer and Team Lead at HP India PPS R&D Hub Bangalore. He is the author of the books- Java Design Patterns, Interactive Object Oriented Programming in Java, Design Patterns in C#, Operating System: Computer Science Interview Series and C# Basics. He has more than 10 years of teaching and industry experience. He is also a national Gate scholar (2005-2007).
Autoren/Hrsg.
Weitere Infos & Material
1;Table of Contents;5
2;About the Author;19
3;About the Technical Reviewers;20
4;Acknowledgments;21
5;Foreword;22
6;Preface;24
7;Guidelines for Using This Book;26
8;Part I: Gang of Four Design Patterns;28
8.1;I.A: Creational Patterns;29
8.1.1;Chapter 1: Singleton Pattern;31
8.1.1.1;GoF Definition;31
8.1.1.2;Concept;31
8.1.1.3;Real-Life Example;31
8.1.1.4;Computer World Example;31
8.1.1.5;Illustration;32
8.1.1.5.1;Class Diagram;32
8.1.1.5.2;Solution Explorer View;33
8.1.1.5.3;Discussion;33
8.1.1.5.4;Implementation;34
8.1.1.5.5;Output;35
8.1.1.5.6;Challenges;36
8.1.1.6;Q&A Session;37
8.1.2;Chapter 2: Prototype Pattern;42
8.1.2.1;GoF Definition;42
8.1.2.2;Concept;42
8.1.2.3;Real-Life Example;42
8.1.2.4;Computer World Example;42
8.1.2.5;Illustration;43
8.1.2.5.1;Class Diagram;43
8.1.2.5.2;Directed Graph Document;45
8.1.2.5.3;Solution Explorer View;45
8.1.2.5.4;Implementation;47
8.1.2.5.5;Output;49
8.1.2.6;Q&A Session;50
8.1.2.6.1;Demonstration;52
8.1.2.6.2;Output;54
8.1.3;Chapter 3: Builder Pattern;55
8.1.3.1;GoF Definition;55
8.1.3.2;Concept;55
8.1.3.3;Real-Life Example;56
8.1.3.4;Computer World Example;56
8.1.3.5;Illustration;56
8.1.3.5.1;Class Diagram;57
8.1.3.5.2;Solution Explorer View;57
8.1.3.5.3;Implementation;58
8.1.3.5.4;Output;63
8.1.3.6;Q&A Session;63
8.1.4;Chapter 4: Factory Method Pattern;66
8.1.4.1;GoF Definition;66
8.1.4.2;Concept;66
8.1.4.3;Real-Life Example;66
8.1.4.4;Computer World Example;67
8.1.4.5;Illustration;67
8.1.4.5.1;Class Diagram;67
8.1.4.5.2;Directed Graph Document;68
8.1.4.5.3;Solution Explorer View;68
8.1.4.5.4;Implementation;69
8.1.4.5.5;Output;72
8.1.4.5.6;Modified Implementation;72
8.1.4.5.7;Modified Output;74
8.1.4.5.8;Analysis;74
8.1.4.6;Q&A Session;74
8.1.5;Chapter 5: Abstract Factory Pattern;78
8.1.5.1;GoF Definition;78
8.1.5.2;Concept;78
8.1.5.3;Real-Life Example;79
8.1.5.4;Computer World Example;79
8.1.5.5;Illustration;79
8.1.5.5.1;Class Diagram;81
8.1.5.5.2;Solution Explorer View;81
8.1.5.5.3;Implementation;83
8.1.5.5.4;Output;86
8.1.5.6;Q&A Session;87
8.1.5.6.1;Conclusion;90
8.2;I.B: Structural Patterns;91
8.2.1;Chapter 6: Proxy Pattern;93
8.2.1.1;GoF Definition;93
8.2.1.2;Concept;93
8.2.1.3;Real-Life Example;93
8.2.1.4;Computer World Example;93
8.2.1.5;Illustration;94
8.2.1.5.1;Class Diagram;94
8.2.1.5.2;Directed Graph Document;95
8.2.1.5.3;Solution Explorer View;95
8.2.1.5.4;Implementation;96
8.2.1.5.5;Output;98
8.2.1.6;Q&A Session;98
8.2.1.6.1;Modified Implementation;101
8.2.1.6.2;Modified Output;104
8.2.2;Chapter 7: Decorator Pattern;105
8.2.2.1;GoF Definition;105
8.2.2.2;Concept;105
8.2.2.3;Real-Life Example;105
8.2.2.4;Computer World Example;107
8.2.2.5;Illustration;107
8.2.2.5.1;Class Diagram;108
8.2.2.5.2;Solution Explorer View;109
8.2.2.5.3;Implementation;110
8.2.2.5.4;Output;112
8.2.2.6;Q&A Session;113
8.2.3;Chapter 8: Adapter Pattern;119
8.2.3.1;GoF Definition;119
8.2.3.2;Concept;119
8.2.3.3;Real-Life Example;119
8.2.3.4;Computer World Example;120
8.2.3.5;Illustration;121
8.2.3.5.1;Class Diagram;121
8.2.3.5.2;Directed Graph Document;122
8.2.3.5.3;Solution Explorer View;122
8.2.3.5.4;Implementation;124
8.2.3.5.5;Output;125
8.2.3.5.6;Modified Illustration;125
8.2.3.5.7;Key Characteristics of the Modified Implementation;126
8.2.3.5.8;Modified Solution Explorer View;127
8.2.3.5.9;Modified Implementation;128
8.2.3.5.10;Modified Output;131
8.2.3.5.11;Types of Adapters;131
8.2.3.5.11.1;Object Adapters;131
8.2.3.5.11.2;Class Adapters;132
8.2.3.6;Q&A Session;132
8.2.4;Chapter 9: Facade Pattern;134
8.2.4.1;GoF Definition;134
8.2.4.2;Concept;134
8.2.4.3;Real-Life Example;134
8.2.4.4;Computer World Example;134
8.2.4.5;Illustration;135
8.2.4.5.1;Class Diagram;135
8.2.4.5.2;Directed Graph Document;136
8.2.4.5.3;Solution Explorer View;136
8.2.4.5.4;Implementation;137
8.2.4.5.5;Output;141
8.2.4.6;Q&A Session;142
8.2.5;Chapter 10: Flyweight Pattern;144
8.2.5.1;GoF Definition;144
8.2.5.2;Concept;144
8.2.5.3;Real-Life Example;145
8.2.5.4;Computer World Example;145
8.2.5.5;Illustration;145
8.2.5.6;Class Diagram;146
8.2.5.7;Directed Graph Document;147
8.2.5.8;Solution Explorer View;148
8.2.5.9;Implementation;148
8.2.5.10;Output;151
8.2.5.11;Improvements to the Program;152
8.2.5.12;Modified Class Diagram;153
8.2.5.13;Modified Solution Explorer View;154
8.2.5.14;Modified Implementation;154
8.2.5.15;Modified Output;158
8.2.5.16;Q&A Session;159
8.2.6;Chapter 11: Composite Pattern;163
8.2.6.1;GoF Definition;163
8.2.6.2;Concept;163
8.2.6.3;Real-Life Example;164
8.2.6.4;Computer World Example;164
8.2.6.5;Illustration;164
8.2.6.5.1;Class Diagram;166
8.2.6.5.2;Solution Explorer View;167
8.2.6.5.3;Implementation;168
8.2.6.5.4;Output;171
8.2.6.6;Q&A Session;172
8.2.7;Chapter 12: Bridge Pattern;175
8.2.7.1;GoF Definition;175
8.2.7.2;Concept;175
8.2.7.3;Real-Life Example;175
8.2.7.4;Computer World Example;176
8.2.7.5;Illustration;176
8.2.7.5.1;Class Diagram;178
8.2.7.5.2;Solution Explorer View;179
8.2.7.5.3;Implementation;179
8.2.7.5.4;Output;183
8.2.7.6;Q&A Session;183
8.3;I.C: Behavioral Patterns;185
8.3.1;Chapter 13: Visitor Pattern;187
8.3.1.1;GoF Definition;187
8.3.1.2;Concept;187
8.3.1.3;Real-Life Example;187
8.3.1.4;Computer World Example;188
8.3.1.5;Illustration;188
8.3.1.5.1;Class Diagram;189
8.3.1.5.2;Solution Explorer View;190
8.3.1.5.3;Implementation;190
8.3.1.5.4;Output;192
8.3.1.5.5;Modified Illustration;192
8.3.1.5.5.1;Key Characteristics of the Modified Example;193
8.3.1.5.5.2;Step 1;194
8.3.1.5.5.3;Step 2;194
8.3.1.5.5.4;Step 3;195
8.3.1.5.5.5;Step 4;195
8.3.1.5.5.6;Step 5;196
8.3.1.5.6;Modified Solution Explorer View;196
8.3.1.5.7;Modified Implementation;197
8.3.1.5.8;Modified Output;203
8.3.1.6;Q&A Session;204
8.3.2;Chapter 14: Observer Pattern;205
8.3.2.1;GoF Definition;205
8.3.2.2;Concept;205
8.3.2.3;Real-Life Example;208
8.3.2.4;Computer World Example;208
8.3.2.5;Illustration;209
8.3.2.5.1;Class Diagram;209
8.3.2.5.2;Solution Explorer View;210
8.3.2.5.3;Implementation;211
8.3.2.5.4;Output;214
8.3.2.5.5;Analysis of the Output;214
8.3.2.6;Q&A Session;215
8.3.3;Chapter 15: Strategy (Policy) Pattern;219
8.3.3.1;GoF Definition;219
8.3.3.2;Concept;219
8.3.3.3;Real-Life Example;219
8.3.3.4;Computer World Example;219
8.3.3.5;Illustration;220
8.3.3.5.1;Class Diagram;220
8.3.3.6;Directed Graph Document;221
8.3.3.7;Solution Explorer View;222
8.3.3.8;Implementation;223
8.3.3.9;Output;225
8.3.3.10;Q&A Session;226
8.3.4;Chapter 16: Template Method Pattern;231
8.3.4.1;GoF Definition;231
8.3.4.2;Concept;231
8.3.4.3;Real-Life Example;231
8.3.4.4;Computer World Example;232
8.3.4.5;Illustration;232
8.3.4.5.1;Class Diagram;233
8.3.4.5.2;Solution Explorer View;234
8.3.4.5.3;Implementation;234
8.3.4.5.4;Output;237
8.3.4.6;Q&A Session;237
8.3.4.6.1;Modified Implementation;238
8.3.4.6.2;Modified Output;241
8.3.5;Chapter 17: Command Pattern;243
8.3.5.1;GoF Definition;243
8.3.5.2;Concept;243
8.3.5.3;Real-Life Example;243
8.3.5.4;Computer World Example;244
8.3.5.5;Illustration;244
8.3.5.5.1;Class Diagram;245
8.3.5.5.2;Directed Graph Document;246
8.3.5.5.3;Solution Explorer View;247
8.3.5.5.4;Implementation;248
8.3.5.5.5;Output;251
8.3.5.6;Q&A Session;251
8.3.5.6.1;Modified Class Diagram;252
8.3.5.6.2;Modified Solution Explorer View;253
8.3.5.6.3;Modified Implementation;254
8.3.5.6.4;Modified Output;260
8.3.6;Chapter 18: Iterator Pattern;263
8.3.6.1;GoF Definition;263
8.3.6.2;Concept;263
8.3.6.3;Real-Life Example;264
8.3.6.4;Computer World Example;264
8.3.6.5;Illustration;264
8.3.6.6;Class Diagram;265
8.3.6.7;Directed Graph Document;266
8.3.6.8;Solution Explorer View;267
8.3.6.9;Implementation;268
8.3.6.10;Output;273
8.3.6.11;Q&A Session;273
8.3.7;Chapter 19: Memento Pattern;276
8.3.7.1;GoF Definition;276
8.3.7.2;Concept;276
8.3.7.3;Real-Life Example;276
8.3.7.4;Computer World Example;276
8.3.7.5;Illustration;277
8.3.7.5.1;Class Diagram;277
8.3.7.5.2;Directed Graph Document;278
8.3.7.5.3;Solution Explorer View;279
8.3.7.5.4;Implementation;279
8.3.7.5.5;Output;283
8.3.7.6;Q&A Session;283
8.3.7.6.1;Modified Implementation;283
8.3.7.6.2;Modified Output;285
8.3.8;Chapter 20: State Pattern;288
8.3.8.1;GoF Definition;288
8.3.8.2;Concept;288
8.3.8.3;Real-Life Example;288
8.3.8.4;Computer World Example;289
8.3.8.5;Illustration;289
8.3.8.5.1;Class Diagram;290
8.3.8.5.2;Directed Graph Document;291
8.3.8.5.3;Solution Explorer View;291
8.3.8.5.4;Implementation;293
8.3.8.5.5;Output;298
8.3.8.6;Q&A Session;298
8.3.9;Chapter 21: Mediator Pattern;302
8.3.9.1;GoF Definition;302
8.3.9.2;Concept;302
8.3.9.3;Real-Life Example;302
8.3.9.4;Computer World Example;303
8.3.9.5;Illustration;303
8.3.9.5.1;Class Diagram;305
8.3.9.5.2;Solution Explorer View;305
8.3.9.5.3;Implementation;307
8.3.9.5.4;Output;311
8.3.9.5.5;Analysis;311
8.3.9.6;Q&A Session;312
8.3.9.6.1;Modified Illustration;313
8.3.9.6.2;Modified Implementation;313
8.3.9.6.3;Modified Output;318
8.3.10;Chapter 22: Chain of Responsibility Pattern;322
8.3.10.1;GoF Definition;322
8.3.10.2;Concept;322
8.3.10.3;Real-Life Example;323
8.3.10.4;Computer World Example;323
8.3.10.5;Illustration;324
8.3.10.5.1;Class Diagram;325
8.3.10.5.2;Directed Graph Document;326
8.3.10.5.3;Solution Explorer View;326
8.3.10.5.4;Implementation;327
8.3.10.5.5;Output;331
8.3.10.6;Q&A Session;331
8.3.11;Chapter 23: Interpreter Pattern;334
8.3.11.1;GoF Definition;334
8.3.11.2;Concept;334
8.3.11.3;Real-Life Example;334
8.3.11.4;Computer World Example;334
8.3.11.5;Illustration;335
8.3.11.5.1;Class Diagram;335
8.3.11.5.2;Solution Explorer View;337
8.3.11.5.3;Implementation;337
8.3.11.5.4;Output;344
8.3.11.6;Q&A Session;345
9;Part II: Additional Design Patterns;346
9.1;Chapter 24: Simple Factory Pattern;347
9.1.1;Definition;347
9.1.2;Concept;347
9.1.3;Real-Life Example;347
9.1.4;Computer World Example;348
9.1.5;Illustration;348
9.1.5.1;Class Diagram;349
9.1.5.2;Directed Graph Document;350
9.1.5.3;Solution Explorer View;350
9.1.5.4;Implementation;351
9.1.5.5;Output;354
9.1.6;Q&A Session;355
9.2;Chapter 25: Null Object Pattern;358
9.2.1;Definition;358
9.2.2;Concept;358
9.2.2.1;A Faulty Program;359
9.2.2.2;Output with Valid Inputs;361
9.2.2.3;Analysis with Unwanted Input;361
9.2.2.4;Encountered Exception;362
9.2.2.5;Immediate Remedy;362
9.2.2.6;Analysis;362
9.2.3;Real-Life Example;363
9.2.4;Computer World Example;363
9.2.5;Illustration;363
9.2.5.1;Class Diagram;364
9.2.5.2;Solution Explorer View;365
9.2.5.3;Implementation;366
9.2.5.4;Output;369
9.2.6;Q&A Session;370
9.3;Chapter 26: MVC Pattern;372
9.3.1;Definition;372
9.3.2;Concept;372
9.3.2.1;Key Points to Remember;373
9.3.2.2;Variation 1;374
9.3.2.3;Variation 2;375
9.3.2.4;Variation 3;375
9.3.3;Real-Life Example;376
9.3.4;Computer World Example;376
9.3.5;Illustration;377
9.3.5.1;Class Diagram;379
9.3.5.2;Solution Explorer View;379
9.3.5.3;Implementation;380
9.3.5.4;Output;390
9.3.6;Q&A Session;394
10;Part III: Final Thoughts on Design Patterns;399
10.1;Chapter 27: Criticisms of Design Patterns;400
10.1.1;Q&A Session;402
10.2;Chapter 28: Anti-patterns;405
10.2.1;What Is an Anti-pattern?;405
10.2.2;Q&A Session;406
10.3;Chapter 29: Sealing the Leaks in Your Applications;410
10.3.1;How Garbage Collection Works;411
10.3.2;Demonstration 1;413
10.3.2.1;Output;416
10.3.2.2;Analysis;417
10.3.3;Q&A Session 1;418
10.3.3.1;Quiz;426
10.3.3.2;Quiz;428
10.3.3.3;Quiz;430
10.3.3.4;Quiz;431
10.3.4;Understanding Memory Leaks;432
10.3.5;Demonstration 2;433
10.3.5.1;Snapshots;435
10.3.5.2;Analysis;436
10.3.5.3;Modified Code;437
10.3.5.4;Snapshots;440
10.3.5.5;Analysis;441
10.3.6;Q&A Session 2;443
10.4;Chapter 30: FAQ;446
11;Appendix A: Brief Overview of GoF Design Patterns;451
11.1;Key Points;452
11.2;Q&A Session;455
12;Appendix B: Some Useful Resources;457
13;Appendix C: The Road Ahead;458
14;Index;459




