Core java
- 29 September
Builder design pattern in java
Builder design pattern allows to create complex object step by step and also enforces a process to create an object as a finished product.Construction of object should be such that same construction process can create different representations.Director controls the construction of object and only director knows what type of object to create. For example, You […]
- 28 September
Proxy design pattern in java
CodeProjectProxy design pattern allows you to create a wrapper class over real object.Wrapper class which is proxy,controls access to real object so in turn you can add extra functionalities to real object without changing real object’s code. As described by GoF: “Provide a surrogate or placeholder for another object to control access over it.” Real […]
- 19 September
Composite design pattern in java
CodeProjectComposite design patten allows you to have a tree structure and ask each node in the tree structure to perform a task.You can take real life example of a organization.It have general managers and under general managers, there can be managers and under managers there can be developers.Now you can set a tree structure and […]
- 19 September
Adapter design pattern in java
CodeProjectReal life example: A very simple example is using phone charger. Suppose your mobile phone needs 9 Volts of supply to get charged but main supply is 220 V which is not what you require but it can be a source and you can have something that can get 9 V out of this 220 […]
- 19 September
Bridge design pattern in java
As stated by Gof: “Decouple an abstraction from its implementation so that the two can vary independently”.When there are inheritance hierarchies in both interface and implementation then you loose coupling because of interdependence.In other words,Decoupling interface from implementation and hiding implementation detail of abstraction from client is main objectives of bridge design pattern. Also known […]
- 12 July
Decorator Design Pattern
The Decorator design pattern attach additional responsibilities to an object dynamically.It is wrap up at another object.It will extend functionality of object without affecting any other object.Decorators provide a alternative to subclassing for extending functionality. Also known as: Wrapper When to use it: Use Decoraotor to add responsibilities to individual objects dynamically without affecting other […]