Download presentation
Presentation is loading. Please wait.
Published byRobert McIntosh Modified over 10 years ago
1
UML and WSDL for JISC e-Learning Projects INTRODUCTION TO UML Richard Hopkins rph@nesc.ac.uk NeSC Training Team Member rph@nesc.ac.uk
2
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20042 Goals and Overview Goals – To enable you to understand the UML part of the first example To explain the context and overall approach for UML Overview UML History and concepts Simple use of most essential diagrams Requirements Structure Behaviour
3
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20043 History of UML Use of diagrams In any discipline for the construction of complex artefacts Need to use diagrams, as tools for Thinking Communicating As discipline matures, diagrams become - Standardised – For effective communication between all practitioners Stylized – Specialised technical language for compact representation UML – M is for Models A diagram is a model of the (proposed) system A partial representation of some aspect of the system
4
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20044 History of UML Historically A variety of stylised diagram languages Each associated with a design methodology A formalised Process for arriving at a design E.g., for Object-oriented design (early 90s) Grady Boochs OOD – Object-Oriented Design James Rumbaughs OMT – Object-oriented Modelling and Design Ivar Jacobsons OOSE – Object-Oriented Software Engineering Competing Methodologies Rather improbably – Rumbaugh joined Booch, with intention of merging their methods They bought out Jacobsonns company – Objectory These three aimed for a single Unified Method
5
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20045 Methodolgy vs Notation Generally need different methodologies for different contexts Small application in four weeks by single programmer Large system in four years by 200-strong development organisation Often use of X methodology was actually use of Xsnotation with methodology appropriate to context Strong reasons for using the same notation Concept of Unified Method, changed to Unified Modelling Language
6
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20046 Methodology vs Notation UML is NOT a methodology UML is a notation for recording the results of A requirements gathering / design process Carried out using some methodology – maybe! Any kind of diagram can be used for any purpose that is useful Sufficiently general that could be used with any imaginable O-O methodology However, for concreteness we will assume a particular general methodology -
7
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20047 An Overall Development Process Partially articulated requirements Capture Requirements Use Case Diag. Requirements Construct Model of Overall system Class Diag. Structure Sequence Diag. Behaviour These diagram types, and the process can be used both for Designing a new system Understanding an existing system
8
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20048 Requirements Overview UML History and concepts Simple use of most essential diagrams Requirements Structure Behaviour
9
JISC UML/WSDL – Introduction to UML, 9 th Nov. 20049 Introducing the Library Example A computer system for a university library; some facts The library has members – Staff Students The library contains items - Books possibly several copies of each book Some books are for short-term loan only – only students can do short-term loans Journals Only staff may borrow journals The functionalities include Keeping track of when items are borrowed/returned Allow users to search for a book and check availability
10
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200410 Some Queries The library has members – Staff Students The library contains Books; possibly several copies of each book Some books are for short-term loan only – only students can do short- term loans Journal Only staff may borrow journals The functionalities include Keeping track of when items are borrowed/returned Allow users to search for a book and check availability Can someone be both? Do we mean copies? Is user something different from member? Henceforth use user
11
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200411 Requirements Engineering Natural language statement of requirements is typically riddled with ambiguities and inconsistencies Requirements Engineering is the discipline of dealing with this Developing UML models helps with identifying and clarifying requirements But still depends on natural language documentation It helps, but does not guarantee complete consistent set of requirements
12
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200412 Requirements - Simple Use Cases An Actor – a user of the system, in a particular role BookBorrower is a role played by library members Usually a person, but could be another system An entity outside the system being modelled In web services – usually another web service BookBorrower Borrow Copy of book Update Catalogue Librarian A Use Case – A task that an actor needs to perform with the help of the system Borrow Copy of Book describes the successful outcome – there will be variants for the exception cases - This Actor participates in this Use Case
13
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200413 Simple Use Cases Not a very rich diagram – later on we will see richer diagrams Needs more explanation – associated documentation Limitations of natural language! BookBorrower Borrow Copy of book Use Case Documentation Use Case: Borrow copy of book. A bookBorrower presents a book. The system checks that the potential borrower is a member of the library, and that s/he does not already have the maximum permitted number of books on loan. The maximum is 6 unless the member is is a staff member, in which case it is 12. If both ckecks succeed, the system records that this library member has this copy of the book on loan. Otherwise it refuses the loan. Update Catalogue Librarian
14
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200414 STRUCTURE Overview UML History and concepts Simple use of most essential diagrams Requirements Structure Behaviour
15
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200415 Structure - Class Design UML is for Object-Oriented Design The state of the system is a collection of Objects Each Object is an instance of a Class The structure of the system is characterised by the class and their inter-relationships Key is identifying the classes kinds of things manipulated within the system Standard Technique - Noun identification Take a concise description of the system Identify the words/phrases that denote things
16
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200416 Noun Identification Some Facts – The library contains books and journals. It may have several copies of a given book. The system must keep track of when items are borrowed and returned The system must allow users to borrow items subject to rules – A student can borrow up to six items …
17
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200417 Class Design – Which Nouns? Library Book Journal Item System Rule User Student NO – Not within the system Yes if rules are updatable No if rules are built in Yes – All these are things which the system needs to track Although they are not independent – Journal is a special case of item Student is a special case of user Here a book, student etc. within the system – Represents an actual entity in the external world Partially Tracks what is happening to the real world entity
18
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200418 Class Diagram A box for each Class There are relationships between classes Otherwise dont need a diagram!!! UserStudentStaffItemJournalBook Specialisation/Generalisation User is a generalisation of both Student Staff Any instance of Student is also an instance of User Student Later we will see other class relationships
19
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200419 Class Attributes and Operations Book Title : String ItemJournal Attribute – Information associated with each instance of the class – whats important for understanding; not all that exists in a programming language class implementing it Each attribute will have a type
20
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200420 Class Attributes and Operations Book Title : String copiesOnShelf() : Integer ItemJournal An operation – something that instances of this class can do, which can be externally invoked A unit of functionality which is externally exposed Equivalent to a Java Method copiesOnShelf() : Integer To provide the invoker with a number which is the number of copies of the book which are available for borrowing. copies(in onShelf:Bool, out copyNos[0..*] Integer) : Status UML terminology is message-passing - An objects operation is invoked by another object sending it a message
21
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200421 Web Services as Objects A WSDL definition corresponds to a class a service type An actual web service conforming to that definition is an instance of that class But service types are often not found by noun identification Often more by Identifying Functions, rather than things Legacy Overall domain understanding (guesswork / intuition) Notion of layered architecture Viewing a function-provider as a service object
22
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200422 Example some Web Services A Web services Framework for E-learning (surprise!) User Agents (layer) PortalTimetablingLibraryAuthoring Tool... Application Service (layer) Group ManagementResource DiscoveryResource Management... Common Services (layer)... AuthenticationAuthorisationSearch Messaging Naturally a domain noun? – Yes No (As perceived by domain non-expert!)
23
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200423 BEHAVIOUR Overview UML History and concepts Simple use of most essential diagrams Requirements Structure Behaviour
24
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200424 Behaviour - Sequence Diagrams To Document how objects work together to achieve an overall function of the system – An Interaction Diagram Each sequence diagram shows an example walk-through Typically for a use case Not for all of them For Complex situations Where clarification seems needed
25
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200425 Sequence Diagram - participants For Use Case : Borrow copy of book BookBorrower theUser: UsertheCopy: CopytheBook: Book Identify the participants External Actor from the use case Objects within the system This is an instance diagram – Name each object, and identify its class theUser – object which is the internal representation of the user playing the BookBorrower role theUser : User seems redundant, but could have several User participants
26
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200426 Sequence Diagram – Lifelines Book Borrower theUser: User theCopy: Copy theBook: Book timetime Object existence lifeline Period of activation 1: 3: 2: 4: 1. BookBorrower invokes the use case – activating the corresponding User object, theUser 2. theUser tells theCopy object that it is now borrowed – it changes its state 3. theCopy tells theBook that it has been borrowed – its reduces its count of available copies 4. TheUser confirms success to BookBorrower The replies to 2 and 3 not shown because not particularly important, whereas the confirmation to external user is. Sending a message The reply
27
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200427 Sequence Diagram – Operations Book Borrower theUser: UsertheCopy: Copy theBook: Book timetime Object existence lifelinePeriod of activation 1: borrow(theCopy) 3: borrowed() 2: borrow() 4: borrowStatus Associate with the message line – The information communicated Usually the operation invoked and possibly its parameters Sending a message The reply
28
JISC UML/WSDL – Introduction to UML, 9 th Nov. 200428 Final Points UML is a language to enable expression Its up to you what you express and what you dont Which cases you give sequence diagrams Which attributes you include for a class... Based on maximising usefulness to the reader Rather than rigid rules But it maybe you organisations standards, rather than your personal judgement
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.