Which two statements are true?
A.
Implementing a DAO often includes the use of factory.
B.
To be implemented properly, factories rely on the private keyword.
C.
Factories are an example of the OO principle “program to an interface.”
D.
Using factory prevents your replication from being tightly coupled with a specific Singleton
E.
One step in implementing a factory is to add references from all the classes that the factory will
merge.
Explanation:
A: The DAO design pattern completely hides the data access implementation from
its clients. The interfaces given to client does not changes when the underlying data source
mechanism changes. this is the capability which allows the DAO to adopt different access scheme
without affecting to business logic or its clients. generally it acts as a adapter between its
components and database. The DAO design pattern consists of some factory classes, DAO
interfaces and some DAO classes to implement those interfaces.
C: The essence of the Factory method Pattern is to “Define an interface for creating an object, but
let the classes which implement the interface decide which class to instantiate. The Factory
method lets a class defer instantiation to subclasses.”
Note:The factory method pattern is an object-oriented design pattern to implement the concept
of factories. Like other creational patterns, it deals with the problem of creating objects (products)
without specifying the exact class of object that will be created. The creation of an object often
requires complex processes not appropriate to include within a composing object. The object’s
creation may lead to a significant duplication of code, may require information not accessible to
the composing object, may not provide a sufficient level of abstraction, or may otherwise not be
part of the composing object’s concerns. The factory method design pattern handles these
problems by defining a separate method for creating the objects, whichsubclasses can then
override to specify the derived type of product that will be created.
Some of the processes required in the creation of an object include determining which object to
create, managing the lifetime of the object, and managing specialized build-up and tear-down
concerns of the object.