In this tutorial I am going to explain about the adapter design pattern as part of the design patterns in Java series. Adapter design pattern is one of the structural design pattern because adapter design deals with how we make / structure an object. The primary problem this pattern trying to solve is to make …
Design Patterns
Builder Design Pattern
In this tutorial I am going to explain about builder design pattern, this is one of the most widely used design pattern in Java. Builder design pattern comes under the creational design pattern since builder design pattern helps in creating an object using step-by-step approach. Subscribe to our future updates. Builder design pattern solves the problem …
State Design Pattern In Java
This tutorial explains the state design pattern with a simple example program. State design pattern is very similar to the Strategy pattern, the only difference is that state design pattern maintains the state of the context where as strategy pattern passes the context and execute the specific strategy. The state design pattern is very useful …
Design Patterns in Java
In developing a system, it is expected that some requirements are guaranteed, for example, performance, robustness, understanding, ease of reuse, modification, and use. The Design Patterns were created by the architect Christopher Alexander , in the 1970s. During this period the architect wrote two books: “Pattern Language” and “Timeless Way of Building“. These books were an example of …
Lazy Initialization, Singleton Pattern and Double Checked locking
Lazy Initialization Lazy Initialization is a technique where one postpones the instantiation of a object until its first use. In other words the instance of a class is created when its required to be used for the first time. The idea behind this is to avoid unnecessary instance creation. But there are concerns related to …
Design Patterns Interview Questions
1) What is a software design pattern? A design pattern is a solution to a general software problem within a particular context. Context : A recurring set of situations where the pattern applies. Problem : A system of forces (goals and constraints) that occur repeatedly in this context. Solution : A description of communicating objects …
Strategy Design Pattern In Java
Strategy design pattern falls under the category of Behavioural patterns. Assume that we have an object and its behavior is largely dependent on the state of its internal variables. Strategy pattern allows, object to behave in different ways depends on the internal state. Strategy pattern is defined in the book Gang of four is, Allows an …