Professional Documents
Culture Documents
Introduction
What is design?
Introduction to Design 2
Two meanings of “design” activity in our
context
• Activity that acts as a bridge between requirements and
the implementation of the software
• Activity that gives a structure to the artifact
– e.g., a requirements specification document must be
designed
• must be given a structure that makes it easy to understand and
evolve
Introduction to Design 3
The sw design activity
Introduction to Design 4
Software architecture
Introduction to Design 5
Two important goals
Introduction to Design 6
Product families
Introduction to Design 7
Modularity to the rescue
Introduction to Design 8
Module
• A well-defined component of a software system
– for example, a module managing a set of elements
– or of a system in general, not only software
• e.g., a button, a light, a lamp, etc.
• A part of a system that provides a set of services to
other modules
– Services are computational elements that other modules may
use
• e.g., a module managing a set typically offers “service”
“addElement”
– again, this notion can be generalized to “functionalities” that
are offered by non-sw components
• e.g., a lamp offers the “service” “turn light on”
Introduction to Design 9
Interactions between modules
Introduction to Design 10
Interface vs. implementation (1)
Introduction to Design 11
Interface vs. implementation (2)
Introduction to Design 12
Interface vs. implementation (3)
Introduction to Design 13
Information hiding
Introduction to Design 14
Interface design
Introduction to Design 15
Object Oriented Design & UML
Object-oriented Design
• Objects
• Classes
• Relationships among classes
• The state:
– is the current configuration in which the object is
– is defined by the values of its properties (attributes)
• e.g., “the lamp is on” is represented as the attribute “on/off” of the
lamp being “on”
Turn on!
• A class is an abstraction
– it emphasizes some features
• e.g., the presence of the button
– it disregards other properties
• e.g., the color of the light
State
Behavior
Name
AddStudent
Teacher
Room UniversityCourse DeleteStudent
ListStudents
Semester
SetRoom
Students
• Multiplicity specifies:
– whether the association is mandatory or not
– the maximum and minimum number of objects that can be
related to another object
1
Exactly 1
* zero or more
0..1
zero or 1
m..n
between m and n
Introduction to Design 43
Aggregations
Subclasses
Sub-subclasses
• A simple system:
– a controller uses a sensor with an analog-to-digital converter
to acquire information
– the controller then uses an actuator to affect its environment
– the system may use a temperature sensor to activate either a
heater or a fan for closed-loop control
– additionally, it may use a pressure sensor to provide
information about a gas line that it uses to control a valve with
a stepper motor
Introduction to Design 57
...to Objects
Introduction to Design 58
Sequence Diagrams
Introduction to Design 59
Example of Sequence Diagram
Introduction to Design 60
Sequence Diagram explained
object
lifeline
reply message
message
(synchronous)
recursive message
message
(asynchronous)
Introduction to Design 61
Advantages of OO approach in the design of sw
• Easier maintenance
– objects can be understood (and modified) as stand-alone
entitires
• Reusability of objects
• In many systems, there is a clear correspondence
between the “real-world” entities (persons, roles,
devices…) and the (sw) objects of the system
• Features are:
– public
ChangeOwner • typically the operations
GetOperations – private
DepositMoney • typically the attributes
OpenAccount • Private features are visible and can be
CloseAccount modified only through suitable public
features
number
owner • From the point of view of the user (the client)
balance objects become black boxes that are used
through their interfaces
Bank account class