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.
2
Q
Program to an Interface, not an
Implementation
A
Program to an interface, not an implementation. Depend
on abstractions, not on concrete classes.
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.