Noun phrase approach: 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 the list divided into relevant classes, fuzzy classes and irrelevant class. Look for the noun phrases through the use cases.
Three categories:
Relevant classes. Fuzzy classes. Irrelevant classes.
Identifying tentative classes.
Look for noun phrases and nouns 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 class names.
Selecting classes from the relevant and fuzzy classes.
Redundant classes. Adjective classes. Attribute classes. Irrelevant classes.
Candidate classes are selected from the relevant and fuzzy categories. The guidelines that are to be followed are: Redundant classes: Don’t keep two classes that express the same information. Adjectives classes: If the object behaves differently when the adjective is applied then make a new class Attribute classes: Tentative objects that are used only as values should be defined as attributes and not as a class Irrelevant classes: Each class should have a purpose.
Guide lines for selecting classes in all application:
Carefully choose and define class names. All classes must make sense in the application domain, avoid computer implementation classes – defer there to the design stage. Look for nouns and noun-phrases in the use cases. Some classes are implicit or taken from general knowledge.
Example: Bank ATM system: Identifying classes by using noun phrase approach: Initial list of Noun phrases candidate classes o o o o o o o o o o o o o o o o o
Balance Amount Approval process ATM card ATM machine Bank Bank client Card Cash Check Checking Checking Client Client’s Currency Dollar
o o o o o o o o o o o o o o o o
Envelope Four digits Fund Savings Savings Step System Transaction Transaction history Invalid PIN Message Money PIN Pin Code Record
The following irrelevant classes are removed from the above list:
Envelope Four Digits Step
Reviewing the Redundant classes and Building a common vocabulary: Client, Bank client = Bank client , Client’s = PIN, PIN code = PIN Checking, Checking = Checking Savings, Savings = Savings
Fund, Money ATM card, card
= Fund = ATM card
Reviewing the classes containing adjectives In this example, we have no classes containing adjectives that we can eliminate. Reviewing the Possible Attribute Amount = A value not a class Balance = An attribute of the class Invalid PIN = It is only a value, not class = An attribute for Bank client class Transaction history = An attribute of transaction class PIN = An attribute of Bank client class Reviewing the class purpose The final candidate classes are: o o o o o o o o
ATM machine class ATM card class Bank client Bank class class Checking class Savings class Transaction class