1 / 28

Introduction to the Unified Modelling Language Pauline A. Wilcox Department of Computer Science

Introduction to the Unified Modelling Language Pauline A. Wilcox Department of Computer Science. Aims. This lecture introduces the UML: Will discuss, what it is … and what it is not Components of UML: Use Case Diagram Class Diagram Interaction Diagrams Activity Diagrams State Charts.

alisa
Télécharger la présentation

Introduction to the Unified Modelling Language Pauline A. Wilcox Department of Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to the Unified Modelling Language Pauline A. Wilcox Department of Computer Science

  2. Aims • This lecture introduces the UML: • Will discuss, what it is … and what it is not • Components of UML: • Use Case Diagram • Class Diagram • Interaction Diagrams • Activity Diagrams • State Charts

  3. An Alternative View Requirements Capture System Structure System Behaviour Use Case Diagram Class Diagram Interaction Diagrams Activity Diagrams State Charts

  4. About the UML • The Unified Modelling Language (UML) is an industry standard for object oriented design notation, supported by the Object Management Group (OMG). • It is becoming widely adopted in many areas of the software and computer systems development community. Some references included at end of lecture notes

  5. Activity Take a couple of minutes to read through the introductory Bank case study on the following slides. Try and pull out the key things which we might want to represent in a model of the Bank as described. Focus on requirements Can also look for candidate classes and methods

  6. Introductory Case StudyThe Bank Account You are asked to design a system to handle current and savings accounts for a bank. Accounts are assigned to one or more customers, who may make deposits or withdraw money. Each type of account earns interest on the current balance held in it. Current accounts may have negative balances (overdrafts) and then interest is deducted. Rates of interest are different for each type of account. On a savings account, there is a maximum amount that can be withdrawn in one transaction.

  7. Introductory Case StudyThe Bank Account Bank employees may check any account that is held at their branch. They are responsible for invoking the addition of interest and for issuing statements at the correct times. A money transfer is a short lived record of an amount which has been debited from one account and has to be credited to another. A customer may create such a transfer from their account to any other. Transfers within a branch happen immediately, while those between branches take three days.

  8. The Bank Case Study • Use Case Diagram • Examine and capture requirements • Activity Diagram • Illustrate dependencies in system • Class Diagram • Start to examine system structure • Interaction Diagrams • Express system dynamics Illustration and description in following slides

  9. A Use Case Model • Nearly all object oriented design methods now use use case models to represent requirements. • Use case modelling was invented by Ivar Jacobsen, one of the three amigos who created UML. • A use case model shows the external view of a system which is being designed.

  10. deposit withdraw transfer customer statement teller This is one possibility add interest A Use Case Model of the Bank

  11. What’s in a Use Case? • A use case model can be shown as a use case diagram • Such a diagram shows: • actors • the roles adopted by those participating • use cases • high level activities to be supported by the system • links • which actors are involved in which use cases

  12. Dependencies between Use Cases • Customers who want to open a new account, must check with the manager • The manager also has to check the books from time to time • Clearly the request for a new account depends on whether the manager is available to act in his role of authorising the customer’s request • Can show dependencies via Activity Diagram

  13. Not on Use Case diagram? Open New Account Activity Diagram Done [no accounts to do] Free Enter [accounts to do] Ready Doing Accounts Request Authorisation Complete Wait Teller Manager Customer

  14. Customer 1 withdraws and deposits money with 1 withdraws and deposits money with 0..* Current account 1 0..* 1 Branch holds holds 0..* 0..* Transfer Savings account moves money to moves money to 1 1 1 1 1 1 summarises Statement summarises 1 1 A Class Diagram of the Bank -balance : real +withdraw(a:Real) +deposit(a:Real) +curBal():Real

  15. Example showing Specialisation Customer 1 0..* Account 1 0..* holds Branch moves money to 1 1 Transfer Current Account 1 Savings Account summarises Statement 1

  16. Showing Interactions • The Use Case Diagram captures requirements • The Class diagram shows static structure • Important to show how objects of this type interact to satisfy the requirements • A Choice of Two Diagrams in the UML: • Sequence Diagram • Collaboration Diagram

  17. c:Customer ac1:Account b:Branch :ACustomer :Teller deposit(v,a,name) c:= getRec(name) ac1 := getAcc(a,c) addToBalance(v) Sequence for a successful deposit

  18. Collaboration Diagram b:Branch c1:Customer :ACustomer :Teller This open diamond notation is an aggregate association ac1:Account

  19. Collaboration Diagram b:Branch 1.1:c:= getRec(name) 1:deposit(v,a,name) 1.2:ac1 := getAcc(a,c) c1:Customer :ACustomer :Teller 1.3addToBalance(v) ac1:Account

  20. And Finally ... … to complete our whirlwind tour of UML we look at state charts Moves away from the introductory Bank case study

  21. Internal Behaviour - Statecharts • How do we show how objects behave? • One way is to give the code for the methods (functions) which support each operation. • Much behaviour depends on the state of the object, i.e. the values of its attributes and, possibly, of the attributes of its collaborators. • The current state of an object can be shown in a statechart (We use a different example for this) • All objects of the same class (not just the same interface) have the same statechart.

  22. Activity • Take a brief while to consider what the following statechart represents …

  23. Example State Chart move( r,c)/^ umpire.validate(‘ X’,r,c) XtoMove XtoMove XtoMove XhasMoved invalid()/^ xPlayer.makeAMove() valid()/^ xPlayer.makeAMove() valid()/^ yPlayer.makeAMove() Y’,r,c) move( r,c)/^ umpire.validate(‘ YhasMoved YtoMove invalid()/^ yPlayer.makeAMove()

  24. A Few Example Class Diagrams • The examples on the following slides relate to coursework 1 for this module • That does not mean there are any ‘answers’ here, but it may give you something to think about!

  25. Example UML Class Diagram

  26. Example UML Class Diagram

  27. Example UML Class Diagram

  28. Post Lecture Activities • Lots of other resources for UML General Object Management Group http://www.omg.com/ The UML Zone http://www.uml-zone.com/ Tools/Methodologies UML Open Edition http://www.umlopenedition.com/ argoUML http://argouml.tigris.org/ Rational http://www.rational.com/ <-- also lots of white papers available Catalysis http://www.trireme.u-net.com/catalysis/ The New Methodology http://www.martinfowler.com/articles/newMethodology.html Books Perdita Stevens and Rob Pooley, Using UML - Software Engineering with Objects and Components Addison Wesley ISBN 0-201-64860-1 • Comprehensive UML notes also available from http://www.macs.hw.ac.uk/~paw/teaching/dsa1/uml/

More Related