Introduction Flashcards
What are the three types of design patterns?
Creational, structural and behavioral.
What are the most common patterns?
Abstract factory, adapter, composite, decorator, factory method, observer, strategy and template method.
What are the essential four elements of a design pattern?
Name, the problem, the solution and the consequences.
What’s a signature?
The method name, its parameters and the return value.
What’s an interface?
A set of all signatures defined by an interface type.
What’s dynamic binding?
It means you’re not committing to an object implementation until runtime.
What’s polymorphism?
Allows you to substitute implementations in run time.
What’s an object?
An instance of a class.
What’s an abstract class?
It will defer some or all of the implementations.
What’s a concrete class?
Class that implements all methods. Differently than abstract classes.
What are the disadvantage of inheritance?
Class inheritance is defined at compile time, not runtime;
it breaks encapsulation;
And changing parent classes may impact child classes.
What are the advantages of inheritance?
Straightforward to use and easy to modify parent’s functionality.
What are the advantages of composition?
Defined at run time;
Do not break encapsulation;
Objects can be changed freely as long they implement the same interface;
Promove loose-coupled system
What are the oriented object principles?
Program to an interface, not an implementation;
Favor object composition over inheritance;
What’s a delegation?
It’s when you simply forward the request to a private composite class and return its return.