250 likes | 375 Views
Chapter 16. Fig. 16.1. Fig. 16.2. Note: Why no arrow?. Note: If Sale references nothing then the only thing it is associated with is what references it. Note: association name is missing since role name of Sale is used as instance variable name in Register. Fig. 16.3.
E N D
Fig. 16.2 Note: Why no arrow? Note: If Sale references nothing then the only thing it is associated with is what references it Note: association name is missing since role name of Sale is used as instance variable name in Register
Fig. 16.3 Note: Use attribute text when the data type identity is not important, eg primitives. visible
public class Register { private int id; private Sale currentSale; private Store: location; ... }
Fig. 16.6 property string
Fig. 16.7 method declaration return type is also typical Full Syntax: visibility name (param list):return-type {property-string} property-string: exceptions, abstract, friend, etc.
Fig. 16.9 Dependency presence of coupling 1 mSale AClass <<method>> public void foo() { mSale.updatePriceFor(pd) } foo():void
Kinds of Dependency -- having an attribute of supplier type -- sending a message to a supplier using an attribute, param, local variable global variable, static method -- receiving a parameter of a supplier type -- supplier is a supertype or interface Use a dependency line when no other structural line exists.
doX() calls System.runFinalize() Foo System doX() runFinalize()
Fig. 16.11 Example: A factory “creates” an object of a separate class but has no other relationship to the object.
Window1 <<interface>> Timer <<interface>> Timer Window3 Clock3 either one
Fig. 16.13 Note: Author suggests not using general aggregation; only composition.
Fig. 16.14 Constraints constraint: { text between braces}
Fig. 16.15 Qualified Association qualifier is used to select a specific object from a larger set of objects
Fig. 16.16 Association Class model an association with attributes and operations
Fig. 16.20 An active class is one controlling its own thread
Fig. 16.21 in Agile, these diagrams a re drawn in parallel