47
1 Object-Oriented Analysis Use Case Driven

1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

Embed Size (px)

Citation preview

Page 1: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

1

Object-Oriented Analysis

Use Case Driven

Page 2: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

2

The outline method for OOA

1.Identify object classes within the problem domain

2.Define the behaviour of those classes

3.Define the attributes and methods of those classes

4.Model the relationships between those classes

From the text book P79.

Page 3: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

3

Develop use cases, activity

diagrams

Identify classes, relationships, and

methods

Develop interaction diagrams

Refine and iterate

Page 5: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

5

Actors:•An actor is a user playing a role with respect to the system.

Page 6: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

6

Actors:•An actor is a user playing a role with respect to the system.•An actor is the key to finding the correct use cases.

Page 7: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

7

Actors:•An actor is a user playing a role with respect to the system.•An actor is the key to finding the correct use cases.•An actor can be an external system.

Use cases:

Page 8: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

8

Actors:•An actor is a user playing a role with respect to the system.•An actor is the key to finding the correct use cases.•An actor can be an external system.

Use cases:A use case is a sequence of transactions in a system whose task is to yield results of measurable value to an individual actor of the system.

Transaction

Page 9: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

9

Actors:•An actor is a user playing a role with respect to the system.•An actor is the key to finding the correct use cases.•An actor can be an external system.

Use cases:A use case is a sequence of transactions in a system whose task is to yield results of measurable value to an individual actor of the system.

Transaction is an atomic set of activities that are performed either fully or not at all.

Page 10: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

10

Actors:•An actor is a user playing a role with respect to the system.•An actor is the key to finding the correct use cases.•An actor can be an external system.

Use cases:A use case is a sequence of transactions in a system whose task is to yield results of measurable value to an individual actor of the system.

Transaction is an atomic set of activities that are performed either fully or not at all.

Use case is a special flow of events through the system. However, many courses of events are possible, so we must group the courses of events and call each group a use case class.

Page 11: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

11

Library

Borrow books

Return books

Interlibrary loan

Do research

Read books, newspaper

Purchase supplies

Member

Circulation clerk

Supplier

Page 12: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

12

Dividing use cases into packages

For example, in a library system, the various scenarios involve a member borrowing books, a member do research, or a supplier providing books.

Page 13: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

13

How to use <<include>> and <<extends>>

Page 14: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

Irrelevant ClassesIrrelevant Classes

14

Classes identification –

Fuzzy ClassesFuzzy ClassesRelevant ClassesRelevant Classes

Page 15: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

15

Classes identification –

1.The noun phrase approach

2.The use case driven (Sequence/collaboration modeling approach)

3.Classes, Responsibilities, and Collaborators (CRC) approach

Page 16: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

16

The noun phrase approach

Look for nouns and noun phrases in the use cases.

Some classes are implicit or taken from general knowledge

All classes must make sense in the application domain.

Page 17: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

17

Common mistake – use case refers to aprocess (not a class)

Use case can contain many classesThe same class can occur in many different use cases

Example: Using ATM machineStep 1: insert ATM cardStep 2: enter PIN numberStep 3: may/may not do somethingStep 4: Remove the ATM Card

Page 18: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

18

A simple ATM system use cases –

Deactivate ATMWithdraw money

Deposit money

Check balance

Transfer money

Print audit log

Cardholder

Bank employee

Validate pin

<<include>>

<<include>>

<<include>>

<<include>>

Page 19: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

19

The noun phrase approach

Initial list of noun phrases: Candidate Classes

AccountAccount BalanceAmountApproval ProcessATM CardATM MachineBankBank ClientCardCashCheckChecking Account

ClientClient’s AccountCurrencyDollarEnvelopeFour DigitsFundInvalid PinMoneyPasswordPINPIN Code

RecordSavings AccountSystemStepTeletubbieTransactionTransaction Historyetc.,

Page 20: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

20

The noun phrase approach

Eliminate the irrelevant Classes

Page 21: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

21

The noun phrase approach

Eliminate the irrelevant Classes

AccountAccount BalanceAmountApproval ProcessATM CardATM MachineBankBank ClientCardCashCheckChecking Account

Page 22: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

22

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

AccountAccount BalanceAmountApproval ProcessATM CardATM MachineBankBank ClientCardCashCheckChecking Account

Page 23: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

23

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

Page 24: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

24

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

Account, Client’s Account = Account

Page 25: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

25

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

Account, Client’s Account = Account

ATM Card, Card = ATM Card

Page 26: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

26

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

