Design Patterns in C# .NET
Design patterns are reusable solutions that solve the challenges software developers face over and over again. Rather than reinventing the wheel, learn how to make use of these proven and tested patterns that will make your software more reliable and flexible to change. This course will introduce you to design patterns and take you through 16 of the most used object-oriented patterns that will make your development faster and easier.
We introduce Object Oriented Programming fundamentals through GRASP Patterns, then we deeply explore the famous SOLID principles.
We analyze the most useful Design Patterns from the classic GoF Design Patterns book and discuss the SOLID principles in the context of the patterns. Each pattern has several sample codes which helps understanding the pattern in real world usage.
There are several lab exercises (in C#) to really grasp the ideas of the patterns.
The main value of the course is not simply the introduction of the Design Patterns, but the fact it can help the programmers to think in object-oriented manner, consciously decide about the tradeoffs of a design decision.
The course is available in the following programming languages: C#.
Architects, software developers with minimum 3 year C# background or years of practice in other programing languages (lots of C++ programmers successfully completed this couse too).
This course is mainly constructed for C# .NET programmers who need to learn real-world Object Oriented Design.
General responsibility assignment software patterns (or principles), abbreviated GRASP, consist of guidelines for assigning responsibility to classes and objects in object-oriented design.
During this module the participants understand the basic principles of Object Oriented Programming. The patterns are actualized by introducing how we think differently about some of the patterns nowadays.
Key topics during this section: Information Expert, Creator, Cohesion, Coupling, Controller, Polymorphism, Indirection, Protected Variations and Pure Fabrication.
SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable. We deeply discuss how these principles make a better software design, and how can we analyze a design quality by these tenets.
Key topics during this module: Single Responsibility, Open-Closed Principle, Liskov Substitution Principle, Interface Segregation, Dependency Inversion.
Deriving the Bridge Pattern from ground-up based on a Drawing Editor example. Examining the Bridge Pattern in detail. Examples from the .NET Framework.
Lab: Refactoring a badly designed multi-database sample application to Bridge.
Examining the Template Method in detail. Examples from the .NET Framework.
Lab: Refactoring the previous example to remove duplication by introducing Template Method pattern on both sides of the Bridge.
Sample codes: Sorting using IComparable, event handling callers in .NET, webpage input validation using Layer Supertype + Template Method patterns.
Examining the Strategy pattern in detail. Examples from the .NET Framework.
Sample codes: Sorting using IComparer, user input validators, Multi-Step Etl process using Strategy pattern.
Examining the Factory Method pattern in detail. Examples from the .NET Framework.
Sample codes: different kind of factories.
Examining the Abstract Factory pattern in detail. Examples from the .NET Framework.
Sample codes: Concrete Factories, Abstract Database object Factory
Examining the Decorator pattern in detail. Examples from the .NET Framework.
Sample codes: changing collection responsibilities using decorators.
Lab: refactoring a wrong Visual Decorator hierarchy to become conform to the canonical pattern structure.
Examining the Adapter pattern in detail. Examples from the .NET Framework.
Sample codes: adapter to adapt anything to IDataReader for bulk sql server insert. A reusable tree view control as a pluggable adapter example. Adapting anything to IListSource sample.
Examining the Iterator pattern in detail. Examples from the .NET Framework.
Sample codes: creating external iterator to recursive structures using custom stack, creating recursive iterator using C# yield support, creating generators and transformations using yields, creating a Where filter using yield. Creating internal iterator to a linked list. Versioned iterator concept demo.
Lab: creating external iterator for a linked list.
Examining the Composite pattern in detail. Examples from the .NET Framework.
Sample code: file system simulation using the Composite Pattern. Handling parent references. Lowering memory requirements by using data dictionaries.
Lab: adding Size property to the composite structure.
Examining the Visitor pattern in detail. Examples from the .NET Framework.
Sample code: File Composite made extensible by Visitor, Expression visitor by C# dynamic support. Expression AST transformation using Visitor. Code examination and transformation using Roslyn.
Examining the Singleton (anti)pattern in detail. Examples from the .NET Framework.
Sample codes: Simple singleton, making singleton thread safe, BeforeFieldInit, modelling business rules complex sample which uses singleton and other patterns.
Examining the Command pattern in detail. Examples from the .NET Framework.
Sample code: implementing undo-redo for a tree editor.
Examining the Observer pattern in detail. Examples from the .NET Framework.
Sample code: INotifyPropertyChanged implementation details.
Chain of Responsibility
Examining the Chain of Responsibility pattern in detail. Examples from the .NET Framework.
Sample codes: Chain of Responsibility variations, Loan processing, Middlewares in OWIN, Handlers in WebAPI.
Examining the Builder pattern in detail. Examples from the .NET Framework.
Sample code: Fluent style builders. Building source code using CodeDom. Building a state machine using fluent builders.
Examining the State pattern in detail. Examples from the .NET Framework
Sample code: CSV reader..
Explore the remaining patterns briefly: Prototype, Facade, Flyweight, Proxy, Interpreter, Mediator, Memento.
- Classroom with computers is required
- Hungarian handout and the source code of the demo applications will be provided for the participants.
- 2 whiteboards and a beamer with HDMI is required.