2. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Learning Objectives
• State why domain modelling is done
• List the steps in Noun Phrase Approach for finding
candidate classes
• Apply the technique to find candidate classes
OOAD 2
3. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Domain Modelling
• What is a “domain”?
– Area of interest
– Area of the problem to be
solved
• Domain Modelling
– Modelling (to represent) the
business domain (problem
domain)
OOAD 3
4. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Why Perform Domain Modelling?
• Define the key concepts for the problem
domain.
– Also called candidate classes
• Identify and relate the key abstractions (key
classes / ideas) that the system must handle:
these candidate classes will be used to later
analyse and design the use case.
OOAD 4
5. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Conceptual/ Domain Modelling
• Two step process involving:
– Step 1: Find Candidate Classes
• Noun-Phrase Approach / Noun Analysis
– underline the noun(s) in the problem description and decide if they are
relevant and key to solving the problem)
– Step 2: Complete the domain model
• Add attributes
• Add relationships between classes
• Draw the classes, attributes and relationships on a class diagram.
• Domain Modelling captures:
• Candidate classes
• Attributes of candidate classes
• Relationships
OOAD 5
6. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Noun Phrase Approach
OOAD 6
Finding candidate classes
(Noun phrase approach)
Complete the
domain model
We are here
Domain modelling
7. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Noun Phrase Approach
• What are Nouns?
– A word that can be used to refer to a person, place,
thing, quality.
– Examples:
• Customer, Sale, ShoppingCart, Student, Movie, Teacher
– Noun with one or more other words.
– Example: "The black cat is happy."
• noun phrase: "the black cat"
– Noun/Class Cat
– Attribute Black
OOAD 7
8. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
OOAD 8
Exercise 1: Find the Nouns
• Given the following statement:
“All students in OOAD are fans of Mr. Bean and
watch his shows on their Laptops.”
• Find the nouns.
9. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Noun Phrase Approach (Steps)
• Read the documents, look for noun phrases, and make a list of nouns
• Divide the list of nouns into these categories:
– Relevant (Candidate Class).
– Fuzzy (we are not sure).
– Irrelevant.
– Attributes.
• Write a statement of purpose for each noun.
– For what purpose do you want to “store” this data?
– For irrelevant nouns, there's no reason for having them.
• For those in the “Relevant” and “Fuzzy” categories, write possible attributes
relevant to the domain
– If no attributes, the class is irrelevant
OOAD 9
10. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Guidelines for Class Identification
• Avoid computer implementation classes.
– Example: AccountDB_table
• too DB implementation specific
• If there are two classes with similar meaning, keep only one
(which is most meaningful).
– Subject & Course may have the same meaning
• If there is a class that is “relevant”, but does not map to a
concept in the system re-write it as an attribute
– Name, age are not classes but attributes of another class
OOAD 10
11. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
OOAD 11
Exercise 2: Apply Noun Phrase Approach
• Given the following statement:
“School ABC wants to track the number of hours each
student spends in the lab. A student using the lab has
his/her matric number and date stored. Each lab has a
number and location.
A weekly report is generated showing the number of
hours spent by each student per lab.”
• Use the Noun Phrase Approach to identify the candidate
classes for the domain of this lab usage system. Use the
noun phase analysis template.
12. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
OOAD 12
Noun-Phrase Analysis Template
Noun/Noun
Phrase
Statement of
purpose
Possible Attributes Classification Accept
(Y/N)
Reason for
Rejection
Partial Noun phrase approach to identify
candidate classes: (one row per noun you find)
Write “Relevant”,
“Fuzzy”,
“Irrelevant”, or
“Attributes”
Write the
noun
Write the
possible
attributes
Y(es) – accept
As candidate
class
13. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Food for Thought
• What are the steps in the noun phrase
approach?
• What are the categories in which we divide
our list of nouns?
OOAD 13
14. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
OOAD 14
Guidelines for Class Identification (1)
• Classes adorned with adjectives:
– Does the object represented by the noun behave
differently when the adjective is applied to it?
– If the use of the adjective signals that the behaviour of
the object is different, then make a new class.
– Example:
• If AdultMember and YouthMember behave differently or
contain several different properties, then they should be
classified as different classes.
15. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
OOAD 15
Guidelines for Class Identification(2)
• Irrelevant Classes:
– Each class must have a purpose and every class should be
clearly defined when necessary.
– If you cannot come up with a statement of purpose, simply
eliminate the candidate class.
– Example: If you are designing a computer system for the
school, and there is only 1 school, which is the Domain
environment for the system, we do not need to have School
class.
16. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
Naming Classes guidelines (3)
• Guidelines for Naming Classes
– The class should describe a single object, so it should be the singular form
of noun.
• Example: "Student" is correct; "Students" is wrong
– Use names that the users are comfortable with.
– The name of a class should reflect its intrinsic nature.
– Use readable names. By convention, the class name must begin with an
Upper-case letter.
– For compound words, capitalize the first letter of each word.
• Example: PartTimeStudent, FullTimeStudent.
OOAD 16
17. TEMASEK POLYTECHNIC • SCHOOL OF INFORMATICS & IT
The fate of candidate classes
• As we move from Requirements (domain
modelling is considered a requirements
analysis technique) to Use Case Analysis and
Use Case Design, we may discover more
classes, and we may also refine attributes
and add operations to our existing candidate
classes.
OOAD 17