Skip to main content

Posts

Showing posts with the label Design Patterns

Abstract Factory Pattern

ABSTRACT FACTORY PATTERN           Provide an interface for creating families of related or dependent objects without specifying their concrete classes.                           Casual Implementation                               Factory Pattern Implementation  Usual Code Block   Factory Pattern Parent Class public class CheckBook {     protected decimal _Amount;     public decimal getExpense()     {       return _Amount;     } } These below child classes is derived from CheckBook base class. public class Health : CheckBook {     public Health()     {         _Amount = 5000;//Could be any logi...

Design Patterns

Design Pattern - Design pattern to build high quality robust applications.             Developer have to take care to select the right pattern for the right problem. Improper usage lead to  unmaintainable, complex and inefficient code .              We shall take a look at how to use the well known Gang of Four (GoF) Design Patterns in C# 4.0 code. Those patterns will work well in any project that uses C# but especially in WPF, WCF, WinForms, ASP.NET projects.  The GoF Design Patterns are divided into 3 categories : Creational Patterns, Structural Patterns and Behavioral Patterns . I am going to explain each GoF Design Pattern in detail and will show you examples of how to write good C# 4.0 code that implement those patterns. Creational Pattern Abstract Factory Pattern:  Create instances of classes belonging to different families Builder Pattern:  Separate representation and object construct...