SOFTWARE DESIGN PRINCIPLES Flashcards

1
Q

Encapsulate What Varies

A

Identify the aspects of your application that vary and separate them from what stays the same.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Program to an Interface, not an
Implementation

A

Program to an interface, not an implementation. Depend
on abstractions, not on concrete classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Favor Composition Over
Inheritance

A

A subclass can’t reduce the interface of the superclass.
When overriding methods you need to make sure that the new behavior is compatible with the base one.
Inheritance breaks encapsulation of the superclass
Subclasses are tightly coupled to superclasses.
Trying to reuse code through inheritance can lead to creating parallel inheritance hierarchies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly