💻Step 26:Design Patterns -23th hour + code


💡1-Creational Patterns

These design patterns provides way to create objects while hiding the creation logic, rather than instantiating objects directly using new operator. This gives program more flexibility in deciding which objects need to be created for a given use case.

Abstract Factory

Sets of methods to make various objects.


Make and return one object various ways.

Factory Method

Methods to make and return components of one object various ways.


Make new objects by cloning the objects which you set as prototypes.


A class distributes the only instance of itself.

💡2-Structural Patterns

These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities.


A class extends another class, takes in an object, and makes the taken object behave like the extended class.


An abstraction and implementation are in different class hierarchies.


Assemble groups of objects with the same signature.


One class takes in another class, both of which extend the same abstract class, and adds functionality.


One class has a method that performs a complex process calling several other classes.


The reusable and variable parts of a class are broken into two classes to save resources.


One class controls the creation of and access to objects in another class.

💡3-Behavioral Patterns

These design patterns are specifically concerned with communication between objects.

Chain Of Responsibility

A method called in one class can move up a hierarchy to find an object that can properly execute the method.


An object encapsulates everything needed to execute a method in another object.


Define a macro language and syntax, parsing input into objects which perform the correct opertaions.


One object can traverse the elements of another object.


An object distributes communication between two or more objects.


One object stores another objects state.


An object notifies other object(s) if it changes.


An object appears to change its` class when the class it passes calls through to switches itself for a related class.


An object controls which of a family of methods is called. Each method is in its` own class that extends a common base class.


An abstract class defines various methods, and has one non-overridden method which calls the various methods.


One or more related classes have the same method, which calls a method specific for themselves in another class.

💡4-J2EE Patterns

These design patterns are specifically concerned with the presentation tier. These patterns are identified by Sun Java Center.

MVC Pattern

Intercepting Filter pattern

Business Delegate Pattern

Service Locator pattern

Composite Entity Pattern

Transfer Object pattern

Data Access Object Pattern


Front Controller Pattern


Interview Questions —

  • What is advantage of design pattern in programming?
  • What is factory pattern?
  • What is singleton pattern?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.