SlideShare a Scribd company logo
Faculty Instructor:
Dr. kavitha sooda
Associate Professor
Dept. of CSE
B.M.S. College of engineering, Bengaluru
TB: Object oriented modelling and design with UML, 2nd Edition, Michael blaha, james Rumbaugh
©- PPT
Object-Oriented Modeling and Design
CourseCode: 20cs6pcomd
Course Content
Units Content
1- C1,2,3 Introduction, Modeling Concepts, Class Modeling
2 – C4,5 Advanced Class Modeling, State Modeling
3 – C6,7,8 Advanced State Modeling, Interaction Modeling:
Advanced State Modeling
4 – C10-13 Process Overview, System Conception, Domain
Analysis, Application Analysis: Process Overview
5 - C14,15,17 System Design, Class Design, Implementation
Modeling
Unit-1
2
Course Outcomes
CO Course outcomes
CO1 Ability to apply the knowledge of class, State & Interaction
Modelling using Unified Modeling Language to solve a
given problem.
CO2 Ability to analyze a System for a given requirement using
Unified Modeling language
CO3 Ability to design a given system using high level strategy.
CO4 Ability to conduct practical experiment to solve a given
problem using Unified Modeling language.
Unit-1
3
Is Software Engineering the right
term?
If Engineering then it has to be constructed like Civil engineering, Electrical or
Mechanical Engineering
Unit-1
4
What is Software Development &
Engineering?
 Software development is art of problem solving-
Just 100 years old
 Software Engineering is an innovative process
Unit-1
5
Unit-1
6
Why projects Fail? - Complexity
 Changes from requirements
 Changes from Technology
 Changes from People
 Why Project fails?
Unit-1
7
Software Development life cycle
Unit-1
8
Software Development- Software
Construction
 OOAD aids in
 Structural analysis, Modeling, Design and
Implementation
 Adherence to Good Practices.
 UML
Unit-1
9
End of Class
Next Class,
Introduction, 4 Aspects of OO approach, OO
Development, Methodology, Themes
Unit-1
10
Content
 Introduction
 Four Aspects of OO Approach
 OO Development
 OO Themes
Unit-1
11
Introduction
 Intention of OOMD is to learn how to apply object -
oriented concepts to all the stages of the software
development life cycle.
 Object-oriented modelling and design is a way of
thinking about problems using models organized around
real world concepts.
 The fundamental construct is the object, which combines
both data structure and behaviour.
Unit-1
12
Four Aspects of OO Approach
 OO means that we organize software as a collection of
discrete objects.
There are four aspects required by an OO approach
 Identity.
 Classification.
 Inheritance.
 Polymorphism.
Unit-1
13
Identity:
 Identity means that data is quantized into discrete,
distinguishable entities called objects.
 E.g. Personal computer, bicycle, queen in chess.
 Objects can be concrete or conceptual. Each object
has its own inherent identity.
Classification:
 Classification means that objects with the same
data structure and behaviour are grouped into a
class.
 E.g. paragraph, monitor, chess piece.
 Each object is said to be an instance of its class.
Unit-1
14
Unit-1
15
Inheritance:
 It is the sharing of attributes and operations among
classes based on a hierarchical relationship. A super class
has general information that sub classes refine and
elaborate.
 E.g. Regular Customer and Privileged customer are the
subclasses of Customer.
Polymorphism:
 Polymorphism means that the same operation may behave
differently for different classes.
 For E.g. move operation behaves differently for a pawn
than for the queen in a chess game.
 An operation is a procedure/transformation that an object
performs or is subjected to. An implementation of an
operation by a specific class is called a method.
Unit-1
16
OO Development
Unit-1
17
 Development refers to the software life cycle: Analysis,
Design and Implementation.
 The essence of OO Development is the identification and
organization of application concepts.
 OO development is fundamentally a way of thinking and
not a programming technique
Unit-1
18
OO Methodology
 The process consists of building a model of an
application and then adding details to it during design.
 The methodology has the following 5 stages:
 System conception: Software development begins
with business analysis or users conceiving an
application and formulating tentative requirements.
 Analysis: The analyst scrutinizes and rigorously
restates the requirements from the system conception
by constructing models.
Unit-1
19
 The analysis model is a concise, precise abstraction of what
the desired system must do, not how it will be done.
The analysis model has two parts:
 Domain Model- a description of real world objects
reflected within the system.
 Application Model- a description of parts of the
application system itself that are visible to the user.
E.g. In case of stock broker application-
 Domain objects may include- stock, bond, trade &
commission.
 Application objects might control the execution of trades
and present the results.
Unit-1
20
 System Design: The development teams devise a high-
level strategy- The System Architecture- for solving the
application problem.
 The system designer should decide what performance
characteristics to optimize, chose a strategy of attacking
the problem, and make tentative resource allocations.
 Class Design: The class designer adds details to the
analysis model in accordance with the system design
strategy.
 Implementation: Implementers translate the classes and
relationships developed during class design into a
particular programming language, database or hardware.
Unit-1
21
Three models
 Class Model—for the objects in the system & their
relationships.
 It describes the static structure of the objects in the system and
their relationships.
 Class model contains class diagrams- a graph whose nodes are
classes and arcs are relationships among the classes.
 State model— for the life history of objects.
 It describes the aspects of an object that change over time.
 It specifies and implements control with state diagrams-a
graph whose nodes are states and whose arcs are transition
between states caused by events.
Unit-1
22
 Interaction Model— for the interaction among
objects.
 It describes how the objects in the system co-operate to
achieve broader results.
 This model starts with use cases that are then elaborated
with sequence and activity diagrams.
 Use case – focuses on functionality of a system – i.e
what a system does for users.
 Sequence diagrams – shows the object that interact and
the time sequence of their interactions.
 Activity diagrams – elaborates important processing
steps.
Unit-1
23
OO THEMES - 6
 Abstraction
 Abstraction lets you focus on essential aspects of an
application while ignoring details i.e focusing on what an
object is and does, before deciding how to implement it.
 It’s the most important skill required for OO development.
 Encapsulation (information hiding)
 It separates the external aspects of an object from the
internal implementation details.
 Encapsulation prevents portions of a program from
becoming so interdependent that a small change has
massive ripple effects.
Unit-1
24
 Combining data and behavior
 Caller of an operation need not consider how many
implementations exist.
 In OO system the data structure hierarchy matches
the operation inheritance hierarchy .
Unit-1
25
 Sharing
 OO techniques provide sharing at different levels.
 Inheritance of both data structure and behavior lets sub
classes share common code.
 OO offers the prospect of reusing designs and code on
future projects.
 Emphasis on the essence of an object
 OO development places a greater emphasis on data
structure and a lesser emphasis on procedure structure
than functional-decomposition methodologies.
 Synergy
 Identity, classification, polymorphism and inheritance
characterize OO languages.
 Each of these concepts can be used in isolation, but
together they complement each other synergistically.
Unit-1
26
End of Chapter 1
Unit-1 OOMD- Inthhro- class modeling.ppt
 Purpose of Modeling
 Abstraction
 Three models
Unit-1 29
 A model is an abstraction of something for the
purpose of understanding it before building it.
 MODELLING
 Designers build many kinds of models for various
purposes before constructing things.
 Models serve several purposes –
 Testing a physical entity before building it:
