1 / 20

Class and Sequence diagrams

Class and Sequence diagrams. UML notation. Domain modeling will identify multiple classes. Taken together, a class diagram gives a good overview of a system’s structure Including how the various classes are related to one another. Identifying class relationships.

joylyn
Download Presentation

Class and Sequence diagrams

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. Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick

  2. Domain modeling will identify multiple classes Taken together, a class diagram gives a good overview of a system’s structure Including how the various classes are related to one another SE-2030 Dr. Mark L. Hornick

  3. Identifying class relationships Go back to the Use Cases, and look for possessive terms relating one object to another • “account’s credentials” • “order’s entries” • “path’s coordinates” Possessive terms usually indicate a stronger form of relationship thana simple association SE-2030 Dr. Mark L. Hornick

  4. Many classes within an application usually exhibit some type of Association between one another Associations represent permanent relationships between instances of classes: An Order has Entries An Order is billed to an Account A Login Screen is a type of Dialog An Invoice corresponds to each Order SE-2030 Dr. Mark L. Hornick

  5. A Simple Association merely shows a general-purpose relationship The single-line connector doesn’t indicate anything specific – thatis, it’s an unspecified association. About all we can say is that objects of these classes are somehow interrelated – perhaps an Invoice somehow holds a reference to an Order object (or vice versa). SE-2030 Dr. Mark L. Hornick

  6. An association can indicate multiplicity – that is, how many objects of one class correspond to objects of the other This association indicates that there is a one-to-one correspondence between Invoice instances and Order instances; that is, for every Invoice object, there is a corresponding Order object, and vice versa. SE-2030 Dr. Mark L. Hornick

  7. Associations can indicate various degrees of multiplicity This Simple Association indicates that for every Order object, there is at least one corresponding Entry object. Here, any number (including zero) of Entry objects correspond to each Order object SE-2030 Dr. Mark L. Hornick

  8. Associations can indicate navigability – that is, whether an object holds a reference to the other This one-way association indicates that an Invoice object holds a reference to a single Order object. This bi-directional association indicates that Invoice and Order objects hold references to each other. SE-2030 Dr. Mark L. Hornick

  9. End Roles indicate that an association is maintained via a specific attribute defined within a class This one-to-one, one-way association with End Role acct indicates that an Order object holds a reference to a single Account object via a private Account attribute named acct. Here is a less illustrative way of showing the same relationship. SE-2030 Dr. Mark L. Hornick

  10. End Roles can indicate specific bi-directional references This bi-directional association indicates that an Order object holds a reference to a single Account object via a private Account attribute named acct, and that an Account object holds a reference to a single Order object via a private Order attribute named ord. Here is a less illustrative way of showing the same relationship. SE-2030 Dr. Mark L. Hornick

  11. Associations can imply that a reference is a collection of objects This one-way association indicates that an Order object holds a reference to a collection of zero or more Entry objects via a private attribute named items. The same association, less illustratively. SE-2030 Dr. Mark L. Hornick

  12. Stereotypes indicate a logical function of an association This stereotype specifies “containment” of an collection of Entry objects by an Order object. Stereotypes are usually verbs that indicate the specific type of usage. SE-2030 Dr. Mark L. Hornick

  13. Composition is a stronger form of an association that implies containment and lifetime By “stronger”, we mean that the semantics of the association are more specific. Composition indicates that the Entry objects cannot exist independently of the Order object; that is, if the Order object is deleted, all the Entries are deleted as well. SE-2030 Dr. Mark L. Hornick

  14. Aggregation is a stronger form of an association that implies containment, but not lifetime Aggregation indicates that the Order object can exist independently of the Invoice object; that is, if the Invoice object is deleted, the Order can still exist (maybe it can be fulfilled free of charge). However, the Composition association in the other direction indicates that if an Order is deleted, the associated Invoice must be deleted as well (you shouldn’t invoice someone for an Order that doesn’t exist!) SE-2030 Dr. Mark L. Hornick

  15. Inconsistent terminology between strict UML and EA • UML Aggregation • A is composed of B; B can exist without A • EA refers to this as Shared Aggregation • UML Composition • A is composed of B; B cannot exist without A • EA refers to this as Composite Aggregation SE-2030 Dr. Mark L. Hornick

  16. Generalization is another form of association that implies that a class inherits behavior defined and implemented in another class Here, the Generalization association implies that the LoginClass inherits the behavior (and attributes) of the JFrame class. Objects of the LoginClass are also JFrame objects. Generalization can be illustrated in the alternate notation shown if the parent class is not present in the class diagram SE-2030 Dr. Mark L. Hornick

  17. Realization is a form of association that implies that a class implements, but does not inherit, the behavior defined in another class Here, the Realization association implies that the LoginClass implements the behavior of the Serializable class (which in Java is called an Interface). Objects of the LoginScreen class are also Serializable objects. SE-2030 Dr. Mark L. Hornick

  18. In EA, the Association Properties dialog controls the semantics of an association SE-2030 Dr. Mark L. Hornick

  19. Showing recursion in a Sequence Diagram SE-2030 Dr. Mark L. Hornick

  20. Showing selection in a Sequence Diagram SE-2030 Dr. Mark L. Hornick

More Related