Java Design Patterns
- 25 April
Strategy design pattern in java
In this post, we will see about Strategy design pattern in java. Strategy design pattern allows us to change algorithm implementation at runtime.Strategy design pattern provides multiple algorithms and client can choose algorithm based on their needs with the help of composition. Strategy design pattern example Let’s understand this with the help of simple example. […]
- 24 April
Singleton design pattern in java
In this post, we will see about Singleton design pattern in java. Singleton design pattern is one of the simplest design pattern but singleton property can be broken using multithreading, reflection, serialization etc, so you need to be careful while you create the singleton class. Singleton design pattern restricts a class to create multiple objects […]
- 14 July
How to use connection pool using service locator design Pattern in java
In this post, you will learn about the Connection Pool. This post is intended by java application development experts for entire development community to let people learn and acknowledge about Connection Pool and how to use its object using Service Locator design pattern. Introduction Connection pool is a mechanism which applicable for all technologies in […]
- 01 March
Template method design pattern in java
CodeProjectTemplate method pattern is a behavioral design pattern which provide base method for algorithm,called template method which defers some of its steps to subclasses So algorithm structure is same but some of its steps can be redefined by subclasses according to context. Template means Preset format like HTML templates which has fixed preset format.Similarly in […]
- 27 February
Observer design pattern in java
As the name suggests it is used for observing some objects.Observer watch for any change in state or property of subject.Suppose you are interested in particular object and want to get notified when its state changes then you observe that object and when any state or property change happens to that object,it get notified to […]
- 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 […]