Skip to main content

Posts

Showing posts from 2014

Design Patterns - Abstract Factory Pattern

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DesignPattern_AbstractFactoryApp {    class Program    {       static void Main( string [] args)       {          /* ABSTRACT FACTORY PATTERN:           * The abstract factory pattern provides a way to            * encapsulate a group of individual factories            * that have a common theme without            * specifying their concrete classes.           * Use of this pattern makes it possible to            * interchange concrete implementations            * without changing the code            * that uses th...

Design Patterns - Strategy Pattern

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DesignPattern_StrategyPattern {    class Program    {       static void Main( string [] args)       {          /* STRATEGY PATTERN (POLICY PATTERN):           * Strategy lets the algorithm vary independently            * from clients that use it.           * When the program is running, we can switch between different            * type of algorithms           * For instance, a class that performs validation on incoming data           * may use a strategy pattern to select a validation            * algorithm   based on the type of data,    ...