goals and overview
Post on 15-Jan-2016
34 Views
Preview:
DESCRIPTION
TRANSCRIPT
UML and WSDL for JISC e-Learning Projects
UML – ADDITIONAL FEATURES
Richard Hopkins rph@nesc.ac.uk
NeSC Training Team Member
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 2
Goals and Overview
Goals –To enable you to appreciate more of UMLTo introduce some features that you might find useful
OverviewSequence Diagrams & StatechartsGeneral Features - ExtensibilityClass Diagrams
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 3
Conditions in Sequence Diags.
Have different objects for cataloguing books and journalJournals and softback books are registeredHardback books are catalogued
LibrarianBC :BookCatalogue
register(it) [Journal]
JC :JournalCatalogue
catalogue(it) [hardBack]
register(it) [softBack]
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 4
Statecharts
StatechartFor Copy Class
On Loan
StatusCheck()
Return()
[ isSpoilt ] / notifyAbuse() In Bindery
[ not isSpoilt ]On Shelf
Self-transition Alternatives – decision diamond guardsAs in activity diag. (flowchart)
Action on transition – Action1 / Action2 / …
Statecharts –Self TransitionsActionsAlternatives
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 5
Statecharts – entry / exit actions
entry / done whenever enter stateexit / done whenever exit stateClearer and less words
Attribute book:BookInvoke its isAvail operation
On LoanOn ShelfBorrow() / book . notAvail(self)
In BinderyRebind() / book . notAvail(self)
Borrow() / book . isAvail(self)
On LoanOn ShelfBorrow()
In BinderyRebind()
Borrow()
entry / book . isAvail(self)
exit / book . notAvail(self)
StatechartFor Copy Class
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 6
Sequence Diagrams & Statecharts
OverviewSequence Diagrams & StatechartsGeneral Features - ExtensibilityClass Diagrams
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 7
StereotypesAdding extra classification to model elements
Pre-definedModel-specific
Already seen some stereotypes
<<Internet>> <<LAN>>Univ:Server Clerk’s:PCUser’s:PC
Deployment Diag.Model-specific
Return OverdueCopy
Pay fine Defer fine<<include>> <<extend>> Use Case Diag.
Pre-defined
<<stereotype name>> - written “near” the element
Can use for any element – icon, line, operation, …
Can define a new icon for a particular stereotype –Developing specialised language
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 8
Properties
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
Just as a class has an attribute, and object has value for itSo, element type has property, and instance has property valueUML itself is a UML-expressible model
Book
Title : String
copiesOnShelf() : Integer
getISBN() : ISBN
{isQuery = true}
{isQuery}
{author = Richard,reviewer = David}
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 9
Stereotype vs Property
How significant is the characteristic?Very Significant (to user) -> use stereotype
Being a web service -Which layer (since lower layers can’t use higher ones)
Relatively incidental -> use propertyWhich language used in implementation
LibraryService
AuthenticationService
{layer=UserAgents,language = Java,AWebService}
{layer=CommonService,language = C++,AWebService}
<<UserAgentLayer>><<InJava>><<WebService>>LibraryService
<<ComonServiceLayer>><<InC++>><<WebService>>AuthenticationService
Vs.
Class Diag. Class Diag.
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 10
Class Diagrams
OverviewSequence Diagrams & StatechartsGeneral Features – ExtensibilityClass Diagrams
Specialised Class vs Attribute Interfaces Parameterised Classes Constraints Association Class
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 11
Specialised Class vs AttributeStereotype vs PropertyLike difference between specialised class or attribute of general class
Book
HardBackBook SoftBackBook
Book
hardBack: bool
Vs.
Use specialised class if a significant difference to user, e.g. hardBack has a reBind operation, but softBack doesn’t
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 12
InterfacesSame concepts as in JavaA 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
JournalBook
Article
Is part of
contains
<<interface>>Copyable
printOffColour()printOffB&W
printOffColour()
printOffB&W…
Redundant – don’t need both
Leaflet
printOffColour()
printOffB&W…
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 13
Interfaces
Lollipop dependency asserts that copyService is only dependent on the Copyable interface of the associated objectsOther things can have “Supports interface” lollipop – use-cases, components
Leaflet
<<interface>>Copyable
printOffColour()printOffB&W
Copyable
Article
Copyable
CopyService
Supports interfacelollipop
(Design)Dependency
Association( instances canknows about)
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 14
Parameterised Classes
The parameterised class is not really a classA function from classes to a classSometimes called a templateUsed to avoid duplication, can be easier to readThe parameter (T) is almost always used in the templates attributes and operations –
It is use of class variable in this way which is the pointOtherwise, could make IndexedList an interface supported by both
BookLIst
IndexedList
add(t : T, pos: int)
get(pos : int) : T
T
<<bind>>(Book) IndexeddList<Book>
IndexedList
add(t : T, pos: int)
get(pos : int) : T
TAlternatively -
References
<<bind>>(Citation)
IndexedList<Citation>
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 15
Parameterised Classes
X is a particular kind of Biosystem having Y as its constituents
BIoSystem
Cell
<<bind>>(Null)
Organism
(Cell)
Population
(Organism)
EcoSystem
(Populaton)
BioRegion
(EcoSystem)
Null
T
BioComponent1..*
Cell Organism Population EcoSystem BioRegion
A BioRegion comprises a collection of EcoSystems, comprises a collection of Populations, comprises ….
Which is a better model ?
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 16
Association Classes
• To model there being some information and/or operations for an association between two classes
• Could be done using an ordinary class
Student Moduletakes
60..*
IsTaking
Mark : int
Student Moduletakes
60..*
Mark
Mark : int
0..*6
1 1
Student Module60..*
Mark
Mark : int
0..*6
1 1
• Less clear• Would have to implement it in one of these ways
Or -
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 17
Constraints
A constraint is a condition that must be satisfied by any correct implementation.These are class invariantsCan put constraints on other diagram typesCan be done in natural language or formally in – Object constraint language (OCL)
Greater precisionHarder to understand
Journal Book60..*
Copy
largePrint: boolbraille : boolaisle : intshelf : int
1..*
1 1
1..*
{braille implies aisle = 6}
{xor}Pre-defined constrain type – can’t be both a copy of a book and a copy of journal
Define constraints within an element or between elements
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 18
Object Constraint Language
Syntax – approximate, see http://www.omg.org/technology/documents/formal/uml.htm
Chapt 6Other contexts –
Operation: pre and post conditionsState diag., activity diag, sequence diag -Guards
Manager
hasPA : Boolphone:PhoneNo
Worker
lineM : ManagerlineMphone : PhoneNo
Administrator
phone : PhoneNo
{IF self . lineM . hasPA = True
THEN lineMphone =
self . lineM . myPA . Phone
ELSE lineMphone =
self . lineM . phone}
myPA0..1
1
Worker must contactHis/her manger via PA,If there is one
JISC UML/WSDL – UML, Additional Features, 9th Nov. 2004 19
END
top related