design - Abstract Factory method practice or usage of abstract factory pattern in an API -
first of sorry may sound quite stupid while asking this.
i want understand practical usage of abstract design pattern. apis have implemented pattern , under use case.
one of use case strikes me di of objects need created using run time information.
i have understanding pattern used create object of various product families. every new product family have change existing factories. if there addition implementation of product family have provide new factory new implementation.
for example
i have products frame , textbox 2 types of os ( windows , mac). have 2 factories 1 each window , mac windowfactory returns textbox , frame windows , macfactory return same objects mac. want add os solar in case need write new factory returns corresponding objects solar.
how api use patterns in real world?
if using java can check entitymanagerfactory, has method create entitymanager, entity manager has different configuration depend on type of entitymanager (hibernate, openjpa, etc), entity manger has datasource created using factory pattern (db2 datasource, mysql, oracle, etc)
Comments
Post a Comment