Singleton

Singleton is also a very popular design pattern, although when not used appropriately it does become an anti- pattern. It is used when we need an object to be unique and easily accessible from all parts of the application e.g. database handler or loggers are frequently used. It is often considered an anti-pattern because is...

Callback

Callback design pattern allows us to avoid "freezing" the rest of the application if a method takes too long to return. It is very useful if running computationally-expensive or time unpredictable methods. It does generally involve running in a separate thread/task. The solution involves creating IXCallback interface which contains method called whn the slow operation...

Factory

Factory is one of the most popular design pattern out there. It is used to simply creation of the objects of different classes that inherit from a common super-class (or interface X) depending on some condition. The Recipe In order to create a factory for a class X: Create an XFactory class Add an X...

Command Stack

Command stack is a design patter if we need to support for undo/redo operations. There are two aspects to this design pattern ICommand interface where we can define the behaviour of the execution and undo operation and a CommandStack which is a generic. Create an ICommand interface with methods execute() and undo() All undoable/redoable actions...

Listener Design Pattern

Listener design pattern (also known as Subscriber/Observer) is a 'well-proven' technique for asynchronous message passing. It is used when the client needs to be notified when 'something interesting' happens to another object (of class X) in a passive manner (i.e. the client is not checking every so often (pulling) in the state has changed). The...

Introduction

Engineers are lazy. Design Patters are a way of reusing some well proven techniques to solve problems. The are sort of templates for solving problems but not complete solutions. There are 4 key types of design patters: Creational Structural Behavioral Concurrency In this category, I will share some of my experience in the area of...