Skip to main content

Posts

Showing posts from January, 2018

Abstract Factory Pattern

Abstract Factory Pattern  Gamma Categorization: Creational Design Patten Summary: When the object construction is complicated, needing multiple arguments, we should create a separate function (Factory Method) or class (Factory), which is responsible for the creation of the all object. Problem examples Suport of multiple databases Multiple data sources: Serial port, ethernet port, device driver Diferent report types Solution Abstract class Generalized interface A Factory creates instances of the concrete classes Sample Code The abstract factory public   interface   IPhotoFactory {      IAnaloguePhoto   CreateAnaloguePhoto ();      IDigitalPhoto   CreateDigitalPhoto (); } The abstract products public   interface   IAnaloguePhoto {      string   GetName (); } public   interface   IDigitalPhoto {      string   GetName (); } The concrete factories public   class   CanonFactory  :  IPhotoFactory {      public   IAnalog

Design Patterns

Design Patterns Software Design Patterns Design patterns are common architectural approaches that have been observed in software engineering practices. A pattern is a description of an approach, how it is expressed in a programming language and what it is used for. Solid Principles In object-oriented computer programming, SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible, and maintainable. Single Resposibility Principle Open Close Principle Liskov substitution principle Interface segregation principle Dependency inversion principle Gama Categorization (Gang of Four) Design patterns are typically slit into three categories Creational Deal with the construction of objects;constructor, DI, reflection;single statement, stet-by-step Builder Fluent Builder Factory Prototype Singleton Structural Defines the structure (Interfaces, all API) Behavioural Focus on communication among objects Other Pattern