Skip to content

Types of Patterns

S.N. Pattern & Description
1 Creational Patterns These design patterns provide a 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. Eg: Factory, Singleton etc.
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. Eg: Adapter, Bridge etc.
3 Behavioral Patterns These design patterns are specifically concerned with communication between objects. Eg: Observer, Iterator etc.
4 J2EE Patterns These design patterns are specifically concerned with the presentation tier. These patterns are identified by Sun Java Center.

Difference between Design Pattern and Framework

Pattern

A pattern is a way of doing something, or a way of pursuing intent. This idea applies to cooking, making fireworks, developing software, and to any other craft. It is a solution to a problem in a context.
Patterns are classified into:

  1. Design Pattern,
  2. Architectural Pattern,
  3. Macro – Architecture,
  4. Micro – Architecture,
  5. Idioms or Coding Patterns,
  6. Language Paradigms etc.

Design Pattern

Design pattern is a category of patterns that deals with object oriented software. They represent solutions to problems that arise when developing software within a particular context. Design pattern captures the static and dynamic structure and collaboration among key participants in software designs. They can be used across different domains.

Framework

Framework is made up of group of concrete classes which can be directly implemented on an existing platform. Frameworks are written in programming languages. It is a large entity comprising of several design patterns. Frameworks are concerned with specific application domain e.g. database, web application etc.

Above definition very much clarifies the difference among three. A design pattern is a type of pattern and is more like a concept, whereas a framework is something already coded to be used repetitively.

Eg: MVC is a design pattern. "MVC frameworks" is shortcut for "frameworks that follow MVC design pattern".