Course Overview

This class will introduce students to the wonderful world of Object-Oriented Design Patterns, which allow the leveraging of proven solutions to common re-occurring problems and provide a common vocabulary to describe a software system. You will learn how to think of and describe systems as a series of patterns, leading to accurate and efficient communication and, more important, proven and scalable architectures. As part of this process, students will obtain key insights in how to design object oriented systems. The original Gang of Four Design Patterns were documented prior to .NET, and in this course the implementation of these patterns is bought up to date using the latest versions of C# and the .NET framework.

Key Learning Areas

  • Why use Design Patterns
  • Utilize design patterns to build loosely coupled systems
  • Simplify code using design patterns
  • Learn how design patterns assist in making code testable
  • Learn a common vocabulary to communicate complex ideas quickly and efficiently
  • Learn modern implementations of the Gang of Four Design patterns using .NET framework
  • See the power of combining many patterns to produce an elegant and simple testable solution

Course Outline

  • Why learn design patterns
    • Examine the reasons for patterns, common vocabulary , re-using solutions not code
  • Singleton
    • Why overuse of this pattern is an anti pattern
    • Issues with testing
    • Singleton variants ThreadScoped, WeakSingleton
  • Strategy and Template patterns
    • See how both these patterns allow code to be re-used without copy and paste and if/else
  • Observer pattern
    • See how to separate code that needs to react to state change from the object that under goes state change.
    • See how Reactive Extensions make use of a standardized form of the Observer pattern
    • See how the classic observer pattern is best implemented in .NET using events
      • Examine the thread safety implications
  • Creational patterns
    • Creating objects using the new keyword, causes issues with testing see how creational patterns create more flexible code.
    • Examine how Factory, Abstract Factory, Builder and Prototype all allow you to build flexible testable solutions.
    • Create instance of types not yet designed.
  • Iterator, Composite and Visitor patterns
    • See the benefit of providing a common way to define iteration ( LINQ, foreach )
    • Using the composite pattern simplify the iteration of complex structures
    • Using the visitor pattern add functionality to a composite without having to modify it.
  • Decorator pattern
    • Inheritance allows extending behavior at design time. Decorator pattern allows the extending of behavior at run time.
    • I don't want object X I want Object X + Feature Y + Feature Z
    • Allow new feature combinations can be developed without breaking existing working code
  • Command pattern and Chain of responsibility pattern
    • Separate code that knows what to do from code that knows when to make it happen
    • Classic example MVVM, Button knows when to make something happen application code knows what to happen.
    • See how command pattern can be used to
      • Build journals
      • Build complex Undo/Redo behavior
    • Utilize chain of responsibility pattern to provide many command handlers, but keeping the client unaware.
  • Proxy and Interceptor patterns
    • Control access to an object, Caching Proxy, Synchronized Proxy , Virtual Proxy , Security Proxy.
    • See how proxies allow the separation of concerns, maintaining single responsibility principle
    • See how interceptor pattern allows the creation of common cross cutting concerns that can be applied to many types.
  • State pattern
    • Object behavior often based on state.
    • See how to cleanly separate object behavior based on state.

Who Benefits

Developer's wishing to develop their Object Orientated skills in C# and the .NET framework. After attending this course developers will be able to code smarter, building simpler and more testable solutions. This course is essential for all developers wishing to ensure they are using best practice when it comes to designing and building an object orientated system on the .NET platform.

Prerequisites

The expected audience for this course is C# developers with at least 6 months experience.