Design Patterns in C# - Vaskaran Sarcar

Design Patterns in C# (eBook)

A Hands-on Guide with Real-World Examples

(Autor)

eBook Download: PDF
2018 | 1st ed.
XXX, 455 Seiten
Apress (Verlag)
978-1-4842-3640-6 (ISBN)
Systemvoraussetzungen
52,99 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
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 Learn
  • Work 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).
Get hands-on experience with each Gang of Four design pattern using C#. 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 patternsImplement the design patterns in real-world applicationsSelect an alternative to these patterns by comparing their pros and consUse Visual Studio Community Edition 2017 to write code and generate outputWho This Book Is ForSoftware 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).    

Table of Contents 5
About the Author 19
About the Technical Reviewers 20
Acknowledgments 21
Foreword 22
Preface 24
Guidelines for Using This Book 26
Part I: Gang of Four Design Patterns 28
I.A: Creational Patterns 29
Chapter 1: Singleton Pattern 31
GoF Definition 31
Concept 31
Real-Life Example 31
Computer World Example 31
Illustration 32
Class Diagram 32
Solution Explorer View 33
Discussion 33
Implementation 34
Output 35
Challenges 36
Q& A Session
Chapter 2: Prototype Pattern 42
GoF Definition 42
Concept 42
Real-Life Example 42
Computer World Example 42
Illustration 43
Class Diagram 43
Directed Graph Document 45
Solution Explorer View 45
Implementation 47
Output 49
Q& A Session
Demonstration 52
Output 54
Chapter 3: Builder Pattern 55
GoF Definition 55
Concept 55
Real-Life Example 56
Computer World Example 56
Illustration 56
Class Diagram 57
Solution Explorer View 57
Implementation 58
Output 63
Q& A Session
Chapter 4: Factory Method Pattern 66
GoF Definition 66
Concept 66
Real-Life Example 66
Computer World Example 67
Illustration 67
Class Diagram 67
Directed Graph Document 68
Solution Explorer View 68
Implementation 69
Output 72
Modified Implementation 72
Modified Output 74
Analysis 74
Q& A Session
Chapter 5: Abstract Factory Pattern 78
GoF Definition 78
Concept 78
Real-Life Example 79
Computer World Example 79
Illustration 79
Class Diagram 81
Solution Explorer View 81
Implementation 83
Output 86
Q& A Session
Conclusion 90
I.B: Structural Patterns 91
Chapter 6: Proxy Pattern 93
GoF Definition 93
Concept 93
Real-Life Example 93
Computer World Example 93
Illustration 94
Class Diagram 94
Directed Graph Document 95
Solution Explorer View 95
Implementation 96
Output 98
Q& A Session
Modified Implementation 101
Modified Output 104
Chapter 7: Decorator Pattern 105
GoF Definition 105
Concept 105
Real-Life Example 105
Computer World Example 107
Illustration 107
Class Diagram 108
Solution Explorer View 109
Implementation 110
Output 112
Q& A Session
Chapter 8: Adapter Pattern 119
GoF Definition 119
Concept 119
Real-Life Example 119
Computer World Example 120
Illustration 121
Class Diagram 121
Directed Graph Document 122
Solution Explorer View 122
Implementation 124
Output 125
Modified Illustration 125
Key Characteristics of the Modified Implementation 126
Modified Solution Explorer View 127
Modified Implementation 128
Modified Output 131
Types of Adapters 131
Object Adapters 131
Class Adapters 132
Q& A Session
Chapter 9: Facade Pattern 134
GoF Definition 134
Concept 134
Real-Life Example 134
Computer World Example 134
Illustration 135
Class Diagram 135
Directed Graph Document 136
Solution Explorer View 136
Implementation 137
Output 141
Q& A Session
Chapter 10: Flyweight Pattern 144
GoF Definition 144
Concept 144
Real-Life Example 145
Computer World Example 145
Illustration 145
Class Diagram 146
Directed Graph Document 147
Solution Explorer View 148
Implementation 148
Output 151
Improvements to the Program 152
Modified Class Diagram 153
Modified Solution Explorer View 154
Modified Implementation 154
Modified Output 158
Q& A Session
Chapter 11: Composite Pattern 163
GoF Definition 163
Concept 163
Real-Life Example 164
Computer World Example 164
Illustration 164
Class Diagram 166
Solution Explorer View 167
Implementation 168
Output 171
Q& A Session
Chapter 12: Bridge Pattern 175
GoF Definition 175
Concept 175
Real-Life Example 175
Computer World Example 176
Illustration 176
Class Diagram 178
Solution Explorer View 179
Implementation 179
Output 183
Q& A Session
I.C: Behavioral Patterns 185
Chapter 13: Visitor Pattern 187
GoF Definition 187
Concept 187
Real-Life Example 187
Computer World Example 188
Illustration 188
Class Diagram 189
Solution Explorer View 190
Implementation 190
Output 192
Modified Illustration 192
Key Characteristics of the Modified Example 193
Step 1 194
Step 2 194
Step 3 195
Step 4 195
Step 5 196
Modified Solution Explorer View 196
Modified Implementation 197
Modified Output 203
Q& A Session
Chapter 14: Observer Pattern 205
GoF Definition 205
Concept 205
Real-Life Example 208
Computer World Example 208
Illustration 209
Class Diagram 209
Solution Explorer View 210
Implementation 211
Output 214
Analysis of the Output 214
Q& A Session
Chapter 15: Strategy (Policy) Pattern 219
GoF Definition 219
Concept 219
Real-Life Example 219
Computer World Example 219
Illustration 220
Class Diagram 220
Directed Graph Document 221
Solution Explorer View 222
Implementation 223
Output 225
Q& A Session
Chapter 16: Template Method Pattern 231
GoF Definition 231
Concept 231
Real-Life Example 231
Computer World Example 232
Illustration 232
Class Diagram 233
Solution Explorer View 234
Implementation 234
Output 237
Q& A Session
Modified Implementation 238
Modified Output 241
Chapter 17: Command Pattern 243
GoF Definition 243
Concept 243
Real-Life Example 243
Computer World Example 244
Illustration 244
Class Diagram 245
Directed Graph Document 246
Solution Explorer View 247
Implementation 248
Output 251
Q& A Session
Modified Class Diagram 252
Modified Solution Explorer View 253
Modified Implementation 254
Modified Output 260
Chapter 18: Iterator Pattern 263
GoF Definition 263
Concept 263
Real-Life Example 264
Computer World Example 264
Illustration 264
Class Diagram 265
Directed Graph Document 266
Solution Explorer View 267
Implementation 268
Output 273
Q& A Session
Chapter 19: Memento Pattern 276
GoF Definition 276
Concept 276
Real-Life Example 276
Computer World Example 276
Illustration 277
Class Diagram 277
Directed Graph Document 278
Solution Explorer View 279
Implementation 279
Output 283
Q& A Session
Modified Implementation 283
Modified Output 285
Chapter 20: State Pattern 288
GoF Definition 288
Concept 288
Real-Life Example 288
Computer World Example 289
Illustration 289
Class Diagram 290
Directed Graph Document 291
Solution Explorer View 291
Implementation 293
Output 298
Q& A Session
Chapter 21: Mediator Pattern 302
GoF Definition 302
Concept 302
Real-Life Example 302
Computer World Example 303
Illustration 303
Class Diagram 305
Solution Explorer View 305
Implementation 307
Output 311
Analysis 311
Q& A Session
Modified Illustration 313
Modified Implementation 313
Modified Output 318
Chapter 22: Chain of Responsibility Pattern 322
GoF Definition 322
Concept 322
Real-Life Example 323
Computer World Example 323
Illustration 324
Class Diagram 325
Directed Graph Document 326
Solution Explorer View 326
Implementation 327
Output 331
Q& A Session
Chapter 23: Interpreter Pattern 334
GoF Definition 334
Concept 334
Real-Life Example 334
Computer World Example 334
Illustration 335
Class Diagram 335
Solution Explorer View 337
Implementation 337
Output 344
Q& A Session
Part II: Additional Design Patterns 346
Chapter 24: Simple Factory Pattern 347
Definition 347
Concept 347
Real-Life Example 347
Computer World Example 348
Illustration 348
Class Diagram 349
Directed Graph Document 350
Solution Explorer View 350
Implementation 351
Output 354
Q& A Session
Chapter 25: Null Object Pattern 358
Definition 358
Concept 358
A Faulty Program 359
Output with Valid Inputs 361
Analysis with Unwanted Input 361
Encountered Exception 362
Immediate Remedy 362
Analysis 362
Real-Life Example 363
Computer World Example 363
Illustration 363
Class Diagram 364
Solution Explorer View 365
Implementation 366
Output 369
Q& A Session
Chapter 26: MVC Pattern 372
Definition 372
Concept 372
Key Points to Remember 373
Variation 1 374
Variation 2 375
Variation 3 375
Real-Life Example 376
Computer World Example 376
Illustration 377
Class Diagram 379
Solution Explorer View 379
Implementation 380
Output 390
Q& A Session
Part III: Final Thoughts on Design Patterns 399
Chapter 27: Criticisms of Design Patterns 400
Q& A Session
Chapter 28: Anti-patterns 405
What Is an Anti-pattern? 405
Q& A Session
Chapter 29: Sealing the Leaks in Your Applications 410
How Garbage Collection Works 411
Demonstration 1 413
Output 416
Analysis 417
Q& A Session 1
Quiz 426
Quiz 428
Quiz 430
Quiz 431
Understanding Memory Leaks 432
Demonstration 2 433
Snapshots 435
Analysis 436
Modified Code 437
Snapshots 440
Analysis 441
Q& A Session 2
Chapter 30: FAQ 446
Appendix A: Brief Overview of GoF Design Patterns 451
Key Points 452
Q& A Session
Appendix B: Some Useful Resources 457
Appendix C: The Road Ahead 458
Index 459

Erscheint lt. Verlag 21.6.2018
Zusatzinfo XXX, 455 p. 154 illus.
Verlagsort Berkeley
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Mathematik / Informatik Informatik Software Entwicklung
Mathematik / Informatik Informatik Theorie / Studium
Schlagworte C# • c# design patterns • C Sharp • csharp beginners • Design Patterns • gang of four design patterns • head first design patterns • NET design patterns,
ISBN-10 1-4842-3640-8 / 1484236408
ISBN-13 978-1-4842-3640-6 / 9781484236406
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 15,0 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Das Handbuch für Webentwickler

von Philip Ackermann

eBook Download (2023)
Rheinwerk Computing (Verlag)
49,90
Das umfassende Handbuch

von Johannes Ernesti; Peter Kaiser

eBook Download (2023)
Rheinwerk Computing (Verlag)
44,90