Code Pumpkin

Tag Archives: Design Patterns

Observer Design Pattern

June 7, 2017
Posted by Pumpkin

Observer Design Pattern is one of the Behavioral Design Pattern. Observer design pattern is useful when you are interested in the state of an object and want to get notified whenever there is any change.  Definition GoF Definition : The Observer Design Pattern defines a one-to-many dependency between objects so that when one object changes state, all […]

Builder Design Pattern

April 27, 2017
Posted by Pumpkin

Builder design pattern is a creational design pattern like Factory Pattern and Abstract Factory Pattern. For better understanding of  any  design pattern, You should know the problems faced by programmers before that design pattern was introduced. What are the traditional ways of creating an object of a class? We can provide either constructor or a static factory method to get the object  of […]

How to create Immutable Class in Java

Immutable class is a class which once created, it's contents can not be changed. In other words, Immutable objects are the objects whose state can not be changed once constructed.  In Java, String and all the wrapper classes e.g. Boolean, Integer, Long, etc are immutable classes. We can also create our own immutable class.  Why should we write Immutable Classes? Here are […]

Producer Consumer Design Pattern

April 5, 2017
Posted by Pumpkin

Producer Consumer Problem is a classical concurrency problem. In fact it is one of the concurrency design pattern.  It is also known as the bounded-buffer problem. The problem describes two processes, the producer and the consumer, who share a common, fixed-size buffer used as a queue. The producer's job is to generate data and put it into […]

Producer Consumer Design Pattern using BlockingQueue

April 5, 2017
Posted by Pumpkin

Producer Consumer Problem is a classical concurrency problem. In fact it is one of the concurrency design pattern.   This article is continuation of my post Producer Consumer Design Pattern in which I have explained basic idea, real life example, uses and benefits of Producer Consumer Design Pattern.   Producer Consumer Design Patter can be implemented using […]

Producer Consumer Design Pattern using wait() and notify()

April 3, 2017
Posted by Pumpkin

Producer Consumer Problem is a classical concurrency problem. In fact it is one of the concurrency design pattern.   This article is continuation of my post Producer Consumer Design Pattern in which I have explained basic idea, real life example, uses and benefits of Producer Consumer Design Pattern.   Producer Consumer Design Patter can either be implemented […]

Singleton Design Pattern

In Design Pattern article, we have seen different types of design patterns. In this article, we will understand one of the simplest Creational Design Pattern i.e. Singleton Design Pattern. What is the purpose of Singleton? The purpose of the singleton class is to control object creation, limiting the number of objects to only one. The singleton allows only […]

Design Patterns

April 2, 2017
Posted by Pumpkin

Design Patterns is general repeatable solution to a commonly occurring problem in software design. Rather we should call it a solution template as it will provide the standard to implement the solution not the code directly. In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides (known as Gang of Four) published a book […]

Next posts
Total Posts : 88
Contribute Your Articles

Interview Experiences

Subscribe Us

Like Us On Facebook