Gang of Four Design Patterns

Access: Public Instant Grading

Start FlashCards Download PDF Quiz Series Learn

Get the best Software engineering course in your pocket!

The objective of this session is to introduce the subject of software engineering. When you have read this session you will understand what software engineering is and why it is important, know the answers to key questions which provide an introduction to software engineering, understand ethical and professional issues which are important for software engineers.


Virtually all countries now depend on complex computer-based systems. More and more products incorporate computers and controlling software in some form. The software in these systems represents a large and increasing proportion of the total system costs. Therefore, producing software in a cost-effective way is essential for the functioning of national and international economies.

Software engineering is an engineering discipline whose goal is the cost-effective development of software systems. Software is abstract and intangible. It is not constrained by materials, governed by physical laws or by manufacturing processes. In some ways, this simplifies software engineering as there are no physical limitations on the potential of software. In other ways, however, this lack of natural constraints means that software can easily become extremely complex and hence very difficult to understand.

Software engineering is still a relatively young discipline. The notion of ‘software engineering’ was first proposed in 1968 at a conference held to discuss what was then called the ‘software crisis’. This software crisis resulted directly from the introduction of powerful, third generation computer hardware. Their power made hitherto unrealisable computer applications a feasible proposition. The resulting software was orders of magnitude larger and more complex than previous software systems.

Early experience in building these systems showed that an informal approach to software development was not good enough. Major projects were sometimes years late. They cost much more than originally predicted, were unreliable, difficult to maintain and performed poorly. Software development was in crisis. Hardware costs were tumbling whilst software costs were rising rapidly. New techniques and methods were needed to control the complexity inherent in large software systems.

These techniques have become part of software engineering and are now widely although not universally used. However, there are still problems in producing complex software which meets user expectations, is delivered on time and to budget. Many software projects still have problems and this has led to some commentators (Pressman, 1997) suggesting that software engineering is in a state of chronic affliction.

As our ability to produce software has increased so too has the complexity of the software systems required. New technologies resulting from the convergence of computers and communication systems place new demands on software engineers. For this reason and because many companies do not apply software engineering techniques effectively, we still have problems. Things are not as bad as the doomsayers suggest but there is clearly room for improvement.

Quiz PDF eBook: 
Gang of Four Design Patterns
Download GOF Quiz PDF eBook
69 Pages
English US
Educational Materials

Sample Questions from the Gang of Four Design Patterns Quiz

Question: Which pattern is most appropriate when a decision must be made at the time a class is instantiated?




Factory Method


Question: What would lead you to apply the builder design pattern?


To abstract steps of construction of objects so that different implementations

To apply the same object construction procedure on variety of representations

To translates one interface for a class into a compatible interface

To restrict instantiation of a class to one object

Question: Which of the following are participants in the GOF builder design pattern?


Builder interface

Constructor Interface

Director Interface

Concrete Builder class

Concrete constructor class

Question: Which design pattern you would you use to decouple the creation procedure of a complex object from it's concrete instance to be able to apply that procedure on variety of implementations.


Factory builder design pattern

Method Builder design pattern

Builder design pattern

Factory method design pattern

Question: You want all the clients using class A to use the same instance of class A, what should you do to achieve this goal?


mark class A final

mark class A abstract

apply the Singleton pattern to class A

apply the Memento pattern to class A

Question: Given the following scenario: You want to create families of related objects, to be used interchangeably to configure you application. What is the most appropriate GoF pattern to use?


Chain of Responsibility

Abstract Factory



Question: Which of the following are participants in the GOF abstract factory design pattern ?


Factory methods

Factory constructors

Abstract factory

Abstract product

Concrete factory

Question: When would you use the GOF abstract factory pattern?


To design a structure which has a uniform interface for both compositions of objects and individual objects.

To ensure that a certain group of related objects are used together

The client which uses your design is not dependent on how the object are created or connected together

To decouple the creation of objects from their usage

Question: It is also known as Virtual Constructor and it is used to define an interface for creating an object but letting the subclass decide which class to instantiate, this pattern is :



Abstract Factory


Factory Method

Question: What are the consequences of applying the abstract factory patter?


it will be much easier to introduce new family of products

it makes it easier for a certain family of objects to work together

it makes it easier for the client to deal with tree-structured data

it makes the designed product families exchangeable

Question: What are the consequences of applying the Builder design pattern?


it makes the designed product hierarchies exchangeable

it's easier to introduce new product implementation

it separates the prodcut construction from it's representation

the director has fine control over the product creation procedure

Start FlashCards Download PDF Quiz Series Learn