Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Design pattern in C# by using professional examples
Rating: 4.1 out of 5(12 ratings)
123 students

Design pattern in C# by using professional examples

Concepts, class diagram along with professional examples to understand design patterns with C# and .NET
Created byAhemad Ali Khan
Last updated 12/2018
English

What you'll learn

  • Able to write clean code.
  • Identify the most suitable design pattern to address a given application design problem.
  • Apply design principles (e.g., open-closed, dependency inversion etc )

Course content

5 sections73 lectures10h 58m total length
  • Introduction6:26

    Explore design patterns in C# with professional examples, covering creational and structural patterns such as factory, abstract factory, singleton, prototype, builder, decorator, and facade, plus solid principles.

  • Getting Started1:35

    Explore creational design patterns that control object creation, including simple factory, factory method, abstract factory, singleton, prototype, and builder, to manage complexity and flexibility.

  • Simple Factory - Concepts2:57

    Explore the simple factory pattern by encapsulating object creation behind a factory method. See how CreateExam returns an IOnlineExam implemented by DotNet or Java, keeping clients unaware of concrete classes.

  • Simple Factory - Implementation [Example : OnLineExam ]16:18

    Demonstrates the simple factory pattern by implementing the IOnlineExam interface and concrete DotNet and Java classes, with a factory creating online exam objects.

  • Factory Method Pattern - Concepts4:27

    Explore the factory method pattern by defining an interface for object creation and letting subclasses decide which concrete class to instantiate. Learn about the open-closed principle and decoupling.

  • Factory Method Pattern - Implementation [ Example : OnLineExam ]7:18

    Master the factory method pattern through an online exam implementation, building exam objects via specific exam factories for line and dot net exams, demonstrating extensibility.

  • Abstract Factory Pattern - Concepts7:00

    Learn how the abstract factory pattern decouples client code from concrete products by creating families of related objects through a single interface, enabling easy extension.

  • Abstract Factory Pattern - Implementation - [ AbstractWidgetFactory ]8:00

    Explore how the abstract factory pattern uses a widget factory to create related window and dialog products for different families, such as windows and mac style.

  • Singleton Pattern - Concepts2:31

    Learn the singleton pattern concepts in C# with real-world examples like a login service, a printer, and a team captain, plus lazy instantiation and double-checked locking.

  • Singleton Pattern Implementation - Thread Safe and Double Check Locking12:55

    Explore the singleton pattern in C# with private constructors, a single instance, and thread safety techniques including lock and double-check locking, highlighting performance trade-offs.

  • Singleton Pattern Implementation - Static Initialization and Lazy Instantiation12:05

    Compare static initialization and lazy instantiation in C# singletons, including private constructors, nested classes, and dotnet lazy initialization for on-demand, thread-safe instance creation.

  • Prototype Pattern - Concepts4:10

    Clone existing objects to create new instances efficiently using the prototype pattern, with a clone method on an abstract prototype and concrete customers like general and privileged with discounts.

  • Prototype Pattern - Implementation - [Example : General and Privilege Customer]18:52

    Explore prototype pattern implementation by cloning general and privilege customers, creating copies, and applying discount logic to sale prices.

  • Prototype Pattern - Shallow Copy11:13

    Explore the prototype pattern through shallow copy, creating a new object and copying non-static fields while shared references, like product details, remain linked; compare with the deep-copy behavior.

  • Prototype Pattern - Deep Copy4:30

    Explore the prototype pattern by implementing deep copy, cloning objects and ensuring both object references and nested details, like product details, are copied correctly.

  • Prototype Pattern - Implementation of Both Shallow and Deep Copy8:26

    Implement shallow and deep copies using the prototype pattern, exploring local copy, cloning, and copy methods on a customer object to manage references and duplicates.

  • Builder Pattern - Fluent Interface - Concepts7:53

    Explore the builder pattern and fluent interface to address complex constructors and factory pitfalls, using a bank account example to build objects step by step with proper initialization.

  • Builder Pattern - Fluent Interface - [Example - Creation of Account Object]15:29

    Explore the builder pattern with a fluent interface to create a bank account object step by step, using chainable methods and a private constructor to produce final account.

  • Builder Pattern - Concepts4:23

    Explore the builder pattern in C# using abstract interfaces and concrete builders to assemble complex objects like bank accounts. See how a director guides construction to produce different representations.

  • Builder Pattern - Implementation - [Ex:BankBuilder with different account types]16:04

    Explore the builder pattern in a bank account example, implementing interfaces and concrete builders to create saving and other account types via a director.

Requirements

  • Understanding of object oriented programming concepts.
  • Knowledge of C#.

Description

Creational Design Pattern

1. Simple Factory - Creation of object by using "CreateExam" Method for OnlineExam.

2. Factory Method - Creation of object by using ConcreteFactory subclasses for OnlineExam.

3. Abstract Factory -  Creation of object for Window and Dialog with respect to different OS by using AbstractWidgetFactory.

4. Singleton - Generic example to understand the concepts, example of static initialization and double lock checking.

5. Prototype - Creation prototype object at run time for GeneralCustomer and PrevilegeCustomer.

6. Builder - Creation of object in series of steps by using Fluent Interface and Bank builder for BankAccount.

Structural Design Pattern

1. Adapter - Adapter used in between Mediaplayer and Mediapackage

2. Bridge - Example Used - Bridge used in between persistence mechanism and file types.

3. Composite - Example Used - HTML tree structure with parent and child element.

4. Decorator - Example Used - Decorating CarRacing application with stage progression.

5. Facade - FacadeReportGenerator for different type of DB.

6. Proxy - Example used for remote proxy, virtual proxy and protection proxy through restaurant application.

Behavioral Design Pattern

1. Chain of Responsibility - ATMWithdraw application for different denominator of Indian rupees.

2. Command - Calculator Application with redo and undo features.

3. Interpreter - Convert Roman number to number.

4. Iterator - Iterating posts of blog.

5. Mediator - ChatMediator for different category of users.

6. Memento - Savepoint with file contents so that go back to previous save point.

7. Observer - Notify all customers when product is available

Solid Principle

1. Checkpoint to see dirty code.

2. Should we give importance to Solid Principle.

3. Acronym of SOLID.

4. SRP Concetps with violation - Example Used : Loan Application

5. OCP : Used open and closed principle in Loan Application

6. LSP : Violation of LSP after adding Educational Loan to Loan Application.

7. ISP : Provide solution to LSP violation in the form of ISP.

8. DIP : Used English and French messenger to understand the concepts in Loan Application.

Who this course is for:

  • Beginner, intermediate and experienced developers.
  • Interested in design principles.