Questions tagged [gang-of-four]

Originally refers to the authors of book "Design Patterns: Elements of Reusable Object-Oriented Software" whom are ErichGamma, RichardHelm, RalphJohnson, and JohnVlissides (aka the Gang-of-Four). Although the term is also used interchangeably as a reference to the collection of design patterns presented in the book.

The authors of the DesignPatternsBook came to be known as the "Gang of Four." The name of the book ("Design Patterns: Elements of Reusable Object-Oriented Software") is too long for e-mail, so "book by the gang of four" became a shorthand name for it. After all, it isn't the ONLY book on patterns. That got shortened to "GOF book", which is pretty cryptic the first time you hear it.

  • ErichGamma
  • RichardHelm
  • RalphJohnson
  • JohnVlissides

Source: Design Patterns Book

26 questions
1
vote
1 answer

How to use boost::flyweight as a GOF pattern?

I can't understand how to use boost::flyweight as a GOF pattern. Is there are exist example somewhere? For example, I expect it usage in the following way. There must be some flyweight container, that consist the "fat" objects. This container can…
AeroSun
  • 2,401
  • 2
  • 23
  • 46
0
votes
1 answer

Is this the best way to write my factory method

My intention is to make an empty virtual function in the base class. Redefine that function in the derived classes such that they return the particular subclass's object. createShapeObjects is the factory method here. What is the proper…
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
0
votes
2 answers

Why do some methods belong to the subject/observer interface, while others to the subject/observer concrete subclass?

From Design Pattern by Gang of Four Why are field observers, and methods Attach, Detach and Notify are in the interface Subject, while methods GetState and SetState and field SubjectState are in the concrete subclass ConcreteSubject? Why are the…
Tim
  • 1
  • 141
  • 372
  • 590
0
votes
2 answers

must a subclass of a singleton class be a singleton class?

According to Design Pattern by Gang of Four, a singleton class can have a subclass. Must a subclass of a singleton class be a singleton class? Can a singleton class have any number of subclasses? Thanks.
user3284469
0
votes
1 answer

What does "a class instantiates another" mean?

From Design Pattern by GoF: Another useful thing to show is which classes instantiate which others. We use a dashed arrowheaded line to indicate this, since OMT doesn't support it. We call this the "creates" relationship. The arrow…
Tim
  • 1
  • 141
  • 372
  • 590
0
votes
0 answers

How to make the comparison the responsibility of an object that's passed to the sorting routine by strategy pattern?

I started self learning design patterns from Design Patterns by Gang of Four Parameterized types give us a third way (in addition to class inheritance and object composition) to compose behavior in object-oriented systems. Many designs can…
user3284469
0
votes
1 answer

How to make comparison an operation implemented by subclasses and Template pattern?

I started self learning design patterns from Design Patterns by Gang of Four Parameterized types give us a third way (in addition to class inheritance and object composition) to compose behavior in object-oriented systems. Many designs can…
user3284469
0
votes
1 answer

Rx Subject Vs GoF Subject

How the Rx Subject and the Subject in GandOfFour Observer pattern are different?
wonderful world
  • 10,969
  • 20
  • 97
  • 194
0
votes
2 answers

Design Pattern - Fat adapter

We've implemented the adapter design pattern whose job is the following: Act as a liaison between service and data access layers. Convert raw data (from data source, internal or external) to domain specific data. Do necessary validation and…
Abhijit Sarkar
  • 21,927
  • 20
  • 110
  • 219
0
votes
1 answer

Gang of four patterns usage in automation frameworks

I would like to know which Gang of four design patterns may have important applications when developing an automation framework. For example Page Object Model (not a Gof pattern btw) is one of the most commonly used design patterns which are…
Hassan Ali
  • 71
  • 1
  • 10
-2
votes
1 answer

Which design pattern should I use and why?

Pharmacy sells medicine from different producers. Each medicine has a name, type (antibiotics, anti-inflammatory, stomach), price etc. However, imported medicine must have a certificate from a lab in the current country. Moreover, if customer…
1
2