SlideShare a Scribd company logo
1 of 63
1
Chapter 2
Structural Modeling & Analysis
Object-Oriented Technology
From Diagram to Code with Visual Paradigm for UML
Curtis H.K. Tsang, Clarence S.W. Lau and Y.K.
Leung
McGraw-Hill Education (Asia), 2005
2
References
īŽ Chapter 2, Object-Oriented Technology:
from diagram to code with Visual
Paradigm for UML
īŽ Chapters 4-8, The UML User Guide
3
What You Will Learn
īŽ Describe and apply the fundamental object
orientation concepts.
īŽ Use the standard UML notation to represent
classes and their properties.
īŽ Model the structural aspects of problems with
the class model.
īŽ Perform domain analysis to develop domain
class models.
4
What Is an Object?
īŽ An object is a self-contained entity with
well-defined characteristics (properties
or attributes) and behaviors
(operations).
īŽ For example, the real-life environment
consists of objects, such as schools,
students, teachers and courses which
are related in one way or another.
5
Types of Objects
īŽ Physical and Conceptual Objects
īŽ Physical (tangible) objects are those
visible and touchable things such as a
book, bus, computer or Christmas tree.
īŽ Conceptual objects are intangible things,
such as a bank account, time schedule,
etc.
6
Types of Objects (cont’d)
īŽ Domain Objects and Implementation
Objects
īŽ Objects identified from the real world are domain
objects.
īŽ Collectively, we call all objects which are not
related to real world entities implementation
objects.
īŽ Bank accounts, tellers and customers are domain
objects.
īŽ An example of an implementation object is the
transaction log.
7
Types of Objects (cont’d)
īŽ Active and Passive Objects
īŽ Passive object. The state of an object will
not change unless the object receives a
message. An example of a passive object
is a bank account.
īŽ Active object. An object that can change
its state, for example, a clock, timer, etc.
8
What Is a Class and What
Are Instances?
īŽ A class is a generic definition for a set of similar
objects.
īŽ A class is a template or blueprint for a category of
structurally identical items (objects).
īŽ A class has methods and attributes while object
instances have behaviors and states.
+debit(in amount)
+credit(in amount)
-name
-balance
Bank Account
name = John Smith
balance = 1000.0
Object1 : Bank Account
name = Robert Jones
balance = -200.0
Object2 : Bank Account
9
Class and Object Notation
īŽ Classes Providing Different Levels
of Details
īŽ UML Notation
10
Class and Object Notation
(cont’d)
īŽ Example
11
Relationships between
Classes
īŽ Relationships exist among real-life objects.
īŽ For example, friendship and partnership are common examples
of relationships among people.
īŽ A relationship specifies the type of link that exists between
objects.
īŽ Through the links of an object, we can find out what other
objects are related to it.
īŽ For example, we can find out all the friends of a person John
through the links to John.
īŽ There are essentially three important types of relationships
between classes:
īŽ generalization/specialization (“type-of”),
īŽ aggregation (“part-of”), and
īŽ association.
12
Inheritance
īŽ inheritance allows the implementation of generalization-
specialization associations.
īŽ Attributes and operations common to a group of subclasses
are attached to a superclass and inherited by its
subclasses.
13
Inheritance (cont’d)
īŽ An abstract class is used to specify the required
behaviors (operations) of a class, without having
to provide their actual implementation.
īŽ An operation without the implementation (body) is
called an abstract operation.
īŽ A class with one or more abstract operations is an
abstract class.
īŽ An abstract class cannot be instantiated because
it does not have the required implementation of
the abstract operations.
14
Inheritance (cont’d)
īŽ Polymorphism is the ability of a variable to hold objects of
its own class and its subclasses at runtime.
īŽ The variable can be used to invoke an operation of the
object held.
īŽ The actual operation being invoked depends on the actual
class of the object referenced by the variable.
īŽ For example, suppose variable “shape” is of type Shape. If
shape references a Rectangle object, then shape.draw()
invokes the draw() method of the Rectangle class.
īŽ Similarly, if shape references a Polygon object, the draw()
method of the Polygon class is invoked by shape.draw().
15
Association
īŽ Object-oriented systems are made up of objects of
many classes. Associations represent relationships
among classes.
īŽ An association is represented by a line drawn
between the associated classes involved with an
optional role name attached to either end.
īŽ The role name is used to specify the role of an
associated class in the association.
īŽ If an association connects two objects instead of
classes, it is called a link.
īŽ A link is an instance of an association.
16
Association (cont’d)
Name of Link
Multiplicity
Role
Name of Association
17
Qualification
īŽ Qualification serves as names or keys that are part of
the association and are used to select objects across
the association at the other end.
īŽ Qualification reduces the effective multiplicity of the
association from one-to-many to one-to-one.
īŽ In UML, a qualifier is used to model this association
semantic, that is an association attribute whose value
determines a unique object or a subset of objects at
the other end of an association.
18
Qualification
Bank + account no => person
19
N-ary Association
20
N-ary Association (cont’d)
decompose
21
Association Classes
Sometimes, it is necessary to describe an
association by including some attributes which
do not naturally belong to the objects involved
in the association.
22
Association Classes (cont’d)
23
Aggregation
īŽ Aggregation is a stronger form of association.
īŽ It represents the has-a or part-of relationship.
īŽ In UML, a link is placed between the “whole” and
the “parts” classes with a diamond head attached
to the “whole” class to indicate that this
association is an aggregation.
īŽ Multiplicity can be specified at the end of the
association for each of the “part-of” classes to
indicate the quantity of the constituent parts.
īŽ Typically, aggregations are not named, and the
keywords used to identify aggregations are
“consists of”, “contains” or “is part of”.
24
Aggregation (cont’d)
25
Composition
īŽ A stronger form of aggregation is called
composition, which implies exclusive
ownership of the “part-of” classes by the
“whole” class, i.e. a composite object has
exclusive ownership of the parts objects.
īŽ This means that parts may be created after
a composite is created, but such parts will
be explicitly removed before the
destruction of the composite.
26
Composition (cont’d)
27
Constraints and Notes
īŽ Constraints are an extension of the semantics of a
UML element, allowing one to add new rules or
modify existing ones. Sometimes it is helpful to
present an idea about restrictions on attributes
and associations for which there is no specific
notation.
īŽ Constraints are represented by a label in curly
brackets ({constraintName} or {expression}) that
are attached to the constrained element.
28
Constraints and Notes (cont’d)
29
Example – Car
30
Example – A Sales
Order System
31
Structural Analysis
Techniques
Problem Statement
Textual
Analysis
Use Case Descriptions
Class Model
32
Domain Modeling and Analysis
īŽ Preparing the problem statement;
īŽ Identifying objects and classes using textual
analysis;
īŽ Developing a data dictionary;
īŽ Identifying associations between classes;
īŽ Identifying attributes of classes and association
classes;
īŽ Structuring classes using inheritance;
īŽ Verifying access paths for likely queries; and
īŽ Iterating and refining the model.
33
Domain Modeling and Analysis
(cont’d)
Customer Account
Bank Transaction
Customer Account
Bank Transaction
Problem Statement
Textual
Analysis
Customer Account
Bank Transaction
Candidate Clases
Customer Account
BankTransaction
Initial Domain Class Model
-name
-address
Customer
-balance
Account
-name
Bank
-amount
Transaction
Classes with Attributes
-name
-address
Customer
-balance
Account
-name
Bank
-amount
Transaction
Restructured Class Model
Withdraw Transaction
-destination account
Transfer Transaction
-credit limit
Credit Card Account
-overdraft limit
Current Account
34
Example – Online
Stock Trading
īŽ A stock brokerage firm wants to provide an online stock trading
service to enable its clients to trade via the computer. With this
system, a client must first be registered before he can trade online.
The registration process involves the client providing his ID,
address and telephone number. A client may open one or more
accounts for stock trading. The stock brokerage firm needs to be
registered with a stock exchange before its clients can trade the
stocks listed on the stock exchange. A stock brokerage firm can be
registered with one or more stock exchanges. The stock brokerage
firm may need to pay monthly charges for using the services
provided by the stock exchange.
35
Example – Online Stock
Trading (cont’d)
īŽ Once registered, the client can buy and sell stocks. The client
can check the current price, bid price, ask price and traded
volume of a stock in real time. The stock price and traded
volume information is provided by the stock exchange on
which the stock is listed and traded. When a client issues a
buy order for an account, the client must specify the stock
code, the number of shares and the maximum price that he is
willing to pay for them (the bid price). A client must have
sufficient funds in his account to settle the transaction, when it
is completed. When a client issues a sell order, the client
must specify the stock code, the number of share and the
minimum price that he is willing to sell them (the ask price).
The client must have sufficient shares of the stock in his
account before he can issue the sell order.
36
Example – Online Stock
Trading (cont’d)
īŽ A client can check the status of execution of his (buy or sell) orders.
The client can issue a buy or sell order before the end of the
trading day of the stock exchange which processed the order. All
trade orders will be forwarded to the stock trading system of the
stock exchange for execution. When an order is completed, the
stock trading system of the stock exchange will return the
transaction details of the order to the online stock trading system.
The transaction details of a trade order may be a list of
transactions, each transaction specifying the price and the number
of shares traded. For example, the result of a buy order of 20,000
HSBC (stock code: 0005) shares at HK$88.00 on the Hong Kong
Stock Exchange may be as follows:
īŽ 4,000 shares at HK$87.50,
īŽ 8,000 shares at HK$87.75, and
īŽ 8,000 shares at HK488.00.
37
Example – Online Stock
Trading (cont’d)
īŽ An order will be kept on the system for execution until the order is
completed or the end of a trading day is reached. There are three possible
outcomes for a trade order:
1. The trade order is completed. For a buy order, the total amount for the buy
order will be deducted from the client’s account and the number of shares
of the stock purchased deposited into the account. For a sell order, the
number of shares sold will be deducted from the client’s account and the
proceeds of the sell order deposited into the client’s account.
2. The trade order is partially completed. The number of shares actually
traded (sell or buy) is less than the number of shares specified in the
order. The number of shares successfully traded in the order will be used
for the calculation of the amount of the proceeds, and the client’s account
adjusted accordingly.
3. The trade order is not executed by the end of a trading day. The order will
be canceled.
38
Identifying objects and classes
īŽ To identify objects and classes, perform a textual
analysis to extract all nouns and noun phrases
from the problem statement.
īŽ Nouns or noun phrases of the following categories
are more likely to represent objects:
īŽ Tangible things (e.g. classroom, playground)
īŽ Conceptual things (e.g. course, module)
īŽ Events (e.g. test, examination, seminar)
īŽ Outside organizations (e.g. publisher, supplier)
īŽ Roles played (e.g. student, teacher, principal)
īŽ Other systems (e.g. admission system, grade reporting
system)
39
Identifying objects and classes
(cont’d)
Stock brokerage firm (concept) Buy order (event)
Monthly charge Stock code (simple value, attribute)
Trade (event) Number of shares (simple value, attribute)
Trade order (event) Maximum price (simple value, attribute)
Computer (tangible thing) Transaction (event)
Client (role played) Sell order (event)
ID (simple value, attribute) Trading hours (simple value, attribute)
Address (simple value, attribute) Trading day (simple value, attribute)
Telephone number (simple value, attribute) Stock trading system (other systems)
Account (concept) Order (event)
Stock exchange (outside organization) Execution result (event)
40
The Generalization
Relationship
Stock (concept) Hong Kong Bank (instance of stock)
Current price (simple value, attribute) Hong Kong Stock Exchange (instance of
stock exchange)
Bid price (simple value, attribute) Lot size (simple value, attribute)
Ask price (simple value, attribute) Registration process (not an object)
Traded volume (simple value,
attribute)
41
Categories of Inappropriate Classes
Category Description
Redundant
classes
Classes that mean the same thing. Choose the most descriptive
class. For example, order, trade and trade order mean the same
thing. Eliminate trade and order, and keep trade order.
Irrelevant
classes
Those classes which are not directly related to the problem. For
example, monthly charge is not directly related to the system.
Vague classes Classes with a loosely defined scope.
Attributes Attributes of classes also represent as nouns or noun phrases.
Therefore, the list of nouns or noun phrases extracted by textual
analysis may contain attributes of classes. For example, address
and telephone number are attributes of the client.
42
Categories of Inappropriate Classes
(cont’d)
Category Description
Operations The performance of actions is sometimes expressed as nouns
or noun phrases. For example, the registration process is the
action taken by the client to register on the system. It should
be considered an operation of a class, rather than a class.
Roles The role names help to differentiate the responsibilities of the
objects in an interaction. However, they should not be
considered as classes.
Implementation
constructs
Sometimes, implementation details of a particular solution are
written in the problem statement, for example, array, indexed
sequential file, etc. Candidate classes representing the
implementation details should be removed.
43
Inappropriate Classes
Stock brokerage firm (irrelevant) Stock code (attribute)
Monthly charge (irrelevant) Number of shares (attribute)
Trade (redundant) Maximum price (attribute)
Computer (implementation) Trading hours (attribute)
ID (attribute) Trading day (attribute)
Address (attribute) Order (redundant)
Telephone number (attribute) Hong Kong Bank (instance of stock)
Current price (attribute) Hong Kong Stock Exchange
(instance of stock exchange)
Bid price (attribute) Lot size (attribute)
Ask price (attribute) Registration process (operation)
Traded volume (attribute)
44
Candidate Classes
Trade order (event) Transaction (event)
Client (role played) Sell order (event)
Account (concept) Stock trading system (other systems)
Stock exchange
(outside organization)
Execution result (event)
Buy order (event) Stock (concept)
45
Developing the Data Dictionary
Class Definition
Client An individual or a company registered with the stock brokerage firm
for online stock trading services. The class has attributes like
address, telephone number and ID. A client may have one or more
accounts.
Account A client can issue trade order on his or her accounts. An account
holds details about the cash and stock balances for trading.
Stock exchange A financial institution that provides a platform where the stock trading
is carried out.
Stock trading system A platform for the execution of the trade orders of stock.
Trade order A trade order specifies the price, stock code and number of shares. A
trade order can be a buy order or a sell order.
Buy order A buy order specifies the bid price, stock code and number of shares.
46
Developing the Data Dictionary
Class Definition
Sell order A sell order specifies the ask price, stock code and number of shares.
Stock A company listed on a stock exchange. Shares of a company can be
traded only in a multiple of its lot size.
Execution result The result of the execution of a trade order. It contains a list of
transactions.
Transaction The execution of a trade order at a particular price. It also contains
the number of shares traded at that price.
47
Identifying Associations
between Classes
īŽ An association is a relationship between objects.
īŽ For example, John and Peter are instances of the
class Person and John is the father of Peter.
īŽ Association can be identified by looking for verbs
and verb phrases connecting two or more objects
in the problem statement.
īŽ e.g. “A client may open one or more accounts for
stock trading.”
īŽ Name of the association: has or opened by?
īŽ The name of the association should reflect the
nature rather than the historic event.
48
Identifying Associations between
Classes (cont’d)
Verb phrase Association
A client may open one or more accounts for stock trading. has
When a client issues a buy order for an account, the client must specify the
stock code, number of shares and the maximum price that he is willing to
pay for them (the bid price).
issued by, buy
When a client issues a sell order for an account, the client must specify the
stock code, the number of share and the minimum price that he is willing to
sell them (the ask price).
issued by, sell
All trade orders will be forwarded to the stock trading system of the stock
exchange for execution.
executed by
When an order is completed, the stock trading system of the stock exchange
will return the transaction details of the order to the online stock trading
system.
returned by
The transaction details of a trade order may be a list of transactions, and
each transaction specifies the price and the number of shares traded.
consists of
49
Identifying Associations between
Classes (cont’d)
īŽ From the domain knowledge, we have the
following associations:
īŽ A stock is listed on a stock exchange.
īŽ A stock is traded on a stock trading system of a
stock exchange.
īŽ The result of a trade order is a list of
transactions.
īŽ A stock exchange has one or more stock
trading systems.
50
Initial Domain Class Diagram
51
Identifying Attributes of Classes
and Association Classes
īŽ Attributes are properties of a class, such as name, address,
telephone number of the Client class.
īŽ Look for nouns or noun phrases followed by possessive phrases,
e.g. “address of the client”.
īŽ Adjectives that appear immediately before a noun corresponding to
a class can also be an enumerated value of an attribute, e.g. “a
canceled buy order”.
īŽ Attributes are less likely to be discovered from the problem
statement.
īŽ However, it is not necessary to identify all attributes in this step
because the attributes do not affect the structure of the domain
class model.
īŽ Instead we should only do so if they can be identified readily. We
will be able to identify the attributes more readily at later stages of
the development life cycle (e.g. detailed design phase).
52
Structuring Classes
Using Inheritance
īŽ Two approaches: top down and bottom up
īŽ Bottom-up approach:
īŽ similar class name
īŽ similar attributes
īŽ similar operations
īŽ similar associations
īŽ e.g. the buy order and sell order classes both
have the price and number of shares attributes
and both of them are associated with the stock
class and account class.
53
Structuring Classes Using
Inheritance (cont’d)
54
Structuring Classes Using
Inheritance (cont)
īŽ Top-down approach:
īŽ check a class to see whether it has some
special cases that have additional structural or
behavioral requirements.
īŽ noun phrases consisting of adjectives and
class names,
īŽ
e.g. sell order class and buy order class
īŽ taxonomies of real-life objects
īŽ domain knowledge,
īŽ
e.g. cash account and margin account
55
Structuring Classes Using
Inheritance (cont’d)
56
Verifying Access Paths for
Likely Queries
īŽ Check whether the domain class diagram
can provide the correct answers to queries
that are common to other applications in
the domain.
īŽ In the online stock trading system
example, a typical client query would be
the current stock balance of his account.
īŽ This requires an association between the
account class and the stock class to
provide the information on the number of
shares held in the account.
57
Verifying Access Paths for Likely
Queries (cont’d)
58
Verifying Access Paths for
Likely Queries (cont’d)
59
Iterating and Refining the Model
īŽ It is highly unlikely that we are able to
develop the correct domain class model in
one pass.
īŽ The domain class model needs to be
refined several times before it becomes
robust.
īŽ The development of the domain class
model is not a rigid process, and we need
to repeatedly apply the above steps until
the domain class model finally becomes
stable.
60
Iterating and Refining the Model
(cont’d)
īŽ The following checklist can help you identify areas to
improve the domain class model .
īŽ A class without attributes, operations and associations -
consider removing the class.
īŽ A class with many attributes and operations covering a wide
area of requirements - consider splitting the class into two or
more classes.
īŽ A query cannot be answered by tracing the domain class model
- consider adding additional associations.
īŽ Asymmetries in generalizations and associations - consider
adding additional associations and restructuring the classes
with inheritance.
īŽ Attributes or operations without a hosting class - consider
adding new classes to hold these attributes and operations.
61
Tricks and Tips in Structural
Modeling and Analysis
īŽ Set Focus and Context of Your Diagram
īŽ Make sure your class diagram only deals with the static
aspects of the system. Do not attempt to consolidate everything
into one single class diagram.
īŽ Use Appropriate Names for Your Classes
īŽ Classes from two sources: domain analysis and use case
analysis. If the classes identified from the use case analysis is
similar or identical to those you have derived from the domain
analysis, that would be a happy situation.
īŽ On the other hand, where inconsistent classes are derived from
these two sources, you should discuss them with your end
users, advising them to use standard terminologies of the
industry, allowing for a dominant player in the field. If they insist
on using their (non-standard) terminologies, you may need to
put the standard ones in your libraries and use subclasses for
their non-standard ones specifically for this application.
62
Tricks and Tips in Structural
Modeling and Analysis
(cont’d)
īŽ Organize Your Diagram Elements
īŽ Not only should you structure classes with various
object-oriented semantics, but also organize their
elements spatially to improve their readability. For
example, minimize cross lines in the diagram and place
the semantically close? /similar? elements close
together.
īŽ Annotate Your Diagram Elements
īŽ You should attach notes to those elements where you
need to clarify unclear concepts, and where necessary
attach external files, documents or links within the notes
(i.e. an http link or a directory path). Some automated
CASE tools support such kind of annotations (e.g. Visual
Paradigm for UML), so that you can glue resources into
a navigable visual model.
63
Tricks and Tips in Structural
Modeling and Analysis
(cont’d)
īŽ Refine the Structural Model Iteratively and Incrementally
īŽ As you progress through the development stages, you
will be able to enrich your structural models from time to
time. For example, dynamic models help to identify the
responsibilities of the classes, or possibly even new
classes, implementation classes and control classes.
We shall discuss this concept in more details in Chapter
4 – Dynamic Modeling and Analysis.
īŽ Show Only the Relevant Associations
īŽ If a class is used by a number of use cases or even
several applications, the class may have a number of
associations that are related to different contexts. In your
diagram, only show the associations related to the
context that you are currently concerned with and hide
the irrelevant associations. Do not attempt to consolidate
all the associations and classes into a large class model
that cannot be easily managed by most people.

