Monday 4 January 2021
Design Patterns
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.
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?
- Creational Design Patterns.
- Structural Design Patterns.
- Behavioral Design Patterns.
- JEE Design Patterns.
Type of Creational Design Patterns.
- Factory Design Patterns.
- Abstract factory Design Patterns.
- Singleton Design patterns.
- Prototype Design Patterns.
- Builder Design Patterns.
- Object pool Design Patterns.
Type of Structure Design Patterns.
- Façade Design Patterns.
- Bridge Design Patterns.
- Composite Design Patterns.
- Decorator Design Patterns.
- Adapter Design Patterns.
- Flyweight Design Patterns.
- Proxy Design Patterns.
- Filter Design Patterns.
Type of Behavioral Design Patterns.
- Strategy Design Patterns.
- Iterator Design Patterns.
- Mediator Design Patterns.
- Command Design Patterns.
- State Design Patterns.
- Observer Design Patterns.
- Template Design Patterns.
- Visitor Design Patterns.
Type of JEE Design Patterns.
Factory Design Patterns
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.
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.
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;
Subscribe to:
Posts
(
Atom
)