Medieval built scale models of Gothic Cathedrals to
test the forces on the structures. Engineers test scale
models of airplanes, cars and boats to improve their
dynamics.
Unit-1 30
 Communication with customers: Architects and product
designers build models to show their customers.
 mock-ups are demonstration products that imitate some of
the external behaviour of a system.
 Visualization: Storyboards of movies, TV shows and
advertisements let writers see how their ideas flow.
 Artists sketches let them block out their ideas and make
changes before committing them to soil or stone.
 Reduction of complexity: Models reduce complexity to
understand directly by separating out a small number of
important things to do with at a time.
Unit-1 31
 Abstraction is the selective examination of certain
aspects of a problem.
 The goal of abstraction is to isolate those aspects that
are important for some purpose and suppress those
aspects that are unimportant.
 All abstractions are incomplete and inaccurate.
 A good model captures the crucial aspects of a problem
and omits others.
Unit-1 32
 Class Model: represents the static, structural, “data”
aspects of a system.
 It describes the structure of objects in a system- their
identity, their relationships to other objects, their
attributes, and their operations.
 Goal in constructing class model is to capture those
concepts from the real world that are important to an
application.
 Class diagrams express the class model.
Unit-1 33
 State Model: represents the temporal, behavioural,
“control” aspects of a system.
 State model describes those aspects of objects
concerned with time and the sequencing of
operations –
 Events that mark changes, states that define the context
for events, and the organization of events and states.
 State diagram express the state model.
 Each state diagram shows the state and event
sequences permitted in a system for one class of
objects.
 State diagram refer to the other models.
Unit-1 34
 Interaction model – represents the collaboration of
individual objects, the “interaction” aspects of a
system.
 Interaction model describes interactions between
objects – how individual objects collaborate to achieve
the behaviour of the system as a whole.
 Use cases-document interaction between system and
actor.
 Sequence diagrams-objects that interact and time
sequence.
 Activity diagrams –flow of control .
Unit-1 35
 Relationship Among the Models
 The class model describes data structure on which the
state and interaction models operate.
 The operations in the class model correspond to events
and actions.
 The state model describes the control structure of
objects.
 The interaction model focuses on the exchanges
between objects.
 The goal is to simplify the system description without
loading down the model with so many constructs that
it becomes a burden and not help.
Unit-1 36
Next Chapter : Class Modeling
CHAPTER 3
 A class model captures the static structure of a system by
characterizing the objects in the system, the relationships
between the objects, and the attributes and operations for
each class of objects.
 Object- generally Proper noun
 Purpose of class modeling is to describe objects.
 An object is a concept, abstraction or thing with identity
that has meaning for an application.
 Ex: Joe Smith, Infosys Company, process number 7648
and top window are objects.
Unit-1 39
 Some objects are real-world entities, conceptual etc.,
 The choice of object depends on judgment and the nature of
a problem.
 All objects have identity and are distinguishable.
 The term identity means that the objects are distinguished
by their inherent existence and not by descriptive properties
that they may have.
 Example : Two apples with the same color, shape and
texture are still individuals.
 Identical twins are two distinct persons even though they
look the same
Unit-1 40
 Class – Common Noun
 An object is an instance or occurrence of a class.
 A class describes a group of objects with the same
properties (attributes), behaviour(operations), kinds
of relationships and semantics.
Ex: Person, company, process and window are
classes.
 Objects in a class have the same attributes and forms
of behavior.
 The objects in a class share a common semantic
purpose.
Unit-1 41
 A barn and horse may have cost and age .
 If considered as financial assets they both
could belong to same class.
 If developer takes into consideration that a
person paints a barn and feeds a horse, they
would be modeled as distinct classes.
 The interpretation of semantics depends on
the purpose of each application and is a
matter of judgment
Unit-1 42
 Class Diagrams
 Class diagrams provide a graphic notation for modeling
classes and their relationships, thereby describing
possible objects.
 Class diagrams are useful both for abstract modeling and
for designing actual programs.
 A class diagram corresponds to infinite set of object
diagrams.
 An object diagram shows individual objects and their
relationships.
 Useful for documenting test cases and discussing
examples. Unit-1 43
Conventions used (UML):
 UML symbol for both classes and objects is box.
 Objects are modelled using box with object name
followed by colon followed by class name.
 Use boldface to list class name, centre the name in the
box and capitalize the first letter. Use singular nouns for
names of classes.
 To run together multiword names (such as JoeSmith),
separate the words with intervening capital letter.
Unit-1 44
 Values and Attributes
 Value is a piece of data.
 Attribute is a named property of a class that describes a
value held by each object of the class.
 Object is to class as value is to attribute.
E.g. Attributes: Name, bdate, weight.
Values: JoeSmith, 21 October 1983, 64
 Color, model year and weight are attributes of Car objects.
 Each attribute has a value for each object.
 Different objects may have the same or different values for
a given attribute.
 Each attribute name is unique within a class.
Unit-1 45
Conventions used (UML):
• List attributes in the 2nd compartment of the class box. Optional
details (like default value) may follow each attribute.
• A colon precedes the type, an equal sign precedes default value.
• Show attribute name in regular face, left align the name in the
box and use small case for the first letter.
•Similarly we may also include attribute values in the 2nd
compartment of object boxes with same conventions.
Unit-1 46
 Operations and Methods
 An operation is a function or procedure that maybe applied
to or by objects in a class.
 E.g. Hire, fire and pay dividend are operations on class
Company.
 Object identifiers not to be listed in the class, they are
implicit in models
 Open,close,hide and redisplay are operations on class
Window.
 Do not list object identifiers; they are implicit in
models.
Unit-1 47
 Same operation may apply to many different classes.
Such an operation is polymorphic.
 A method is the implementation of an operation for a
class.
 E.g. In class file, print is an operation you could
implement different methods to print ASCII files, print
binary files, print digitized picture files.
 When an operation has methods on several classes, it is
important that the methods all have the same signature.
 Ex: print should not have filename as an argument for
one method and filepointer as an argument for the other
method.
Unit-1 48
 Feature is a generic word for either an attribute or operations.
 UML conventions used –
 List operations in 3rd compartment of class box.
 List operation name in regular face, left align and use lower case for first
letter.
 Optional details like argument list and return type may follow each operation
name.
 Parenthesis enclose an argument list, commas separate the arguments. A colon
precedes the result type.
 Directions: in, out, inout (To modify)
Unit-1 49
 Summary of Notation for classes
Unit-1 50
 A link is a physical or conceptual connection among
objects.
 E.g. JoeSmith Works For Simplex Company.
 Mathematically, we define a link as a tuple – that is, a list of
objects.
 A link is an instance of an association generally appears
as Verb.
 An association is a description of a group of links with
common structure and common semantics.
 E.g. a person Works For a company.
 An association describes a set of potential links in the same
way that a class describes a set of potential objects.
Unit-1 51
Unit-1 52
 Conventions used (UML):
 Link is a line between objects; a line may consist of several
line segments.
 If the link has the name, it is underlined.
 Association connects related classes and is also denoted by
a line.
 Show link and association names in italics.
 Association name is optional, if the model is unambiguous.
Ambiguity arises when a model has multiple associations
among same classes.
 Associations are inherently bidirectional.
