RSS Feed for CreationalCategory: Creational

Design Pattern in .NET 101 - Abstract Factory Pattern (Creational Pattern) »

Download Sample Code
Abstract Factory pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.
E.g. I have a DocumentFactory class that either returns DefaultDocumentFactory or CustomDocumentFactory dependening on the environment variable.

using System;
using System.Collections.Generic;
using System.Text;

namespace AbstractFactory
{
abstract class DocumentFactory
{
[…]

Design Pattern in .NET 101 - Factory Method Pattern (Creational Pattern) »

Download Sample Code
Factory Method Pattern defines an interface for creating an object, but let subclasses decide which class to instantiate. It lets a class defer instantiation to subclasses.
E.g., I defined a abstract News class.

using System;
using System.Collections.Generic;
using System.Text;

namespace FactoryPattern
{
abstract class News
{
}
}

Different kinds of […]