55
Object oriented classification •Classification is 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. •Classification guides us in making decisions about modularization. •Classification also plays a role in allocating process to procedures

Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Embed Size (px)

Citation preview

Page 1: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Object oriented classification

•Classification is 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.

•Classification guides us in making decisions about modularization.

•Classification also plays a role in allocating process to procedures

Page 2: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Classes are an important mechanisms for classifying objects.

• A class is a specification structure., behavior and the description of the object

Page 3: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Employer Employee

Pet owner Woman Jill

Page 4: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• So classification is defined as the categorization of input data (things) into identifiable classes via the extraction of the significant feature of attributes of the data from a background of irrelevant details

Page 5: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Approaches to identifying classes

• Identifying classes

• Noun phase approach

• The common class pattern approach

• Use case driven/sequence/collaboration modeling approach

• Classes, responsibilities, collaborators (CRC)

Page 6: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Noun phase approach

• It was proposed by Rebecca Wirfs-Brock

• You read the through the requirements or use cases looking for noun phases

• Noun in the textual description are considered to be classes and verbs to be methods of the classes.

Page 7: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• All plurals are changed into singular

• Nouns are listed

• List divided into three categories

• Relevant classes

• Fuzzy classes (those classes that are not sure about)

• Irrelevant classes

Page 8: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Identifying Tentative classes

• The following guidelines • 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 • Carefully choose and define the class

names

Page 9: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Selecting classes from the relevant and fuzzy categories

• Guidelines

• Redundant classes:- Do not keep two classes that express the same information.

• It 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 vocabulary carefully

Page 10: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Adjectives classes:- “ Be wary 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.

• Ex adult members behave different from young members so the two should be classified a different classes

Page 11: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Attribute classes: tentative objects that are used only a values should be defined or restated as attributes not as a class.

• For ex: client status and demographic of client are not classes but attributes of the client classes

Page 12: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• 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 classes.

• If you cannot come up with a statement of purpose , simply eliminate the candidate class

Page 13: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Review redundant classes

Review irrelevant classes

Review attributes

Review adjectives

Page 14: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• The vianet bank system: identifying classes by using noun phrase approach

• Initial list of noun phrases: candidate classes:

• The initial study of the use cases of the bank system produces the following noun phrases

Page 15: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Guidelines for identifying super-sub class relationship

Top-downBottom-upReusability

Multiple inheritance

Page 16: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Top-down

• Look for noun phrases composed of various adjectives in a class name.

• Avoid excessive refinement.• Specialize only when the subclasses have

significant behavior.• For example , a phone operator can be

represented as a cook as well as a clerk or manager because they all have similar behavior

Page 17: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Bottom-up

• Look for classes with similar attributes or methods

• You can group them by moving the common attributes and methods to an abstract class

• You may have to alter the definitions a bit; this is acceptable as long as generalization truly applies

Page 18: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Reusability

• Move attributes and behaviors (methods) as high as possible in the hierarchy.

• Do not create very specialized classes at the top of the hierarchy.

• The balancing act can be achieved by several iterations

• This process ensures that you design objects that can be reused in another application.

Page 19: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Multiple inheritance

• Avoid excessive use of multiple inheritance • It give more complications• How to determine which behavior to get from

which class , particularly several ancestors define the same method

• One way to achieve the benefits of MI is to inherit from the most appropriate class and add an object of another class as an attribute

Page 20: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Multiple Inheritance

Single inheritance Aggregation

Page 21: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

A-part of relationships-Aggregation

• A-part of relationships also called Aggregation , represents the situation where a class consists of several component classes.

• A class that is composed of other classes does not behave like its parts.

• For example a car consist of many other classes, one of which is radio , but a car does not behave like a radio.

Page 22: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Two major properties

• Transitivity :- the property where

• If a-> b and b>c so a->c

• For example a carburetor is part of an engine and engine is a part of car , therefore a carburetor is a part of car.

Page 23: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Ant symmetry:- the property of a-part-of relation where , if A is a part of b , then B is not part of A

• For example an engine is part of car, but a car is not part of engine .

Page 24: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Car

Engine Radio

carburetor

Page 25: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Does the part class belong to a problem domain?

• Is the part class within the system’s responsibilities?

• Does the part class capture more than a single value?

• Does it provides a useful abstraction in dealing problem domain?

• Hallow diamond represents Aggregation

Page 26: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

A-part-of-relationship patterns

• Assembly: an assembly is constructed from its parts and an assembly-part situation physically exists

• For example a French onion soup is an assembly of onion, butter, flour, French bread, cheddar cheese and so on.

