Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Object Oriented Analysis and Design System Events & Contracts.

Similar presentations


Presentation on theme: "1 Object Oriented Analysis and Design System Events & Contracts."— Presentation transcript:

1 1 Object Oriented Analysis and Design System Events & Contracts

2 2 Object Oriented Analysis and Design Analysis Design Use Cases What are the domain process ? (text + visual notation) Software Requirements Specification What are the business needs ? (long text) Conceptual Model What are the concepts, terms ? (visual) System Sequence Diagrams What are the system events, operations ? (visual) Contracts What do the system operations do ? (text) Collaboration / sequence Diagrams How software objects interact to fulfill task ? (visual) Design Class Diagrams What is the specification for the software classes ? (visual)

3 3 System Sequence Diagrams Cashier :System enterItem(UPC,quantity) endSale() makePayment(amount) Corresponds to: Buy Item Use Case Repeat until no more items

4 4 System Sequence Diagrams Cashier :System enterItem(UPC,quantity) endSale() makePayment(amount) Actor Actions: 1.This use case begins when a Customer arrives at a POST checkout system with items to purchase 2. Cashier records the identifier for each item. If there is more than one of the same item, Cashier enters the quantity 4. On completion of item entry, Cashier indicates to POST that item entry is complete 6. Cashier tells Customer the total System Response: 3. Determines item price and adds item info to the running sales transaction Description and price of the current item is presented 5. Calculates and presents sale total

5 5 System Sequence Diagrams elements Cashier :System enterItem(UPC,quantity) endSale() makePayment(amount) Corresponds to: Buy Item Use Case Repeat until no more items Actor Cross reference to use case Text to clarify logic, control, iterations, etc.. System event System BLACK BOX

6 6 System Sequence Diagrams elements

7 7 System Sequence Diagrams Identifying system events It is necessary to be clear about the system boundary Actors to be considered are those who trigger the system Costumer is not an actor ! From use case typical course of events, identify system (external) events

8 8 System Sequence Diagrams Naming System Events Express at the level of intent rather than in terms of physical input medium Preferably, start the name with a verb endSale()ESCPressed() makePayment(amount)enterAmountTendered(amount) enterPayment(amount) Better Worse

9 9 Object Oriented Analysis and Design Analysis Design Use Cases What are the domain process ? (text + visual notation) Software Requirements Specification What are the business needs ? (long text) Conceptual Model What are the concepts, terms ? (visual) System Sequence Diagrams What are the system events, operations ? (visual) Contracts What do the system operations do ? (text) Collaboration / sequence Diagrams How software objects interact to fulfill task ? (visual) Design Class Diagrams What is the specification for the software classes ? (visual)

10 10 Contracts Describes what an operation commits to achieve What will happen rather than how it will be achieved Depends on conceptual model system sequence diagrams identification of system operations

11 11 Contracts example: enterItem Name: enterItem(upc:number, quantity:integer) Responsibility: Enter (record) sale of an item and add it to sale. Display item description and price. Type: System Cross References: System Functions: R1.1, R1.3, R1.9. Use Cases: Buy Items Notes: Use fast dbase access Exceptions: If UPC is invalid, indicate an error Pre-Conditions: UPC is known to system

12 12 Contracts example: enterItem Post-Conditions: If new sale, a Sale was created (instance creation) If new sale, new Sale was associated with POST (association formed) A SalesLineItem was created (instance created) SalesLineItem was associated with Sale (association formed) SaleLineItem.quantity was set to quantity (attribute modification) SaleLineItem was associated with ProductSpecification based on UPC match (association formed)

13 13 Contracts Contract Sections Name: Name of operation, and parameters Responsibilities: An informal description of responsibilities this operation must fulfill Type: Name of type (concept, software class, interface) Cross References: System function reference numbers, use cases, etc. Notes: Design notes, algorithms, etc. Exceptions: Exceptional cases

14 14 Contracts Contract Sections Output: Non-UI outputs such as messages or records that are sent outside of system Pre-Conditions: Assumptions about the state of system before execution of operation Post-Conditions: The state of system after completion of operation

15 15 Contracts How to make Contracts Identify system operations from system sequence diagrams For each system operation, construct a contract Start by writing responsibilities section Then complete post conditions section Then move to pre-conditions section

16 16 Contracts How to make Contracts Writing post conditions It should describe the state changes that occur to objects in the conceptual model (rather than actions) Possible state changes: Instance creation or deletion Attribute modification Association formed or broken

17 17 Contracts How to make Contracts Writing post conditions Use past passive tense form (was..) Establish memory between existing objects: The most common mistake: not forming associations Association to several objects is very likely Think of the system and its object like a stage in a theatre Craig Larman

18 18 Contracts More on Contracts Generating complete and accurate set of post- conditions is not likely and not necessary Following pre-conditions worth capturing: Things that are important to test in software Things that affect the success of operation Use notes section to capture known design statements Use exceptions section to discuss reaction to exceptional situations

19 19 From Use Cases to Contracts Use Case: Buy Item … Typical Course of Events: 1.… Use Case Cashier System enterItem endSale makePayment System Sequence Diagram System enterItem() endSale() makePayment() System Operations Contracts Operation: enterItem … Post-conditions: 1. … Operation: endSale … Post-conditions: 1. …

20 20 Contracts More example (from larman’s book)

21 21

22 22

23 23

24 24 Contracts More example login use case  contract

25 25 Use Case Description

26 26

27 27

28 28 Object Oriented Analysis and Design Analysis Design Use Cases What are the domain process ? (text + visual notation) Software Requirements Specification What are the business needs ? (long text) Conceptual Model What are the concepts, terms ? (visual) System Sequence Diagrams What are the system events, operations ? (visual) Contracts What do the system operations do ? (text) Collaboration / sequence Diagrams How software objects interact to fulfill task ? (visual) Design Class Diagrams What is the specification for the software classes ? (visual)


Download ppt "1 Object Oriented Analysis and Design System Events & Contracts."

Similar presentations


Ads by Google