Posts

Showing posts from October, 2014

Design Patterns commonly used in OOP

A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. It is a framework based on which applications can be made. They are widely used in Object Oriented Programming/Design. The intent of this post is to give general awareness on the various design patterns that are commonly used.  Strategy Pattern According to the GoF book, Strategy design pattern should “Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.”  You encapsulate code in external algorithms for easy use rather than spreading it around inside your core code and modifying it throughout that code. Decorator Pattern According to the GoF book, Decorator Pattern should “Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.” Factory Pattern Ac...