Design Patterns Evolution

SelfSufficientRadon avatar
SelfSufficientRadon
·
·
Download

Start Quiz

Study Flashcards

22 Questions

What is the main difference between Abstract Factory and Builder?

Abstract Factory returns the product immediately, while Builder lets you run some additional construction steps before fetching the product.

What is the purpose of using Abstract Factory along with Bridge?

To encapsulate the relations between abstractions and implementations.

What is the problem that Builder pattern solves?

All of the above.

What is a possible alternative to Facade?

Abstract Factory.

What is the advantage of using Builder pattern?

It lets you produce different types and representations of an object using the same construction code.

What is a common implementation approach for Abstract Factories, Builders, and Prototypes?

As Singletons.

What is the main difference between Factory Method and Abstract Factory?

Factory Method is less complicated and more customizable via subclasses, while Abstract Factory is more flexible but more complicated.

What is the purpose of using Prototype with Abstract Factory?

To compose the methods on Abstract Factory classes.

What is the primary purpose of the Builder pattern?

To separate the construction and representation of an object

What is the benefit of using multiple builder classes in the Builder pattern?

It enables the use of different materials for building different objects

What do creational patterns provide in object-oriented design?

Object creation mechanisms that increase flexibility and reuse of existing code

What is the main goal of creational patterns?

To increase flexibility and reuse of existing code

What is a key characteristic of the Builder pattern?

It separates the construction and representation of an object

Who first described the concept of patterns?

Christopher Alexander

What is the role of the client code in the Builder pattern?

It calls the building steps in a specific order

What is an advantage of using the Builder pattern?

It allows for more flexibility in object creation

What is the name of the book that applied the concept of design patterns to programming?

Design Patterns: Elements of Reusable Object-Oriented Software

What is the relationship between the building steps and the builder classes in the Builder pattern?

The builder classes implement the building steps

How many patterns were featured in the book Design Patterns: Elements of Reusable Object-Oriented Software?

23

What is the nickname of the authors of the book Design Patterns: Elements of Reusable Object-Oriented Software?

The Gang of Four

What is the focus of structural patterns?

Assembling objects and classes into larger structures

How many groups of patterns are covered in this book?

3

Study Notes

Relations with Other Patterns

  • Many designs start with Factory Method and evolve to Abstract Factory, Prototype, or Builder for more flexibility and complexity.
  • Builder focuses on step-by-step construction of complex objects.
  • Abstract Factory specializes in creating families of related objects and returns the product immediately.
  • Abstract Factory can serve as an alternative to Facade when hiding object creation from client code.

Abstract Factory

  • Can be used with Bridge to encapsulate relations and hide complexity from client code.
  • Can be implemented as a Singleton.

Builder

  • A creational design pattern that constructs complex objects step by step.
  • Allows for different types and representations of an object using the same construction code.
  • Organizes object construction into a set of steps (e.g., buildWalls, buildDoor).
  • Users can call only necessary steps to produce a particular configuration of an object.
  • Different builders can implement the same set of building steps to produce various representations of the product.

Design Patterns

  • Providing object creation mechanisms that increase flexibility and reuse of existing code.
  • Structured into three main groups: Creational, Structural, and Behavioral patterns.
  • Creational patterns provide object creation mechanisms.
  • Structural patterns explain how to assemble objects and classes into larger structures.
  • Behavioral patterns take care of effective communication and assignment of responsibilities between objects.

History of Design Patterns

  • The concept of patterns was first described by Christopher Alexander in "A Pattern Language: Towns, Buildings, Construction".
  • Applied to programming by Erich Gamma, John Vlissides, Ralph Johnson, and Richard Helm in "Design Patterns: Elements of Reusable Object-Oriented Software" (1995).
  • "The Gang of Four" (GOF) book featured 23 patterns and became a bestseller.
  • Dozens of other object-oriented patterns have been discovered since then.

This quiz explores the relationships between design patterns such as Factory Method, Abstract Factory, Prototype, and Builder. It discusses how one pattern can evolve into another and their key differences.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser