Tutorial by Examples

The Singleton pattern is designed to restrict creation of a class to exactly one single instance. This pattern is used in a scenario where it makes sense to have only one of something, such as: a single class that orchestrates other objects' interactions, ex. Manager class or one class that rep...
Factory Method is one of creational design patterns. It is used to deal with the problem of creating objects without specifying exact result type. This document will teach you how to use Factory Method DP properly. Let me explain the idea of it to you on a simple example. Imagine you're working in ...
Separate the construction of a complex object from its representation so that the same construction process can create different representations and and provides a high level of control over the assembly of the objects. In this example demonstrates the Builder pattern in which different vehicles ar...
Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype. In this example demonstrates the Prototype pattern in which new Color objects are created by copying pre-existing, user-defined Colors of the same type. using System; using Syste...
Provide an interface for creating families of related or dependent objects without specifying their concrete classes. In this example demonstrates the creation of different animal worlds for a computer game using different factories. Although the animals created by the Continent factories are diffe...

Page 1 of 1