OOPortal OOPortal

Problem Analysis  «Prev  Next»
Lesson 5Identify classes and objects
ObjectiveIdentify classes and objects from the problem domain vocabulary.

Identify Classes and Objects when Object Modeling

Up to this point, we have discussed what a domain class is.
But would you know one when you see it? Would everyone in the team agree with your decision with respect to your interpretation of the problem domain?
What happens when you find some new information that changes your opinion?
Show your work
Here is a simple technique for tracking down classes which could represent the problem domain and will enable you to show your work.

Step 1:

Find the nouns
Read through the problem statement and the associated documentation and highlight the nouns. Parts of speech translate very nicely into object model elements. Nouns translate into classes or objects, attributes, or attribute values. (Verbs often reveal operations or associations.)

Part of Speech Model Element
  1. Object (useful as test data)
  2. Class
  3. Attribute
  4. Attribute value (useful as test data)
  1. Association
  2. Operation
  3. Event
Adjective State

I use this technique without exception. When I walk into a consulting situation, I am expected to come up to speed instantly. I immediately gather the most significant documents, highlight the nouns and verbs, and build a data dictionary. Through this process of highlighting the nouns and verbs, I am able to generate classes that best represent the situation at hand. Invariably, I am able to ask probing questions that challenge the (SME) subject matter experts simply by scrutinizing their own vocabulary. By asking the users of the system questions with respect to the problem domain, I am assured that the client I am communicating with, has a deep understanding of the problem domain.

Step 2:

Evaluate the nouns to find classes
Questions to ask to evaluate nouns to find classes:
  1. Is the term needed within the scope of the project?
  2. If so, then does the noun qualify as a problem domain resource? Think of an appropriate class name for the domain resource to which the noun refers.
  3. Otherwise, is the noun an example of a class, for example, an object, an instance of a class? What class? Write down this fact and refer back to it when you need test data.
  4. Otherwise, is the noun an attribute of a class? What class? Write it down.
  5. Otherwise, is the noun an example of an attribute, for example, an attribute value? Write down this fact and refer back to it when you need test data.

Be sure to reconcile terms. You will often encounter synonyms. Pick the most meaningful term and point the other terms to it. Be certain that the users agree with your choice.

Step 3:

Define the purpose
Describe why the class is a required resource of the problem domain.
Here is an example of the process just described from the course project. From the problem statement (nouns in bold):
Our auditorium is used for different types of events. Some of the events are one-time events, such as basketball games. Other events consist of a number of shows, such as plays or concerts.

Candidate Term Not a class because Class Name Class Purpose
Auditorium   Auditorium The facility in which the events are held and for which tickets are sold
Event   Event A performance negotiated by the event planner and presented in one or more shows
Basketball game It is a type of event    
Show   Show A single presentation of an event
Play It is a type of event    
Concert It is a type of event    

Classes Objects - Exercise

Click the Exercise link below to identify the classes in the course project problem statement.
Classes Objects - Exercise