Powered by Blogger.

Monday 4 January 2021

Design Patterns

No comments :
Introduction
Software Design Patterns can be defined as a software template or a description to solve a problem that occurs in multiple instances while designing a software application or a software framework. It is use to represent some of the best practices by experienced object oriented software developments.
Type of Design Patterns?
  1. Creational Design Patterns.
  2. Structural Design Patterns.
  3. Behavioral Design Patterns.
  4. JEE Design Patterns.
1> Creational Design Patterns:- Creational Design Patterns are concerned with the method of creating objects.
Type of Creational Design Patterns.
  1. Factory Design Patterns.
  2. Abstract factory Design Patterns.
  3. Singleton Design patterns.
  4. Prototype Design Patterns.
  5. Builder Design Patterns.
  6. Object pool Design Patterns.
2> Structural Design Patterns:- Structural Design Patterns deal with the composition of classes and objects which from larger structures.
Type of Structure Design Patterns.
  1. Façade Design Patterns.
  2. Bridge Design Patterns.
  3. Composite Design Patterns.
  4. Decorator Design Patterns.
  5. Adapter Design Patterns.
  6. Flyweight Design Patterns.
  7. Proxy Design Patterns.
  8. Filter Design Patterns.
3> Behavioral Design Patterns:- Behavioral Design Patterns are concerned with the responsibility and interaction between the objects.
Type of Behavioral Design Patterns.
  1. Strategy Design Patterns.
  2. Iterator Design Patterns.
  3. Mediator Design Patterns.
  4. Command Design Patterns.
  5. State Design Patterns.
  6. Observer Design Patterns.
  7. Template Design Patterns.
  8. Visitor Design Patterns.
4> JEE Design Patterns:- It is providing solutions to the JavaEE based Software Applications and frameworks.
Type of JEE Design Patterns.
  1. Transfer object Design Patterns.
  2. MVC Design Patterns.
  3. Dependency Injection Design Patterns.
  4. DAO (Data Access Object) Design Patterns.
  5. Business Design Patterns.
  6. Intercepting Filter Design Patterns.
  7. Service Object Patterns.

Factory Design Patterns

No comments :
Introduction
Factory Design Patterns follows the principal of “Define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate”. The factory design Pattern is also known as virtual constructor.
Example:
We have three Milk Brand that describes the cost. Here we have three different Milk Brands namely, AMUL, SUDHA, AAVIN, along with their rate. Let us find milk brand of sale an each packet.

Public String MilkBrandCost(Stirng productame){
if(productame == null){  
             return null;  
            }  
If(productame.equals("AMUL")){
return "AMUL DARY and MRP:28";
}

If(productame.equals("SUDHA")){
return "SUDHA DARY and MRP:23";
}

If(productame.equals("AAVIN")){
return "AAVIN DARY and MRP:25";
}

}
....
return null;