Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Chapter 7 ooad
1. Chapter – 7
Object Analysis: Classification
Classification theory
Classification, the process of checking to see if an
object belongs to a category or a class, is regarded
as a basic attribute of human nature
Classes are an important mechanism for classifying
objects. The chief role of a class is to define the
attributes, methods and applicability of its instances.
The class car e.g.: defines the property color. Each
individual car will have a value for this property such
as yellow or white
Objects have properties(attributes) and
methods(behavior)
2. A class is a specification of structure, behavior and
the description of an object
Classification is concerned more with identifying the
class of an object than the individual objects within
a system
classes are important because they create
conceptual building blocks for designing systems
An object can be categorized in more than one way
The problem of classification may be regarded as
one of discriminating things, not between the
individual objects but between classes, via the
search for features or invariant attributes or
behaviors among members of a class
3. Classification can be defined as the
categorization of input data(things) into
identifiable classes via the extraction of
significant features of attributes of the data from
a background irrelevant detail
Approach for identifying classes
Four approaches
1.The noun phrase approach
2.The common class patterns approach
3.The use-case driven, sequence/collaboration
modeling approach
4.The classes, responsibilities and collaborators
(CRC) approach
4. Noun Phrase Approach
In this method, you read through the
requirements or use looking for noun phrases
Nouns in the textual description are considered
to be classes and verbs to be methods of the
classes
All plurals are changed to singular, the nouns are
listed and list is divided into 3 categories
1.relevant classes
2.fuzzy classes (those classes that we are not
sure about)
3.irrelevant classes
5. •Diagram
It is safe to scrap the irrelevant classes, which
either have no purpose or will be unnecessary
Candidate classes then are selected from the
other two categories
Identifying classes and developing a UML class
diagram just like other activities is an iterative
process
6. Identifying Tentative Classes
Guidelines for selecting classes in an application
1. Look for nouns and noun phrases in the use
cases
2. Some classes are implicit or taken form general
knowledge
3. All classes must make sense in the application
domain; avoid computer implementation
classes
4. Carefully choose and define class names
Finding classes in an incremental and iterative
process
7. Selecting Classes form the Relevant and Fuzzy
Categories:
Guidelines in selecting candidate classes from the
relevant and fuzzy categories of classes in the
problem domain
1. 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
Choose your vocabulary carefully; use the word
that is being used by the user of the system
8. 2.Adjective classes
An adjective can suggest a different kind of
object, different use of the same object or it
could be utterly irrelevant.
Does the object represented by the noun behave
differently when the adjective is applied to it ?
3.Attribute classes
Tentative objects that are used only as values
should be defined or restated as attributes and
not as a class
4.Irrelevant classes
Each class must have a purpose and every class
should be clearly defined and necessary
9. The process of identifying relevant classes and
eliminating irrelevant classes is an incremental
process
Each iteration often uncovers some classes that
have been overlooked
Classification is the essence of good object-
oriented analysis and design
The process of eliminating the redundant classes
and refining the remaining classes is not
sequential
10. The ViaNet Bank ATM System: Identifying Classes
by using Noun Phrase Approach Initial List of
Noun Phrases: Candidate Classes
Initial study of the use cases of bank system
products the following noun phrase (candidate
classes – may be)
Account Dollar Transaction
Account balance Envelope Transaction History
Amount Four Digit
Approval process Fund
11. ATM card Invalid PIN
ATM machine Message
Bank Money
Bank Client Password
Card PIN
Cash PIN code
Checking Record
Checking account Savings
Client Savings Account
Client’s Account Step
Currency System
12. Eliminate the irrelevant classes. Candidate classes
must be selected from relevant and fuzzy classes.
The following irrelevant classes can be eliminated
because they do not belong to the problem
statement: Envelope, Four Digits and step. Strike
outs indicate eliminate classes
Account Envelope
Account balance Four Digits
Amount Fund
Approval process Invalid PIN
ATM card Message
ATM machine Money
Bank Password
13. Bank client PIN
Card PIN code
Cash Record
Check Savings
Checking account Savings account
Checking Step
Client System
Client’s account Transaction
Currency Transaction History
Dollar
14. Reviewing the redundant classes and building a
common vocabulary
If different words are being used to describe the
same idea, select the one that is the most
meaningful in the context of the system and
eliminate the others
The following are the different class names that are
being used to refer to the same concept
Client, BankClient = Bank Client(the term chosen)
Account, Client’sAccount = Account
PIN, PIN code = PIN
Checking, Checking Account = Checking Account
Savings, Savings Account = Savings Account
Fund, Money = Fund
ATM Card, Card = ATM Card
15. Revised list of candidate classes
Account Envelope
Account Balance Four Digit
Amount Fund
Approval Process Invalid PIN
ATM card Message
Bank Money
Bank client Password
Card PIN
Cash PIN Code
Check, checking Savings
Checking Account Savings Account
Client Step
Client’s Account System
Currency Transaction
Dollar Transaction History
16. Reviewing the Classes Containing Adjectives
Question – Does the object represented by the
noun behave differently when the adjective is
applied to it?
If an adjective suggests a different kind of class
or the class represented by the noun behaves
differently when the adjective is applied to it,
then we need to make a new class
If it is a different use of the same object or the
class is irrelevant, we must eliminate it
In the above e.g.: no elimination
17. Reviewing the Possible Attributes
Identify the noun phrases that are attributes, not
classes
The noun phrases used only as values should be
restated as attributes
Amount – a value, not a class
Account Balance : an attribute of the Account class
Invalid PIN : it is only a value, not a class
Password : an attribute, possibly of Transaction class
PIN: an attribute, possibly of the BankClient class
18. Revised list of candidate classes
Account Four Digits
Account balance Fund
Amount Invalid PIN
Approval process Message
ATM card Money
Bank Password
Bank Client PIN
Card PIN Code
Cash Record
Check Savings
Checking Savings Account
Checking account Step
Client System
Client’s Account Transaction
Currency Transaction History
Dollar
Envelope
19. Reviewing the class purpose
Identifying the classes that play a role in
achieving system goals and requirements is a
major activity of object oriented analysis
Every class must have a purpose and should be
clearly defined
The classes that add no purpose to the system
have been deleted from the list
The candidate classes are these
1.ATM Machine Class: Provides an interface to the
ViaNet bank
20. 2.ATM Card Class: provides a client with a key to an
account
3.Bank Client class: a client is an individual that has a
checking account & possibly savings account
4.Bank class: bank clients belong to the bank. It is a
repository of accounts and processes the account’s
transactions
5.Account class: an account class is a formal (or
abstract) class, it defines the common behaviors that
can be inherited by more specific classes such as
checking Account and savingsAccount
6.Checking Account class: it models a clients checking
account and provides more specialized withdrawal
service
21. 7.Savings Account Class: it models a client’s savings
account
8.Transaction Class: keeps track of transaction,
time, date, type, amount and balance
Some classes are missing form the list and others
will be eliminated or refined later
The process of identifying classes can improve
gradually through incremental process
Problem with Noun Phrase approach:
i. It depends on the completeness and
correctness of the available document, which is
rare in real life
22. ii. Large volume of text on system documentation
might lead to too many candidate classes
iii. Noun phrase approach can be very educational
and useful if combined with other approaches
especially with use case
Common Class Patterns Approach
This approach is based on a knowledge base of
the common classes that have been proposed
by various researchers
Following is the list of patterns for finding the
candidate class and object
23. 1.Name. Concept class
Context. A concept is a particular idea or
understanding that we have of our world. when an
understanding is shared by another, it becomes a
concept
e.g.: performance is an example of concept class
object
2.Name. Events class
Context. Events classes are points in time that must be
recorded. Things happen, usually to something else
at a given date and time or as a step in an ordered
sequence. Associated with things remembered are
attributes such as who, what, when, where, how or
why.
Eg. Landing, interrupt , request and order are possible
events
24. 3.Name. Organization class
Context. An organization class is an collection of
people, resources, facilities or groups to which the
users belong; their capabilities have a defined
mission, whose existence is largely independent of
the individuals
e.g.: an accounting department might be considered a
potential class
4.Name. People class
Context. The people class represents the different
roles users play in interacting with the application.
People carry out some function. Coad and Yourdon
say a class which is represented by a person can be
divided into two types:
25. (i) Those representing users of the system, such as
an operator or clerk who interacts with the
system
(ii) And those representing people who do not use
the system but about whom information is kept
by system
e.g.: Employee, client, teacher, manager
5. Name. Place class
Context. Places are physical locations that the
system must keep information about
e.g.: buildings, stores, sites, and offices are
examples of places
26. 6.Name. Tangible things and devices class
Context. The class includes physical objects or
groups of objects that are tangible and devices
with which the application interacts
e.g.: cars – tangible things
Pressure sensors - devices
The ViaNet Bank ATM systems: Identifying Classes
by using Common Class Patterns
The bank system events classes follow
Account class: an account class is a formal (or
abstract) class. It defines the common behaviors
that can be inherited by more specific classes
such as checking Account and Savings Account
27. Checking 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: it keeps track of transaction, time,
date, type, amount and balance
the bank’s organization class follows Bank class:
Bank clients belong to the bank. It is a repository of
accounts and processes, the account’s transactions
The bank system people and person class Bank client
class: a client is an individual that has a checking
account and possibly a savings account
28. Place classes are not applicable to bank system
Tangible and device classes of bank system
ATM Machine class: it allows access to all accounts
held by a bank client.
Use-case Driven Approach: Identifying classes and
their Behavior through sequence / collaboration
Modeling
Modeling with use case is a recommended aid in
finding the objects of a system and is the technique
used by the unified approach
The process of creating sequence or collaboration
diagram is a systematic way to think about how a
use case(scenario) can take place; and it forces to
think about objects involved in the application
29. When building a new system, designers model the
scenarios of the way the system of business should
work
Implementation of Scenarios
At least one scenario is to be prepared for each
significantly different use-case instance
Each scenario shows a different sequence of
interaction b/w actors and the system
The process helps to understand the behavior of the
system’s objects
Sequence diagrams enables to model more specific
analysis and also assists in the design of the system
by modeling the interactions b/w objects in the
system
30. The ViaNet Bank ATM System: Decomposing a use-
case Scenario with a sequence Diagram: Object
Behavior Analysis
A sequence diagram represents the sequence and
interactions of a given use case or scenario
The following are the use-cases of the bank system
Deposit checking Withdraw Savings denied
Deposit savings Checking Transaction History
Invalid PIN Savings Transaction History
Withdraw checking
Withdraw more from checking
Withdraw savings
31. Create a sequence / collaboration diagram for the
following use case
1.Invalid PIN use card
2.Withdraw Checking use case
3.Withdraw more from checking use case
Invalid PIN use case
The activities the actor BankClient performs
Insert ATM card
Enter PIN number
Remove the ATM card
37. Classes, Responsibilities and Collaborations(CRC)
CRC is a technique used for identifying classes
responsibilities and therefore their attributes and
methods
CRC helps in identify classes
CRC is based on the idea that an object either
can accomplish a certain responsibility itself or it
may require the assistance of other objects
If it requires the assistance of other objects, it
must collaborate with those objects to fulfill its
responsibility
By identifying objects responsibility and
collaborators you can identify methods and
attributes
38. CRC cards are 4 power of 11 * 6 power of 11
index cards. All the information for an object is
written on a card
Class name appear in upper left-hand corner
Bulleted list of responsibility appear under it in
the left two thirds of the card
List of collaborators appear in right third
Cards are cheap, portable, readily available and
familiar
CRC stresses the importance of creating objects
not to meet mythical future needs, but only
under the demands of the moment
39. CRC index card
Classes, Responsibilities and Collaborators process
3 steps
1. Identify classes responsibilities(and identify
classes)
2. Assign responsibility
3. Identify collaborators
Class Name Collaborators
Responsibilities ………….………..
……………
41. The ViaNet Bank ATM System: Identifying Classes
by using CRC
For Account object
Account
Balance
Number
----------
Deposit
Withdraw
get Balance
Checking Account
(sub class)
Saving Account
(subclass)
transaction
42. Naming classes
Guidelines
1. Class name should be singular
2. Use names in which users or clients are
comfortable
3. Name of a class should reflect its intrinsic
nature
4. Use readable names