Module6 - First Half
Module6 - First Half
Module6 - First Half
Classification
Documentation.
WHAT IS ANALYSIS?
3. Questionnaire.
4. Observation.
REQUIREMENTS DIFFICULTIES
O-O Analysis
DEVELOPING BUSINESS PROCESSES
Implemented by Test2
Realized by
Use cases Test
Specified by Design1
Design2
Design4
Design3
Implementation
Design
Analysis
USE CASE MODEL (CONT)
Association
Use Case
<<Uses>>
<<Extends>>
TYPES OF USE CASES
Use cases could be viewed as concrete or abstract.
An abstract use case is not complete and has no
initiation actors but is used by a concrete use case,
which does interact with actors.
Concrete words(noun) help us describe things eg:
shout; abstract words(qualities) help us classify
them. eg.truth
IDENTIFYING THE ACTORS
80%-20%
FAMILIAR VOCABULARY
object-oriented analysis.
Note:
The more practice you have, the better you get at
identifying classes. Finding classes is an incremental
and iterative process.
GUIDELINES FOR REFINING CLASSES
(a)Redundant Classes:
Do not keep two classes that express the same
information.
If more than one word is being used to describe the
same idea, select the one that is the most meaningful
in the context of the system.
Note:
This is part of building a common vocabulary for the
system as a whole . Choose your vocabulary carefully;
use the word that is being used by the user of the
system.
GUIDELINES FOR REFINING CLASSES (CONT)
(b)Adjective Classes:
Does the object represented by the noun behave
differently when the adjective is applied to it?
eg.
Basketball coach here the noun basketball is being used
to describe the noun coach
A cricket bat
Accounts manager
Famous Indian cricket player
Note:
Beware of the use of adjectives. Adjectives can be used in many
ways. An adjective can suggest a different kind of object, different
use of the same object, or it could be utterly irrelevant.
GUIDELINES FOR REFINING CLASSES
(CONT)
If the use of the adjective signals that the
behavior of the object is different, then make a
new class.
For example, If Adult Membership and Youth
Membership behave differently, then they should
be classified as different classes.
Note:
Adult Members behave differently than Youth
Members, so ,the two should be classified as
different classes.
GUIDELINES FOR REFINING CLASSES
(CONT)
(c)Attribute Classes:
Tentative objects which are used only as values
should be defined or restated as attributes and not
as a class.
Eg:
Client Status and Demographic of Client are not
classes but attributes of the Client class
GUIDELINES FOR REFINING CLASSES
(CONT)
(d)Irrelevant Classes:
Each class must have a purpose and every class
should be clearly defined and necessary.
You must formulate a statement of purpose for
each candidate class.
If you cannot come up with a statement of purpose,
simply eliminate the candidate class.
NOTE
You can move back and forth among these steps as often as you like since this is an
incremental process.
Like any other activity of software development, the process of identifying relevant
classes and eliminating irrelevant classes is an incremental process.
The repetition of the entire process combined with what you already have learned
and the reworking of your candidate classes will enable you to gain a better
understanding of the system and the classes that make up your application.
Classification is the essence of good object-oriented analysis and design. You must
continue this refining cycle through the development process until you are satisfied
with the results.
You can move back and forth among these steps as often as you like (see next slide)
IDENTIFYING A LIST OF CANDIDATE
CLASSES
Library member
Member of staff
To better understand the noun phrase method,
we will go through a scenario and apply the noun
phrase strategy for identifying the classes.
We must start by reading the use cases and
applying the principles discussed for identifying
classes.
THE BANK ATM SYSTEM:
IDENTIFYING CLASSES BY USING NOUN PHRASE APPROACH
Basic elements :
Actors : someone/something outside the system that
triggers an event
SEQUENCE DIAGRAM NOTATION
Actor
Class
Synchronous message
Asynchronous message
Focus of Control
Return message
Termination
lifeline
C lie n t A T M M a c h in e B a n k C lie n t
In s e rt A T M c a rd
R e q u e s t P IN
R e q u e s t P IN n u m b e r
V e rify P IN N u m b e r
B a d P IN N u m b e r
B a d P IN N u m b e r
M essage
E je c t A T M c a rd
R e q u e s t ta k e c a rd
T a k e c a rd
D is p la y m a in s c re e n
Bank Client ATM Machine Account Checking Account
Request Kind
Enter Kind
Request Amount
Enter Amount
Process Transaction
Withdraw Checking Account
Transaction succeed Withdraw Successful
Dispense Cash
Objects
a collaboration diagram
Messages
COLLABORATION DIAGRAM
A Collaboration is a name given to the interaction
among two or more classes\objects.
Collaboration Diagram show
objects and their links to each other, as well as
how messages are sent between the linked objects.
COLLABORATION DIAGRAM -
PURPOSE
8: Transaction succeed
1: Request Kind
3: Request Amount
9: Dispense Cash
10: Request Take Cash
7: Withdraw Successful 6: Withdraw Checking Account
11: Take Cash
12: Request Continuation
Checking Account 14: Print Receipt
COLLABORATION DIAGRAM
COLLABORATION DIAGRAM VS
SEQUENCE DIAGRAM
However, a use case can contain many classes, and the same class
can occur in many different use cases.
Consider how we would prepare a sequence diagram for the
Invalid PIN use case.
Here, we need to think about the sequence of activities that the
actor BankClient performs: . Insert ATM Card. .Enter PIN
number. . Remove the ATM Card.
Based on these activities, the system should either grant the
access right to the account or reject the card. Next, we need to
more explicitly define the system.
With what are we interacting? We are interacting with an
ATMMachine and the BankClient. So, the other objects of this use
case are ATMMachine and BankClient.
Now that we have identified the objects involved in the use case,
we need to list them in a line along the top of a page and drop
dotted lines beneath each object (see Figure ).
The client in this case is whoever tries to access an account
through the ATM, and may or may not have an account. The
BankClient on the other hand has an account.
The dotted lines are the lifelines. The line on the right represents an
actor, in this case the Bank Client or an event that is outside the
system boundary.
An event arrow connect objects.
In effect, the event arrow suggests that a message is moving between
those two objects.
An example of an event message is the request for a PIN.
An event line can pass over an object without stopping at that object.
In some cases, several objects are active simultaneously, even if they
are only waiting for another object to return information to them.
In other cases, an object becomes active when it receives a message
and then becomes inactive as soon as it responds . Similarly, we can
develop sequence diagrams for other use cases (as in Figures ).
COLLABORATION DIAGRAM
Collaboration diagrams are just another view of the
sequence diagrams and therefore can be created
automatically; most UML modeling tools automatically
create them (see Figures )
The following classes have been identified by modeling
the UML sequence/collaboration diagrams:
Bank, BankClient, ATMMachine, Account, Checking
Account and Savings Account.
Similarly other classes can be identified by developing
the remaining sequence/ collaboration diagrams.
COLLABORATION DIAGRAM
THE COLLABORATION DIAGRAM FOR THE WITHDRAW MORE FROM
CHECKING -USE CASE
APPROACH4:CRC CARDS
CRC stands for Class, Responsibilities and
Collaborators developed by Cunningham, Wilkerson
and Beck.
CRC cards as a viable alternative to UML sequence
diagram to design the dynamics of object interaction
and collaboration
CRC is a brainstorming tool used in the design of
object-oriented software
CRC can be used for identifying classes and their
responsibilities.
By identifying an objects responsibilities and
collaborators, you can identify its attributes and
methods
PROCESS OF THE CRC TECHNIQUE
Identify
Classes
responsibility
Iterate
Identify Assign
Collaboration responsibility
CONTD
Classes are identified and grouped by common attributes which
also provides candidates for super classes.
The class names then are written onto Classes, Responsibilities,
and Collaborators cards. The card also notes sub- and super
classes to show the class structure.
The application's requirements then are examined for actions
and information associated with each class to find the
responsibilities of each class.
Next, the responsibilities are distributed; they should be as
general as possible and placed as high as possible in the
inheritance hierarchy.
The idea in locating collaborators is to identify how classes
interact.
Classes (cards) that have a close collaboration are grouped
together physically.
COLLABORATIONS
An object can accomplish either a certain responsibility
itself, or it may require the assistance of other objects.
If it requires an assistance of other objects, it must
collaborate with those objects to fulfill its responsibility.
CRC CARDS
CRC cards are usually created from index cards.
Members of a brainstorming session will write up one
CRC card for each relevant class/object of their design.
The card is partitioned into three areas:
On top of the card, the class name
ClassName
...
Collaborators
...
Responsibilities
EXAMPLE1 :ATM SYSTEM
CONTD..
The class name should appear in the upper left-hand
corner, a bulleted list of responsibilities should appear
under it in the left two thirds of the card, and the list of
collaborators should appear in the right third.
However, rather than simply tracing the details of a
collaboration in the form of message sending, Classes,
Responsibilities and Collaborators cards place the
designer's focus on the motivation for collaboration by
representing (potentially) many messages as phrases of
English text.
CRC CARDS (CONT)