Lecture 8 (

wakecabbagepatchΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

67 εμφανίσεις

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Lecture 8 (
6367 and 6677)

OO Modelling

Use Cases

Annette Vincent

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

2

Outline


Administration


Origins of OO


Use Cases



Research


Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

3

Administration


Quiz 2
opens Friday 6
th

April 5:00pm



Assignment 2
:

due Friday 13
th

April 5:00pm.


Late submissions by email only,
moodle

is
set up to prevent late submissions.




Reminder

24 hour rule


no case study
questions will be answered 24 hours before
due date/time
.






Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Where are we?


4

[1]

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Object Oriented
Modelling


The process of
modelling

the problem
domain through
objects

and
classes

of
objects.

5

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

History of OO

6

Object Oriented Programming

Object Oriented Design

Object Oriented Analysis

Smalltalk, Modula 2

Ada

1980s

Simula

1960s

Various OO Methods

1980s & 1990s

Coad
, Yourdon,
Booch
,

Shlaer
/Mellor‏….

UML1995

C++ 1985

Eiffel 1986

Ada95, Java 1985

C#, .NET
2000

MDD, MDA

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

ORIGIN OF OO IDEAS


Layers of Abstraction
(
Dijkstra
)

“the‏purpose‏of‏abstracting‏is‏
not

to be vague, but to create a
new‏semantic‏level‏in‏which‏one‏can‏be‏absolutely‏precise”‏[3]


Information hiding
(
Parnas
)‏…‏Encapsulation

“The‏purpose‏of‏information‏hiding‏is‏to‏obtain‏a‏modularization‏of‏
the‏code‏of‏a‏system‏that‏isolates‏changes‏into‏single‏modules”‏
[4]


Abstract data typing
(
Liskov

&‏others)‏[5]‏…‏Inheritance

“A‏data‏type‏can‏be‏considered‏
abstract

when it is defined in
terms‏of‏operations‏on‏it,‏and‏its‏implementation‏is‏hidden”‏[6]

7

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Aspects of Systems

Data/

Identity

Conditions/

State

Function/

Behaviour

8

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Objects and Classes


What is an Object?


An object is something that has
identity
,
state

and
behaviour
.


Can be physical or conceptual


What is a Class?


“A‏set‏or‏category‏of‏things‏having‏some‏property‏or‏
attribute in common and differentiated from others by
kind,‏type,‏or‏quality.”‏


Older‏mixed‏terminology‏objects,‏instances,‏classes,‏….


9

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Objects and Classes

10

Object of Class Employee

Class Employee

John Smith

21/5/70

1/1/11

--------

Road worker


Behaviour

Apply for position

Resign

Retire

Name

Date of Birth

Start Date

End Date

Position


Behaviour

Apply for position

Resign

Retire

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

History of UML


Unified Modeling Language [2]


Standard for OO
modelling


Developed by
Booch
,
Rumbaugh
, Jacobson & others
…‏solve‏the‏problem‏of‏many‏competing‏notations‏
1995


Now at version 2.0


OMG


Object Management Group


Promote theory and practice of object
-
oriented technology for
development of distributed systems


Provide common architectural framework for OO


11

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML 2.0 Diagrams

13 Diagram Types


Structure Diagrams



Class Diagram
,


Object Diagram,


Component Diagram,


Composite Structure Diagram,


Package Diagram,


Deployment Diagram.



12

Some of these diagrams

are design and lower

level diagrams

We will be concentrating on

most commonly used

diagrams for analysis

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML 2.0 Diagrams

13 Diagram Types (continued)


Behavior Diagrams



Use Case Diagram
(used by some
methodologies during requirements gathering);


Activity Diagram
,


State Machine Diagram
.




13

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML
2.0
Diagrams

13 Diagram Types (continued)


Interaction Diagrams



Sequence Diagram
,


Communication Diagram,


Timing Diagram,


Interaction Overview Diagram.


14

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML is
BIG


Generally only use a subset


Some diagrams can be used for different
purposes


E.g. a State Diagram that captures the state
behaviour

of the whole systems


One that captures the state
behaviour

of a
class


UML is a
notation
, not a method


Can be used with many methods


15

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML Extensibility


Stereotypes


Add extra information to an existing model element


<< >> (guillemots)


E,g
, <<inherits>>


Tagged values


Keyword, value pairs associated with model element


E.g

{Vendor=“Acer”,‏CPU=“AMD”}‏


Often used for code generation purposes


16

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML Extensibility


Constraints


New rules


Often in
OCL (Object Constraint Language)



“In‏models‏that‏depict‏software‏systems,‏
constraints

represent
conditions or restrictions that you can find no other way to model.


In models that depict time
-
critical software systems,
constraints

provide a statement about the relative or absolute value of time during
an‏interaction.”‏[7]




17

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

UML Profiles


“A‏
profile

in the
Unified Modeling Language

(UML)
provides a generic extension mechanism for customizing
UML

models for particular
domains

and platforms.


Extension mechanisms allow refining standard semantics
in strictly additive manner, so that they can't contradict
standard‏semantics.”‏[8]


E.g.


UML Profile for Enterprise Application Integration (EAI)


UML Profile for CORBA®


Less‏formal‏profiles,‏Web‏Services,‏Executable‏UML‏…

18

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Object
-
Oriented Requirements


Use case diagrams


capture system (business) requirements,


identify actors and their roles,


how the actor roles utilise the system.

19

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Use Cases


“A‏use‏case‏in‏software‏engineering‏and‏systems‏engineering‏is‏a‏
description‏of‏a‏system’s‏behaviour‏as‏it‏responds‏to‏a‏request‏that‏originates‏
from outside of that system. In other words, a use case describes "who" can
do‏"what"‏with‏the‏system‏in‏question.”‏[9]



Symbols on Use Case Diagrams





Actor

Use Case

Relationships

Generalisation

System

Boundary

20

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Use Case Diagram


Diagram that summarises information about actors
and use cases


Simple diagram shows overview of functional
requirements


Can have multiple use case diagrams


By subsystem


By actor

21

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Actor


Has a
name

(noun)


Anything that needs to exchange

information with the system


Users/
Roles


External Systems


Outside the system boundary




Stakeholders




22

Customer

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Use Cases


A usage of the system by an actor


Atomic interaction


Testable


Name

verb

the
noun

[for/if/when/…‏constraint]


23

Submit
Order

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

System Boundary


Use Cases
inside the boundary


Actors

outside the boundary



Visual reminder

24

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Relationships


Between Actor and Use Case

Indicates Actor is involved in Use Case






Arrow ends optional


indicates direction of data flow

25

Customer

Submit
Order

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Relationships


Between Use Case and Use Case






26

Submit
Order

Check
Stock

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Extend Relationship


Target use case extends the
behaviour

of the source use
case


Source is independent of extension


Extended use case is dependent on source


<< extends >> stereotype





While Submitting Order can optionally join mailing list (an extension)



27

Join
Mailing List

Submit
Order

<< extends >>

Source

Target

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Include Relationship


Source use case explicitly incorporates the
behaviour

of
the target


Common set of steps used in multiple other use cases


<< includes >> stereotype






Select Product is a mandatory step in Submit Order



28

Submit
Order

Select
Product

<< includes>>

Source

Target

Faculty of

ISE

Systems Analysis and
Modelling

Semester
1 2012

Generalisation


Between actors and actors or

use cases and use cases


Inherits
behaviour



Reduces duplicate

interactions






29

Authenticate
User

Validate
Fingerprint

User

Customer

Validate
Password

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Use Cases


Each Use Case


Has an associated text description


Title/Name


Description (paragraph)


One or more scenarios

30

Submit
Order

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Level of Use Cases

31

Customer

Submit
Order

Manage
Products

Re
-
order
product when
low inventory

Select
Product

Staff

Too
High
?

Ask How?

Too
Low
?

Ask Why?

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Identifying Use Cases


Identify user (stakeholder) goals


Event Table


CRUD analysis technique (create, read/report,
update, delete) to ensure coverage



32

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

All Use Cases Involving Customer as Actor

33

[1]

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Use Case Diagram with Automation
Boundary and
Alternate Actor Notation

34

[1]

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Use case scenarios


Extends information in the use case


Increases client


analyst understanding


Technique for obtaining detailed
requirements


Written in domain (end user) language


35

1.
Step 1

2.
Step 2

3.
Step 3

4.
Step 4

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Scenario


Each use case (symbol) should have an
associated scenario


The scenario should have (at least) a basic
course (path through the scenario)


Normal or essential sequence of steps


May have alternate courses

36

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Scenario

Use Case : Submit Order

1.
Select Products

2.
Enter Delivery Details

3.
Enter Payment Details

4.
Submit


Alternative : Back Order

1.
Select Products

2.
Confirm Back Order Acceptable

3.
Enter Delivery Details

4.
Enter Payment Details

5.
Submit


37

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Scenario elements


Ordered steps (numbered)


Optional sequence of steps (bulleted)


Loops (for, while, etc)


Conditionals (if then else)


Nesting to show level of detail

38

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Extends and Includes


Each use case has its own basic and
possibly alternative scenarios


Scenario references use cases that are
‘extended’


‘Included’‏use‏cases‏are‏referenced‏by‏
other scenarios

39

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Next Week


40


Class Diagrams

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

41

Research



Do some research

on similarity between ERDs and Class
Diagrams






Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

Questions?


42

Faculty of

ISE

Systems Analysis and
Modelling

Semester 1 2012

43

[
1
]

Satzinger
, Jackson &
Burd
, “
Systems Analysis and Design in a Changing World,
5
th Edition”, (
2009
)


[
2
]

“UML Resource Page”, http://www.uml.org/

viewed
1
st

April
2012


[
3
]

Dijkstra
,
Edsger

W (
1972
), ACM Turing Lecture
1972
, The Humble Programmer

available at
http://www.cs.utexas.edu/~EWD/transcriptions/EWD
03
xx/EWD
340
.html

viewed
1
st

April
2012


[
4
]

“Information Hiding”,
http://se.uwaterloo.ca/~dberry/COURSES/software.engr/lectures.pdf/inf_hiding.pdf


viewed
1
st

April
2012


[
5
]

Liskov
,
Barbera

(
1974
)
, Programming with Abstract Data Types, in Proceedings of the ACM SIGPLAN Symposium on Very High Level
Languages, pp.
50
--
59
,
1974
, Santa Monica, California


[
6
]


Abstract Data Type”,
http://c
2
.com/cgi/wiki?AbstractDataType


viewed
1
st

April
2012


[
7
]

“UML extension mechanisms”, http://en.wikipedia.org/wiki/UML_extension_mechanisms


viewed
7
th

October
2011
(no longer accessible)


[
8
]

Si
Alhir
,
Sinan

(
2002
).
Guide to applying the UML


[
9
]

“Use Case”,
http://en.wikipedia.org/wiki/Use_case


viewed
1
st

April
2012




























References