More Related Content

What's hot

Chapter-3 Data Modeling Using the Entity-Relationship Model
Chapter-3  Data Modeling Using the Entity-Relationship ModelChapter-3  Data Modeling Using the Entity-Relationship Model
Chapter-3 Data Modeling Using the Entity-Relationship ModelRaj vardhan
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 
Lecture#01, object orientation
Lecture#01, object orientationLecture#01, object orientation
Lecture#01, object orientationbabak danyal
 
Database Management Systems Tutorial
Database Management Systems TutorialDatabase Management Systems Tutorial
Database Management Systems TutorialSachin MK
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UMLyndaravind
 
class diagram
class diagramclass diagram
class diagramShohan Ean
 
Umldiagram
UmldiagramUmldiagram
Umldiagrampavandeep11
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relationalJafar Nesargi
 
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...Niloy Biswas
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagramsMukesh Tekwani
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class DiagramNiloy Rocker
 

What's hot (19)

Chapter-3 Data Modeling Using the Entity-Relationship Model
Chapter-3  Data Modeling Using the Entity-Relationship ModelChapter-3  Data Modeling Using the Entity-Relationship Model
Chapter-3 Data Modeling Using the Entity-Relationship Model
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
Lecture#01, object orientation
Lecture#01, object orientationLecture#01, object orientation
Lecture#01, object orientation
 
