Design patterns Flashcards
Study and internalize design patterns
What is dynamic binding?
Dynamic binding, also called dynamic dispatch, is the process of linking procedure call to a specific sequence of code (method) at run-time. Dynamic binding is also known as late binding or run-time binding. Dynamic binding is an object oriented programming concept and it is related with polymorphism and inheritance.
What are the 4 main tenets of OO?
Abstraction
Polymorphism
Inheritance
Encapsulation
What is polymorphism in OO?
A property of OO in which an abstraction operation may be performed in different ways in different classes, but share an interface.
Also can mean multiple methods of the same name but different signature.
What is an OCL
Object constraint language. A specification language designed to formally specify constraints in software modules. An OCL expression specifies a logical fact about the system that must remain true.
What is the Chain of Responsibility pattern? Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
What is the Command pattern?
Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
What design pattern avoids coupling the sender of a request to its receiver by giving more than one object a chance to handle the request?
Chain of Responsibility
What design pattern encapsulates a request as an object, thereby letting you parameterize clients with different requests?
Command pattern
What is the Interpreter pattern?
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
What design pattern, given a language, defines a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language?
Interpreter pattern
What is the Iterator pattern?
Provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
What design pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation?
Iterator pattern
What is the Mediator pattern?
Defines an object that encapsulates how a set of objects interact. Promotes loose coupling by keeping objects from referring to each other explicitly and it lets you vary their interactions independently.
What design pattern defines an object that encapsulates how a set of objects interact?
Mediator pattern
What is the Memento pattern?
Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restore to this state later.
What design pattern captures and externalize an object’s internal state so that the object can be restore to this state later?
Memento pattern
What is the Observer pattern?
Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
What design pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically?
Observer pattern
What is the State pattern?
Allows an object to alter its behavior when its internal state changes. The object will appear to change its class.
What design pattern allows an object to alter its behavior when its internal state changes?
State pattern
What is the Strategy pattern?
Defines a family of algorithms, encapsulates each one, and makes them interchangeable. Lets the algorithm vary independently from clients that use it.