Title: UML and WSDL for JISC e-Learning Projects UML
1UML and WSDL for JISC e-Learning ProjectsUML
ADDITIONAL FEATURESRichard Hopkins
rph_at_nesc.ac.ukNeSC Training Team Member
2Goals and Overview
- Goals
- To enable you to appreciate more of UML
- To introduce some features that you might find
useful - Overview
- Sequence Diagrams Statecharts
- General Features - Extensibility
- Class Diagrams
3Conditions in Sequence Diags.
Librarian
BC BookCatalogue
JC JournalCatalogue
register(it) Journal
catalogue(it) hardBack
register(it) softBack
- Have different objects for cataloguing books and
journal - Journals and softback books are registered
- Hardback books are catalogued
4Statecharts
- Statecharts
- Self Transitions
- Actions
- Alternatives
Action on transition Action1 / Action2 /
isSpoilt / notifyAbuse()
In Bindery
Statechart For Copy Class
On Loan
Return()
On Shelf
not isSpoilt
StatusCheck()
Alternatives decision diamond guards As in
activity diag. (flowchart)
Self-transition
5Statecharts entry / exit actions
Attribute bookBook Invoke its isAvail operation
Borrow() / book . isAvail(self)
On Loan
Statechart For Copy Class
On Shelf
Borrow() / book . notAvail(self)
In Bindery
Rebind() / book . notAvail(self)
Borrow()
On Loan
On Shelf
Borrow()
entry / book . isAvail(self)
exit / book . notAvail(self)
In Bindery
Rebind()
- entry / done whenever enter state
- exit / done whenever exit state
- Clearer and less words
6Sequence Diagrams Statecharts
- Overview
- Sequence Diagrams Statecharts
- General Features - Extensibility
- Class Diagrams
7Stereotypes
- Adding extra classification to model elements
- Pre-defined
- Model-specific
- Already seen some stereotypes
Return Overdue Copy
Use Case Diag. Pre-defined
ltltextendgtgt
ltltincludegtgt
Defer fine
Pay fine
Deployment Diag. Model-specific
ltltInternetgtgt
ltltLANgtgt
UnivServer
ClerksPC
UsersPC
- ltltstereotype namegtgt - written near the element
- Can use for any element icon, line, operation,
- Can define a new icon for a particular stereotype
- Developing specialised language
8Properties
Book
Title String
author Richard, reviewer David
copiesOnShelf() Integer
isQuery true
getISBN() ISBN
isQuery
- A model element can have a value for a property
- isQuery true
- Boolean property values can be written
- X rather than X true
- A way of recording design information
- Tagged value tag is name of property, can be
omitted if value is unique to property - Just as a class has an attribute, and object has
value for it - So, element type has property, and instance has
property value - UML itself is a UML-expressible model
9Pre-defined Properties
- documentation
- Applies to everything
- location
- Applies to most things
- Value is typically a deployment diagram node or
component - persistence
- Applies to class, association, attribute
- Whether value survives system re-start
- Value usually Persistent / Transient
- semantics
- Applies to class and operation
10Stereotype vs Property
Class Diag.
Class Diag.
ltltUserAgentLayergtgt ltltInJavagtgt ltltWebServicegtgt Libra
ryService
layerUserAgents, language Java, AWebService
LibraryService
Vs.
ltltComonServiceLayergtgt ltltInCgtgt ltltWebServicegtgt Aut
henticationService
layerCommonService, language C, AWebService
AuthenticationService
- How significant is the characteristic?
- Very Significant (to user) -gt use stereotype
- Being a web service -
- Which layer (since lower layers cant use higher
ones) - Relatively incidental -gt use property
- Which language used in implementation
11Class Diagrams
- Overview
- Sequence Diagrams Statecharts
- General Features Extensibility
- Class Diagrams
- Specialised Class vs Attribute
- Interfaces
- Parameterised Classes
- Constraints
- Association Class
12Specialised Class vs Attribute
- Stereotype vs Property
- Like difference between specialised class or
attribute of general class
Vs.
Book
Book
hardBack bool
HardBackBook
SoftBackBook
- Use specialised class if a significant difference
to user, - e.g. hardBack has a reBind operation, but
softBack doesnt
13Interfaces
- Same concepts as in Java
- A collection of operations
- which must be supported by any class claiming to
support the interface (match the interface
realise the interface) - supports is shown as specialisation with dashed
arrow - An interface is like a class but has no instances
- no attributes, no associations
Item
Is part of
contains
Article
printOffColour() printOffBW
Journal
ltltinterfacegtgt Copyable
Book
printOffColour() printOffBW
Leaflet
printOffColour() printOffBW
Redundant dont need both
14Interfaces
CopyService
Supports interface lollipop
Copyable
Copyable
(Design) Dependency
Leaflet
Article
Association ( instances can knows about)
- Lollipop dependency asserts that copyService is
only dependent on the Copyable interface of the
associated objects - Other things can have Supports interface
lollipop use-cases, components
15Parameterised Classes
Alternatively -
T
T
IndexedList
IndexedList
add(t T, pos int) get(pos int) T
add(t T, pos int) get(pos int) T
IndexeddListltBookgt
ltltbindgtgt(Citation)
ltltbindgtgt(Book)
BookLIst
References
IndexedListltCitationgt
- The parameterised class is not really a class
- A function from classes to a class
- Sometimes called a template
- Used to avoid duplication, can be easier to read
- The parameter (T) is almost always used in the
templates attributes and operations - It is use of class variable in this way which is
the point - Otherwise, could make IndexedList an interface
supported by both
16Parameterised Classes
T
BIoSystem
ltltbindgtgt(Null)
(Cell)
(Organism)
(Populaton)
(EcoSystem)
Null
Cell
Organism
Population
EcoSystem
BioRegion
1..
BioComponent
- X is a particular kind of Biosystem having Y as
its constituents
Cell
Organism
Population
EcoSystem
BioRegion
- A BioRegion comprises a collection of EcoSystems,
comprises a collection of Populations, comprises
.
- Which is a better model ?
17Association Classes
takes
Student
Module
6
0..
IsTaking
Mark int
- To model there being some information and/or
operations for an association between two classes - Could be done using an ordinary class
takes
Student
Module
Student
Module
6
0..
6
0..
1
1
1
1
Or -
0..
0..
6
6
Mark
Mark
Mark int
Mark int
- Less clear
- Would have to implement it in one of these ways
18Constraints
Book
Journal
1
1
Pre-defined constrain type cant be both a copy
of a book and a copy of journal
xor
1..
1..
Copy
braille implies aisle 6
largePrint bool braille bool aisle int shelf
int
Define constraints within an element or between
elements
- A constraint is a condition that must be
satisfied by any correct implementation. - These are class invariants
- Can put constraints on other diagram types
- Can be done in natural language or formally in
- Object constraint language (OCL)
- Greater precision
- Harder to understand
19Object Constraint Language
Manager
Worker must contact His/her manger via PA, If
there is one
hasPA Bool phonePhoneNo
1
IF self . lineM . hasPA True THEN self .
lineMphone self . lineM . myPA . Phone
ELSE self . lineMphone self . lineM
. phone
myPA
0..1
Worker
Administrator
phone PhoneNo
lineM Manager lineMphone PhoneNo
- Syntax approximate, see http//www.omg.org/techn
ology/documents/formal/uml.htm - Chapt 6
- Other contexts
- Operation pre and post conditions
- State diag., activity diag, sequence diag -Guards
20END - references
- http//www.omg.org/technology/documents/formal/uml
.htm - UML Pocket Reference, OReilly,
- ISBN 0-596-00497-4
- UML in a Nutshell
- Using UML Software Engineering with Objects and
Components, Perdita Stevens with Rob Pooley - ISBN 0-201-64860-1