For Example: WorksFor connects a person to a company.
Employs connects a company to a person
Unit-1 53
 Developers often implement associations in
programming languages as references from one object
to another.
 A reference is an attribute in one object that refers to
another object.
For Example: a data structure for Person might contain
an attribute employer that refers to a Company object,
and a Company object might contain an attribute
employees that refers to a set of Person objects.
Unit-1 54
 Multiplicity
 Multiplicity specifies the number of instances of one class
that may relate to a single instance of an associated class.
 Multiplicity constrains the number of related objects.
 UML conventions:
 UML diagrams explicitly lists multiplicity at the ends of
association lines.
 UML specifies multiplicity with an interval, such as
◦ “1” (exactly one).
◦ “1..”(one or more).
◦ “3..5”(three to five, inclusive).
◦ “ * ” ( many, i.e zero or more).
Unit-1 55
One-to One Multiplicity
Unit-1 56
 Zero-to-One Multiplicity
 Workstation may have one of its windows
designated as the console to receive general
error messages.
Unit-1 57
Unit-1 58
 One can use the symbol “arrow( )” to make the
direction of the name clear.
Unit-1 59
 Association end names
 Multiplicity implicitly refers to the ends of
associations. For E.g. A one-to-many association has
two ends –
◦ an end with a multiplicity of “one”
◦ an end with a multiplicity of “many”
 You can not only assign a multiplicity to an
association end, but you can give it a name as well.
Unit-1 60
 A person is an employee with respect to company.
 A company is an employer with respect to a person.
 Association end names are optional.
 Association end names are necessary for associations between
two objects of the same class. They can also distinguish
multiple associations between a pair of classes.
Unit-1 61
 Association end names are necessary for associations between
two objects of the same class.
 Container and contents distinguish the two usages of
Directory in the self-association.
 Each directory has exactly one user who is an owner and many
users who are authorized to use the directory.
Unit-1 62
 Association end names unify multiple references to the
same class.
 When constructing class diagrams you should properly
use association end names and not introduce a separate
class for each reference as below fig shows.
Unit-1 63
 Objects on “many” association end have no explicit order and can be
considered as a set but sometimes objects have an explicit order
 Ordering is an inherent part of association. You can indicate an ordered set
of objects by writing “{ordered}” next to the appropriate association end.
 Workstation screen containing a number of overlapping windows.
 Each window on a screen occurs at most once and have an explicit order
that is only the topmost window is visible at any point on the screen
 Ordering sometimes occurs for “many” multiplicity.
Unit-1 64
 Bags and Sequences
 Normally, a binary association has at most one link for a pair of
objects.
 Multiple links for a pair of objects is permitted by annotating an
association end with {bag} or {sequence}
 A bag is a collection of elements with duplicates allowed.
 A sequence is an ordered collection of elements with duplicates
allowed.
 Itinerary is a sequence of airports and the same airport can be
visited more than once, so you should use {sequence} and not
{ordered}.
 {ordered} and {sequence} annotations are same, except that the
first disallows duplicates and the other allows them.
Unit-1 65
 Association Classes- Adverbs
 An association class is an association that is also a
class.
 Like the links of an association, the instances of an
association class derive identity from instances of the
constituent classes.
 Like a class, an association class can have attributes
and operations and participate in associations.
 accessPermission is an attribute of AccessibleBy.
 UML notation for association class is a box attached to
the association by a dashed line.
Unit-1 66
 Important in many-to-many associations.
 Attributes for association class unmistakably belong to
the link and cannot be ascribed to either object.
 accessPermission is a joint property of File and user
cannot be attached to either file or user alone without
losing information.
Unit-1 67
 Figure shows attributes for two one-to-many
relationships.
 Each person working for a company receives a salary
and has job title.
 The boss evaluates the performance of each worker.
Attributes may also occur for one-to-one associations.
Unit-1 68
• Figure shows how it’s possible to fold attributes for one-to-one
and one-to-many associations into the class opposite a “one”
end.
Unit-1 69
 An association class participating in an association.
 Users may be authorized on many workstations. Each
authorization carries a priority and access privileges.
 A user has a home directory for each authorized
workstation, but several workstations and user can
share the same home directory.
Unit-1 70
 The association class has only one occurrence for each pairing
of Person and Company.
 In contrast there can be any number of occurrences of a
Purchase for each Person and Company. Each purchase is
distinct and has its own quantity, date and cost.
Unit-1 71
 Qualified Associations
 A Qualified Association is an association in which an
attribute called the qualifier disambiguates the objects
for a “many” association ends.
 It is possible to define qualifiers for one-to-many and
many-to-many associations.
 A qualifier selects among the target objects, reducing
the effective multiplicity from “many” to “one”.
Unit-1 72
 A bank services multiple accounts. An account belongs to
single bank.
 Within the context of a bank, the Account Number specifies
a unique account. Bank and account are classes, and
Account Number is a qualifier.
 Qualification reduces effective multiplicity of this
association from one-to-many to one-to-one.
 qualification increases the precision of a model.
Unit-1 73
 The notation of a qualifier is a small box on the end
of the association line near the source class.
 The qualifier box may grow out of any side(top,
bottom , left , right) of the source class.
 The source class plus the qualifier yields the target
class.
 Bank+accountNumber yields an Account, therefore
accountNumber is listed in a box contiguous to Bank.
Unit-1 74
 A stock exchange lists many companies. However, it
lists only one company with a given ticker symbol.
 A company maybe listed on many stock exchanges,
possibly under different symbols.
Unit-1 75
Next Class :
Generalization, Example, OCL
Unit-1 76
 Generalization is the relationship between a class (the
super class) and one or more variations of the class (the
subclasses).
 Generalization (is-a) organizes classes by their similarities
and differences, structuring the description of objects.
 The super class holds common attributes, operations and
associations; the subclasses add specific attributes,
operations and associations.
 Each subclass is said to inherit the features of its superclass.
Unit-1 77
Unit-1 78
 Generalization is transitive across an arbitrary number of
levels.
 The term ancestor and descendent refers to generalization
of classes across multiple levels.
 An instance of a subclass is simultaneously an instance of
all its ancestor classes.
 An instance includes a value for every attribute of every
ancestor class.
 An instance can invoke any operation on any ancestor class.
Each subclass not only inherits all the features of its
ancestors but adds its own specific features as well.
 Ex: Pump adds attributes suctionPressure ,
dischargePressure and flowrate which other kinds of
equipment do not share.
Unit-1 79
Unit-1 80
 ‘move’, ‘select’, ‘rotate’, and ‘display’ are operations
that all subclasses inherit.
 ‘scale’ applies to one-dimensional and two-dimensional
figures.
 ‘fill’ applies only to two-dimensional figures.
 A generalization set name is an enumerated attribute
that indicates which aspect of an object is being
abstracted by a particular generalization.
 The word written next to the generalization line
diagram-dimensionality-is a generalization set name.
Unit-1 81
 There can be multiple levels of generalization.
 Each object inherits features from one class at each
level of generalization.
 UML convention used:
 Use large hollow arrowhead to denote generalization.
The arrowhead points to superclass.
Unit-1 82
 Use of generalization – 3 purposes
 To support polymorphism: You can call an operation
at the super class level, and the OO language complier
automatically resolves the call to the method that
matches the calling object’s class.
 To structure the description of objects: i.e. to form a
