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

Answer Posted / monica

Use Factory Design Pattern when
- a class cannot anticipate the class of objects it must
create
- a class wants its subclasses to specify the objects it
creates
- classes delegate the responsibility to one of several
helper subclasses and you want to knowledge of which helper
subclass is the delegate.

Use Singleton Pattern when
- there must be one instance of a class and it must be
accessible to clients from well known access point.
-the sole instance should be extensible by subclassing, and
client should be able to use an extended instance without
modifying their code.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstraction in oop with example?

646


Why is abstraction used?

608


What is abstraction in oop?

635


Why do we use class?

635


What are oops methods?

568






What is property in oops?

569


What are the components of marker interface?

602


What is purpose of inheritance?

645


What is the fundamental idea of oop?

638


What is use of overloading?

610


What is difference between abstraction and encapsulation?

594


what are the realtime excercises in C++?

2335


What is oops and its features?

587


What is encapsulation with real life example?

572


Is oop better than procedural?

574