SOFTWARE ENGINEERING

SOFTWARE DESIGN

DESIGN PATTERNS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Identify the aspects of your application that vary and separate them from what stays the same. What does that mean?
A
Define a super class for what varies and let what stays the same extend that super class.
B
Take what varies and “encapsulate” it so it won’t affect the rest of the code.
C
Put what varies and what stays the same together. Do it so that starting with an abstract class, all other classes inherit in a clever way.
D
The number of classes should be identical with the number of interfaces.
Explanation: 

Detailed explanation-1: -Encapsulating what varies is a technique that helps us handle frequently changing details. Code tends to get tangled when it is continuously modified due to new features or requirements. By isolating the parts which are prone to change we limit the surface area that will be affected by a shift in requirements.

Detailed explanation-2: -Strategy Pattern encapsulates interchangeable behaviors and uses delegation to decide which one to use. Observer Pattern allows objects to be notified when state changes.

Detailed explanation-3: -Loosely coupled designs allow us to build flexible object oriented systems that can handle change because they minimize the interdependency between objects. This principle can be seen in the observer pattern.

There is 1 question to complete.