+-+-+ +-+ +-+-+-+-+
|G|O| |4| |H|I|V|E|
+-+-+ +-+ +-+-+-+-+

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Factory Design Pattern

BY: @rakeshbecse | CREATED: April 1, 2018, 4:48 a.m. | VOTES: 0 | PAYOUT: $0.00 | [ VOTE ]

Factory Design Pattern:

It falls under Creational Design Pattern.

Factory pattern says that object creation will be handled by another class using the input type.

Advantages:

It allows loose-coupling.

When to use Factory Design Pattern?

Factory design pattern is used when we have a superclass with multiple sub-classes and based on the input, we need to return one of the sub-class.

Example: If a Restaurant serves Veg food, Non-Veg food, and Italian food. 

Treat VegFood, NonVegFood, and ItalianFood as three classes whose superclass is Food.

If a customer asks "Veg" then Factory method would return the "VegFood" class.

TAGS: [ #softwaredesignpatterns ] [ #java ] [ #factorydesignpattern ]

Replies

NO REPLIES FOUND.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>