How to identify classes

Hi All,

I am beginner to OOAD. Please guide me by specifying any easy steps or procedure available to identify classes from requirements.

Thanks in Advance.

Also please suggest me good books and online materials/tutorials on ooad topic.

Thanks & Regards,

Vasu

[304 byte] By [vasudev123a] at [2007-10-2 2:39:33]
# 1

Try describing the problem in plain english (or your native language). Look at your description and note the "things" in it (subjects and objects in the sentences). Also note the actions that happend between these things (verbs).

For example:

Create a program that allows a customer at a bank to access information about his bank account. Requirements are that the customer should be able to check the current balance on his account and withdraw an amount of cash from his account as long as the amount does not exceed the current balance of the account. The balance in an account can never go below zero.

In this description, I note the following 'things':

Customer

Bank

Account

Amount (of cash)

Balance

The would be my initial candidate classes. Some may be modelled using basic types from Java, others using Java standard classes, and still others will require custom classes. In this simple case, I would probably implement Amount and Balance as floats in Java. The others would likely end up as custom classes.

I also note the following 'actions':

check the Balance (on an Account)

withdraw an Amount (from the Balance of an Account)

These actions can be translated into methods, of the class Account in this case. A partial implementation of the class Account would probably look something like this:public class Account {

private float balance;

// check the balance on the account

public void getBalance() {

return balance;

}

// withdraw an amount from the account balance

public void withdraw(float amount) {

if(balance >= amount) {

balance = balance - amount;

} else {

// report to user that there was insufficient balance

}

}

}

Herko_ter_Horsta at 2007-7-15 20:31:50 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
There are a number of tools which may be able to help you in various ways.I find using tools to see a call tree, remove methods and class which are not used, and tools to reverse engineer the "design" can be useful.
Peter-Lawreya at 2007-7-15 20:31:50 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Hi Peter-Lawrey, Thanks for your timely help.Can you please suggest me good tools which can help me. Thanks & Regards, vasu
vasudev123a at 2007-7-15 20:31:50 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
Hi Herko_ter_Horst, Thanks for your feedback. Can you please suggest good books on ooad. Thanks & Regards, vasu
vasudev123a at 2007-7-15 20:31:50 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

Hi...

As per RUP...

1)Is this candidate inside our system boundary?

If not, it might be an actor of our system.

2)Does this candidate have identifiable behavior for our problem domain?

(i.e., can we name the services/functions that are needed in our problem domain and that this candidate would own and provide?)

3)Does this candidate have identifiable structure?

(i.e., can we identify some set of data this candidate should own and manage?)

4)Does this candidate have relationships with any other candidates?

if all questions answer is YES then it's Class.

You can find out more information on

http://www-128.ibm.com/developerworks/rational/library/5383.html

thx

itcube.ians

itcube.iansa at 2007-7-15 20:31:50 > top of Java-index,Other Topics,Patterns & OO Design...