Account, Client’s Account = Account

ATM Card, Card = ATM Card

Client, Bank Client = Bank Client

Page 27: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

27

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

Account, Client’s Account = Account

ATM Card, Card = ATM Card

Client, Bank Client = Bank Client

Fund, Money = Fund

Page 28: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

28

The noun phrase approach

Reviewing the Redundant Classes and Building a Common Vocabulary

Account, Client’s Account = Account

ATM Card, Card = ATM Card

Client, Bank Client = Bank Client

Fund, Money = Fund

PIN, PIN Code = PIN

Page 29: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

29

The noun phrase approach

Revised list - Reviewing the Redundant Classes and Building a Common vocabulary

Page 30: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

30

The noun phrase approach

Reviewing the Possible Attributes

Page 31: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

31

The noun phrase approach

Reviewing the Possible Attributes

Account Balance: An attribute of the Account class

Page 32: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

32

The noun phrase approach

Reviewing the Possible Attributes

Account Balance: An attribute of the Account class

Amount: A value, not a class

Page 33: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

33

The noun phrase approach

Reviewing the Possible Attributes

Account Balance: An attribute of the Account class

Amount: A value, not a class

Invalid PIN: It is only a value, not a class

Page 34: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

34

The noun phrase approach

Reviewing the Possible Attributes

Account Balance: An attribute of the Account class

Amount: A value, not a class

Invalid PIN: It is only a value, not a class

Password: An attribute, possibly of the Bank Client class

Page 35: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

35

The noun phrase approach

Reviewing the Possible Attributes

Account Balance: An attribute of the Account class

Amount: A value, not a class

Invalid PIN: It is only a value, not a class

Password: An attribute, possibly of the Bank Client class

PIN: An attribute, possibly of the Bank Client class.

Page 36: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

36

The noun phrase approach

Reviewing the Possible Attributes

Account Balance: An attribute of the Account class

Amount: A value, not a class

Invalid PIN: It is only a value, not a class

Password: An attribute, possibly of the Bank Client class

PIN: An attribute, possibly of the Bank Client class.

Transaction History: An attribute, possibly of the Transaction class

Page 37: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

37

The noun phrase approach

Revised list - Reviewing the Possible Attributes

Page 38: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

38

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Page 39: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

39

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings Account

Page 40: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

40

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an account

Page 41: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

41

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an accountATM Machine class: Provides an interface to the ABC Bank

Page 42: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

42

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an accountATM Machine class: Provides an interface to the ABC BankBank class: Bank clients belongs to the Bank. It is a repository of accounts and processes the accounts’ transactions

Page 43: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

43

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an accountATM Machine class: Provides an interface to the ABC BankBank class: Bank clients belongs to the Bank. It is a repository of accounts and processes the accounts’ transactionsBank Client class: A client is an individual that has a checking account and/or a savings account

Page 44: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

44

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an accountATM Machine class: Provides an interface to the ABC BankBank class: Bank clients belongs to the Bank. It is a repository of accounts and processes the accounts’ transactionsBank Client class: A client is an individual that has a checking account and/or a savings accountChecking Account class: It models a client’s checking account and provides more specialized withdrawal service.

Page 45: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

45

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an accountATM Machine class: Provides an interface to the ABC BankBank class: Bank clients belongs to the Bank. It is a repository of accounts and processes the accounts’ transactionsBank Client class: A client is an individual that has a checking account and/or a savings accountChecking Account class: It models a client’s checking account and provides more specialized withdrawal service.Savings Account class: It models a client’s savings account.

Page 46: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

46

The noun phrase approach

Reviewing the Class Purpose – each class must have a purpose. If we cannotformulate a statement of purpose for a class, simply eliminate it.

Account class: An Account class is a formal (abstract) class, it defines the common behaviors that can be inherited by more specific classes such as Checking Account and Savings AccountATM Card class: Provides a client with a key to an accountATM Machine class: Provides an interface to the ABC BankBank class: Bank clients belongs to the Bank. It is a repository of accounts and processes the accounts’ transactionsBank Client class: A client is an individual that has a checking account and/or a savings accountChecking Account class: It models a client’s checking account and provides more specialized withdrawal service.Savings Account class: It models a client’s savings account.Transaction class: Keeps track of transaction, time, date, type, amount, and balance

Page 47: 1 Object-Oriented Analysis Use Case Driven. 2 The outline method for OOA 1.Identify object classes within the problem domain 2.Define the behaviour of

47

The noun phrase approach

Revised list - Reviewing the Possible Attributes – revised list