Presentation is loading. Please wait.

Presentation is loading. Please wait.

Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1.

Similar presentations


Presentation on theme: "Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1."— Presentation transcript:

1 Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1

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 2

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” SE-2030 Dr. Mark L. Hornick 3 Possessive terms usually indicate a stronger form of relationship than a simple association

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 4

5 A Simple Association merely shows a general-purpose relationship SE-2030 Dr. Mark L. Hornick 5 The single-line connector doesn’t indicate anything specific – that is, 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).

6 An association can indicate multiplicity – that is, how many objects of one class correspond to objects of the other SE-2030 Dr. Mark L. Hornick 6 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.

7 Associations can indicate various degrees of multiplicity SE-2030 Dr. Mark L. Hornick 7 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

8 Associations can indicate navigability – that is, whether an object holds a reference to the other SE-2030 Dr. Mark L. Hornick 8 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.

9 End Roles indicate that an association is maintained via a specific attribute defined within a class SE-2030 Dr. Mark L. Hornick 9 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.

10 End Roles can indicate specific bi-directional references SE-2030 Dr. Mark L. Hornick 10 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.

11 Associations can imply that a reference is a collection of objects SE-2030 Dr. Mark L. Hornick 11 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.

12 Stereotypes indicate a logical function of an association SE-2030 Dr. Mark L. Hornick 12 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.

13 Composition is a stronger form of an association that implies containment and lifetime SE-2030 Dr. Mark L. Hornick 13 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.

14 Aggregation is a stronger form of an association that implies containment, but not lifetime SE-2030 Dr. Mark L. Hornick 14 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!)

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 15

16 Generalization is another form of association that implies that a class inherits behavior defined and implemented in another class SE-2030 Dr. Mark L. Hornick 16 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

17 Realization is a form of association that implies that a class implements, but does not inherit, the behavior defined in another class SE-2030 Dr. Mark L. Hornick 17 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.

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

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

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


Download ppt "Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1."

Similar presentations


Ads by Google