Page 27: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Container:- a physical whole encompasses but is not constructed from physical parts.

• For example a house can be considered as a container for furniture and appliances

Page 28: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

House

Furniture Appliances

Page 29: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Collection –member :- a conceptual whole encompasses parts that may be physical or conceptual

• For example a football teams is a collection of players.

Page 30: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Football Team

Player

Page 31: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Case study Relationship analysis for vianet bank ATM system

• Identifying classes relationships

• One of the strengths of object-oriented analysis is the ability to model objects as they exist in the real world.

• Several different relationships exist in the vianet bank ATM system

Page 32: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Developing a UML class diagram based on the use-case analysis

• Bank client• ATM machine• Transaction• Savings Account• Checking Account

BANK Account

Page 33: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Defining associations

• Part-of ,next-to, works-for

• Location association: next to. Part of, contained in

• Communication association

• Talk to order to

Page 34: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

BANK

Account

1

1,2

Has

Page 35: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Guidelines for identifying super-sub class relationship

Top-downBottom-upReusability

Multiple inheritance

Page 36: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Top-down

• Look for noun phrases composed of various adjectives in a class name.

• Avoid excessive refinement.• Specialize only when the subclasses have

significant behavior.• For example , a phone operator can be

represented as a cook as well as a clerk or manager because they all have similar behavior

Page 37: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Bottom-up

• Look for classes with similar attributes or methods

• You can group them by moving the common attributes and methods to an abstract class

• You may have to alter the definitions a bit; this is acceptable as long as generalization truly applies

Page 38: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Reusability

• Move attributes and behaviors (methods) as high as possible in the hierarchy.

• Do not create very specialized classes at the top of the hierarchy.

• The balancing act can be achieved by several iterations

• This process ensures that you design objects that can be reused in another application.

Page 39: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Multiple inheritance

• Avoid excessive use of multiple inheritance • It give more complications• How to determine which behavior to get from

which class , particularly several ancestors define the same method

• One way to achieve the benefits of MI is to inherit from the most appropriate class and add an object of another class as an attribute

Page 40: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Multiple Inheritance

Single inheritance Aggregation

Page 41: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

A-part of relationships-Aggregation

• A-part of relationships also called Aggregation , represents the situation where a class consists of several component classes.

• A class that is composed of other classes does not behave like its parts.

• For example a car consist of many other classes, one of which is radio , but a car does not behave like a radio.

Page 42: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Two major properties

• Transitivity :- the property where

• If a-> b and b>c so a->c

• For example a carburetor is part of an engine and engine is a part of car , therefore a carburetor is a part of car.

Page 43: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Ant symmetry:- the property of a-part-of relation where , if A is a part of b , then B is not part of A

• For example an engine is part of car, but a car is not part of engine .

Page 44: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Car

Engine Radio

carburetor

Page 45: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Does the part class belong to a problem domain?

• Is the part class within the system’s responsibilities?

• Does the part class capture more than a single value?

• Does it provides a useful abstraction in dealing problem domain?

• Hallow diamond represents Aggregation

Page 46: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

A-part-of-relationship patterns

• Assembly: an assembly is constructed from its parts and an assembly-part situation physically exists

• For example a French onion soup is an assembly of onion, butter, flour, French bread, cheddar cheese and so on.

Page 47: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Container:- a physical whole encompasses but is not constructed from physical parts.

• For example a house can be considered as a container for furniture and appliances

Page 48: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

House

Furniture Appliances

Page 49: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Collection –member :- a conceptual whole encompasses parts that may be physical or conceptual

• For example a football teams is a collection of players.

Page 50: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Football Team

Player

Page 51: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Case study Relationship analysis for vianet bank ATM system

• Identifying classes relationships

• One of the strengths of object-oriented analysis is the ability to model objects as they exist in the real world.

• Several different relationships exist in the vianet bank ATM system

Page 52: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

• Developing a UML class diagram based on the use-case analysis

• Bank client• ATM machine• Transaction• Savings Account• Checking Account

BANK Account

Page 53: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Defining associations

• Part-of ,next-to, works-for

• Location association: next to. Part of, contained in

• Communication association

• Talk to order to

Page 54: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

BANK

Account

1

1,2

Has

Page 55: Object oriented classification Classification is the process of checking to see if an object belongs to a category or a class, is regarded as a basic attribute

Defining super-sub relationship

• Top-down : Look for noun phrases composed of various adjectives in the class name

• Bottom-up: Look for classes with similar attributes or methods

• Reusability : Move attributes and behaviors as high as possible in the hierarchy

• Multiple inheritance: Avoid excessive use of multiple inheritance