Download presentation
Presentation is loading. Please wait.
Published byGriffin Chase Modified over 9 years ago
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 of human nature. Classification guides us in making decisions about modularization. Classification also plays a role in allocating process to procedures
2
Classes are an important mechanisms for classifying objects. A class is a specification structure., behavior and the description of the object
3
Employer Employee Pet owner Woman Jill
4
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
5
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)
6
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.
7
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
8
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
9
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
10
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
11
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
12
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
13
Review redundant classes Review irrelevant classes Review attributes Review adjectives
14
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
15
Guidelines for identifying super-sub class relationship Top-down Bottom-up Reusability Multiple inheritance
16
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
17
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
18
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.
19
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
20
Multiple Inheritance Single inheritanceAggregation
21
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.
22
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.
23
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.
24
Car Engine Radio carburetor
25
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
26
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.
27
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
28
House Furniture Appliances
29
Collection –member :- a conceptual whole encompasses parts that may be physical or conceptual For example a football teams is a collection of players.
30
Football Team Player
31
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
32
Developing a UML class diagram based on the use-case analysis Bank client ATM machine Transaction Savings Account Checking Account BANK Account
33
Defining associations Part-of,next-to, works-for Location association: next to. Part of, contained in Communication association Talk to order to
34
BANK Account 1 1,2 Has
35
Guidelines for identifying super-sub class relationship Top-down Bottom-up Reusability Multiple inheritance
36
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
37
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
38
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.
39
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
40
Multiple Inheritance Single inheritanceAggregation
41
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.
42
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.
43
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.
44
Car Engine Radio carburetor
45
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
46
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.
47
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
48
House Furniture Appliances
49
Collection –member :- a conceptual whole encompasses parts that may be physical or conceptual For example a football teams is a collection of players.
50
Football Team Player
51
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
52
Developing a UML class diagram based on the use-case analysis Bank client ATM machine Transaction Savings Account Checking Account BANK Account
53
Defining associations Part-of,next-to, works-for Location association: next to. Part of, contained in Communication association Talk to order to
54
BANK Account 1 1,2 Has
55
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
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.