Download presentation
Presentation is loading. Please wait.
Published byPeregrine Parsons Modified over 6 years ago
1
OO Domain Modeling With UML Class Diagrams and CRC Cards
Chapter 6 Princess Nourah bint Abdulrahman University College of Computer and Information Sciences Department of Computer Science Dr. Doaa Sami Khafaga
2
Objectives The main objective of this chapter is to know: how to properly use the most essential features of UML class diagrams, and the typical problems you will encounter when modeling with class diagrams. In this chapter we: Introduce the evolutionary approach for building classes Explain how to identify objects and attributes of classes Describe the technique of CRC ‘Class Responsibility and Collaborator’ Explain how classes are related in a class diagram Explain generalization, association, aggregation and composition Introduce object diagrams Software Engineering OO Domain Modeling
3
What is a Domain Model? Use cases looked at the system’s environment (actors) and the system’s external behavior. Use cases consider the system as a black box and help us understand how the system as a whole interacts with the outside word. Now we turn to consider the inside of the system. We do this by building the domain model, which shows what the black box (the system) encloses. uses cases elaborate the system’s behavioral characteristics (sequence of stimulus-response steps), domain model gives details of the systems structural characteristics (system parts and their arrangement) Software Engineering OO Domain Modeling
4
What is a Domain Model? uses cases elaborate the system’s behavioral characteristics (sequence of stimulus-response steps), domain model gives details of the systems structural characteristics (system parts and their arrangement) The next step is to model the inside of the system. We do this by building the domain model, which shows what the black box (the system) encloses. Software Engineering OO Domain Modeling
5
What is a Domain Model? Illustrates meaningful concepts in the problem domain. Usually expressed in the form of static diagrams (in Rational this implies a high-level class diagram). Is a representation of real-world things; not software components (of the system under development). No operations are defined or specified in the conceptual model. Should show concepts, associations between concepts, and attributes of concepts. Serves as a source of software objects. S.H 2009 Software Engineering OO Domain Modeling
6
What is a Domain Model? Objectives
identify concepts related to current development cycle requirements create initial conceptual model Identify attributed add specification concepts Software Engineering OO Domain Modeling
7
What is a Domain Model? Software Engineering OO Domain Modeling
8
What constitutes a good model?
A model should use a standard notation be understandable by clients and users lead software engineers to have insights about the system provide abstraction. Models are used: to help create designs to permit analysis and review of those designs as the core documentation describing the system. Software Engineering OO Domain Modeling
9
From Use Cases to: Objects, Attributes, Operations (methods) -“evolutionary ”
Software Engineering OO Domain Modeling
10
Building the Domain Model
A useful strategy for building a domain model is to start with: the “boundary” concepts that interact directly with the actors and then identify the internal concepts Software Engineering OO Domain Modeling
11
Domain Model Relationships
Conceptual Class Diagram Classes, attributes, associations Domain objects Use Case Model Functional Requirements Domain Model Define terms Glossary Interaction Diagrams Dynamic Behavior Software Engineering OO Domain Modeling
12
Steps to create a Domain Model
Identify Candidate Conceptual classes Draw them in a Domain Model Add associations necessary to record the relationships that must be retained Add attributes necessary for information to be preserved Software Engineering OO Domain Modeling
13
Find conceptual classes
Software Engineering OO Domain Modeling
14
Use a category list Finding concepts using the concept category list :
Physical objects: register, airplane, blood pressure monitor Places: airport, hospital Catalogs: Product Catalog Transactions: Sale, Payment, reservation Software Engineering OO Domain Modeling
15
Identify conceptual classes from noun phrases
Finding concepts using Noun Phrase identification in the textual description of the domain . Noun phrases may also be attributes or parameters rather than classes: If it stores state information or it has multiple behaviors, then it’s a class If it’s just a number or a string, then it’s probably an attribute Software Engineering OO Domain Modeling
16
Identifying objects Software Engineering OO Domain Modeling
17
Identifying Operations ‘methods’
Software Engineering OO Domain Modeling
18
Objects Software Engineering OO Domain Modeling
19
Example: Identify conceptual classes from noun phrases
Consider the following problem description, analyzed for Subjects, Verbs, Objects: The ATM verifies whether the customer's card number and PIN are correct. SC V R O O A O A If it is, then the customer can check the account balance, deposit cash, and withdraw cash. S R V O A V O A V O A Checking the balance simply displays the account balance. S M O A V O A Depositing asks the customer to enter the amount, then updates the account balance. M S V O R V OA V OA Withdraw cash asks the customer for the amount to withdraw; if the account has enough cash, S M A O V O R OA V S C V O A the account balance is updated. The ATM prints the customer’s account balance on a receipt. O A V C S V O A O Analyze each subject and object as follows: Does it represent a person performing an action? Then it’s an actor, ‘R’. Is it also a verb (such as ‘deposit’)? Then it may be a method, ‘M’. Is it a simple value, such as ‘color’ (string) or ‘money’ (number)? Then it is probably an attribute, ‘A’. Which NPs are unmarked? Make it ‘C’ for class. Verbs can also be classes, for example: Deposit is a class if it retains state information Software Engineering OO Domain Modeling
20
Mapping parts of speech to object model components [Abbott, 1983]
Part of Speech Model Component Examples Proper noun Instance Ali Common noun Class Student, Customer,.. Doing verb Operation Buy, check,.. Being verb Inheritance Is a kind of, is one of either Having verb Aggregation (Composition) Has, consists of, includes Modal verb Constraints Must be Adjective attributes Attributes 3 years old Software Engineering OO Domain Modeling
21
Example: a typical description
Software Engineering OO Domain Modeling
22
Mapping parts of speech to object model components
Software Engineering OO Domain Modeling
23
Identify conceptual classes from noun phrases: POS
Examine use case descriptions. Example: Process Sale use case: Main success scenario: Customer arrives at a POS checkout counter. Cashier starts a new sale. Cashier enters an item ID. System records sale line item. It then presents a description of the item, its price, and a running total. ● …. Possible source of confusion: Is it an attribute or a concept? If X is not a number or a text then it probably is a conceptual class. Software Engineering OO Domain Modeling
24
Example: Initial POS domain model
SalesLineItem Register Item Store Sale Payment Software Engineering OO Domain Modeling
25
Class and Class diagram
Class naming: Use singular names because each class represents a generalized version of a singular object. Class diagrams are at the core of OO Engineering. Things naturally fall into categories (computers, automobiles, trees...). We refer to these categories as classes. An object class is an abstraction over a set of objects with common: attributes (states) and the services (operations) (methods) provided by each object Class diagrams provide the representations used by the developers. Software Engineering OO Domain Modeling
26
Example: Initial POS domain model
Software Engineering OO Domain Modeling
27
Example: Initial Domain model of the Monopoly Game
Software Engineering OO Domain Modeling
28
Example: Domain model of the Monopoly Game
Software Engineering OO Domain Modeling
29
Agile modeling style Software Engineering OO Domain Modeling
30
Software Engineering OO Domain Modeling
31
Software Engineering OO Domain Modeling
32
Software Engineering OO Domain Modeling
33
Software Engineering OO Domain Modeling
34
Software Engineering OO Domain Modeling
35
Software Engineering OO Domain Modeling
36
Software Engineering OO Domain Modeling
37
Software Engineering OO Domain Modeling
38
Class or Attributes Software Engineering OO Domain Modeling
39
Class or Attributes Software Engineering OO Domain Modeling
40
Description Class Software Engineering OO Domain Modeling
41
Associations Software Engineering OO Domain Modeling
42
Associations Software Engineering OO Domain Modeling
43
Association, aggregation and composition
Software Engineering OO Domain Modeling
44
Association between classes Who does What
Software Engineering OO Domain Modeling
45
When to show association
Software Engineering OO Domain Modeling
46
Associations and implementation
Software Engineering OO Domain Modeling
47
Association Notation Software Engineering OO Domain Modeling
48
Association Notation Software Engineering OO Domain Modeling
49
Naming association Software Engineering OO Domain Modeling
50
Applying UML: multiplicity
Software Engineering OO Domain Modeling
51
Multiplicity values Software Engineering OO Domain Modeling
52
Applying UML: multiplicity
Software Engineering OO Domain Modeling
53
Applying UML: multiplicity
Software Engineering OO Domain Modeling
54
Multiple association between two classes
Software Engineering OO Domain Modeling
55
Find association Software Engineering OO Domain Modeling
56
Find association High priority associations
A is a physical or logical part of B A is physically or logically contained in/on B A is recorded in B Other associations A uses or manages or controls B (Pilot -airplane) A owns B (Airline -airplane) Each of the two ends of an association is called a role. Roles have name multiplicity expression navigability Software Engineering OO Domain Modeling
57
Example: POS Domain Model
Software Engineering OO Domain Modeling
58
Example: Monopoly Game Partial Domain Model
Software Engineering OO Domain Modeling
59
Attributes Attribute - is a logical data value of an object
Include the following attributes in a conceptual model those for which the requirements suggest or imply a need to remember information For example: Sale needs a dateTime attribute Store needs a name and address. Software Engineering OO Domain Modeling
60
Attributes: UML Notation
Software Engineering OO Domain Modeling
61
Suitable attribute types
Software Engineering OO Domain Modeling
62
Data types as attributes
Software Engineering OO Domain Modeling
63
Attributes are NOT foreign keys
Software Engineering OO Domain Modeling
64
Generalization Software Engineering OO Domain Modeling
65
Aggregation models a whole-part relationship between an
14 Association is used when both of the involved classes are equaly important. Aggregation is a special form of association that models a whole-part relationship between an aggregate (the whole) and its parts. Aggregation shows how classes that are collections are composed of other classes. Aggregation is a part-of relationship. Car Wheel
66
Composition 15 Composition is a strong form of aggregation.
Aggregation is used to model a whole-part relationship between an aggregate (whole) and its parts. Composition is a strong form of aggregation. The whole is the only owner of its part. Multiplicity on the whole side must be one. The lifetime of the part is dependent upon the whole. When Circle is destroyed, Point is also destroyed. The composite must manage the creation and destruction of its parts.
67
Composition (C++ Implementation)
16 Restaurant Menu class Restaurant{ class Menu{ }; Menu m; }; ....
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.