Category: .NET Core

  • Pattern: Factory

    Description A factory is a function or method that returns objects of a varying prototype or class from some method call,which is assumed to be new Example in .NET : Factory Learn More Wikipedia Homework having multiple types of drinks( water,tea,coffee) with an IDrink interface create a factory method ( with a parameter ) to…

  • Pattern: Prototype

    Description It is used when the type of objects to create is determined by a prototypical instance,which is cloned to produce new objects Example in .NET : ICloneable Learn More Wikipedia Homework Imagine that you have a cow farm and you want to create a new cow. Implement a prototype that will allow you to…

  • Pattern: Singleton

    Description Singleton pattern restricts the instantiation of a class to one object. It is used when you want to have one instance of a class that is shared across the application. Example in .NET : Singleton Learn More Wikipedia Homework Implement a singleton that will allow you to create a single instance of a logger…

  • Pattern: Strategy

    Description Strategy pattern allows a client to choose from a family of algorithms at runtime. It is used when the client expects to have multiple algorithms and wants to choose one of them at runtime. Example in .NET : Strategy Learn More Wikipedia Homework Image you want to serialize classes to XML,JSON and CSV .…

  • Pattern: Visitor

    Description Visitor pattern is a way of separating an algorithm from an object structure on which it operates. A practical result of this separation is the ability to add new operations to existing object structures without modifying the structures. Example in .NET : Visitor Learn More Wikipedia Homework Implement a visitor that will allow you…

  • Pattern: Adapter

    Description Adapter design pattern allows the interface of an existing class to be used as another interface.It is often used to make existing classes work with others without modifying their source code. Examples in .NET : SQLiteDataAdapter EncodingAdapter Learn More Wikipedia Homework iPhone 7 does not have a headphone jack. Implement an adapter that will…

  • Pattern: Builder

    Description The intent of the Builder design pattern is to separate the construction of a complex object from its representation Examples in .NET : UriBuilder SqlConnectionStringBuilder Learn More Wikipedia Homework Imagine that you have a logger that logs to a file and to a console. Implement a builder that will allow you to create a…

  • Pattern: Iterator

    Description Iterator design pattern allows to traverse a container and access the container’s elements. Example in .NET : DirectoryEnumerable Learn More Wikipedia Homework With the Yield keyword implement a function that return an IEnumerable of generic int that will return the first 10 numbers of the Fibonacci sequence

  • Pattern: NullObject

    Description Instead of returning null,use an object which implements the expected interface,but whose method body is empty. Examples in .NET : EmptyFolder NullLogger Learn More Wikipedia Homework When retrieving data( e.g. a Person with ID =-1 ) from a database,return a NullObject instead of null. How you will verify that the object is a NullObject?

  • Comparing EFCore Database Providers part 3

    I did not have the opportunity to migrate from a database from another . But seems to me that,when using EF,the principal problem will be the stored procedures,not the code that EF ( and providers) are generating automatically.  Yes,there are some problems ( see part 1 and part 2),but those seems not so important and…