Object ModelingSystem Concepts for Object Modeling Classes, Generalization, and Specialization The class supertype will have one or more one-to-one relationships to object class sub
Trang 1Object Modeling
Introduction
The chapter will address the following questions:
What is object modeling and what are its benefits?
How do you discover objects and classes, and their relationships?
Trang 2Object Modeling
An Introduction to Object
Modeling
and design is called object-oriented analysis.
study existing objects to see if they can be reused or adapted for new uses, and to (2) define new or modified objects that will be combined with existing objects into a useful business computing application
referred to as object modeling
the systems environment, and the relationships between those objects
Trang 3Object Modeling
System Concepts for Object Modeling
Objects, Attributes, Methods, and Encapsulation
the concept of objects that exist within a system’s environment
Webster’s Dictionary definition of an object
Something that is or is capable of being seen, touched, or otherwise sensed.
definition of an object is as follows:
An object is something that is or is capable of being seen,
touched, or otherwise sensed, and about which users store data and associate behavior
Trang 4Object Modeling
System Concepts for Object Modeling
Objects, Attributes, Methods, and Encapsulation
The types of objects may include a person, place, thing, or event.
person objects
A particular warehouse, regional office, building, and room are
examples of place objects
appearing on a users display monitor are examples of thing
objects
An order, payment, invoice, application, registration, and
reservation are examples of event objects
Trang 5Object Modeling
System Concepts for Object Modeling
Objects, Attributes, Methods, and Encapsulation
attributes.
Attributes are the data that represent characteristics of interest
about an object.
WORK ADDRESS, TYPE OF CUSTOMER, HOME PHONE, WORK PHONE, CREDIT LIMIT, AVAILABLE CREDIT, ACCOUNT BALANCE, and ACCOUNT STATUS.
• An instance (or object instance) of an object consists of the values for
the attributes that describe a specific person, place, thing, or event.
Trang 6Object Modeling
System Concepts for Object Modeling
Objects, Attributes, Methods, and Encapsulation
What is the “behavior” of an object
which correspond to functions that act on the object’s data (or attributes)
In object-oriented circles, an object’s behavior is commonly
referred to as a method or service.
An object is solely responsible for carrying out any functions
or behaviors that act upon its own data (or attributes)
• For example, only YOU (an object) may CHANGE (behavior)
your LAST NAME and HOME ADDRESS (attributes about you)
Trang 7Object Modeling
System Concepts for Object Modeling
Objects, Attributes, Methods, and Encapsulation
Encapsulation, an important concept
Trang 8Object Modeling
System Concepts for Object Modeling
Classes, Generalization, and Specialization
categorizing objects into classes.
A class is a set of objects that share common attributes and
behavior A class is sometimes referred to as an object class.
thing-objects that have some similar attributes and behavior and could be classified as BOOKs
A class may also have sub-classes of objects
be members of the class PERSON
Trang 9Object Modeling
System Concepts for Object Modeling
Classes, Generalization, and Specialization
When levels of classes are identified, the concept of inheritance is
applied
object class can be inherited or reused by another object class
between objects/classes is referred to as
generalization/specialization.
attributes and behaviors that are common to several types of an object classes are grouped into their own class, called a
supertype The attributes and methods of the supertype object
Trang 10Object Modeling
System Concepts for Object Modeling
Classes, Generalization, and Specialization
When levels of classes are identified, the concept of inheritance is
applied.
class can be inherited or reused by another object class.
In the object class PERSON, STUDENT and TEACHER example,
PERSON is referred to as a supertype (or generalization class) whereas STUDENT and TEACHER are referred to as subtypes (or specialization class)
A class supertype is an entity whose instances store attributes that are
common to one or more class subtypes
A class subtype is an object class whose instances inherit some
common attributes from a class supertype, and then add other attributes that are unique to an instances of the subtype.
Trang 11Object Modeling
System Concepts for Object Modeling
Classes, Generalization, and Specialization
The class supertype will have one or more one-to-one relationships
to object class subtypes.
These relationships are sometimes called “IS A” relationships (or “WAS A”, or “COULD BE A”) because each instance of the supertype “is also an” instance of one or more subtypes
Using OMT notation, classes are represented on an object model as
a rectangle
The rectangle is divided into three portions
• The top portion contains the name of the class.
• The middle portion contains the name of the common attributes of interest.
Trang 12Object Modeling
(Customer) customer number = 412209 last name = Bentley first name = Lonnie home phone = 317-463-9593 street = 2625 Darwin Drive
city = West Lafayette state = Indiana zipcode = 47906 etc.
copyright = 1996
Person Class (supertype)
Student Class
(c)
Open
ISBN type title copyright Book
Trang 13Object Modeling
walk jump talk sleep eat etc.
last name first name birthdate gender Person
Trang 14Object Modeling
System Concepts for Object Modeling
Object/Class Relationships
Objects and classes do not exist in isolation
The things they represent interact with, and impact one another
to support the business mission
Thus there is an object/class relationship
• An object/class relationship is a natural business association that
exists between one or more objects/classes
For example, consider the object classes customer and order that may exist in a typical information system and how they interact
• a CUSTOMER PLACES zero or more ORDERs
• an ORDER IS PLACED BY one and only one CUSTOMERs
Trang 15 A verb phrase describes the relationship.
All relationships are implicitly bi-directional, meaning that they can interpreted in both directions
occurrences of one object/class for a single occurrence of the related object/class
Because all relationships are bi-directional, multiplicity must
be defined in both directions for every relationship
Trang 16means one and only one
means zero or more
means zero or one
(a)
Trang 17Object Modeling
System Concepts for Object Modeling
Object/Class Relationships
What are aggregation class relationships?
Sometimes objects/classes are made up of other objects/classes
This type of relationship is called aggregation
• It is also sometimes referred to as “whole-part” or “part-of”
relationships
objects, including: COVER, TABLE OF CONTENTS, CHAPTER, and INDEX objects
• The CHAPTER object contains PAGE objects, which in turn
contain PARAGRAPH objects, which in turn contain WORD objects, and so forth.
Trang 18individual objects within it
Multiplicity is also specified for aggregate relationships
Trang 191 +
1 +
Trang 20Object Modeling
System Concepts for Object Modeling
Objects/Classes interact or "communicate" with one another by
passing messages
method (behavior) to request information or some action
receiving object is organized internally or how the behavior is to
be accomplished, only that it responds to the request in a defined way
Trang 21well-Object Modeling
Customer
add order modify order delete order display status etc.
order number order date order status etc.
Order
display order status
of order 23161
MESSAGE REQUEST
(containing name of request behavior and attribute needed by ORDER)
Trang 22Object Modeling
System Concepts for Object Modeling
object-oriented techniques, it means that a behavior may be completed differently for different objects/classes
The requesting object knows the what service (or behavior) to
request and from which object However, the requesting object does not need to worry about how a behavior is accomplished
Trang 23Object Modeling
The Process of Object Modeling
Performing Object Oriented Analysis (OOA)
system and its functional requirements
OOA requires that we identify the objects, their data attributes, associated behavior, and relationships which support the required business system functionality
the data and behavior they encapsulate, plus their relationships with other objects
Finding and identifying the business objects
Organizing the objects and identifying their relationships
Trang 24Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
In trying to identify objects, many methodology experts
recommend the technique of searching the requirements document
or other associated documentation and underline the nouns which may represent potential objects
nouns
and identifying objects, is a technique called Use Case Modeling
developed by Dr Ivar Jacobson
business events, who initiated them, and how the system responds to them
Trang 25Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
functionality into many smaller statements of system functionality
called use cases or business events
A use case a behaviorally related sequence of steps (a
scenario), both automated and manual for the purpose of completing a single business task
This smaller format simplifies and makes more efficient the technique of underlining the nouns
It identifies and describes the system functions from the perspective of external users
Trang 26Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
Use Cases are initiated by users or systems called Actors.
An actor represents anything that needs to interact with the
system to exchange information An actor is a user, a role, which could be an external system as well as a person
• An actor initiates system activity, a use case, for the purpose of
completing some business task
• An actor represents a role fulfilled by a user interacting with the system and is not meant to portray a single individual or job title
• For events that are triggered by time called temporal events, the
actor is the system itself
Trang 27Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
Use cases provide the following benefits:
As a basis to help identify objects and their high level relationships and responsibilities
An effective tool for validating requirements
As a basis for a test plan
As a basis for a user’s manual
Trang 28Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
A good place to find potential actors and use cases is by analyzing the context model diagram of the system
• If an external party initiates the input, it is considered an actor.
• Some of the inputs are self explanatory, but others may be
misleading, it is always wise to confirm your findings with the system’s business analyst.
Trang 29Object Modeling
Warehouse
Member Services System Club Member
Marketing Department
Potential Member
Subscription Offer
New Subscription
New Membership Plan & Subscrition Offer Sales & Promotion Reports Order To Be Filled
Club Promtion
Promotion Order
Member Services Context Model
New Monthly or Seasonal Promotion
Past Member
Subscrition Renewal Offer Subscrition Renewal
Member Credit Status
Accounts Receivable Data Base
Regular Order
Member Services Department
Membership Reports
Trang 30Object Modeling
Club Member initiates Submit Promotion Order
Submit Regular Order Potential Member initiates Submit New Subscription
Past Member initiates Submit Subscription Renewal Member Services Department initiates Request Membership Rpts.
Marketing Department initiates Create New Monthly Promotion
Create New Seasonal Promotion Create New Subscription Program Request Promotion Rpts.
Request Sales Rpts.
Member Services System initiates Send New Subscription Offer
Send Club Promotion Send Subscription Renewal Offer
Trang 31Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
system scope and boundaries in terms of use cases and actors
The use case model diagram represents the relationships between the actors and use cases defined for each business subsystem
• The subsystems represent logical functional areas of business
processes
• The partitioning of system behavior into subsystems is very
important in understanding the system architecture and is very key
to defining your development strategy — which use cases will be developed first and by who.
Trang 32Object Modeling
M ember Services Department
M arketing Department
M ember Services System
Request Promotion Rpts.
Reques t
M embers hip Rpts.
Request Sales Rpts.
Create N ew Subs cription Program
Create N ew
M onthly Promotion
Submit N ew Subscription
Send N ew Subscription Offer
Submit Subscription Renewal
Send Subscription Renewal Offer
Submit Promotion Order
Send Club Promotion
Submit Regular Order
Member Services System Use Case Model
Promotions Subsystem
Orders Subsystem
Membership
Subsystem
Trang 33Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
For each use case identified, use case’s normal course of events must be documented
A use case’s normal course of events is a step by step description starting with the actor initiating the use case until the end of the business event
• At this point we only include the major steps which happen the
majority of the time (its normal course)
• Exception conditions or conditional branching logic will be
documented in a later step.
Trang 34Object Modeling
USE CASE
USE CASE NAME: Submit Promotion Order
DESCRIPTION: Describes the process when a club member submits a club promotion order to either
indicate the products they are interested in ordering or declining to order during this promotion.
3 The promotion order is verified to see if product is being ordered.
4 The club member’s credit status is checked with Accounts Receivable to make sure no payments are outstanding.
5 For each product being ordered, validate the product number.
6 For each product being ordered, check the availability in inventory and record the ordered product information which include “quantify being ordered” and give each ordered product a status of “open”.
7 Create a Picking Ticket for the promotion order containing all ordered products which have a status “open”.
8 Route the Picking Ticket to the Warehouse.
PRE-CONDITION: Use case Send Club Motion has been processed.
POST-CONDITION: Promotion order has been recorded and the Picking Ticket has been routed to the
Warehouse.
ASSUMPTIONS:
A B
C
D
E
F
Trang 35Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
use case leaving the system in a state that is a precondition for another use case
to model dependencies
Trang 36Object Modeling
The Process of Object Modeling
Finding And Identifying The Business Objects
• Helps facilitate project management by depicting which use cases
are more critical (have the most dependencies) and thus need to have a higher priority.