logo

Design Pattern | Interfaces and Objects

   

Added on  2022-08-21

5 Pages1267 Words11 Views
Design Pattern | Interfaces and Objects_1
Introduction
A design pattern expresses a solution in terms of interfaces and objects. It has four
elements including the name of the pattern which is a handle used to give a
description of a problem, the solution to the problem and the consequences. The
problem describes the pattern to be applied to realize the solution. The third
element of a design patter in the solution which describes the design making
elements, relationships between different elements of the design and their
collaborations and responsibilities. The final element of a design patter is the
consequences element which describes the trade-offs and results of using the
pattern.
Designing object-oriented programs requires the designer to consider many factors
like reusability by designing the program using objects factored into granular
classes. This design pattern helps the program to address future problems that may
arise as a result of maintenance of the program by avoiding complete redesigning
of the software. Use of design patterns in development of software makes it easy to
reuse the designs.
Question 1
To accomplish productivity while developing software, the following patterns can be
applied [2];
Abstract factor– This is also known as Kit. It provides an interface used to
create groups of objects that are related without specification of their
concrete class. Abstract factory helps increase productivity of a software
development. For example, a user interface toolkit supporting multiple look
and feels can be use this design pattern through the definition of an abstract
widget factory class declaring an interface used to create the basic kind of
widget. Thus, abstract factory is best used when:
o The system needs independence from how the products making it are
composed, represented and created.
o A system required configuration with one product from a family of
multiple products
o A family of objects that are related having products enforcing the same
constraint and their design allows them to be used together.
o When there is need to for a class library composed of products that
need their interfaces revealed while at the same time not revealing
their implementations.
Builder – This pattern separates complex object construction from its
representation to make it possible for the same construction process to be
used to create other representations that are different. Scenarios to use the
builder pattern include;
o The algorithm to be used to create a complex object is independent of
the parts making up the object and their assembly process.
Design Pattern | Interfaces and Objects_2

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Object Oriented Software Development
|7
|1021
|93

Object Oriented Software Development
|10
|2054
|50

Object Oriented Software Development
|7
|1034
|90

Object Oriented Software Development
|11
|2016
|72

Object Oriented Design Patterns in Java
|15
|2645
|493

System Design Analysis Using UML PDF
|5
|950
|81