Gof Flashcards
Which pattern restricts the initialization of a class to ensure that only one instance of the class can be created?
Singleton
Which pattern takes out the responsibility of instantiating a object from the class to a new class with only this responsibility?
Factory
Which pattern create a Factory for factory classes?
Abstract Factory
Which creates an object step by step and a method to finally get the object instance?
Builder
Which pattern creates a new object instance from another similar instance and then modify according to our requirements?
Prototype
Which pattern creates an interface so that two distinct interfaces can work together?
Adapter
Which pattern creates an interface with multiple pieces or leaves in a part-whole?
Composite (FileSystemItem -> File, Directory that contains files)
Which pattern creates a new object that controls an object?
Proxy (Functionality -> AdminFunctionality)
Which pattern caches objects so that they do not need to be instantiated again for the same functionality?
Flyweight
Which pattern creates an interface so that it lowers complexity of its parts?
Facade (SoundSystem, TvSystem -> HomeTheaterFacade)
Which pattern creates an abstraction so that both implementations and interfaces can grow separately?
Bridge
abstract vehicle - bus,bike
interface WorkShop - produce, assemble)
Which pattern creates an abstract class that defines the skeleton and passes the responsibility of implementing some steps to the subclasses?
Template
(Abstract BuildHouse -> GlassHouse, WoodenHouse)
Which pattern abstract communications between objects, decoupling them into a single interface?
Mediator
Which pattern decouples client requests that follow a order so that each step is not coupled?
Chain of responsibility
(ATM dispenser with 50DollarDispense, 20DollarDispense, etc)
Which pattern makes objects be notified of changes made to their interested objects?
Observer
interface Observer -> class YtSubscriber
interface Subject -> class YtChannel