In what situation factory design patterns,DAO design
patterns,singleton design patterns should be applied.?

Answer Posted / rajan

Unlike constructors, factory methods are not required to
create a new object each time they are invoked. Factory
methods can encapsulate the logic required to return a
singleton instance of the class requested, or they can
return an instance of the requested class from a pool of
instances.
Factory methods can return any subtype of the type
requested, and can require that clients refer to the
returned object by its interface, rather than the
implementation class. This enables an API to return objects
without making their classes public.
The class for the object returned by a factory method need
not even exist at the time the factory method is written.
This is one of the classic benefits of polymorphism: "old
code uses new code," which means that new classes can be
added, and their instances returned by the factory method,
without changing any of the existing code.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between data abstraction and encapsulation?

617


What is abstraction oop?

625


Plese get me a perfect C++ program for railway/airway reservation with all details.

3429


Describe these concepts: Polymorphism, Inheritance and Abstraction.

614


What is the difference between a constructor and a destructor?

613






What is polymorphism explain?

691


How do you achieve runtime polymorphism?

571


How is polymorphism achieved?

584


What polymorphism means?

622


Why do we need oop?

671


Is abstract thinking intelligence?

594


What is polymorphism programming?

605


What is data binding in oops?

586


what's the basic's in dot net

1738


Why is abstraction needed?

567