Category: designPatterns

  • Pattern: CompositeProvider

    Description Composite Provider pattern is a structural design pattern that lets you compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Example in .NET : CompositeProvider And his usage Learn More Source Code for Microsoft implementation of CompositeProvider SourceCode Composite Provider Learn More File…

  • Pattern: AbstractFactory

    Description Abstract Factory is a creational design pattern that lets you produce families of related objects without specifying their concrete classes. Example in .NET : AbstractFactory Learn More Source Code for Microsoft implementation of AbstractFactory SourceCode DbConnection Learn More Wikipedia } Homework Imagine you want to produce loggers. You have a logger that logs to…

  • Pattern: Flyweight

    Description Flyweight pattern is used to reduce the memory and resource usage for complex models containing a large number of similar objects. Example in .NET : Flyweight Learn More Source Code for Microsoft implementation of Flyweight SourceCode String.Intern Learn More Wikipedia } Homework Make an exchange rate system. The symbol and names of the currency…

  • Pattern: Observer

    Description Observer pattern is a behavioral design pattern that defines a one-to-many dependency between objects so that when one object changes state,all its dependents are notified and updated automatically. Example in .NET : Observer Learn More Source Code for Microsoft implementation of Observer SourceCode INotifyPropertyChanged Learn More Wikipedia } Homework Imagine you have a logger…

  • Pattern: FluentInterface

    Description Fluent interface allows you do have method chaining Example in .NET : FluentInterface Learn More Source Code for Microsoft implementation of FluentInterface SourceCode Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton Learn More Wikipedia } Homework Implement a class person that you can see the first name and last name as fluent interface

  • Pattern: IOC

    Description Inversion of Control is a principle in software engineering by which the control of objects or portions of a program is transferred to a container or framework. It’s a design principle in which custom-written portions of a computer program receive the flow of control from a generic framework. Examples in .NET : IOC DI…

  • Pattern: Lazy

    Description Lazy initialization is the tactic of delaying the creation of an object,the calculation of a value,or some other expensive process until the first time it is needed. Example in .NET : Lazy Learn More Source Code for Microsoft implementation of Lazy SourceCode Lazy Learn More C2Wiki Wikipedia Homework Implement a lazy initialization of a…

  • Pattern: Chain

    Description Chain of responsibility pattern allows an object to send a command without knowing what object will receive and handle it. Chain the receiving objects and pass the request along the chain until an object handles it Example in .NET : Chain Learn More Wikipedia Homework Implement a middleware in ASP.NET Core that intercepts the…

  • Pattern: Decorator

    Description Decorator allows behavior to be added to an individual object,either statically or dynamically,without affecting the behavior of other objects from the same class. Example in .NET : Decorator Learn More Wikipedia Homework 1. Add a logging to DBConnection . 2. Use by decorating a coffee with milk,sugar,and chocolate (and maybe other condiments). The coffee…

  • Pattern: Facade

    Description Facade is is an object that provides a simplified interface to a larger body of code,such as a class library. Example in .NET : Facade Learn More Wikipedia Homework Implement a Facade that will allow you to display a question in a MessageBox with a single method call in a console application and return…