Object-Oriented programming 1 SSD3: Object-Oriented Programming and Design.
1 Object Oriented Analysis and Design System Events & Contracts.
-
Upload
esmond-jefferson -
Category
Documents
-
view
220 -
download
0
Transcript of 1 Object Oriented Analysis and Design System Events & Contracts.
![Page 1: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/1.jpg)
1
Object OrientedAnalysis and Design
System Events
&
Contracts
![Page 2: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/2.jpg)
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)
ConceptualModel
What are the concepts, terms ?
(visual)
SystemSequenceDiagrams
What are the system events, operations ?
(visual)
Contracts
What do the system operations do ?
(text)
Collaboration / sequenceDiagrams
How software objects interact to fulfill task ?
(visual)
Design Class
Diagrams
What is the specification for the software classes ?
(visual)
![Page 3: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/3.jpg)
3אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
System Sequence Diagrams
Cashier
:System
enterItem(UPC,quantity)
endSale()
makePayment(amount)
Corresponds to:Buy Item Use Case
Repeat until no more items
![Page 4: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/4.jpg)
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 transactionDescription and price of the current item is presented
5. Calculates and presents sale total
![Page 5: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/5.jpg)
5אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
System Sequence Diagramselements
Cashier
:System
enterItem(UPC,quantity)
endSale()
makePayment(amount)
Corresponds to:Buy Item Use Case
Repeat until no more items
ActorCross reference to use case
Text to clarify logic, control,
iterations, etc..
System event
System BLACK BOX
![Page 6: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/6.jpg)
6אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
System Sequence Diagramselements
enterItem(itemID, quantity)
:System: Cashier
endSale()
makePayment(amount)
box may enlose aniteration area
the * [...] is an iterationmarker and clauseindicating the box is foriteration
external actor tosystem
Process Sale Scenario
system as black box
the name could be "NextGenPOS" but "System" keeps itsimple
the ":" and underline imply an instance, and are explained in alater chapter on sequence diagram notation in the UML
a message withparameters
it is an abstractionrepresenting thesystem event ofentering thepayment data bysome mechanism
description, total
return value(s)associated with theprevious message
an abstraction thatignores presentationand medium
the return line isoptional if nothing isreturned
total with taxes
change due, receipt
* [more items]
makeNewSale()
![Page 7: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/7.jpg)
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
![Page 8: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/8.jpg)
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
![Page 9: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/9.jpg)
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)
ConceptualModel
What are the concepts, terms ?
(visual)
SystemSequenceDiagrams
What are the system events, operations ?
(visual)
Contracts
What do the system operations do ?
(text)
Collaboration / sequenceDiagrams
How software objects interact to fulfill task ?
(visual)
Design Class
Diagrams
What is the specification for the software classes ?
(visual)
![Page 10: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/10.jpg)
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
![Page 11: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/11.jpg)
11אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
Contractsexample: 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
![Page 12: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/12.jpg)
12אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
Contractsexample: 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)
![Page 13: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/13.jpg)
13אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
ContractsContract 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
![Page 14: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/14.jpg)
14אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
ContractsContract 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
![Page 15: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/15.jpg)
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
![Page 16: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/16.jpg)
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 deletionAttribute modificationAssociation formed or broken
![Page 17: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/17.jpg)
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
![Page 18: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/18.jpg)
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
![Page 19: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/19.jpg)
19אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
From Use Cases to Contracts
Use Case: Buy Item…Typical Course of Events:1. …
Use Case
Cashier System
enterItemendSale
makePayment
System Sequence Diagram
System
enterItem()endSale()makePayment()
SystemOperations
Contracts
Operation:enterItem…Post-conditions:1. …
Operation:endSale…Post-conditions:1. …
![Page 20: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/20.jpg)
20אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
Contracts
More example(from larman’s book)
![Page 21: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/21.jpg)
21אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
![Page 22: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/22.jpg)
22אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
![Page 23: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/23.jpg)
23אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
![Page 24: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/24.jpg)
24אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
Contracts
More examplelogin use case contract
![Page 25: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/25.jpg)
25אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
Use Case Description
![Page 26: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/26.jpg)
26אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
![Page 27: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/27.jpg)
27אוריאל ברגיג, המכללה למנהל - המסלול האקדמי, קורס הנדסת תוכנה מכוונת עצמים
![Page 28: 1 Object Oriented Analysis and Design System Events & Contracts.](https://reader035.fdocuments.in/reader035/viewer/2022062408/56649ea05503460f94ba3a56/html5/thumbnails/28.jpg)
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)
ConceptualModel
What are the concepts, terms ?
(visual)
SystemSequenceDiagrams
What are the system events, operations ?
(visual)
Contracts
What do the system operations do ?
(text)
Collaboration / sequenceDiagrams
How software objects interact to fulfill task ?
(visual)
Design Class
Diagrams
What is the specification for the software classes ?
(visual)