lec 37: structural design patterns

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:14 PM on 4/13/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

22 Terms

1
New cards

What is the main problem Bridge solves?

It prevents abstraction and implementation from being permanently bound together.

2
New cards

What is the definition of Bridge?

Decouple an abstraction from its implementation so that the two can vary independently.

3
New cards

What is the key issue in the list example before using Bridge?

Adding refinements like PrintableList or VerboseList creates many subclasses for each implementation.

4
New cards

Why is the inheritance-only solution bad in the list example?

It causes code duplication and a complex inheritance hierarchy.

5
New cards

What are the abstraction-side classes in the list example?

List, PrintableList, and VerboseList.

6
New cards

What are the implementation-side classes in the list example?

ListImpl, ArrayListImpl, and SetListImpl.

7
New cards

What is the Abstraction in the pattern?

The high-level interface seen by the client.

8
New cards

What is the Implementor in the pattern?

The separate implementation interface used by the abstraction.

9
New cards

What key design relationship does Bridge use?

The abstraction holds a pointer/reference to an implementor object.

10
New cards

In the list example, what does List store?

A pointer to ListImpl.

11
New cards

What does PrintableList do?

It refines the abstraction by printing the list in a nice formatted way.

12
New cards

What does VerboseList do?

It refines the abstraction by printing debug messages when methods are called.

13
New cards

What does ListImpl define?

The low-level operations like add, remove, contains, get, and size.

14
New cards

What is ArrayListImpl?

A concrete implementor using an array-based structure.

15
New cards

What is SetListImpl?

A concrete implementor using a set-based structure.

16
New cards

Why do PrintableList with ArrayListImpl and PrintableList with SetListImpl produce different output?

Because the underlying implementations behave differently.

17
New cards

When should Bridge be used?

When abstraction and implementation both need to be extensible and vary independently.

18
New cards

What is one consequence of Bridge?

It decouples interface and implementation.

19
New cards

What is another consequence of Bridge?

It can potentially allow implementation changes at runtime.

20
New cards

What is another consequence of Bridge?

It hides implementation details from clients.

21
New cards

How is Bridge different from Strategy?

Bridge separates abstraction from implementation, while Strategy provides interchangeable algorithms.

22
New cards

What is the easy memory trick for Bridge?

Bridge separates what something is from how it is implemented.