I. adding associations (Larman Ch 11) ------------------------------------------ ASSOCIATIONS vs. ATTRIBUTES Def: an association is Example: |-----------| |---------| | Synch |* Stored-on 1| PMSD | |Partnership|-----------------|---------| |-----------| Def: an attribute is Example: |---------| | PMSD | |---------| | name | | capacity| |---------| ------------------------------------------ But can't we represent an The main distinction is that attributes are atomic/simple values, whose identity is not important, while associations to not involve simple values whose identity is unimportant. Guideline (p. 169): "Relate conceptual classes with an association, not with an attribute." A. Criteria for Useful Associations ------------------------------------------ DOMAIN MODEL: ADDING ASSOCIATIONS (Ch. 11) Goal: identify associations needed by information requirements of scenarios in this iteration Consider the following associations: - "need to know" relationship that must be preserved for some length of time - those in common associations list ------------------------------------------ Q: does the Process Sale use case need to remember what SalesLineItem instances are associated with a Sale instance? does the Process Sale use case need to remember who the manager was when a Sale was created? B. The UML association notation ------------------------------------------ UML NOTATION |----------| 1 Records 1 |---------| | Register |---------------| Sale | |----------| |---------| |-----------| |---------| | Synch | * Stored-on 1 | PMSD | |Partnership|-----------------|---------| |-----------| | 1 | | Consists-of | | 2 |--------------| | Computer | |--------------| ------------------------------------------ C. Common associations list ------------------------------------------ COMMON ASSOCIATIONS LIST (Table 11.1) Associate conceptual classes A and B if: - A is a physical part of B - A is a logical part of B - A is physically contained in B - A is logically contained in B - A is a description for B - A is a line item of a transaction or report B - A is known, logged, recorded, reported, or captured in B - A is a member of B - A is an organizational subunit of B - A uses or manages B - A communicates with B - A is related to a transaction B - A is a transaction related to another transaction B - A is next to B - A is owned by B - A is an event related to B ------------------------------------------ 1. high-priority associations Which of these would be the most useful? D. Association Guidelines (11.4) Which is more important, conceptual classes or their associations? What if we have an association between Sale -- Register and Register -- Store, do we also need an association between Sale and Store. No, could always derive it if necessary E. Roles (11.5) 1. definition the ends of associations are called "roles". Each role can optionally have: - a name - a multiplicity expression (a number) - navigability information 2. multiplicity ------------------------------------------ MULTIPLICITY NOTATION |----------| 1 Stock s * |---------| | Store |---------------| Item | |----------| |---------| Each Store is associated with zero or more instances of Item. Each Item is associated with one Store. notation meaning ==================================== [A]-- A is associated with... *|-----| ----| T | zero or more T's |-----| 1..*|-----| ----| T | one or more T's |-----| 1..4|-----| ----| T | 1, 2, 3, or 4 T's |-----| 5|-----| ----| T | 5 T's |-----| 1,4,6|-----| ----| T | 1, 4, or 6 T's |-----| ------------------------------------------ The multiplicity restrictions are applied at all time instants. Q: Can a used car be stocked-by more than one dealer? Can a used car be stocked-by more than one dealer? F. Naming associations (11.7) G. Multiple associations between two types (11.8) can two types have multiple associations between them? H. Associations and Implementation (11.9) during data modeling, are associations the same thing as instance variables (fields, data members)? I. example (11.10) 1. StickSync what relationships are unforgettable in the StickSync system for the Add File use case? ------------------------------------------ STICKSYNC PARTIAL DOMAIN MODEL |-----------| |---------| | Synch |* Stored-on 1| PMSD | |Partnership|-----------------|---------| |-----------| | 1 | | Consists-of | | 2 |--------------| | Computer | |--------------| | 1 | | Contains | | * |--------------|1 | Directory |---\ | | | Contains | |---/ |--------------|* | 1 | | Contains | | * |--------------| | File | |--------------| ------------------------------------------ 2. POS System's Process Sale what relationships are unforgettable in the POS system for the Process Sale use case? Use the category checklist to find associations related to the Process Sale use case?