11.10.2013 Views

Slides Part 2 (OOA, pages 1-128, pdf, 4 slides per page)

Slides Part 2 (OOA, pages 1-128, pdf, 4 slides per page)

Slides Part 2 (OOA, pages 1-128, pdf, 4 slides per page)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPLICATION OF THE DESIGN-BY-CONTRACT-PRINCIPLE<br />

➠ Fusion <strong>OOA</strong>: Specifies system o<strong>per</strong>ations by means of preconditions and<br />

postconditions.<br />

➠ Fusion OOD: Specifies all added o<strong>per</strong>ations by means of preconditions<br />

and postconditions.<br />

➠ OOI: Give preconditions and postconditions as documentation in the<br />

source code.<br />

➠ There are programming languages (e. g. Eiffel) which allow for dynamic<br />

checking of preconditions and postconditions.<br />

CLASS MODEL FOR BANK<br />

Schufa<br />

Bank<br />

81<br />

Queries<br />

Owns<br />

Customer Account<br />

Checking<br />

Keeps<br />

Works_for<br />

Savings Credit<br />

83<br />

BankClerk<br />

LoanEx<strong>per</strong>t<br />

EXAMPLE: WITHDRAW MONEY FROM BANK ACCOUNT<br />

sd WithdrawN<br />

sd<br />

: Bank<br />

WithdrawE<br />

BankClerk BankClerk<br />

withdraw_money<br />

withdraw_money<br />

give_money no_cover<br />

OPERATION SCHEMA<br />

82<br />

O<strong>per</strong>ation = withdraw money<br />

Description = Money should be withdrawn from an account. This is possible<br />

only if the account is not overdrawn.<br />

Reads = supplied accountnr : Accountnr<br />

supplied amount : N<br />

: Bank<br />

Changes = account : Account with account.number = accountnr<br />

with: Predicate which uniquely determines an object.<br />

number must be introduced as attribute of the class Account<br />

(=⇒ system class model)<br />

84

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!