Se Lec8 9
Se Lec8 9
Se Lec8 9
I
Introduction
• Definition of Object
• An object is a self-contained entity/package with well-defined
characteristics (properties or attributes) and behaviors (operations).
• Example of real-life objects include: School, Teacher, Client, Course,
Account,
etc.
Object
classification
Domain Models/Conceptual model
OOD is concerned with creating a description of the domain
(concepts) from the perspective of classification by objects.
Syste
m
Characteristic of the Domain Modeling
• Association and relationship between concepts (e.g Payment PAYS- FOR Sales).
• Attributes for information content (e.g. Sale records DATE and TIME).
• Does not include operations / functions.
• Does not describe Software Classes
• Does not describe Software Responsibilities.
What are Concepts and Conceptual Classes?
sa le -
4
7
Class
diagram
• A diagram that describe the structure of a system by showing
the system’s:
• classes
• its attributes and operations
• relationships between the classes.
• their name will never be “imperative procedural name”
HOW TO CREATE A
DOMAIN
MODEL?
Expanded
Steps:
A recommended flow for domain modeling is shown below in sequential
order:
1. Prepare problem statement for the system being developed.
2. Identify objects.
3. Develop data dictionary.
4. Identify association between classes.
5.Identify attributes of classes and association classes.
6.Verify access paths for likely queries.
7. Iterate and refine the model.
Brief Guideline: How to Create
a Domain Model?
• Find the conceptual classes (see a following guideline).
Step 1:
• Add associations
Step 3:
• Add attributes.
Step 4
Guideline: How to Create
a Domain Model?
• Find the conceptual classes
• using the concept category list and noun phrase identification
Step 1: • related to the current requirements under consideration.
• Add associations to record relationships (for which there is a need to preserve some memory)
Step 3:
• UML static structure is being used as “concept” to refer to real-world things, and
“class” will be used to refer to software specifications and Implementations
(design class).
1: Finding Conceptual Classes with Noun
Phrase Identification
Expanded use cases are good candidates for nouns based concept or attribute
Register Attribute
1.This use case begins when
Attribute Customer arrives at the
POST checkout with items
tto purchase.
2. The Cashier records the 3. Determines the item price and
universal adds the item information to the
product code (UPC) from each item. running sales transaction. →
If there is more than one of an event
item, the Cashier can enter thee
The description and price of the
quantity as well.
current item are presented.
Step 2: Find and Draw Conceptual Classes
SalesLineItem Store
Item
Sale Cashier CashPayment Customer
Inherently bi-directional
association name
multiplicity
•Not a statement about connection b/w s/w entities (not implementation guide).
19
Naming Associations
1. based on a TypeName-VerbPhrase-TypeName format
20
Class
diagram
How to make a Design Class Diagram (DCD)?
Identify Classes
• Identify all the classes participating in the SW solution by
analyzing the interaction diagrams.
• Draw them in a class diagram.
Add Methods/Operations
• Add method names by analyzing the interaction diagrams.
Elaborate Attributes
• Add type information to the attributes and methods,
constrains.
Attribut
e
Attributes as Attribute Text vs. Association Line
•Use the attribute text notation for data type objects and
the association line notation for others.
• Both are semantically equal
• Showing an association line to another class box in the
diagram gives visual emphasis
• it catches the eye
• Emphasis on the connection between the class of objects on
the diagram.
constrains
Constraints
• Constraints may be used on most UML diagrams, but are especially common
on class diagrams.
• A UML constraint is a restriction or condition on a UML element.
• It is visualized in text between braces;
• for example: { size >= 0 }.
• The text may be natural language or anything else,
•such as UML's formal specification language, the Object Constraint
Language (OCL).
OPERATIONS AND
METHODS
36
Operations
• One of the compartments of the UML class box shows the
signatures of operations
• Official format of the operation
• visibility name (parameter-list) : return-type {property- string}
• The property string contains arbitrary additional information
•e.g. exceptions that may be raised, if the operation is abstract,
and so forth
• UML allows the operation signature to be written in any programming
language
• such as Java, both expressions are possible:
• + getPlayer( name : String ) : Player {exception
IOException}
• public Player getPlayer( String name )
throws IOException
Operation vs. Method
• Interface Realization
• Lollipop Notation
ASSOCIATIONS,
DEPENDENCIES,
GENERALIZATIO
NS AND
AGGREGATIONS
Association
• is-a-kind-of relationship.
Aggregatio
n
• Whole/part relationship
• Has-a relationship
Composition Over Aggregation
The change in multiplicity. Contrast (a) vs. (b), qualification reduces the multiplicity at the target end of
the association,
usually down from many to one,
It implies the selection of usually one instance from a larger set
Association Class
• An association class allows you treat an
association itself as a class,
• and model it with attributes, operations, and other
features.
included:
Classes,
associations, and
attributes
Interfaces, with
their
operations and
constants
Methods
Attribute type
information