1 / 17

Towards Design – Entity / Relationship Models

Towards Design – Entity / Relationship Models. Richard Hopkins rph@nesc.ac.uk UML for Use Cases NeSC, Edinburgh, Jan 5/6 2006. Contents. Goal An appreciation of how UML class diagrams can be used to elucidate technical detail Contents Internal vs External class diagrams

bella
Télécharger la présentation

Towards Design – Entity / Relationship Models

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. Towards Design – Entity / Relationship Models Richard Hopkins rph@nesc.ac.uk UML for Use Cases NeSC, Edinburgh, Jan 5/6 2006

  2. Contents Goal • An appreciation of how UML class diagrams can be used to elucidate technical detail Contents • Internal vs External class diagrams • Details of class diagrams • Practical

  3. Activity Diag. Class Diag. Sequence Diag. Sequence Diag. Activity Diag. Development Process • Requirements level Class Diagram – externally visible entities • Design level Class Diagram – model of external entities + internal entities => OO design Partially articulated requirements to elucidate requirements – what entities exist and how each behaves Capture Requirements Requirements Use Case Diag. Construct Model of Overall system Class Diag. Structure … Behaviour

  4. Internal vs External • Similarities – used external classes as starting point; differences, e.g. • A “lendable” entity is may be a more useful abstraction than “Item” – greater commonality but need additional constraints for User-to-Loan User Item Is part of contains has out Is copy of Student Staff Member Journal Article Copy Book has out Ordered print-off to of User Loan Lendable for Student Staff Journal Copy print-off order in of Article Book of

  5. Internal vs External • Similarities – used external classes as starting point; differences, e.g. • Relationship entities – need information about the relationship – • when the loan is to be returned • In this case, 1:N, could put that info with the Copy User Item Is part of contains has out Is copy of Student Staff Member Journal Article Copy Book has out Ordered print-off to of User Loan Lendable for Student Staff Journal Copy print-off order in of Article Book of

  6. Payment Fine Internal Entities • Introduce Modelling of required internal state need to keep track of fines – what for how much paid Overdue Damage Loss to of User Loan Lendable for Student Staff Journal Copy print-off order in of Article Book of

  7. Contents Goal • An appreciation of how UML class diagrams can be used to elucidate techniocal detail Contents • Internal vs External class diagrams • Details of class diagrams • Practical

  8. Aggregation and Composition • Special Associations • Aggregation – To model a collection of things • Journal has a collection of Articles • Article has a collection of Authors • Composition • A special case of aggregation – “ownership” / “component” • An article is a component of a journal • Part can only belong to one whole • The part cannot exist without the whole • Role name - Not given explicitly – implicit in the end-point – “is part of” • Multiplicity – by default (1) --- (0..*) Journal Article Author composition general aggregation

  9. Payment Fine Multiplicity Compactly communicates a lot of properties/assumptions – one picture of whole design • A payment can relate to several fines • An article can’t be in more than one Journal (issue) …. • Can be very useful as reality check on requirements with user • Can daunting notation for user – may be better to extract all assumptions made! 1..* 0..* Overdue Damage Loss 1 1 1 1 1 1 User Loan Lendable 1 1 Student Staff Journal Copy print-off order 0..* Article Book 1..*

  10. Attributes • Attribute – Information associated with each instance of class • Each attribute will have a type (could be omitted) • Attributes are inherited – Title would be attribute of book, not Copy • Show What’s important for understanding • Maybe not all that exists in implementation • Don’t show IsCopyof attribute because duplicates Of association • Could put in virtual information • Title for copy even though only held for Book - ? Copy Book ShelfMark : Int Title : String of IsCopyOf : Book Title : String

  11. Specialised Class vs Attribute 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 doesn’t

  12. Navigability • Arrow-head means the association can be followed in the direction shown • In implementation view, navigability requires attributes to hold the link(s) to associated object(s) • In VP-UML – default is no navigability signs – • either both un-specified or both navigable Is copy of of Copy Copy Book Book One-way from copy to the Book it is a copy of Two-way Also - From a Book to any of its copies

  13. Complex Class Structures • The intended structure would be elucidated by giving some examples ! • Particularly if audience is not familiar with this particular view on the possible structure of book • So illustrate the class diagram by one or more instance diagrams Class Diagram 0..* Book 1 by 0..* 1..* 0..* contains Author Division 1 by 1..* 0..* Part Chapter

  14. B1: Book Title: UML & WSDL A2: Author Name: Guy A1: Author Name: Richard A2: Author Name: David C111: Chapter Title: Classes C112: Chapter Title: Use Cases Object Diagrams • An Instance diagram • Does not show full range of possibilities • The lines are “links” – instances of associations • Can annotate links with navigability and role if useful Class Diagram 0..* Book 1 by 0..* 1..* 0..* contains Author Division 1 by 1..* 0..* Part Chapter Object Diagram P11: Part Title: UML P12: Part Title: WSDL

  15. Questions ? • Can we express/derive full OO design from UML? • Yes • Additional features • operations • using UML-defined classes as attribute types • visibility • interfaces • …. • ?????

  16. Contents Goal • An appreciation of how UML class diagrams can be used to elucidate techniocal detail Contents • Internal vs External class diagrams • Details of class diagrams • Practical

  17. Practical –Entity/ Relationship Model • Clarifying technical detail – 1 hour • One group member plays role of software developer • draft a class diagram for the design the system you have been working on • quickly! • could be two developers for 4-person group • Others play role of clients • with the developer – discuss and evolve the detail • The point is to explore the potential of these diagrams as communication tool – • Not to come up with the ideal design

More Related