Computer Science: Design Patterns
Gang of Four design patterns — creational, structural, and behavioral patterns.
Study these flashcards with spaced repetition
Track your progress, master difficult cards, and export to Anki. Free to start.
Start Studying — FreeFlashcards in This Deck
What is the primary purpose of the Singleton design pattern?
The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance throughout the application.
Which design pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified automatically?
The Observer pattern, often used in event-driven systems or the Model-View-Controller (MVC) architecture.
What structural pattern provides a simplified, high-level interface to a complex set of interfaces in a subsystem?
The Facade pattern, which hides the complexities of the system and provides an interface to the client that is easier to use.
Which creational pattern allows an object to be created by copying an existing instance rather than creating a new one from scratch?
The Prototype pattern, which uses a 'clone' method to duplicate objects, avoiding the overhead of standard construction.
What is the main goal of the Adapter pattern?
To allow classes with incompatible interfaces to work together by wrapping the original interface in a new interface that the client expects.
Which behavioral pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation?
The Iterator pattern, which abstracts the traversal logic away from the collection itself.
How does the Builder pattern differ from other creational patterns regarding the construction process?
It separates the construction of a complex object from its representation, allowing the same construction process to create different representations step-by-step.
In the Decorator pattern, how is behavior added to an object compared to traditional inheritance?
Behavior is added dynamically at runtime by wrapping the object in another class (the decorator), rather than statically through subclassing.
What is the primary difference between the Factory Method and the Abstract Factory pattern?
Factory Method uses inheritance to decide which object to instantiate (one product), while Abstract Factory uses composition to create families of related or dependent objects.
Which structural pattern uses a surrogate or placeholder for another object to control access to it?
The Proxy pattern, which can be used for lazy initialization, logging, access control, or remote service communication.
+10 more cards — sign up to see all
Frequently Asked Questions
How many flashcards are in this Computer Science: Design Patterns deck?
This deck contains 20 flashcards with a mix of difficulty levels: 6 easy, 10 medium, and 4 hard cards.
Is this flashcard deck free to use?
Yes! You can study these flashcards for free with our spaced repetition system. Create a free account to track your progress and save your study history.
Can I export these flashcards to Anki?
Pro users can export any deck to Anki (.apkg format) with one click. Free users can export to CSV. Start studying for free and upgrade when you need Anki export.
What is spaced repetition?
Spaced repetition is a study technique that shows you cards at increasing intervals based on how well you know them. Cards you struggle with appear more often, while mastered cards are shown less frequently. This is proven to be one of the most effective ways to memorize information.
Related Flashcard Decks
Ready to study?
Create a free account and start studying these flashcards with spaced repetition.
Get Started — Free