taxonomy and organizing objects on the basis of their
similarities and differences.
 To enable reuse of code: Inherit code from the
previous application as well as from previous work.
Reuse is more productive than repeatedly writing code
from scratch.
Unit-1 83
 The terms generalization, specialization and inheritance
all refer to aspects of the same idea.
 Generalization derives from the fact that the super class
generalizes the subclasses.
 Specialization refers to the fact that the sub class refine
or specialize the super classes.
 Inheritance is the mechanism for sharing attributes,
operations, and associations via the
generalization/specialization relationship.
Unit-1 84
 Overriding features
 A subclass may override a super class feature by defining a
feature with the same name. The overriding feature
(subclass feature) refines and replaces the overridden
feature (super class feature).
 Why override feature?
 To specify behavior that depends on subclass.
 To tighten the specification of a feature.
 To improve performance.
 In the example:”Figure” each leaf subclasses had
overridden ‘display’ feature.
 You may override methods and default values of attributes.
You should never override the signature, or form of a
feature.
Unit-1 85
3. 4 A Sample Class model
Unit-1 86
Unit-1 87
Unit-1 88
 Expressing the behavior of navigating among classes.
 Navigation is important because it lets you exercise a
model and uncover hidden flaws and omissions so that
you can repair them.
 Example:
 An institution may issue many credit card accounts, each
identified by an account number. Each account has a
maximum credit limit, a current balance, and a mailing
address. The account serves one or more customers
who reside at the mailing address. The institution
periodically issues a statement for each account. The
statement lists a payment due date, finance charge, and
minimum payment.
Unit-1 89
 What transactions occurred for a credit card
account within a time interval?
 What volume of transactions were handled by
an institution in the last year?
 What customers patronized a merchant in the
last year by any kind of credit card?
 How many credit card accounts does a
customer currently have?
 What is the total maximum credit for a customer,
for all accounts?
Unit-1 90
Unit-1 91
 Attributes. The syntax is the source object, followed by
a dot, and then the attribute name.
 For example, the expression
aCreditCardAccount.maximumCredit takes a
CreditCardAccount object and finds the value of
maximumCredit.
 Operations. An operation must be followed by
parentheses, even if it has no arguments
 Simple associations. The target end may be indicated
by an association end name or, where there is no
ambiguity, a class name. In the example,
aCustomer.MailingAddress yields a set of addresses for
a customer.
Unit-1 92
 Qualified associations. A qualifier lets you make a
more precise traversal. The expression
aCreditCardAccount.Statement[30 November 1999]
finds the statement for a credit card account with the
statement date of 30 November 1999.
 Association classes. Given a link of an association
class, you can find the constituent objects. Alternatively,
given a constituent object, you can find the multiple links
of an association class.
 Generalizations. Traversal of a generalization hierarchy
is implicit for the OCL notation.
 Filters. There is often a need to filter the objects in a set.
The OCL has several kinds of filters, the most common
of which is the select operation.
Unit-1 93
Unit-1 94
 What transactions occurred for a credit card account
within a time interval?
aCreditCardAccount.Statement.Transaction->
select(aStartDate <= transactionDate and
transactionDate <= anEndDate)
 What volume of transactions were handled by an
institution in the last year?
anInstitution.CreditCardAccount.Statement.Transaction-
> select(aStartDate <= transactionDate and
transactionDate <= anEndDate).amount->sum()
 What is the total maximum credit for a customer, for all
accounts?
aCustomer.MailingAddress.CreditCardAccount.
maximumCredit->sum()
Unit-1 95
End of Unit- 1
Next Class – Advanced Class Modeling,
Chapter 4

More Related Content

Similar to Unit-1 OOMD- Inthhro- class modeling.ppt (20)

PPTX
Object Oriented Approach for Software Development
Rishabh Soni
 
PPTX
UNIT 01 SMD.pptx
Kalpna Saharan
 
PPT
Object-Oriented Analysis and Design
RiazAhmad786
 
PPT
oomd-unit-i-cgpa.ppt
Pavan992098
 
PPTX
Unit-1 OOAD Introduction.pptx
Ravindranath67
 
PPTX
INTRODUCTION TO SYSTEM ANALYSIS AND DESIGN.pptx
AlmendarezNicole
 
PPT
CEN6016-Chapter1.ppt
NelsonYanes6
 
PPT
CEN6016-Chapter1.ppt
SumitVishwambhar
 
PPT
Object Oriented Analysis and Design - Overview
rmk_rrj
 
PPT
OOAD UNIT I UML DIAGRAMS
Mikel Raj
 
PPT
OBJECT ORIENTED ANALYSIS FOR EASY UNDERSTANDING .ppt
AshishSaraswat30
 
PPT
Unit-1 object oriented systems(OOSD) .ppt
AnushyaR6
 
PPTX
lecture 2.pptx
Tik Tok
 
PDF
Oo aand d-overview
Saravana Suresh Saravanamuthu
 
PPTX
Assignment 1 SYD601 2012 rick_danby completed with audio
RickNZ
 
PPTX
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
PDF
ppt_ooad.pdf
anuj962198
 
PDF
CS8592-OOAD Lecture Notes Unit-1
Gobinath Subramaniam
 
PDF
SE_Lec 06_Object Oriented Analysis and Design
Amr E. Mohamed
 
PPTX
Networking chapter jkl; dfghyubLec 1.pptx
adnanshaheen425
 
Object Oriented Approach for Software Development
Rishabh Soni
 
UNIT 01 SMD.pptx
Kalpna Saharan
 
Object-Oriented Analysis and Design
RiazAhmad786
 
oomd-unit-i-cgpa.ppt
Pavan992098
 
Unit-1 OOAD Introduction.pptx
Ravindranath67
 
INTRODUCTION TO SYSTEM ANALYSIS AND DESIGN.pptx
AlmendarezNicole
 
CEN6016-Chapter1.ppt
NelsonYanes6
 
CEN6016-Chapter1.ppt
SumitVishwambhar
 
Object Oriented Analysis and Design - Overview
rmk_rrj
 
OOAD UNIT I UML DIAGRAMS
Mikel Raj
 
OBJECT ORIENTED ANALYSIS FOR EASY UNDERSTANDING .ppt
AshishSaraswat30
 
Unit-1 object oriented systems(OOSD) .ppt
AnushyaR6
 
lecture 2.pptx
Tik Tok
 
Oo aand d-overview
Saravana Suresh Saravanamuthu
 
Assignment 1 SYD601 2012 rick_danby completed with audio
RickNZ
 
Software Engineering and Project Management - Introduction, Modeling Concepts...
Prakhyath Rai
 
ppt_ooad.pdf
anuj962198
 
CS8592-OOAD Lecture Notes Unit-1
Gobinath Subramaniam
 
SE_Lec 06_Object Oriented Analysis and Design
Amr E. Mohamed
 
Networking chapter jkl; dfghyubLec 1.pptx
adnanshaheen425
 

More from ChiragSuresh (10)

PPTX
wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
ChiragSuresh
 
PPT
PorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
ChiragSuresh
 
PPTX
Unit-4- Process oveunit5and6forview.pptx
ChiragSuresh
 
PPT
osama-quantum-computingoftge quantum.ppt
ChiragSuresh
 