Database Management Systems Tutorial
Database Management Systems TutorialDatabase Management Systems Tutorial
Database Management Systems Tutorial
 
Database design
Database designDatabase design
Database design
 
Chapter3
Chapter3Chapter3
Chapter3
 
Er model
Er modelEr model
Er model
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
class diagram
class diagramclass diagram
class diagram
 
Umldiagram
UmldiagramUmldiagram
Umldiagram
 
dbms
dbmsdbms
dbms
 
Chapter 6 relational data model and relational
Chapter  6  relational data model and relationalChapter  6  relational data model and relational
Chapter 6 relational data model and relational
 
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
UML Diagram - Use-Case diagram, Activity Diagram, Sequence Diagram, Er Diagra...
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
 
Chapter 4
Chapter 4Chapter 4
Chapter 4
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class Diagram
 
Class Diagram
Class DiagramClass Diagram
Class Diagram
 
uml
umluml
uml
 

Similar to Jar chapter 2

Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented DesignAravinth NSP
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignAmr E. Mohamed
 
SE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and DesignSE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and DesignAmr E. Mohamed
 
2 class use case
2 class use case2 class use case
2 class use caseMinal Maniar
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.pptChishaleFriday
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptxRokaKaram
 
CHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptCHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptNgoHuuNhan1
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxanguraju1
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An OverviewRaj Thilak S
 
