Week 8 PPT

advertisement
Object-Oriented Design
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 1
Object-oriented development




Object-Oriented analysis, design and programming
are related but distinct.
OOA is concerned with developing an object model
of the application domain.
OOD is concerned with developing an objectoriented system model to implement requirements.
OOP is concerned with realising an OOD using an
OO programming language such as Java or C++.
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 2
What is UML?

Unified Modeling Language
•
•

OMG Standard, Object Management Group
Based on work from Booch, Rumbaugh,
Jacobson
UML is a modeling language to express and
design documents, software
•
•
•
Particularly useful for OO design
Not a process, but some have been proposed
using UML
Independent of implementation language
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 3
Brief History

Inundated with methodologies in early 90’s
•




Booch, Jacobson, Yourden, Rumbaugh
Booch, Jacobson merged methods 1994
Rumbaugh joined 1995
1997 UML 1.1 from OMG includes input from
others, e.g. Yourden
UML v2.0 current version
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 4
History of UML
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 5
Some UML modeling notations








Use case diagram
Class diagram
Sequence diagram
Statechart diagram
Activity diagram
Deployment diagram
Component diagram
Collaboration diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 6
UML diagram hierarchy
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 7
UML tools





Rational Rose is the “real world” standard; full round-trip
code generation
• Recently acquired by IBM (right under Microsoft’s
nose!)
Together (from Borland) is a lot like Rational Rose
ArgoUML looks interesting (and is open source)
BlueJ, of course, displays simple UML diagrams
Drawing programs with UML support
• Visio is a Microsoft tool
• Dia is a freeware clone of Visio
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
8
Slide 8
Tool links
1.
2.
3.
4.
5.
6.
Rational Rose
• http://www-3.ibm.com/software/awdtools/developer/
rosexde/
Together
• http://www.borland.com/together/
ArgoUML
• http://argouml.tigris.org
Visio
• http://msdn.microsoft.com/office/understanding/visio/
Dia
• http://www.gnome.org/projects/dia/
OmniGraffle 3 (Mac OS X)
• http://www.omnigroup.com/applications/omnigraffle/
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
9
Slide 9
An association model
Emp loy ee
is-member-o f
Depar tment
is-managed-by
manages
M an ager
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 10
Use-case models



Use-case models are used to represent each
interaction with the system.
A use-case model shows the system
features as ellipses and the interacting entity
as a stick figure.
Flow of events within a use case can be
depicted using sequence diagrams.
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 11
Use Case Diagrams

Used during requirements
elicitation to represent
external behavior
Actors represent roles, that
is, a type of user of the
system

Use cases represent a
sequence of interaction for a
type of functionality; summary
of scenarios
PurchaseTicket

The use case model is the
set of all use cases. It is a
complete description of the
functionality of the system
and
its Chapter
environment
Modified from Sommerville’s originals
Software Engineering, 7th
edition.
14
Slide 12
Passenger

Actors

Passenger
An actor models an external entity which
communicates with the system:
•
•
•


User
External system
Physical environment
An actor has a unique name and an
optional description.
Examples:
•
•
Modified from Sommerville’s originals
Passenger: A person in the train
GPS satellite: Provides the system with
GPS coordinates
Software Engineering, 7th edition. Chapter 14
Slide 13
Use Case
A use case represents a class of
functionality provided by the system
as an event flow.
A use case consists of:
PurchaseTicket

Unique name

Participating actors

Entry conditions

Flow of events

Exit conditions

Special requirements
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 14
Use cases diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 15
Use cases diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 16
Class diagram
UML class diagrams show the classes of the
system, their inter-relationships, and the
operations and attributes of the classes

Depict the detailed design of object-oriented or
object-based software
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 17
Class diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 18
Sequence diagram


Sequence
diagrams
models
the
collaboration of objects based on a time
sequence.
It shows how the objects interact with others
in a particular scenario of a use case.
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 19
Sequence diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 20
Activity diagram

Activity diagrams helps to describe the flow
of control of the target system, such as the
exploring complex business rules and
operations, describing the use case also the
business process.
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 21
Activity diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 22
Deployment diagram
UML deployment diagram depicts a static view
of the run-time configuration of hardware
nodes and the software components that run
on those nodes.
Deployment diagrams show the hardware for
your system, the software that is installed on
that hardware, and the middleware used to
connect the disparate machines to one
another.
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 23
Deployment diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 24
Component diagram
UML
component
diagrams
shows the
dependencies among software components,

including the classifiers that specify them
(for example implementation classes) and

the artifacts that implement them; such as
source code files, binary code files,
executable files, scripts and tables.
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 25
Component diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 26
Collaboration Diagram

Collaboration Diagrams show similar information to
sequence diagrams, except that the vertical
sequence is missing. In its place are:
•
•

Object Links - solid lines between the objects that
interact
On the links are Messages - arrows with one or more
message name that show the direction and names of the
messages sent between objects
Emphasis on static links as opposed to sequence in
the sequence diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 27
Collaboration Diagram
Modified from Sommerville’s originals
Software Engineering, 7th edition. Chapter 14
Slide 28
Download