SOFTWARE ENGINEERING

SOFTWARE DESIGN

DESIGN PATTERNS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What pattern can we use when our code shouldn’t depend on the concrete classes of objects that we need to copy.
A
Chain of Responsibility
B
Prototype
C
Builder
D
Abstract Method
Explanation: 

Detailed explanation-1: -Use the Prototype pattern when your code shouldn’t depend on the concrete classes of objects that you need to copy.

Detailed explanation-2: -Visitor lets you define a new operation without changing the classes of the elements on which it operates. The Visitor Design Pattern is a way of separating an algorithm from an object structure.

Detailed explanation-3: -Factory Method Design Pattern The Factory Design Pattern or Factory Method Design Pattern is one of the most used design patterns in Java. According to GoF, this pattern “defines an interface for creating an object, but let subclasses decide which class to instantiate.

Detailed explanation-4: -Prototype design pattern is used when the Object creation is a costly affair and requires a lot of time and resources and you have a similar object already existing. Prototype pattern provides a mechanism to copy the original object to a new object and then modify it according to our needs.

There is 1 question to complete.