PPT
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
ChiragSuresh
 
PPTX
Bharti Airtel_ Connectivity Empowering Millions.pptx
ChiragSuresh
 
PPTX
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
ChiragSuresh
 
PPTX
Student repository System.pptx
ChiragSuresh
 
PPTX
UNIT-2.pptx
ChiragSuresh
 
PPT
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
ChiragSuresh
 
wepik-mastering-the-art-of-entrepreneurship-20240313164953QR4t.pptx
ChiragSuresh
 
PorterchitwetyujbzxcbbnmlkhggfdPorter.ppt
ChiragSuresh
 
Unit-4- Process oveunit5and6forview.pptx
ChiragSuresh
 
osama-quantum-computingoftge quantum.ppt
ChiragSuresh
 
Luo_SC_mc_butorqwertyuiomabsvsbsbsjC.ppt
ChiragSuresh
 
Bharti Airtel_ Connectivity Empowering Millions.pptx
ChiragSuresh
 
509404501-Online-Shopping-System-Mini-Project-Ppt (1).pptx
ChiragSuresh
 
Student repository System.pptx
ChiragSuresh
 
UNIT-2.pptx
ChiragSuresh
 
Unit1_Part2-Machine_Instructions_Programs_7_9_2018_3pm.ppt
ChiragSuresh
 
Ad

Recently uploaded (20)

PPTX
Adjective..pptxujjjjjjjjjjjjjjjjjjjjjjjj
seemanodiyal
 
PPTX
Visit Biogas Refresher Slide_Jun 2025.pptx
isyraffemir
 
PPTX
一比一原版(HM毕业证书)慕尼黑应用技术大学毕业证如何办理
Taqyea
 
PDF
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
PDF
The Role of Logos as Identity Shapers (IFIC Logo)
Md. Mehedi Hasan Asif
 
PDF
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
PDF
Presentation of design made by power point
habibikuw002
 
PDF
WEEK3-Literary-Gennnnnnnnnnnnnnnnnres.pdf
MaybelynVergara
 
PPTX
Light weight Concrete-CONCRETE TECHNOLOGY.
mayurbhandari2123
 
PDF
tdtr.pdfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
JuanCParedes
 
PDF
SS27 Men's Fashion Trend Book Peclers Paris
Peclers Paris
 
PPTX
sistem teknologi yang di desain untuk mahasiswa dan dosen agar memudahkan mer...
gamesonlya2rj
 
DOCX
Ai vehicle traffic signal detector research proposal.docx
DavidNameza
 
PPTX
HIGH DENSITY CONCRETE-Concrete Technology
mayurbhandari2123
 
PPTX
sCREW cONVEYOR AUGER DAF SLUDGE SYSTEM TO
viksurs
 
PPTX
TAMBO CANTA CALLAO C3 INFOGRAFIA - 05.07.pptx
milleracosta1
 
PPTX
condylar pptx.in relation to dental seurgery
abishekgowtham586
 
PDF
Case Study on good and bad acoustics in auditorium
Disha Agrawal
 
PDF
Empowering Artisans Through Technology Karmakar App Concept
yellowslice2
 
PPTX
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
Adjective..pptxujjjjjjjjjjjjjjjjjjjjjjjj
seemanodiyal
 
Visit Biogas Refresher Slide_Jun 2025.pptx
isyraffemir
 
一比一原版(HM毕业证书)慕尼黑应用技术大学毕业证如何办理
Taqyea
 
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
The Role of Logos as Identity Shapers (IFIC Logo)
Md. Mehedi Hasan Asif
 
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
Presentation of design made by power point
habibikuw002
 
WEEK3-Literary-Gennnnnnnnnnnnnnnnnres.pdf
MaybelynVergara
 
Light weight Concrete-CONCRETE TECHNOLOGY.
mayurbhandari2123
 
tdtr.pdfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
JuanCParedes
 
SS27 Men's Fashion Trend Book Peclers Paris
Peclers Paris
 
sistem teknologi yang di desain untuk mahasiswa dan dosen agar memudahkan mer...
gamesonlya2rj
 
Ai vehicle traffic signal detector research proposal.docx
DavidNameza
 
HIGH DENSITY CONCRETE-Concrete Technology
mayurbhandari2123
 
sCREW cONVEYOR AUGER DAF SLUDGE SYSTEM TO
viksurs
 
TAMBO CANTA CALLAO C3 INFOGRAFIA - 05.07.pptx
milleracosta1
 
condylar pptx.in relation to dental seurgery
abishekgowtham586
 
Case Study on good and bad acoustics in auditorium
Disha Agrawal
 
Empowering Artisans Through Technology Karmakar App Concept
yellowslice2
 
CompanyReviewTypeOfPowerpointThatIsColor
plukleomarigpuara
 
Ad