2012.10 - DDI Lifecycle - Moving Forward - 3
2012.10 - DDI Lifecycle - Moving Forward - 32012.10 - DDI Lifecycle - Moving Forward - 3
2012.10 - DDI Lifecycle - Moving Forward - 3Dr.-Ing. Thomas Hartmann
 
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPTCS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPTleela rani
 
ASP.NET System design 2
ASP.NET System design 2ASP.NET System design 2
ASP.NET System design 2Sisir Ghosh
 
UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software EngineeringAmit Singh
 
Object Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLObject Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLMalek Sumaiya
 
OOAD with UML (Interaction Diagramming)
OOAD with UML (Interaction Diagramming)OOAD with UML (Interaction Diagramming)
OOAD with UML (Interaction Diagramming)jsm1979
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagramskebsterz
 

Similar to Jar chapter 2 (20)

Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
SE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and DesignSE_Lec 06_Object Oriented Analysis and Design
SE_Lec 06_Object Oriented Analysis and Design
 
SE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and DesignSE18_Lec 06_Object Oriented Analysis and Design
SE18_Lec 06_Object Oriented Analysis and Design
 
2 class use case
2 class use case2 class use case
2 class use case
 
Uml report
Uml reportUml report
Uml report
 
Intro Uml
Intro UmlIntro Uml
Intro Uml
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.ppt
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx
 
CHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptCHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.ppt
 
UNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptxUNIT II STATIC UML DIAGRAMS.pptx
UNIT II STATIC UML DIAGRAMS.pptx
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
2012.10 - DDI Lifecycle - Moving Forward - 3
2012.10 - DDI Lifecycle - Moving Forward - 32012.10 - DDI Lifecycle - Moving Forward - 3
2012.10 - DDI Lifecycle - Moving Forward - 3
 
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPTCS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
CS8592-OOAD-UNIT II-STATIC UML DIAGRAMS PPT
 
ASP.NET System design 2
ASP.NET System design 2ASP.NET System design 2
ASP.NET System design 2
 
UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software Engineering
 
Object Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLObject Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UML
 
OOAD with UML (Interaction Diagramming)
OOAD with UML (Interaction Diagramming)OOAD with UML (Interaction Diagramming)
OOAD with UML (Interaction Diagramming)
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagrams
 

More from Reham Maher El-Safarini

Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Reham Maher El-Safarini
 
AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)Reham Maher El-Safarini
 
Application and database migration workshop
Application and database migration workshopApplication and database migration workshop
Application and database migration workshopReham Maher El-Safarini
 
Security and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsSecurity and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsReham Maher El-Safarini
 
2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloudReham Maher El-Safarini
 

More from Reham Maher El-Safarini (20)

Ux
Ux Ux
Ux
 
Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.Global threat-landscape report by fortinet.
Global threat-landscape report by fortinet.
 
Dynamics AX/ X++
Dynamics AX/ X++Dynamics AX/ X++
Dynamics AX/ X++
 
Microsoft sql-and-the-gdpr
Microsoft sql-and-the-gdprMicrosoft sql-and-the-gdpr
Microsoft sql-and-the-gdpr
 
AWS Cloud economics
AWS Cloud economicsAWS Cloud economics
AWS Cloud economics
 
Cloud skills development
Cloud skills developmentCloud skills development
Cloud skills development
 
AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)AWS cloud adoption framework (caf)
AWS cloud adoption framework (caf)
 
Application and database migration workshop
Application and database migration workshopApplication and database migration workshop
Application and database migration workshop
 
Containers on AWS
Containers on AWSContainers on AWS
Containers on AWS
 
Security and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizationsSecurity and governance with aws control tower and aws organizations
Security and governance with aws control tower and aws organizations
 
Digital transformation on aws
Digital transformation on awsDigital transformation on aws
Digital transformation on aws
 
Security in the cloud
Security in the cloudSecurity in the cloud
Security in the cloud
 
2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud2. migration, disaster recovery and business continuity in the cloud
2. migration, disaster recovery and business continuity in the cloud
 
1. aws overview
1. aws overview1. aws overview
1. aws overview
 
Pgp
PgpPgp
Pgp
 
ssl for securing
ssl for securingssl for securing
ssl for securing
 
03 unity 3_d_part_2
03 unity 3_d_part_203 unity 3_d_part_2
03 unity 3_d_part_2
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
 
01 unity 3_d_introduction
01 unity 3_d_introduction01 unity 3_d_introduction
01 unity 3_d_introduction
 
unity basics
unity basicsunity basics
unity basics
 

Recently uploaded

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸
call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸
call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 

Recently uploaded (20)

What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸
call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸
call girls in Kamla Market (DELHI) 🔝 >āŧ’9953330565🔝 genuine Escort Service 🔝✔ī¸âœ”ī¸
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 

