Design-Patterns In Java

adplus-dvertising
Introduction of Design-Patterns In Java

Design pattern is a proven design solution to a common problem faced by software developers. Design Patterns are about design and interaction of objects. Design patterns became popular with the rise of object oriented analysis and design (OOAD). They provide a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.

Design patterns are designed to help developers deliver higher quality, more easily maintained software products in less time and at lower cost. Design Patterns can solve problems by providing a framework for building a cleaner and more efficient application. classification of design patterns

Types of Design Pattern

    There are three design pattern

  1. Behavioral design patterns
  2. Creational design patterns
  3. Structural design patterns
Behavioral design patterns

Behavioral Patterns define the behavior of the classes involved. The popular behavioral patterns include Chain of R esponsibilities, Interpreter, Mediator, Iterator, Observer, etc and it characterize the manner of class and object interaction and how responsibilities are distributed among them. Observer pattern involves a one-many dependency between objects where a change in an object(subject) needs to be notified to all it's dependents(observers).

Creational design patterns

This is a very popular creational pattern which restricts a class to have only one instance and it is address the object creation process. Creational design patterns encapsulate knowledge about how, when, and by whom an instance is created.

Structural design patterns

Address the composition of classes and objects.Structural patterns depend on the structure of the classes involved. There are many structural patterns like Adapter, Builder, Decorator, etc.

Design Patterns on the .NET Platform

There are following of the design patterns used with .NET

A) Creational Patterns

  1. Factory Method
  2. Abstract Factory
  3. Builder
  4. Prototype
  5. Singleton

B) Structural Patterns

  1. Adapter
  2. Bridge
  3. Composite
  4. Proxy

C) Behavioral Patterns

  1. Iterator
  2. Observer
Advantage of Design Pattern
  1. Enable large scale reuse of S/W
  2. Helps in improve developer communication.They consume more memory because of generalised format they are written, to store any kind of data.
  3. capture expert knowledge and design trade-offs and make expertise widely available
  4. Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns.
  5. A standard solution to a common programming problem enable large scale reuse of S/W
Disadvantage of Design Pattern
  1. Do not lead to direct code reuse
  2. Complex in nature and Design patterns may increase or decrease the understandability of a design or implementation.
  3. they are deceptivrly simple.
  4. they are validated by experince and discussion.
  5. They can decrease understandability by adding indirection or increasing the amount of code.