0

Factory design pattern advantages

Hello I am aware that factory design patterns help us to create a method to create objects... I could not understand how client code is not required to change and all similar terms for this design pattern.... can anyone please help me to understand this in detail?

1st Jun 2019, 12:53 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
4 odpowiedzi
0
Refer below link : https://www.geeksforgeeks.org/design-patterns-set-2-factory-method/ Here in both the way, hard-coding is already there.... in first approach, class constructor is having code to decide object type where as in factory design patterns, class static method decided object type.... if I am codder, what could be differentiated for me to change in class constructor or class method... code change is required at all in case of new addition of object type.... what benifit I could get by defining objects type instantiation into a class method...
1st Jun 2019, 1:00 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
any thoughts on the same ?
11th Jun 2019, 3:12 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
shubham kumar plz don't spam... Is this code relevant to the question , if not don't post it here
21st Jul 2020, 6:17 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
21st Jul 2020, 1:00 AM
shubham kumar
shubham kumar - avatar