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
44
votes
3 answers

what is Gang of Four design pattern

I have recently come to know that there is a design pattern in Java called Gang of Four (GoF). I'm not able to understand what it is and what's its use. Can anybody make me clear on this? Thanks in advance.
harshita
  • 633
  • 1
  • 5
  • 5
14
votes
1 answer

Singleton pattern in JavaScript

Below is an example of a very popular implementation of the JavaScript Singleton pattern: var mySingleton = (function() { var instance; function init() { function privateMethod() { console.log("I am private"); } …
Gurpreet Singh
  • 20,907
  • 5
  • 44
  • 60
9
votes
1 answer

Design patterns NOT in the Gang of Four?

We all know the great book about design patterns known as Gang of Four, and the Patterns for Enterprise by Fowler. I would like to propose this wikified question to collect unusual software patterns for obscure and nice situations, spanning…
Stefano Borini
  • 138,652
  • 96
  • 297
  • 431
7
votes
3 answers

gang of four design patterns -- Objective C sample code?

I'm curious if anyone knows of any downloadable Objective C sample code for the gang of four design patterns out there? I am looking for working sample XCode projects and don't mind paying! Incidentally, if you're looking for other languages, you…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
4
votes
3 answers

Drawback of using Abstract factory and which pattern address it

I have faced following question in interview for which I could not find any solution on Google or stack overflow. I don't know is it really a valid question(as I wasn't given any context. In which context he was talking about)?? I was asked to tell…
Yogesh
  • 3,044
  • 8
  • 33
  • 60
3
votes
0 answers

Are these both the abstract factory pattern?

I think the original use of the abstract factory pattern is when you want to create a family of related objects. This is what is described in Gang of Four (GoF) and this tutorial: http://www.oodesign.com/abstract-factory-pattern.html I keep also…
3
votes
3 answers

Gang-of-four pattern usage in aspect-oriented-programming?

I am doing research on a SOA topic and i am trying to understand what gang of four say about aspect orientation. I also need to implement one of these pattern in AOP paradigm. What would be best pattern to pick for this?
Alex Xander
  • 3,903
  • 14
  • 36
  • 43
2
votes
2 answers

Why does an object's type refer to its interface? (Design Patterns: Elements of Reusable Object-Oriented Software book)

Why does object's type refer to its interface? Why the term type is used here? In terms of C++ I am not able to understand it. Gamma, Erich. Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley Professional Computing…
Sreeraj Chundayil
  • 5,548
  • 3
  • 29
  • 68
2
votes
1 answer

Why does the builder pattern not have a method `GetResult()` in the builder interface?

From Design Pattern by Gang of Four, Example: Why doesn't the interface Builder have a method GetResult(), which is overridden in the concrete class ConcreteBuilder? In the example, the concrete builders have GetXXX() methods, where XXX is…
Tim
  • 1
  • 141
  • 372
  • 590
1
vote
2 answers

How to implement Strategy pattern using Generics in C#

I have a string string partialCityName and a generic list . var city = List I want to do two things: 1. Filter the list based on the name and I am doing that like this: var availableCities = cityList.Where(f =>…
Ayo Adesina
  • 2,231
  • 3
  • 37
  • 71
1
vote
1 answer

Why do the references in a decorator and in a proxy point to their subject's interface and concrete respectively?

From Design Pattern by Gang of Four Why does the reference component of the decorator Decorator to the decorated point to the interface Component of the decorated, while the reference realSubject of the proxy Proxy point to the concrete…
Tim
  • 1
  • 141
  • 372
  • 590
1
vote
2 answers

What are the purposes of other members of a Singleton class besides the instance and its get method?

From Design Pattern by GoF Participants • Singleton defines an Instance operation that lets clients access its unique instance uniqueinstance. Instance is a class operation (that is, a class method in Smalltalk and a static member function in…
Tim
  • 1
  • 141
  • 372
  • 590
1
vote
1 answer

How shall I understand the motivation of abstract factory?

From Design Pattern by GoF ABSTRACT FACTORY Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Motivation Consider a user interface toolkit that supports multiple…
Tim
  • 1
  • 141
  • 372
  • 590
1
vote
1 answer

Java Interface Design Pattern Situation

I am stuck at a problem. My Problem goes like this. I have a superclass Animal and two subclasses Human And Bird. I have a fly method in my super class Animal which will provide an implementation for both the class Human and Bird based on the…
Rohit Singh
  • 16,950
  • 7
  • 90
  • 88
1
vote
2 answers

Have a Request handled by multiple handlers in a chain of responsibility pattern

I was learning design pattern's to implement it in code and I think I found one that I think will work but with one major flaw. The pattern I ended up on is Chain Of Responsibility Pattern . From what I understand there is a request passed to a…
1
2