Jar chapter 2

  • 1. 1 Chapter 2 Structural Modeling & Analysis Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H.K. Tsang, Clarence S.W. Lau and Y.K. Leung McGraw-Hill Education (Asia), 2005
  • 2. 2 References īŽ Chapter 2, Object-Oriented Technology: from diagram to code with Visual Paradigm for UML īŽ Chapters 4-8, The UML User Guide
  • 3. 3 What You Will Learn īŽ Describe and apply the fundamental object orientation concepts. īŽ Use the standard UML notation to represent classes and their properties. īŽ Model the structural aspects of problems with the class model. īŽ Perform domain analysis to develop domain class models.
  • 4. 4 What Is an Object? īŽ An object is a self-contained entity with well-defined characteristics (properties or attributes) and behaviors (operations). īŽ For example, the real-life environment consists of objects, such as schools, students, teachers and courses which are related in one way or another.
  • 5. 5 Types of Objects īŽ Physical and Conceptual Objects īŽ Physical (tangible) objects are those visible and touchable things such as a book, bus, computer or Christmas tree. īŽ Conceptual objects are intangible things, such as a bank account, time schedule, etc.
  • 6. 6 Types of Objects (cont’d) īŽ Domain Objects and Implementation Objects īŽ Objects identified from the real world are domain objects. īŽ Collectively, we call all objects which are not related to real world entities implementation objects. īŽ Bank accounts, tellers and customers are domain objects. īŽ An example of an implementation object is the transaction log.
  • 7. 7 Types of Objects (cont’d) īŽ Active and Passive Objects īŽ Passive object. The state of an object will not change unless the object receives a message. An example of a passive object is a bank account. īŽ Active object. An object that can change its state, for example, a clock, timer, etc.
  • 8. 8 What Is a Class and What Are Instances? īŽ A class is a generic definition for a set of similar objects. īŽ A class is a template or blueprint for a category of structurally identical items (objects). īŽ A class has methods and attributes while object instances have behaviors and states. +debit(in amount) +credit(in amount) -name -balance Bank Account name = John Smith balance = 1000.0 Object1 : Bank Account name = Robert Jones balance = -200.0 Object2 : Bank Account
  • 9. 9 Class and Object Notation īŽ Classes Providing Different Levels of Details īŽ UML Notation
  • 10. 10 Class and Object Notation (cont’d) īŽ Example
  • 11. 11 Relationships between Classes īŽ Relationships exist among real-life objects. īŽ For example, friendship and partnership are common examples of relationships among people. īŽ A relationship specifies the type of link that exists between objects. īŽ Through the links of an object, we can find out what other objects are related to it. īŽ For example, we can find out all the friends of a person John through the links to John. īŽ There are essentially three important types of relationships between classes: īŽ generalization/specialization (“type-of”), īŽ aggregation (“part-of”), and īŽ association.
  • 12. 12 Inheritance īŽ inheritance allows the implementation of generalization- specialization associations. īŽ Attributes and operations common to a group of subclasses are attached to a superclass and inherited by its subclasses.
  • 13. 13 Inheritance (cont’d) īŽ An abstract class is used to specify the required behaviors (operations) of a class, without having to provide their actual implementation. īŽ An operation without the implementation (body) is called an abstract operation. īŽ A class with one or more abstract operations is an abstract class. īŽ An abstract class cannot be instantiated because it does not have the required implementation of the abstract operations.
  • 14. 14 Inheritance (cont’d) īŽ Polymorphism is the ability of a variable to hold objects of its own class and its subclasses at runtime. īŽ The variable can be used to invoke an operation of the object held. īŽ The actual operation being invoked depends on the actual class of the object referenced by the variable. īŽ For example, suppose variable “shape” is of type Shape. If shape references a Rectangle object, then shape.draw() invokes the draw() method of the Rectangle class. īŽ Similarly, if shape references a Polygon object, the draw() method of the Polygon class is invoked by shape.draw().
  • 15. 15 Association īŽ Object-oriented systems are made up of objects of many classes. Associations represent relationships among classes. īŽ An association is represented by a line drawn between the associated classes involved with an optional role name attached to either end. īŽ The role name is used to specify the role of an associated class in the association. īŽ If an association connects two objects instead of classes, it is called a link. īŽ A link is an instance of an association.
  • 16. 16 Association (cont’d) Name of Link Multiplicity Role Name of Association
  • 17. 17 Qualification īŽ Qualification serves as names or keys that are part of the association and are used to select objects across the association at the other end. īŽ Qualification reduces the effective multiplicity of the association from one-to-many to one-to-one. īŽ In UML, a qualifier is used to model this association semantic, that is an association attribute whose value determines a unique object or a subset of objects at the other end of an association.
  • 21. 21 Association Classes Sometimes, it is necessary to describe an association by including some attributes which do not naturally belong to the objects involved in the association.
  • 23. 23 Aggregation īŽ Aggregation is a stronger form of association. īŽ It represents the has-a or part-of relationship. īŽ In UML, a link is placed between the “whole” and the “parts” classes with a diamond head attached to the “whole” class to indicate that this association is an aggregation. īŽ Multiplicity can be specified at the end of the association for each of the “part-of” classes to indicate the quantity of the constituent parts. īŽ Typically, aggregations are not named, and the keywords used to identify aggregations are “consists of”, “contains” or “is part of”.
  • 25. 25 Composition īŽ A stronger form of aggregation is called composition, which implies exclusive ownership of the “part-of” classes by the “whole” class, i.e. a composite object has exclusive ownership of the parts objects. īŽ This means that parts may be created after a composite is created, but such parts will be explicitly removed before the destruction of the composite.
  • 27. 27 Constraints and Notes īŽ Constraints are an extension of the semantics of a UML element, allowing one to add new rules or modify existing ones. Sometimes it is helpful to present an idea about restrictions on attributes and associations for which there is no specific notation. īŽ Constraints are represented by a label in curly brackets ({constraintName} or {expression}) that are attached to the constrained element.
  • 28. 28 Constraints and Notes (cont’d)
  • 30. 30 Example – A Sales Order System
  • 32. 32 Domain Modeling and Analysis īŽ Preparing the problem statement; īŽ Identifying objects and classes using textual analysis; īŽ Developing a data dictionary; īŽ Identifying associations between classes; īŽ Identifying attributes of classes and association classes; īŽ Structuring classes using inheritance; īŽ Verifying access paths for likely queries; and īŽ Iterating and refining the model.
  • 33. 33 Domain Modeling and Analysis (cont’d) Customer Account Bank Transaction Customer Account Bank Transaction Problem Statement Textual Analysis Customer Account Bank Transaction Candidate Clases Customer Account BankTransaction Initial Domain Class Model -name -address Customer -balance Account -name Bank -amount Transaction Classes with Attributes -name -address Customer -balance Account -name Bank -amount Transaction Restructured Class Model Withdraw Transaction -destination account Transfer Transaction -credit limit Credit Card Account -overdraft limit Current Account
  • 34. 34 Example – Online Stock Trading īŽ A stock brokerage firm wants to provide an online stock trading service to enable its clients to trade via the computer. With this system, a client must first be registered before he can trade online. The registration process involves the client providing his ID, address and telephone number. A client may open one or more accounts for stock trading. The stock brokerage firm needs to be registered with a stock exchange before its clients can trade the stocks listed on the stock exchange. A stock brokerage firm can be registered with one or more stock exchanges. The stock brokerage firm may need to pay monthly charges for using the services provided by the stock exchange.
  • 35. 35 Example – Online Stock Trading (cont’d) īŽ Once registered, the client can buy and sell stocks. The client can check the current price, bid price, ask price and traded volume of a stock in real time. The stock price and traded volume information is provided by the stock exchange on which the stock is listed and traded. When a client issues a buy order for an account, the client must specify the stock code, the number of shares and the maximum price that he is willing to pay for them (the bid price). A client must have sufficient funds in his account to settle the transaction, when it is completed. When a client issues a sell order, the client must specify the stock code, the number of share and the minimum price that he is willing to sell them (the ask price). The client must have sufficient shares of the stock in his account before he can issue the sell order.
  • 36. 36 Example – Online Stock Trading (cont’d) īŽ A client can check the status of execution of his (buy or sell) orders. The client can issue a buy or sell order before the end of the trading day of the stock exchange which processed the order. All trade orders will be forwarded to the stock trading system of the stock exchange for execution. When an order is completed, the stock trading system of the stock exchange will return the transaction details of the order to the online stock trading system. The transaction details of a trade order may be a list of transactions, each transaction specifying the price and the number of shares traded. For example, the result of a buy order of 20,000 HSBC (stock code: 0005) shares at HK$88.00 on the Hong Kong Stock Exchange may be as follows: īŽ 4,000 shares at HK$87.50, īŽ 8,000 shares at HK$87.75, and īŽ 8,000 shares at HK488.00.
  • 37. 37 Example – Online Stock Trading (cont’d) īŽ An order will be kept on the system for execution until the order is completed or the end of a trading day is reached. There are three possible outcomes for a trade order: 1. The trade order is completed. For a buy order, the total amount for the buy order will be deducted from the client’s account and the number of shares of the stock purchased deposited into the account. For a sell order, the number of shares sold will be deducted from the client’s account and the proceeds of the sell order deposited into the client’s account. 2. The trade order is partially completed. The number of shares actually traded (sell or buy) is less than the number of shares specified in the order. The number of shares successfully traded in the order will be used for the calculation of the amount of the proceeds, and the client’s account adjusted accordingly. 3. The trade order is not executed by the end of a trading day. The order will be canceled.
  • 38. 38 Identifying objects and classes īŽ To identify objects and classes, perform a textual analysis to extract all nouns and noun phrases from the problem statement. īŽ Nouns or noun phrases of the following categories are more likely to represent objects: īŽ Tangible things (e.g. classroom, playground) īŽ Conceptual things (e.g. course, module) īŽ Events (e.g. test, examination, seminar) īŽ Outside organizations (e.g. publisher, supplier) īŽ Roles played (e.g. student, teacher, principal) īŽ Other systems (e.g. admission system, grade reporting system)
  • 39. 39 Identifying objects and classes (cont’d) Stock brokerage firm (concept) Buy order (event) Monthly charge Stock code (simple value, attribute) Trade (event) Number of shares (simple value, attribute) Trade order (event) Maximum price (simple value, attribute) Computer (tangible thing) Transaction (event) Client (role played) Sell order (event) ID (simple value, attribute) Trading hours (simple value, attribute) Address (simple value, attribute) Trading day (simple value, attribute) Telephone number (simple value, attribute) Stock trading system (other systems) Account (concept) Order (event) Stock exchange (outside organization) Execution result (event)
  • 40. 40 The Generalization Relationship Stock (concept) Hong Kong Bank (instance of stock) Current price (simple value, attribute) Hong Kong Stock Exchange (instance of stock exchange) Bid price (simple value, attribute) Lot size (simple value, attribute) Ask price (simple value, attribute) Registration process (not an object) Traded volume (simple value, attribute)
  • 41. 41 Categories of Inappropriate Classes Category Description Redundant classes Classes that mean the same thing. Choose the most descriptive class. For example, order, trade and trade order mean the same thing. Eliminate trade and order, and keep trade order. Irrelevant classes Those classes which are not directly related to the problem. For example, monthly charge is not directly related to the system. Vague classes Classes with a loosely defined scope. Attributes Attributes of classes also represent as nouns or noun phrases. Therefore, the list of nouns or noun phrases extracted by textual analysis may contain attributes of classes. For example, address and telephone number are attributes of the client.
  • 42. 42 Categories of Inappropriate Classes (cont’d) Category Description Operations The performance of actions is sometimes expressed as nouns or noun phrases. For example, the registration process is the action taken by the client to register on the system. It should be considered an operation of a class, rather than a class. Roles The role names help to differentiate the responsibilities of the objects in an interaction. However, they should not be considered as classes. Implementation constructs Sometimes, implementation details of a particular solution are written in the problem statement, for example, array, indexed sequential file, etc. Candidate classes representing the implementation details should be removed.
  • 43. 43 Inappropriate Classes Stock brokerage firm (irrelevant) Stock code (attribute) Monthly charge (irrelevant) Number of shares (attribute) Trade (redundant) Maximum price (attribute) Computer (implementation) Trading hours (attribute) ID (attribute) Trading day (attribute) Address (attribute) Order (redundant) Telephone number (attribute) Hong Kong Bank (instance of stock) Current price (attribute) Hong Kong Stock Exchange (instance of stock exchange) Bid price (attribute) Lot size (attribute) Ask price (attribute) Registration process (operation) Traded volume (attribute)
  • 44. 44 Candidate Classes Trade order (event) Transaction (event) Client (role played) Sell order (event) Account (concept) Stock trading system (other systems) Stock exchange (outside organization) Execution result (event) Buy order (event) Stock (concept)
  • 45. 45 Developing the Data Dictionary Class Definition Client An individual or a company registered with the stock brokerage firm for online stock trading services. The class has attributes like address, telephone number and ID. A client may have one or more accounts. Account A client can issue trade order on his or her accounts. An account holds details about the cash and stock balances for trading. Stock exchange A financial institution that provides a platform where the stock trading is carried out. Stock trading system A platform for the execution of the trade orders of stock. Trade order A trade order specifies the price, stock code and number of shares. A trade order can be a buy order or a sell order. Buy order A buy order specifies the bid price, stock code and number of shares.
  • 46. 46 Developing the Data Dictionary Class Definition Sell order A sell order specifies the ask price, stock code and number of shares. Stock A company listed on a stock exchange. Shares of a company can be traded only in a multiple of its lot size. Execution result The result of the execution of a trade order. It contains a list of transactions. Transaction The execution of a trade order at a particular price. It also contains the number of shares traded at that price.
  • 47. 47 Identifying Associations between Classes īŽ An association is a relationship between objects. īŽ For example, John and Peter are instances of the class Person and John is the father of Peter. īŽ Association can be identified by looking for verbs and verb phrases connecting two or more objects in the problem statement. īŽ e.g. “A client may open one or more accounts for stock trading.” īŽ Name of the association: has or opened by? īŽ The name of the association should reflect the nature rather than the historic event.
  • 48. 48 Identifying Associations between Classes (cont’d) Verb phrase Association A client may open one or more accounts for stock trading. has When a client issues a buy order for an account, the client must specify the stock code, number of shares and the maximum price that he is willing to pay for them (the bid price). issued by, buy When a client issues a sell order for an account, the client must specify the stock code, the number of share and the minimum price that he is willing to sell them (the ask price). issued by, sell All trade orders will be forwarded to the stock trading system of the stock exchange for execution. executed by When an order is completed, the stock trading system of the stock exchange will return the transaction details of the order to the online stock trading system. returned by The transaction details of a trade order may be a list of transactions, and each transaction specifies the price and the number of shares traded. consists of
  • 49. 49 Identifying Associations between Classes (cont’d) īŽ From the domain knowledge, we have the following associations: īŽ A stock is listed on a stock exchange. īŽ A stock is traded on a stock trading system of a stock exchange. īŽ The result of a trade order is a list of transactions. īŽ A stock exchange has one or more stock trading systems.
  • 51. 51 Identifying Attributes of Classes and Association Classes īŽ Attributes are properties of a class, such as name, address, telephone number of the Client class. īŽ Look for nouns or noun phrases followed by possessive phrases, e.g. “address of the client”. īŽ Adjectives that appear immediately before a noun corresponding to a class can also be an enumerated value of an attribute, e.g. “a canceled buy order”. īŽ Attributes are less likely to be discovered from the problem statement. īŽ However, it is not necessary to identify all attributes in this step because the attributes do not affect the structure of the domain class model. īŽ Instead we should only do so if they can be identified readily. We will be able to identify the attributes more readily at later stages of the development life cycle (e.g. detailed design phase).
  • 52. 52 Structuring Classes Using Inheritance īŽ Two approaches: top down and bottom up īŽ Bottom-up approach: īŽ similar class name īŽ similar attributes īŽ similar operations īŽ similar associations īŽ e.g. the buy order and sell order classes both have the price and number of shares attributes and both of them are associated with the stock class and account class.
  • 54. 54 Structuring Classes Using Inheritance (cont) īŽ Top-down approach: īŽ check a class to see whether it has some special cases that have additional structural or behavioral requirements. īŽ noun phrases consisting of adjectives and class names, īŽ e.g. sell order class and buy order class īŽ taxonomies of real-life objects īŽ domain knowledge, īŽ e.g. cash account and margin account
  • 56. 56 Verifying Access Paths for Likely Queries īŽ Check whether the domain class diagram can provide the correct answers to queries that are common to other applications in the domain. īŽ In the online stock trading system example, a typical client query would be the current stock balance of his account. īŽ This requires an association between the account class and the stock class to provide the information on the number of shares held in the account.
  • 57. 57 Verifying Access Paths for Likely Queries (cont’d)
  • 58. 58 Verifying Access Paths for Likely Queries (cont’d)
  • 59. 59 Iterating and Refining the Model īŽ It is highly unlikely that we are able to develop the correct domain class model in one pass. īŽ The domain class model needs to be refined several times before it becomes robust. īŽ The development of the domain class model is not a rigid process, and we need to repeatedly apply the above steps until the domain class model finally becomes stable.
  • 60. 60 Iterating and Refining the Model (cont’d) īŽ The following checklist can help you identify areas to improve the domain class model . īŽ A class without attributes, operations and associations - consider removing the class. īŽ A class with many attributes and operations covering a wide area of requirements - consider splitting the class into two or more classes. īŽ A query cannot be answered by tracing the domain class model - consider adding additional associations. īŽ Asymmetries in generalizations and associations - consider adding additional associations and restructuring the classes with inheritance. īŽ Attributes or operations without a hosting class - consider adding new classes to hold these attributes and operations.
  • 61. 61 Tricks and Tips in Structural Modeling and Analysis īŽ Set Focus and Context of Your Diagram īŽ Make sure your class diagram only deals with the static aspects of the system. Do not attempt to consolidate everything into one single class diagram. īŽ Use Appropriate Names for Your Classes īŽ Classes from two sources: domain analysis and use case analysis. If the classes identified from the use case analysis is similar or identical to those you have derived from the domain analysis, that would be a happy situation. īŽ On the other hand, where inconsistent classes are derived from these two sources, you should discuss them with your end users, advising them to use standard terminologies of the industry, allowing for a dominant player in the field. If they insist on using their (non-standard) terminologies, you may need to put the standard ones in your libraries and use subclasses for their non-standard ones specifically for this application.
  • 62. 62 Tricks and Tips in Structural Modeling and Analysis (cont’d) īŽ Organize Your Diagram Elements īŽ Not only should you structure classes with various object-oriented semantics, but also organize their elements spatially to improve their readability. For example, minimize cross lines in the diagram and place the semantically close? /similar? elements close together. īŽ Annotate Your Diagram Elements īŽ You should attach notes to those elements where you need to clarify unclear concepts, and where necessary attach external files, documents or links within the notes (i.e. an http link or a directory path). Some automated CASE tools support such kind of annotations (e.g. Visual Paradigm for UML), so that you can glue resources into a navigable visual model.
  • 63. 63 Tricks and Tips in Structural Modeling and Analysis (cont’d) īŽ Refine the Structural Model Iteratively and Incrementally īŽ As you progress through the development stages, you will be able to enrich your structural models from time to time. For example, dynamic models help to identify the responsibilities of the classes, or possibly even new classes, implementation classes and control classes. We shall discuss this concept in more details in Chapter 4 – Dynamic Modeling and Analysis. īŽ Show Only the Relevant Associations īŽ If a class is used by a number of use cases or even several applications, the class may have a number of associations that are related to different contexts. In your diagram, only show the associations related to the context that you are currently concerned with and hide the irrelevant associations. Do not attempt to consolidate all the associations and classes into a large class model that cannot be easily managed by most people.