Unit 2
Unit 2
Unit
Perspectives
There are three different perspectives; we use in drawing class diagrams. They are
• Conceptual
• Specification
• Implementation
We take the concepts in the domain under study and represent in diagrams, for the
conceptual perspective.
These concepts will relate to the classes that implement them by there us often no direct
aping.
A conceptual model should be drawn with little or no regard to the software that
implements it, so it is considered language independent.
2.2 Object Oriented Analysis and Design
(a) Conceptual
A type can have many classes that implement it and a classes that implement it an a class
implement many types.
(c) Implementation
Here we have classes and we lat the implementation base.
This is the most often used perspective but un many cases the specification perspective is
better than implementation.
Classes are marked with << implementation class >> to show the implementation
perspective and with <<type>> for the specification and conceptual perspective.
Static UML Diagrams 2.3
2.2 ELABORATION
Elaboration has the following series of iterations.
1) The core (risky) software architecture is programmed and tested.
2) Majority of the requirements are discovered and stabilized.
3) Major rises are mitigated or retired.
Each iteration is time boxed. i.e. its end date is fixed. It lasts for two to six weeks.
• During elaboration the models are fully developed in preparation for implementation.
• During elaboration, the code and design are in production. It is called “Executable
architecture” or “Architectural baseline”.
Elaboration is
• Building the core architecture
• Resolving the high risk elements
• Define more requirements and
Estimate overall schedule and resources
Domain model
• Visualization of domain concepts.
• It is similar to static information model.
Design model
It is a set of diagrams that describe logical design.
It includes
• Class diagrams
• Object interaction diagrams
• Package diagrams etc.
2.3.1 Example
A partial domain model for a visual dictionary is drawn with UML class diagram. The
conceptual classes of
• Payment and
• Sale
are shown
The payment is related to sale.
Sale has date and time information.
The conceptual perspective can be had by applying UML class diagram notation for
domain model.
Static UML Diagrams 2.5
Avoid
Figure 2.3 A domain model does not show software artifacts or classes
A conceptual class
Example:
Process Sale
Extensions
7.a. Paying by cash
1) Cashier enters amount
2) System presents balance
3) Cashier deposits cash and returns balance
4) System, records cash payment
Some noun phrases are candidate conceptual classes. Some refer to simple
attributes of conceptual class.
The disadvantage of this approach is – Different noun phrases may represent same
conceptual class or attributes among ambiguities.
2.4.1.4 Examples
POS Domain
A list of candidate classes for the domain is generated.
The list consists of requirements and simplifications of process sale.
Sale Cashier
Cash payment Customer
SalesLineItem Store
Item ProductDescription
Register ProductCatalog
Ledger
Then, construct the UML class diagram for the above classes.
Monopoly Domain
The list of candidate classes for Monopoly domain are
Player
Piece
Die
Board
Square
Example:
ProductDescription is a description class that records
◦ Picture
◦ Price and
◦ Text description
Example:
If a store has „Reynolds‟ pen and in a demand the pen is sold and its instance is lost.
If a customer asks
„What is the cost of Reynolds Pen‟
Static UML Diagrams 2.11
No one can answer because the price of the item is lost, once it is sold.
We also cannot have a duplicate instance of all objects because it causes inefficiency
and wastage of memory.
So the solution is to have a „description class‟. For example, here we have got
ProductDescription class.
Here ProductDescription would have the price, description of the item, but not the
serialNo which is irrelevant.
The ProductDescription class is represented by
2.5 ASSOCIATION
An association is a relationship between classes that indicate meaningful and interesting
connection.
It is represented as a solid line connecting two class symbols.
Example
2.5.1 Definition
An association is defined as “Semantic relationship between two or more classifiers that
involve connections among their instances”.
Static UML Diagrams 2.13
Example:
A graph with „n‟ nodes can have (n(n-1))/2 associations to other nodes. i.e. 20 classes will
have 190 association lines.
So avoid the unnecessary associations.
An association is not statement about data flows during domain modeling.
The ends of association contains multiplicity expression i.e., numerical instances of the classes.
Example:
Legal formats of compound association name.
• Work-for
• Work for
2.5.3 Multiplicity
Multiplicity defines how many instances of a class A can be associated with the instance
of class B
2.5.5 Navigation
UML uses association navigation or navigability to specify a role affiliated with each
other at the end of association line.
Here it means association from person to BankAccount (person has BankAccount) and not the
reverse.
The convention is to read association from left to right and top to bottom.
Example:
Airline system
Category Examples
A is a transaction related to another CashPayment – sale cancellation –
transaction B reservation
A is a line item of a transaction B SalesLineItem – Sale
A is a product or service for a transaction (or Item – SalesLineItem Flight –
line item) B reservation
A is a role related to a transaction B Customer – PaymentPassenger –
Ticket
A is physical or logical part of B Drawer – RegisterSquare – BoardSeat
– Airplane
A is physically or logically contained in/on B Register – storeItem – shelfPassenger
– Airplane
A is a description of B ProductDescription –
ItemFlightDescription – Flight
A is known/logged/recorded/reported/ Sale – RegisterPiece – Square
captured/ in B
A is a member of B Cashier – storePlayer – monopoly
gamePilot – Airline
A is an organizational subunit of B Department – StoreMaintenance –
Airline
A uses or manages or owns Cashier – RegisterPlayer – PiecePilot
– Airplane
A is next to B SalesLineItem – SalesLineItemSquare
– SquareCity – City
2.6 ATTRIBUTES
• Attributes are very similar to associations.
Static UML Diagrams 2.19
• At conceptual level, an attribute customer‟s name indicates that customer have names.
• At specification level, the attributes name indicates the customer name and has a way
of selecting a name.
At the implementation level, a customer has a field ( an instance variable or a data
member) for its name.
The notation for an attribute shows the attributes name, type and default value.
2.6.2 Operations
The processes carried out but a class are called operations.
Whose syntax is
2.20 Object Oriented Analysis and Design
Direction name: type = default value
Direction shows whether parameter used for input (in), output (out) or both (inout).
By default the direction value is in.
Return type expression is a comma- separated list of return types. Most people use single
return type but multiple return types are also allowed.
UML defines a query as an operation that gets a value from a class without changing the
system state. Such operations are marked with constraint {query}
Operations that do change state are called modifier.
Queries can be executed in any order but sequence of modifiers is more important Other
terms are
• getting method
• setting method
• A getting method returns a value from a field.
• A setting method puts a value into a field.
• A client from outside should not tell whether
A query is getting method or a modifier is a setting method knowledge of getting and
setting method is entirely internal to the class.
Other distribution is between operation and method.
An operation is something that is invoked on an object [procedure call] A method is the
body of the procedure.
In C++, operation are called „member function‟
Smalltalk calls operation as „methods‟
UML uses the term „feature‟ for an attribute or an operation.
2.6.4 Attributes
An attributes is a logical data value of an object.
Attributes of conceptual classes are identified to satisfy information requirements of
current scenarios under development.
Example:
A receipt in processSale includes dateTime.
So,
• Sale requires „dateTime‟ attribute
• Store requires „name‟ and „address‟
Static UML Diagrams 2.21
• Cashier requires an „ID‟
2.6.5 Notation
In the class representation, Attributes are shown in the second compartment.
Example:
2.6.6 Syntax
The syntax of attribute in UML is
visibility name : type multiplicity = default {property-string}
Examples
1)
2)
3)
Example:
Total attribute in Sale is calculated or derived from „SalesLineItem‟.
Quantity calculated from actual multiplicity value of the association.
is replaced by
Example:
If the „cashier‟ class has a „current Register No‟ attribute it relates cashier to Register
object.
Figure 2.25
2) Case Study 2:
Monopoly game
Class Attributes Description
Die faceValue After rolling die, calculate distance of move
Square Name Print output desired
Player Name Name of player
Piece Name Name of piece
(i) Generalization
(ii) Specialization and
(iii) Conceptual class hierarchies
Definition:
A conceptual superclass is more general or encompassing than subclass
Example:
Superclass – Payment
Subclasses – CashPayment
Credit Payment
CheckPayment
Representation
Example:
In terms of set membership, all instances of set „CreditPayment‟ are also members of set
„Payment‟.
2.28 Object Oriented Analysis and Design
Example:
All „payments‟ have an attribute „amount‟ which are associated with „Sale‟.
Benefits of composition
Composition is very useful in design than analysis.
1) Composition classifies domain constraint for the existence of the part independent of the
whole.
2) It assists in identification of creator using GRASP.
3) Operations like copy, delete apply to parts.
Figure 2.32
Figure 2.33
While naming the system events, use the abstract level of representation rather than
physical input device.
Example:
“enterItem” is better than “Scan”.
Because the entry could be through scanner, keyboard, voice input or anything.
Static UML Diagrams 2.31
:Cashier :System
Figure 2.34
Always start the system event with a verb like
• add…
• enter…
• end…
• make…
to improve clarity
SSDs are also used to collaborate between systems.
Example:
NextGenPOS and external credit payment authorizer.
The elements of SSD are
• operation name
• parameters
• return data
Glossary is used to maintain the information of what is coming in and what is going out
during design.
Example 1:
In the previous diagram, the return line has the description “change due, receipt”.
Here glossary has a receipt entry and shows receipt (digital picture) and layouts and
contents.
Example 2:
:Observer :System
initialize(num of players)
Play Game
Their purpose is to
1) Identify details of system events
2) Clarify major operations the system is designed to handle
3) Write system operation contracts
4) Support estimation
(Example: Macro estimation with unadjusted function points and cocomo II)
These concepts will relate to the classes that implement them by there us often no direct
aping.
2.34 Object Oriented Analysis and Design
A conceptual model should be drawn with little or no regard to the software that
implements it, so it is considered language independent.
Specification
Here we look at the interface of the software but not its implementation.
The word type is used to talk about an interface of a class.
A type can have many classes that implement it and a classes that implement it an a class
implement many types.
Implementation
Here we have classes and we lat the implementation base.
This is the most often used perspective but un many cases the specification perspective is
better than implementation.
Classes are marked with << implementation class >> to show the implementation
perspective and with <<type>> for the specification and conceptual perspective