Unit-1 OOMD- Inthhro- class modeling.ppt

  • 1. Faculty Instructor: Dr. kavitha sooda Associate Professor Dept. of CSE B.M.S. College of engineering, Bengaluru TB: Object oriented modelling and design with UML, 2nd Edition, Michael blaha, james Rumbaugh ©- PPT Object-Oriented Modeling and Design CourseCode: 20cs6pcomd
  • 2. Course Content Units Content 1- C1,2,3 Introduction, Modeling Concepts, Class Modeling 2 – C4,5 Advanced Class Modeling, State Modeling 3 – C6,7,8 Advanced State Modeling, Interaction Modeling: Advanced State Modeling 4 – C10-13 Process Overview, System Conception, Domain Analysis, Application Analysis: Process Overview 5 - C14,15,17 System Design, Class Design, Implementation Modeling Unit-1 2
  • 3. Course Outcomes CO Course outcomes CO1 Ability to apply the knowledge of class, State & Interaction Modelling using Unified Modeling Language to solve a given problem. CO2 Ability to analyze a System for a given requirement using Unified Modeling language CO3 Ability to design a given system using high level strategy. CO4 Ability to conduct practical experiment to solve a given problem using Unified Modeling language. Unit-1 3
  • 4. Is Software Engineering the right term? If Engineering then it has to be constructed like Civil engineering, Electrical or Mechanical Engineering Unit-1 4
  • 5. What is Software Development & Engineering?  Software development is art of problem solving- Just 100 years old  Software Engineering is an innovative process Unit-1 5
  • 7. Why projects Fail? - Complexity  Changes from requirements  Changes from Technology  Changes from People  Why Project fails? Unit-1 7
  • 8. Software Development life cycle Unit-1 8
  • 9. Software Development- Software Construction  OOAD aids in  Structural analysis, Modeling, Design and Implementation  Adherence to Good Practices.  UML Unit-1 9
  • 10. End of Class Next Class, Introduction, 4 Aspects of OO approach, OO Development, Methodology, Themes Unit-1 10
  • 11. Content  Introduction  Four Aspects of OO Approach  OO Development  OO Themes Unit-1 11
  • 12. Introduction  Intention of OOMD is to learn how to apply object - oriented concepts to all the stages of the software development life cycle.  Object-oriented modelling and design is a way of thinking about problems using models organized around real world concepts.  The fundamental construct is the object, which combines both data structure and behaviour. Unit-1 12
  • 13. Four Aspects of OO Approach  OO means that we organize software as a collection of discrete objects. There are four aspects required by an OO approach  Identity.  Classification.  Inheritance.  Polymorphism. Unit-1 13
  • 14. Identity:  Identity means that data is quantized into discrete, distinguishable entities called objects.  E.g. Personal computer, bicycle, queen in chess.  Objects can be concrete or conceptual. Each object has its own inherent identity. Classification:  Classification means that objects with the same data structure and behaviour are grouped into a class.  E.g. paragraph, monitor, chess piece.  Each object is said to be an instance of its class. Unit-1 14
  • 16. Inheritance:  It is the sharing of attributes and operations among classes based on a hierarchical relationship. A super class has general information that sub classes refine and elaborate.  E.g. Regular Customer and Privileged customer are the subclasses of Customer. Polymorphism:  Polymorphism means that the same operation may behave differently for different classes.  For E.g. move operation behaves differently for a pawn than for the queen in a chess game.  An operation is a procedure/transformation that an object performs or is subjected to. An implementation of an operation by a specific class is called a method. Unit-1 16
  • 18.  Development refers to the software life cycle: Analysis, Design and Implementation.  The essence of OO Development is the identification and organization of application concepts.  OO development is fundamentally a way of thinking and not a programming technique Unit-1 18
  • 19. OO Methodology  The process consists of building a model of an application and then adding details to it during design.  The methodology has the following 5 stages:  System conception: Software development begins with business analysis or users conceiving an application and formulating tentative requirements.  Analysis: The analyst scrutinizes and rigorously restates the requirements from the system conception by constructing models. Unit-1 19
  • 20.  The analysis model is a concise, precise abstraction of what the desired system must do, not how it will be done. The analysis model has two parts:  Domain Model- a description of real world objects reflected within the system.  Application Model- a description of parts of the application system itself that are visible to the user. E.g. In case of stock broker application-  Domain objects may include- stock, bond, trade & commission.  Application objects might control the execution of trades and present the results. Unit-1 20
  • 21.  System Design: The development teams devise a high- level strategy- The System Architecture- for solving the application problem.  The system designer should decide what performance characteristics to optimize, chose a strategy of attacking the problem, and make tentative resource allocations.  Class Design: The class designer adds details to the analysis model in accordance with the system design strategy.  Implementation: Implementers translate the classes and relationships developed during class design into a particular programming language, database or hardware. Unit-1 21
  • 22. Three models  Class Model—for the objects in the system & their relationships.  It describes the static structure of the objects in the system and their relationships.  Class model contains class diagrams- a graph whose nodes are classes and arcs are relationships among the classes.  State model— for the life history of objects.  It describes the aspects of an object that change over time.  It specifies and implements control with state diagrams-a graph whose nodes are states and whose arcs are transition between states caused by events. Unit-1 22
  • 23.  Interaction Model— for the interaction among objects.  It describes how the objects in the system co-operate to achieve broader results.  This model starts with use cases that are then elaborated with sequence and activity diagrams.  Use case – focuses on functionality of a system – i.e what a system does for users.  Sequence diagrams – shows the object that interact and the time sequence of their interactions.  Activity diagrams – elaborates important processing steps. Unit-1 23
  • 24. OO THEMES - 6  Abstraction  Abstraction lets you focus on essential aspects of an application while ignoring details i.e focusing on what an object is and does, before deciding how to implement it.  It’s the most important skill required for OO development.  Encapsulation (information hiding)  It separates the external aspects of an object from the internal implementation details.  Encapsulation prevents portions of a program from becoming so interdependent that a small change has massive ripple effects. Unit-1 24
  • 25.  Combining data and behavior  Caller of an operation need not consider how many implementations exist.  In OO system the data structure hierarchy matches the operation inheritance hierarchy . Unit-1 25
  • 26.  Sharing  OO techniques provide sharing at different levels.  Inheritance of both data structure and behavior lets sub classes share common code.  OO offers the prospect of reusing designs and code on future projects.  Emphasis on the essence of an object  OO development places a greater emphasis on data structure and a lesser emphasis on procedure structure than functional-decomposition methodologies.  Synergy  Identity, classification, polymorphism and inheritance characterize OO languages.  Each of these concepts can be used in isolation, but together they complement each other synergistically. Unit-1 26
  • 29.  Purpose of Modeling  Abstraction  Three models Unit-1 29
  • 30.  A model is an abstraction of something for the purpose of understanding it before building it.  MODELLING  Designers build many kinds of models for various purposes before constructing things.  Models serve several purposes –  Testing a physical entity before building it: Medieval built scale models of Gothic Cathedrals to test the forces on the structures. Engineers test scale models of airplanes, cars and boats to improve their dynamics. Unit-1 30
  • 31.  Communication with customers: Architects and product designers build models to show their customers.  mock-ups are demonstration products that imitate some of the external behaviour of a system.  Visualization: Storyboards of movies, TV shows and advertisements let writers see how their ideas flow.  Artists sketches let them block out their ideas and make changes before committing them to soil or stone.  Reduction of complexity: Models reduce complexity to understand directly by separating out a small number of important things to do with at a time. Unit-1 31
  • 32.  Abstraction is the selective examination of certain aspects of a problem.  The goal of abstraction is to isolate those aspects that are important for some purpose and suppress those aspects that are unimportant.  All abstractions are incomplete and inaccurate.  A good model captures the crucial aspects of a problem and omits others. Unit-1 32
  • 33.  Class Model: represents the static, structural, “data” aspects of a system.  It describes the structure of objects in a system- their identity, their relationships to other objects, their attributes, and their operations.  Goal in constructing class model is to capture those concepts from the real world that are important to an application.  Class diagrams express the class model. Unit-1 33
  • 34.  State Model: represents the temporal, behavioural, “control” aspects of a system.  State model describes those aspects of objects concerned with time and the sequencing of operations –  Events that mark changes, states that define the context for events, and the organization of events and states.  State diagram express the state model.  Each state diagram shows the state and event sequences permitted in a system for one class of objects.  State diagram refer to the other models. Unit-1 34
  • 35.  Interaction model – represents the collaboration of individual objects, the “interaction” aspects of a system.  Interaction model describes interactions between objects – how individual objects collaborate to achieve the behaviour of the system as a whole.  Use cases-document interaction between system and actor.  Sequence diagrams-objects that interact and time sequence.  Activity diagrams –flow of control . Unit-1 35
  • 36.  Relationship Among the Models  The class model describes data structure on which the state and interaction models operate.  The operations in the class model correspond to events and actions.  The state model describes the control structure of objects.  The interaction model focuses on the exchanges between objects.  The goal is to simplify the system description without loading down the model with so many constructs that it becomes a burden and not help. Unit-1 36
  • 37. Next Chapter : Class Modeling
  • 39.  A class model captures the static structure of a system by characterizing the objects in the system, the relationships between the objects, and the attributes and operations for each class of objects.  Object- generally Proper noun  Purpose of class modeling is to describe objects.  An object is a concept, abstraction or thing with identity that has meaning for an application.  Ex: Joe Smith, Infosys Company, process number 7648 and top window are objects. Unit-1 39
  • 40.  Some objects are real-world entities, conceptual etc.,  The choice of object depends on judgment and the nature of a problem.  All objects have identity and are distinguishable.  The term identity means that the objects are distinguished by their inherent existence and not by descriptive properties that they may have.  Example : Two apples with the same color, shape and texture are still individuals.  Identical twins are two distinct persons even though they look the same Unit-1 40
  • 41.  Class – Common Noun  An object is an instance or occurrence of a class.  A class describes a group of objects with the same properties (attributes), behaviour(operations), kinds of relationships and semantics. Ex: Person, company, process and window are classes.  Objects in a class have the same attributes and forms of behavior.  The objects in a class share a common semantic purpose. Unit-1 41
  • 42.  A barn and horse may have cost and age .  If considered as financial assets they both could belong to same class.  If developer takes into consideration that a person paints a barn and feeds a horse, they would be modeled as distinct classes.  The interpretation of semantics depends on the purpose of each application and is a matter of judgment Unit-1 42
  • 43.  Class Diagrams  Class diagrams provide a graphic notation for modeling classes and their relationships, thereby describing possible objects.  Class diagrams are useful both for abstract modeling and for designing actual programs.  A class diagram corresponds to infinite set of object diagrams.  An object diagram shows individual objects and their relationships.  Useful for documenting test cases and discussing examples. Unit-1 43
  • 44. Conventions used (UML):  UML symbol for both classes and objects is box.  Objects are modelled using box with object name followed by colon followed by class name.  Use boldface to list class name, centre the name in the box and capitalize the first letter. Use singular nouns for names of classes.  To run together multiword names (such as JoeSmith), separate the words with intervening capital letter. Unit-1 44
  • 45.  Values and Attributes  Value is a piece of data.  Attribute is a named property of a class that describes a value held by each object of the class.  Object is to class as value is to attribute. E.g. Attributes: Name, bdate, weight. Values: JoeSmith, 21 October 1983, 64  Color, model year and weight are attributes of Car objects.  Each attribute has a value for each object.  Different objects may have the same or different values for a given attribute.  Each attribute name is unique within a class. Unit-1 45
  • 46. Conventions used (UML): • List attributes in the 2nd compartment of the class box. Optional details (like default value) may follow each attribute. • A colon precedes the type, an equal sign precedes default value. • Show attribute name in regular face, left align the name in the box and use small case for the first letter. •Similarly we may also include attribute values in the 2nd compartment of object boxes with same conventions. Unit-1 46
  • 47.  Operations and Methods  An operation is a function or procedure that maybe applied to or by objects in a class.  E.g. Hire, fire and pay dividend are operations on class Company.  Object identifiers not to be listed in the class, they are implicit in models  Open,close,hide and redisplay are operations on class Window.  Do not list object identifiers; they are implicit in models. Unit-1 47
  • 48.  Same operation may apply to many different classes. Such an operation is polymorphic.  A method is the implementation of an operation for a class.  E.g. In class file, print is an operation you could implement different methods to print ASCII files, print binary files, print digitized picture files.  When an operation has methods on several classes, it is important that the methods all have the same signature.  Ex: print should not have filename as an argument for one method and filepointer as an argument for the other method. Unit-1 48
  • 49.  Feature is a generic word for either an attribute or operations.  UML conventions used –  List operations in 3rd compartment of class box.  List operation name in regular face, left align and use lower case for first letter.  Optional details like argument list and return type may follow each operation name.  Parenthesis enclose an argument list, commas separate the arguments. A colon precedes the result type.  Directions: in, out, inout (To modify) Unit-1 49
  • 50.  Summary of Notation for classes Unit-1 50
  • 51.  A link is a physical or conceptual connection among objects.  E.g. JoeSmith Works For Simplex Company.  Mathematically, we define a link as a tuple – that is, a list of objects.  A link is an instance of an association generally appears as Verb.  An association is a description of a group of links with common structure and common semantics.  E.g. a person Works For a company.  An association describes a set of potential links in the same way that a class describes a set of potential objects. Unit-1 51
  • 53.  Conventions used (UML):  Link is a line between objects; a line may consist of several line segments.  If the link has the name, it is underlined.  Association connects related classes and is also denoted by a line.  Show link and association names in italics.  Association name is optional, if the model is unambiguous. Ambiguity arises when a model has multiple associations among same classes.  Associations are inherently bidirectional. For Example: WorksFor connects a person to a company. Employs connects a company to a person Unit-1 53
  • 54.  Developers often implement associations in programming languages as references from one object to another.  A reference is an attribute in one object that refers to another object. For Example: a data structure for Person might contain an attribute employer that refers to a Company object, and a Company object might contain an attribute employees that refers to a set of Person objects. Unit-1 54
  • 55.  Multiplicity  Multiplicity specifies the number of instances of one class that may relate to a single instance of an associated class.  Multiplicity constrains the number of related objects.  UML conventions:  UML diagrams explicitly lists multiplicity at the ends of association lines.  UML specifies multiplicity with an interval, such as ◦ “1” (exactly one). ◦ “1..”(one or more). ◦ “3..5”(three to five, inclusive). ◦ “ * ” ( many, i.e zero or more). Unit-1 55
  • 57.  Zero-to-One Multiplicity  Workstation may have one of its windows designated as the console to receive general error messages. Unit-1 57
  • 59.  One can use the symbol “arrow( )” to make the direction of the name clear. Unit-1 59
  • 60.  Association end names  Multiplicity implicitly refers to the ends of associations. For E.g. A one-to-many association has two ends – ◦ an end with a multiplicity of “one” ◦ an end with a multiplicity of “many”  You can not only assign a multiplicity to an association end, but you can give it a name as well. Unit-1 60
  • 61.  A person is an employee with respect to company.  A company is an employer with respect to a person.  Association end names are optional.  Association end names are necessary for associations between two objects of the same class. They can also distinguish multiple associations between a pair of classes. Unit-1 61
  • 62.  Association end names are necessary for associations between two objects of the same class.  Container and contents distinguish the two usages of Directory in the self-association.  Each directory has exactly one user who is an owner and many users who are authorized to use the directory. Unit-1 62
  • 63.  Association end names unify multiple references to the same class.  When constructing class diagrams you should properly use association end names and not introduce a separate class for each reference as below fig shows. Unit-1 63
  • 64.  Objects on “many” association end have no explicit order and can be considered as a set but sometimes objects have an explicit order  Ordering is an inherent part of association. You can indicate an ordered set of objects by writing “{ordered}” next to the appropriate association end.  Workstation screen containing a number of overlapping windows.  Each window on a screen occurs at most once and have an explicit order that is only the topmost window is visible at any point on the screen  Ordering sometimes occurs for “many” multiplicity. Unit-1 64
  • 65.  Bags and Sequences  Normally, a binary association has at most one link for a pair of objects.  Multiple links for a pair of objects is permitted by annotating an association end with {bag} or {sequence}  A bag is a collection of elements with duplicates allowed.  A sequence is an ordered collection of elements with duplicates allowed.  Itinerary is a sequence of airports and the same airport can be visited more than once, so you should use {sequence} and not {ordered}.  {ordered} and {sequence} annotations are same, except that the first disallows duplicates and the other allows them. Unit-1 65
  • 66.  Association Classes- Adverbs  An association class is an association that is also a class.  Like the links of an association, the instances of an association class derive identity from instances of the constituent classes.  Like a class, an association class can have attributes and operations and participate in associations.  accessPermission is an attribute of AccessibleBy.  UML notation for association class is a box attached to the association by a dashed line. Unit-1 66
  • 67.  Important in many-to-many associations.  Attributes for association class unmistakably belong to the link and cannot be ascribed to either object.  accessPermission is a joint property of File and user cannot be attached to either file or user alone without losing information. Unit-1 67
  • 68.  Figure shows attributes for two one-to-many relationships.  Each person working for a company receives a salary and has job title.  The boss evaluates the performance of each worker. Attributes may also occur for one-to-one associations. Unit-1 68
  • 69. • Figure shows how it’s possible to fold attributes for one-to-one and one-to-many associations into the class opposite a “one” end. Unit-1 69
  • 70.  An association class participating in an association.  Users may be authorized on many workstations. Each authorization carries a priority and access privileges.  A user has a home directory for each authorized workstation, but several workstations and user can share the same home directory. Unit-1 70
  • 71.  The association class has only one occurrence for each pairing of Person and Company.  In contrast there can be any number of occurrences of a Purchase for each Person and Company. Each purchase is distinct and has its own quantity, date and cost. Unit-1 71
  • 72.  Qualified Associations  A Qualified Association is an association in which an attribute called the qualifier disambiguates the objects for a “many” association ends.  It is possible to define qualifiers for one-to-many and many-to-many associations.  A qualifier selects among the target objects, reducing the effective multiplicity from “many” to “one”. Unit-1 72
  • 73.  A bank services multiple accounts. An account belongs to single bank.  Within the context of a bank, the Account Number specifies a unique account. Bank and account are classes, and Account Number is a qualifier.  Qualification reduces effective multiplicity of this association from one-to-many to one-to-one.  qualification increases the precision of a model. Unit-1 73
  • 74.  The notation of a qualifier is a small box on the end of the association line near the source class.  The qualifier box may grow out of any side(top, bottom , left , right) of the source class.  The source class plus the qualifier yields the target class.  Bank+accountNumber yields an Account, therefore accountNumber is listed in a box contiguous to Bank. Unit-1 74
  • 75.  A stock exchange lists many companies. However, it lists only one company with a given ticker symbol.  A company maybe listed on many stock exchanges, possibly under different symbols. Unit-1 75
  • 76. Next Class : Generalization, Example, OCL Unit-1 76
  • 77.  Generalization is the relationship between a class (the super class) and one or more variations of the class (the subclasses).  Generalization (is-a) organizes classes by their similarities and differences, structuring the description of objects.  The super class holds common attributes, operations and associations; the subclasses add specific attributes, operations and associations.  Each subclass is said to inherit the features of its superclass. Unit-1 77
  • 79.  Generalization is transitive across an arbitrary number of levels.  The term ancestor and descendent refers to generalization of classes across multiple levels.  An instance of a subclass is simultaneously an instance of all its ancestor classes.  An instance includes a value for every attribute of every ancestor class.  An instance can invoke any operation on any ancestor class. Each subclass not only inherits all the features of its ancestors but adds its own specific features as well.  Ex: Pump adds attributes suctionPressure , dischargePressure and flowrate which other kinds of equipment do not share. Unit-1 79
  • 81.  ‘move’, ‘select’, ‘rotate’, and ‘display’ are operations that all subclasses inherit.  ‘scale’ applies to one-dimensional and two-dimensional figures.  ‘fill’ applies only to two-dimensional figures.  A generalization set name is an enumerated attribute that indicates which aspect of an object is being abstracted by a particular generalization.  The word written next to the generalization line diagram-dimensionality-is a generalization set name. Unit-1 81
  • 82.  There can be multiple levels of generalization.  Each object inherits features from one class at each level of generalization.  UML convention used:  Use large hollow arrowhead to denote generalization. The arrowhead points to superclass. Unit-1 82
  • 83.  Use of generalization – 3 purposes  To support polymorphism: You can call an operation at the super class level, and the OO language complier automatically resolves the call to the method that matches the calling object’s class.  To structure the description of objects: i.e. to form a taxonomy and organizing objects on the basis of their similarities and differences.  To enable reuse of code: Inherit code from the previous application as well as from previous work. Reuse is more productive than repeatedly writing code from scratch. Unit-1 83
  • 84.  The terms generalization, specialization and inheritance all refer to aspects of the same idea.  Generalization derives from the fact that the super class generalizes the subclasses.  Specialization refers to the fact that the sub class refine or specialize the super classes.  Inheritance is the mechanism for sharing attributes, operations, and associations via the generalization/specialization relationship. Unit-1 84
  • 85.  Overriding features  A subclass may override a super class feature by defining a feature with the same name. The overriding feature (subclass feature) refines and replaces the overridden feature (super class feature).  Why override feature?  To specify behavior that depends on subclass.  To tighten the specification of a feature.  To improve performance.  In the example:”Figure” each leaf subclasses had overridden ‘display’ feature.  You may override methods and default values of attributes. You should never override the signature, or form of a feature. Unit-1 85
  • 86. 3. 4 A Sample Class model Unit-1 86
  • 89.  Expressing the behavior of navigating among classes.  Navigation is important because it lets you exercise a model and uncover hidden flaws and omissions so that you can repair them.  Example:  An institution may issue many credit card accounts, each identified by an account number. Each account has a maximum credit limit, a current balance, and a mailing address. The account serves one or more customers who reside at the mailing address. The institution periodically issues a statement for each account. The statement lists a payment due date, finance charge, and minimum payment. Unit-1 89
  • 90.  What transactions occurred for a credit card account within a time interval?  What volume of transactions were handled by an institution in the last year?  What customers patronized a merchant in the last year by any kind of credit card?  How many credit card accounts does a customer currently have?  What is the total maximum credit for a customer, for all accounts? Unit-1 90
  • 92.  Attributes. The syntax is the source object, followed by a dot, and then the attribute name.  For example, the expression aCreditCardAccount.maximumCredit takes a CreditCardAccount object and finds the value of maximumCredit.  Operations. An operation must be followed by parentheses, even if it has no arguments  Simple associations. The target end may be indicated by an association end name or, where there is no ambiguity, a class name. In the example, aCustomer.MailingAddress yields a set of addresses for a customer. Unit-1 92
  • 93.  Qualified associations. A qualifier lets you make a more precise traversal. The expression aCreditCardAccount.Statement[30 November 1999] finds the statement for a credit card account with the statement date of 30 November 1999.  Association classes. Given a link of an association class, you can find the constituent objects. Alternatively, given a constituent object, you can find the multiple links of an association class.  Generalizations. Traversal of a generalization hierarchy is implicit for the OCL notation.  Filters. There is often a need to filter the objects in a set. The OCL has several kinds of filters, the most common of which is the select operation. Unit-1 93
  • 95.  What transactions occurred for a credit card account within a time interval? aCreditCardAccount.Statement.Transaction-> select(aStartDate <= transactionDate and transactionDate <= anEndDate)  What volume of transactions were handled by an institution in the last year? anInstitution.CreditCardAccount.Statement.Transaction- > select(aStartDate <= transactionDate and transactionDate <= anEndDate).amount->sum()  What is the total maximum credit for a customer, for all accounts? aCustomer.MailingAddress.CreditCardAccount. maximumCredit->sum() Unit-1 95
  • 96. End of Unit- 1 Next Class – Advanced Class Modeling, Chapter 4