The easiest way to learn design patterns
The easiest way to learn design patterns
With C# 12 code samples on .NET 8
About the Book
One thing that makes you truly stand out as a software engineer is a good knowledge of design patterns. Knowing them makes you quicker at solving problems. It makes you much better at understanding architecture. And it significantly improves your chances of landing a good job, as it makes you better at solving problems during technical interviews.
However, the biggest problem with the design patterns is that they are hard to learn. Most of them are not very intuitive. Therefore getting to understand them at the level where you can use them usually takes a long time. Many developers just give up, which prevents them from unlocking their full potential.
This book aims to solve this problem. It takes a very different approach from how design patterns are normally taught. It does it by providing sufficient context first. Instead of jumping into the UML diagrams and code samples, the book provides descriptions of real-life software engineering challenges that developers can easily relate to. For each of these scenarios, appropriate design patterns are listed with a summary of how each of them can solve a given problem. Only then, when sufficient context has been provided, we jump into the code examples.
The process of effective learning is not about memorization. It's about adding new associations to the existing knowledge. And this is the approach this book has taken.
Because of its structure, this book can also be effectively used as a reference source. It allows you to look up an appropriate design pattern as you are facing a problem of a particular type.
Bundles that include this book
Reader Testimonials
Bella Rabbit
Great Resource!
The title says it all! This book showed me the easiest way to learn design patterns… and it did so well because the book has its own methodology. Pick it up and find out precisely what I mean. Even with familiarity on the topic, it can teach a book a two. My friend here tried it out, who has experience in the subject, and she said she found some pointers unexpectedly useful. For her, it also had many design patterns that could be used as a quick reference. It’s navigation friendly.
Table of Contents
-
Introduction
- What design patterns are
- Why would you want to learn design patterns
- Why design patterns are hard to learn
- The goal of this book
- The structure of this book
-
About the author and his mission
- Getting in touch
- Helping to spread the word
-
UML conventions used in the book
- Basic component
- Association
- Dependency
- Implementation
- Inheritance
- Part 1: SOLID principles and why they are important
-
1. Single responsibility principle
- What is single responsibility principle
- The importance of the single responsibility principle
- The concept of class cohesion
- Conclusion
-
2. Open-closed principle
- What is open-closed principle
- Implementing the open-closed principle in C#
- Conclusion
-
3. Liskov substitution principle
- Implementing Liskov substitution principle in C#
- Conclusion
-
4. Interface segregation principle
- What is interface segregation principle
- Importance of interface segregation
- When NotImplementedException is appropriate
-
5. Dependency inversion principle
- What is dependency inversion principle
- Why the dependency inversion principle is important
- Dependency inversion is not only useful in unit tests
- Part 2: The problems that design patterns are intended to solve
-
6. Not knowing what object implementations you’ll need ahead of time
- Suitable design patterns
-
7. Making several exact copies of a complex object
- Suitable design patterns
-
8. Using many instances of an object while keeping code running smoothly
- Suitable design patterns
-
9. Using the same single instance of an object throughout the application
- Suitable design patterns
-
10. Third-party components aren’t directly compatible with your code
- Suitable design patterns
-
11. Adding new functionality to existing objects that cannot be modified
- Suitable design patterns
-
Accessing complex back-end logic from the presentation layer
- Suitable design patterns
-
13. User interface and business logic are developed separately
- Suitable design patterns
-
14. Building a complex object hierarchy
- Suitable design patterns
-
15. Implementing complex conditional logic
- Suitable design patterns
-
16. Multiple object instances of different types need to be able to communicate with each other
- Suitable design patterns
-
17. Multiple stages of processing are needed
- Suitable design patterns
-
18. The system is controlled by complex combinations of inputs
- Suitable design patterns
-
19. Ability to undo an action that has been applied
- Suitable design patterns
-
20. Ability to traverse a collection without knowing its underlying structure
- Suitable design patterns
-
21. Creating a family of related algorithms
- Suitable design patterns
- 22. Summary of the problems design patterns are intended to solve
- Part 3: Design patterns demonstrated in C#
- 23. Design pattern categories
- Creational design patterns
-
24. Factory Method
- Prerequisites
- Factory Method implementation example
- Benefits of using Factory Method
- Caveats of using Factory Method
-
25. Abstract Factory
- Prerequisites
- Abstract Factory implementation example
- Benefits of using Abstract Factory
- Caveats of using Abstract Factory
-
26. Builder
- Prerequisites
- Builder implementation example
- Benefits of using Builder
- Caveats of using Builder
-
27. Prototype
- Prerequisites
- Prototype implementation example
- Benefits of using Prototype
- Caveats of using Prototype
-
28. Singleton
- Prerequisites
- Singleton implementation example
- Benefits of using Singleton
- Caveats of using Singleton
- Structural design patterns
-
29. Adapter
- Prerequisites
- Adapter implementation example
- Benefits of using Adapter
- Caveats of using Adapter
-
30. Bridge
- Prerequisites
- Bridge implementation example
- Benefits of using Bridge
- Caveats of using Bridge
-
31. Composite
- Prerequisites
- Composite implementation example
- Benefits of using Composite
- Caveats of using Composite
-
32. Decorator
- Prerequisites
- Decorator implementation example
- Benefits of using Decorator
- Caveats of using Composite
-
33. Facade
- Prerequisites
- Facade implementation example
- Benefits of using Facade
- Caveats of using Facade
-
34. Flyweight
- Prerequisites
- Flyweight implementation example
- Benefits of using Flyweight
- Caveats of using Flyweight
-
35. Proxy
- Prerequisites
- Proxy implementation example
- Benefits of using Proxy
- Caveats of using Proxy
- Behavioral design patterns
-
36. Chain of Responsibility
- Prerequisites
- Chain of Responsibility implementation example
- Benefits of using Chain of Responsibility
- Caveats of using Chain of Responsibility
-
37. Command
- Prerequisites
- Command implementation example
- Benefits of using Command
- Caveats of using Command
-
38. Iterator
- Prerequisites
- Iterator implementation example
- Benefits of using Iterator
- Caveats of using Iterator
-
39. Mediator
- Prerequisites
- Mediator implementation example
- Benefits of using Mediator
- Caveats of using Mediator
-
40. Memento
- Prerequisites
- Memento implementation example
- Benefits of using Memento
- Caveats of using Memento
-
41. Observer
- Prerequisites
- Observer implementation example
- Benefits of using Observer
- Caveats of using Observer
-
42. State
- Prerequisites
- State implementation example
- Benefits of using State
- Caveats of using State
-
43. Strategy
- Prerequisites
- Strategy implementation example
- Benefits of using Strategy
- Caveats of using Strategy
-
44. Template Method
- Prerequisites
- Template Method implementation example
- Benefits of using Template Method
- Caveats of using Template Method
-
45. Visitor
- Prerequisites
- Visitor implementation example
- Benefits of using Visitor
- Caveats of using Visitor
- Epilogue
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them