1/21
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is the main problem Bridge solves?
It prevents abstraction and implementation from being permanently bound together.
What is the definition of Bridge?
Decouple an abstraction from its implementation so that the two can vary independently.
What is the key issue in the list example before using Bridge?
Adding refinements like PrintableList or VerboseList creates many subclasses for each implementation.
Why is the inheritance-only solution bad in the list example?
It causes code duplication and a complex inheritance hierarchy.
What are the abstraction-side classes in the list example?
List, PrintableList, and VerboseList.
What are the implementation-side classes in the list example?
ListImpl, ArrayListImpl, and SetListImpl.
What is the Abstraction in the pattern?
The high-level interface seen by the client.
What is the Implementor in the pattern?
The separate implementation interface used by the abstraction.
What key design relationship does Bridge use?
The abstraction holds a pointer/reference to an implementor object.
In the list example, what does List store?
A pointer to ListImpl.
What does PrintableList do?
It refines the abstraction by printing the list in a nice formatted way.
What does VerboseList do?
It refines the abstraction by printing debug messages when methods are called.
What does ListImpl define?
The low-level operations like add, remove, contains, get, and size.
What is ArrayListImpl?
A concrete implementor using an array-based structure.
What is SetListImpl?
A concrete implementor using a set-based structure.
Why do PrintableList with ArrayListImpl and PrintableList with SetListImpl produce different output?
Because the underlying implementations behave differently.
When should Bridge be used?
When abstraction and implementation both need to be extensible and vary independently.
What is one consequence of Bridge?
It decouples interface and implementation.
What is another consequence of Bridge?
It can potentially allow implementation changes at runtime.
What is another consequence of Bridge?
It hides implementation details from clients.
How is Bridge different from Strategy?
Bridge separates abstraction from implementation, while Strategy provides interchangeable algorithms.
What is the easy memory trick for Bridge?
Bridge separates what something is from how it is implemented.