Use Case Realizations 1 Use Case Realizations System

  • Slides: 8
Download presentation
Use Case Realizations 1

Use Case Realizations 1

Use Case Realizations System make. New. Sale() add. Line. Item(item. ID, quantity) end. Sale()

Use Case Realizations System make. New. Sale() add. Line. Item(item. ID, quantity) end. Sale() make. Payment() Contract CO 1: make. New. Sale Operation: make. New. Sale () Cross References: Use Cases: Process Sale. Pre-conditions: none. Post-conditions: q A Sale instance s was created. (instance creation) q s was associated with the Register (association formed) q Attributes of s were initialized • A use-case realization describes how a use case is realized in terms of collaborating objects. • UML interaction diagrams are used to illustrate use case realizations. • Recall Process Sale: from main scenario we identified a number of system events (operations) • Each system event was then described by a contract. 2

Fig. 18. 2

Fig. 18. 2

Fig. 18. 3

Fig. 18. 3

Object Design: make. New. Sale • We work through the postcondition state changes and

Object Design: make. New. Sale • We work through the postcondition state changes and design message interactions to satisfy the requirements. : Register make. New. Sale() Register creates a Sale by Creator. create() By Controller. By Creator, Sale creates an empty multiobject which will eventually hold Sales. Line. Item instances : Sale create() : Sales. Line. Item Implied to take place within the constructor of Sale instance. Contract CO 1: make. New. Sale Operation: make. New. Sale () Cross References: Use Cases: Process Sale. Pre-conditions: none. Post-conditions: q A Sale instance s was created. (instance creation) q s was associated with the Register (association formed) q Attributes of s were initialized This is NOT a Sales. Line. Item Instance but a collection object. 5

Object Design: add. Line. Item(item. ID, quantity) • Contract CO 2: add. Line. Item

Object Design: add. Line. Item(item. ID, quantity) • Contract CO 2: add. Line. Item • … • Post-conditions: • A Sales. Line. Item instance sli was created. (instance creation) • sli was associated with the Sale. (association formed) • sli. quantity was set to quantity. (attribute modification) • sli was associated with a Product. Specification, based on item. ID match (association formed) 2: make. Line. Item(spec, quantity) : Sale : Register 1: get. Specification(item. ID) 2. 2: add (sli) 2. 1: create (spec, quantity) : Product. Catalog sli: Sales. Line. Item 1. 1: spec: = find(item. ID) : Sales. Line. Item : Product. Specification 6

Object Design: add. Line. Item By Controller. By Creator. add. Line. Item(item. ID, quantity)

Object Design: add. Line. Item By Controller. By Creator. add. Line. Item(item. ID, quantity) 2: make. Line. Item(spec, quantity) : Sale : Register By Expert. 1: get. Specification(item. ID) 2. 2: add (sli) 2. 1: create (spec, quantity) : Product. Catalog 1. 1: spec: = find(item. ID) : Sales. Line. Item sli: Sales. Line. Item : Product. Specification This is a multiobject collection. It contains many instances of Product. Specification. find add are generic implementation-independent messages. 7

Object Design: end. Sale • Contract CO 3: end. Sale • … • Post-conditions:

Object Design: end. Sale • Contract CO 3: end. Sale • … • Post-conditions: • Sale. is. Complete became true (attribute modification) { public void become. Complete() { is. Complete = true; } } end. Sale() UML notation for a constraint {s. is. Complete = true} 1: become. Complete() s: Sale : Register By Controller. By Expert. 8