lec 30: design patterns: creational design, part 5

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

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:36 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

11 Terms

1
New cards

What is the Prototype pattern?

A pattern that creates new objects by copying an existing prototype.

2
New cards

What problem does Prototype solve in the slides?

Configuration objects are expensive to load, but we sometimes need duplicates.

3
New cards

Why is reloading the configuration each time a bad idea?

Because it is expensive and slow.

4
New cards

Why can’t the client just use the copy constructor through AppConfig?

Because AppConfig is abstract.

5
New cards

What method is added to the base class in Prototype?

A virtual clone() method.

6
New cards

What does FileConfig::clone() do?

It returns new FileConfig(*this).

7
New cards

What does DatabaseConfig::clone() do?

It returns new DatabaseConfig(*this).

8
New cards

When is Prototype especially useful?

When objects are expensive to create but easy to copy.

9
New cards

What advantage does Prototype give clients?

Clients can clone objects without knowing their exact concrete types.

10
New cards

How is Prototype different from Abstract Factory?

Prototype allows more flexible mixes by cloning prototypes, while Abstract Factory creates related families of products.

11
New cards

What is one consequence of Prototype?

It may reduce the need for subclassing or large factory hierarchies.