State Pattern
State Pattern State pattern allows an object to alter its behavior when its internal state changes and the object will appear to change its class. For explaining state pattern lets consider the example of a Turnstile at public transportation entrance for subway, where we can use our subway card so that turnstile unlocks provided there... » read more
Singleton Pattern
Singleton Pattern The Singleton pattern ensures class has only one instance and provides a global access to it. In other words, it says that singleton pattern makes it impossible to instantiate the class except for the first time and whenever you want an instance you must use the same instance. There is a good argument... » read more
Null Object Pattern
If something is null in the program it means we have two paths one path on which we do something in the program when it is null another path is the one when it’s not null. The problem is this type of branching as soon as something is null, we must check that value everywhere... » read more
Decorator Pattern
Decorator Pattern Imagine there is an object where if we send a message Speak () to the object returns “Hello World” as response. Decorator pattern says that if I want to change the behavior of the object, I can do so without changing the contents of the object at run time. Decorator pattern wraps the... » read more
Observer Pattern
Observer Pattern We have one object whose state keeps changing and there is another object which wants to know whenever the state has been changed. Think of something like an RSS client which wants to know when a new article has been published or a broadcast message which delivers to all the recipients. Push Vs... » read more