Design Patterns in C#
Minimum price
Suggested price

Design Patterns in C#

About the Book

This book provides a modern, comprehensive overview of design pattern implementations for the .NET ecosystem using the C# programming language. The book covers every single pattern from the Gang of Four and a few extras such as enterprise and functional design patterns.

About the Author

Dmitri Nesteruk
Dmitri Nesteruk

Dmitri Nesteruk is a developer, speaker, podcaster and a technologist. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. He is an instructor of an entry-level course in Quantitative Finance. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

Table of Contents

    • Introduction
      • Who This Book Is For
      • On Code Examples
      • Preface to the 2nd Edition
    • The SOLID Design Principles
      • Single Responsibility Principle
      • Open-Closed Principle
      • Liskov Substitution Principle
      • Interface Segregation Principle
      • Dependency Inversion Principle
    • The Functional Perspective
      • Function Basics
      • Functional Literals in C#
      • Storing Functions in C#
      • Functional Literals in F#
      • Composition
      • Functional-Related Language Features
  • Creational Patterns
    • Builder
      • Scenario
      • Simple Builder
      • Fluent Builder
      • Communicating Intent
      • Composite Builder
      • Builder Parameter
      • Builder Extension with Recursive Generics
      • Lazy Functional Builder
      • DSL Construction in F#
      • Summary
    • Factories
      • Scenario
      • Factory Method
      • Asynchronous Factory Method
      • Factory
      • Inner Factory
      • Abstract Factory
      • Delegate Factories in IoC
      • Functional Factory
      • Summary
    • Prototype
      • Deep vs. Shallow Copying
      • ICloneable Is Bad
      • Deep Copying with a Special Interface
      • Deep Copying Objects
      • Duplication via Copy Construction
      • Serialization
      • Prototype Factory
      • Summary
    • Singleton
      • Singleton by Convention
      • Classic Implementation
      • The Trouble with Singleton
      • Singletons and Inversion of Control
      • Monostate
      • Multiton
      • Summary
  • Structural Patterns
    • Adapter
      • Scenario
      • Adapter
      • Adapter Temporaries
      • The Problem with Hashing
      • Property Adapter (Surrogate)
      • Generic Value Adapter
      • Adapter in Dependency Injection
      • Adapters in the .NET Framework
      • Summary
    • Bridge
      • Conventional Bridge
      • Dynamic Prototyping Bridge
      • Summary
    • Composite
      • Grouping Graphic Objects
      • Neural Networks
      • Shrink Wrapping the Composite
      • Composite Specification
      • Summary
    • Decorator
      • Custom String Builder
      • Adapter-Decorator
      • Multiple Inheritance with Interfaces
      • Multiple Inheritance with Default Interface Members
      • Dynamic Decorator Composition
      • Static Decorator Composition
      • Functional Decorator
      • Summary
    • Façade
      • Magic Squares
      • Building a Trading Terminal
      • An Advanced Terminal
      • Where’s the Façade?
      • Summary
    • Flyweight
      • User Names
      • Text Formatting
      • Summary
    • Proxy
      • Protection Proxy
      • Property Proxy
      • Value Proxy
      • Composite Proxy: SoA/AoS
      • Composite Proxy with Array-Backed Properties
      • Virtual Proxy
      • Communication Proxy
      • Dynamic Proxy for Logging
      • Summary
  • Behavioral Patterns
    • Chain of Responsibility
      • Scenario
      • Method Chain
      • Broker Chain
      • Summary
    • Command
      • Scenario
      • Implementing the Command Pattern
      • Undo Operations
      • Composite Commands (a.k.a. Macros)
      • Functional Command
      • Queries and Command Query Separation
      • Summary
    • Interpreter
      • Numeric Expression Evaluator
      • Interpretation in the Functional Paradigm
      • Summary
    • Iterator
      • Array-Backed Properties
      • Let’s Make an Iterator
      • Improved Iteration
      • Iterator Adapter
      • Summary
    • Mediator
      • Chat Room
      • Mediator with Events
      • Introduction to MediatR
      • Summary
    • Memento
      • Bank Account
      • Undo and Redo
      • Using Memento for Interop
      • Summary
    • Null Object
      • Scenario
      • Intrusive Approaches
      • Null Object
      • Dynamic Null Object
      • Summary
    • Observer
      • Events
      • Weak Event Pattern
      • Event Streams
      • Property Observers
      • Observable Collections
      • Declarative Subscriptions in Autofac
      • Summary
    • State
      • State Driven State Transitions
      • Handmade State Machine
      • Switch-Based State Machine
      • Encoding Transitions with Switch Expressions
      • State Machines with Stateless
      • Summary
    • Strategy
      • Dynamic Strategy
      • Static Strategy
      • Equality and Comparison Strategies
      • Functional Strategy
      • Summary
    • Template Method
      • Game Simulation
      • Functional Template Method
      • Summary
    • Visitor
      • Intrusive Visitor
      • Reflective Printer
      • What is Dispatch?
      • Dynamic Visitor
      • Classic Visitor
      • Acyclic Visitor
      • Functional Visitor
      • Summary
  • Notes

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...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course 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

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub