dp factory pattern introduction as per wikipedia"the factory pattern is creational design pattern used in software development to encapsulate the processes involved in the creation of objects factory pattern involves creating super class which provides an abstract interface to create objects of particular typebut instead of taking decision on which objects get created it defers this creation decision to its subclasses to support this there is creation class hierarchy for the objects which the factory class attempts create and return factory pattern is used in cases when based on --type|got as an input at runtimethe corresponding object has to be created in such situationsimplementing code based on factory pattern can result in scalable and maintainable code to add new typeone need not modify existing classesit involves just addition of new subclasses that correspond to this new type in shortuse factory pattern whena class does not know what kind of object it must create on user' request you want to build an extensible association between this creater class and classes corresponding to objects that it is supposed to create an example would be better way to understand the above context www testingperspective com