Which two valid alternatives to line 3 would decouple this application from a specific
implementation of CustomerDAO?
A.
CustomerDAO custDao = CustomerDAO();
B.
CustomerDAO custDao = (CustomerDAO) new Object ();
C.
CustomerDAO custDao = CustomerDAO.getInstance();
D.
CustomerDAO custDao = (CustomerDAO) new CustomerDAOmemoryImp1();
E.
CustomerDAO custDao = customerDAOFactory.getInstance();
Explanation:
Note: In software development, the term”decoupling”is used to identify the separation of software
blocks thatshouldn’t depend on each other. Some building blocks are generic and shouldn’t know
details of others.
Special design techniques allow software designers to have as few dependencies as possible.
This typicallyreduces the risk of malfunction in one part of a system when the other part changed.
It also forces thedeveloper to focus on one thing at a time.
Decoupling lowers or minimizes Coupling.
Should be D and E
D is impossible
C, E
D.E is correct
D is correct
because it has implemented CustomerDAO