SlideShare a Scribd company logo
1 of 50
Chapter 3
Class Modeling
Computer Department SPIT, Piludara
CONTENTS:
1. Object and Class Concepts.
2. Link and Association Concepts
3. Generalization and Inheritance
Class Modeling
Computer Department SPIT, Piludara
Object:
•It is a concept, abstraction, or a thing with identity
that has meaning for an application .
•Each have identity and are distinguishable.
•Two apples with the same color, shape, and
texture are still individual apples; a person can eat
one and then eat the other.
•Similarly, identical twins are two distinct persons,
even though they may look the same.
1. Object and Class Concepts:
Computer Department SPIT, Piludara
Class:
•Describes a group of objects with the same
properties( attributes), behavior (operations), kinds
of relationship, and Semantics. (Eg: Person,
company, Process and Window )
•Each person has name and birthdate and may work
at a job.
•Objects in a class have the same attributes and
forms of behavior.
Classes
Computer Department SPIT, Piludara
Class Diagram:
• Provide a Graphical notation for modeling classes and their
relationships, thereby describing possible objects as shown
in figure 1.
Object Diagram:
• Shows individual Objects and their relationships.
Class Diagrams
Computer Department SPIT, Piludara
• Class diagrams are useful both for abstract modeling and for
designing actual programs.
• A class diagram corresponds to an infinite set of object
diagrams.
• Object diagrams are helpful for documenting test cases and
discussing examples.
• In fig. the UML symbol for an object is a box with an object
name followed by a colon and the class name.
• The object name and class name are both underline.
Class Diagrams
Computer Department SPIT, Piludara
Values and Attributes
Computer Department SPIT, Piludara
Operations:
•It is a function or procedure that may be applied to or
by objects in a class as shown in figure.
•Hire, fire, and payDividend are operations on class
Company.
•Open, close, hide and redisplay are operations on
class Window.
•All objects in a class share the same operations.
Operations and Methods
Computer Department SPIT, Piludara
Polymorphic
• Same operation applied to many different class.
• That is the same operations takes on different forms in different
classes
Methods:
• It is a implementation of an operation for a class.
• For example, the class File may have an operation print.
• To implement different methods to print ASCII files, print binary
files and print digitized picture files.
• All these methods logically perform the same task- printing a
file.
Operations and Methods
Computer Department SPIT, Piludara
Signature:
• it is important that the methods all have the same signature –
the number and types of arguments and the type of result
value.
• For example, print should not have filename as argument for
one method and file pointer as argument for another.
Feature:
• Generic word for either an attribute or operation.
Operations and Methods
Computer Department SPIT, Piludara
Operations and Methods
Computer Department SPIT, Piludara
Summary of Notation for Classes
Computer Department SPIT, Piludara
•The compartments in the box contain, from top to bottom: class
name, list of attributes, and list of operations.
•Optional details are type, default values, argument list and result
type may follow each operation name.
direction argumentName : type = defaultValue
• Each argument may have a direction, name, type, and
default value.
• The direction indicates whether an argument is an input (in),
output (out), or an input argument that can be modified
(inout).
• A colon precedes the type. An equal sign precedes the
default value.
• The default value is used if no argument is supplied for the
argument.
Summary of Notation for Classes
Computer Department SPIT, Piludara
Link:
•It is a physical / conceptual connection among objects.
•For example, Joe Smith Works For Simplex company.
•Most links relate two objects, but some links relate three or
more object.
Association:
•It is a description of a group of links with common structure
and common semantics.
•For example, a person WorksFor a company .
•The links of an association connect objects from the same
classes.
•An association describes a set of potential links in the same
way that a class describes a set of potential objects.
Link and Associations
Computer Department SPIT, Piludara
2. Link and Association Concepts:
Computer Department SPIT, Piludara
•The UML notation for a link is a line between objects.
•An association connects related classes and is also denoted
by a line. For example, persons own stock in companies.
•In fig. show link and association names in italics and to
confine line segments to a rectilinear grid.
•The association name is optional, if the model is
unambiguous.
•Ambiguity arises when a model has multiple associations
among the same classes (person works for company and
person owns stock in company).
•When there are multiple associations, use association names
or association end names to resolve the ambiguity.
Link and Associations
Computer Department SPIT, Piludara
•Associations are inherently bidirectional.
•The name of the binary association usually reads in a
particular direction, but the binary association can be
traversed in either direction.
•For example, WorksFor connects a person to a company.
The inverse of WorksFor could be called employee, and it
connects a company to a person.
•Both directions of traversal are equally meaningful and refer
to the same underlying association.
Link and Associations
Computer Department SPIT, Piludara
Reference:
•It 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.
•A link is a relationship among objetcs.
Link and Associations
Computer Department SPIT, Piludara
Multiplicity:
• Specifies the number of instances of one class that may relate
to single instance of other class.
• Multiplicity constrains the number of related objects.
•UML specifies: “1”: exactly one,“1 ..*” (one or more),
“3..5” (three to five inclusive)
• The special symbol “*” is a shorthand notation that denotes
“many” (zero or more).
• In fig. shows a one-to-one association and some
corresponding links. Each country has one capital city.
• A capital city administers one country.
Multiplicity
Computer Department SPIT, Piludara
Multiplicity
Computer Department SPIT, Piludara
Multiplicity
Computer Department SPIT, Piludara
• In fig. show a Workstation may have one of its windows
designated as the console to receive general error messages.
(The word “console” on the diagrams is an association end
name)
• Multiplicity is a constraint on the size of a collection and
Cardinality is the count of elements that are actually in a
collection.
• Therefore, multiplicity is a constraint on the cardinality.
• A multiplicity of “many” specifies that an object may be
associated with multiple objects.
Multiplicity
Computer Department SPIT, Piludara
Multiplicity
Computer Department SPIT, Piludara
Association End names:
• Association End names is an important concept in UML.
• Association ends can not only be assigned multiplicity they can
also be named. In a problem description they are generally
identified by nouns
• For example, a one-to-many association has two ends – an
end with a multiplicity of “one” and an end with a multiplicity of
“many”.
• In fig. shows, a name appears next to the association end.
In fig. Person and Company participate in association
WorksFor . A person is an employee with respect to a
company, a company is an employer with respect to a person.
Association End Names
Computer Department SPIT, Piludara
• Use of Association End names is optional, but it is often
easier and less confusing to assign association end name
instead of , or in addition to, association names.
Association end:
• Can give names to the association link.
Use of associations end name:
• to name links b/w object of same class.
Association End Names
Computer Department SPIT, Piludara
Association End Names
Computer Department SPIT, Piludara
• Association End names are necessary for associations two
objects of the same class.
• For example, in fig.11 container and contents distinguish the
two usages of Directory in the self-association.
• Association End names can also distinguish multiple
associations between the same pair of classes.
• In fig. 11 each Directory has exactly one user who is an
owner and many users who are authorized to use the
directory.
• When there is only a single association between a pair of
distinct classes.
Association End Names
Computer Department SPIT, Piludara
Association End Names
Computer Department SPIT, Piludara
• In fig. shows, in the wrong model, two instances represent a
person with a child, one for the child and one for the parent.
• In the correct model, one person instance participates in two
or more links, twice as a parent and zero or more times as a
child.
• In the correct model, we must show a child as having an
optional parent, so that the recursion eventually terminates.
• No association end name should be the same as an attribute
name of the source class.
Association End Names
Computer Department SPIT, Piludara
Association End Names
Computer Department SPIT, Piludara
Ordering
Computer Department SPIT, Piludara
Bag:
• It is a collection of elements with duplicates allowed.
Sequence:
• Ordered collection of elements with duplicate allowed.
• For example, An itinerary is a sequence of airports and the
same airport can be visited more than once.
• Sequence is ordered bag both allow duplicates, {ordered}
and {sequence} is same only difference is sequence allows
duplicates as shown in figure 14.
Bags and Sequences
Computer Department SPIT, Piludara
Bags and Sequences
Computer Department SPIT, Piludara
• It 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.
• You can find association classes by looking for adverbs in a
problem statement or by abstracting values.
• In fig.15, AccessPermission is an attribute of AccessibleBy.
• The sample data at the bottom of the fig. shows the value for
each link. The UML notation for an association class is a box
(a class box) attached to the association by a dashed line.
Association Classes
Computer Department SPIT, Piludara
Association Classes
Computer Department SPIT, Piludara
• Many-to-many associations provide a compelling rationale for
association classes.
• In fig.15, AccessPermission is a joint property of File and
User and cannot be attached to either File or User alone
without losing information.
• In fig.16 presents attributes for two one-to-many associations
• Each person working for a company receives a salary and
has a job title.
• The boss evaluates the performance of each worker.
• Attributes may also occur for one-to-one associations.
Association Classes
Computer Department SPIT, Piludara
Association Classes
Computer Department SPIT, Piludara
Association Classes
Computer Department SPIT, Piludara
• In fig.17 shows how it is possible to fold attributes for one-to-
one and one-to-many associations into the class opposite a
“one” end. This is not possible for many-to-many associations.
• In fig. 18 shows 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 users can share the same home
directory.
Association Classes
Computer Department SPIT, Piludara
Association Classes
Computer Department SPIT, Piludara
• In fig.19 shows the difference. The association class has only
one occurrence for each pairing of Person and Company.
• In ordinary class there can be any number of occurrence of a
Purchase for each Person and Company.
• Each Purchase is distinct and has its own quantity, date and
cost.
Association Classes
Computer Department SPIT, Piludara
Association Classes
Computer Department SPIT, Piludara
• An association in which an attribute called the qualifier
disambiguates the objects for a “many” association end.
• Job of qualifier is to reduce the many association to one. Can
only work for m-m and 1-m.
• Also facilitates traversal of class models
• Stock exchange gives special unique symbol to each
company
• Using qualified association we can make traversal easy.
• Ref Figure 20,21.
Qualified Association
Computer Department SPIT, Piludara
• In fig.20 show the most common use of a qualifier – for
association with one-to-many multiplicity.
• A bank services multiple accounts. An account belongs to a
single bank. Within the context of a bank, the account
number specifies a unique account.
• Bank and Account are classes and AccountNumber is the
qualifier.
• Qualification reduces the effective multiplicity of this
association from one-to-many to one-to-one.
• Both models are acceptable, but the qualified model adds
information. The qualified model adds multiplicity conctraint,
that the combination of a bank and an account number yields
at most one account.
Qualified Association
Computer Department SPIT, Piludara
Qualified Association
Computer Department SPIT, Piludara
• In fig.23 show a stock exchange lists many companies.
• However, a stock exchange lists only one company with a
given ticker symbol.
• A company may be listed on many stock exchanges, possibly
under different symbols.(If every stock had a single ticker
symbol that was invariant )
Qualified Association
Computer Department SPIT, Piludara
Qualified Association
Computer Department SPIT, Piludara
• Generalization is the relationship between a class (the super
class) and one or more variations of the class (sub class)
• Super class holds the common attributes, operations and
associations. Subclass adds specific attributes, operations,
and associations.
• Each subclass inherits features of super class.
• Generalization is some times called the “is-a” relationship,
because each instance of a subclass is an instance of the
superclass as well.
• There can be multiple levels of generalizations.
Generalization and Inheritance
Computer Department SPIT, Piludara
• Generalization is the relationship between a class (the super
class) and one or more variations of the class (sub class)
• Serves three purposes
• Support for polymorphism. (call at super class level
automatically resolved)
• Second purpose is to structure the description of objects.( a
taxonomy is formed)
• Third purpose is to enable reuse of code.
• The terms generalization, specialization and inheritance all
refer to aspects of the same idea.
• Generalization: derives from the fact that the superclass
generalizes the subclasses.
Use of Generalization
Computer Department SPIT, Piludara
• Specialization: refers to the fact that the subclasses refine or
specialize the Superclass.
• Inheritance: is the mechanism for sharing attributes,
operations, and associations via generalization /
specialization relationship.
Overriding Features:
• A subclass may override a super class feature by defining a
feature with the same name.
• We can override methods and default values of attributes.
• Never override the signature, or form, of a feature.
Use of Generalization
Computer Department SPIT, Piludara

More Related Content

What's hot

Database , 4 Data Integration
Database , 4 Data IntegrationDatabase , 4 Data Integration
Database , 4 Data IntegrationAli Usman
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)Muhammad Hammad Waseem
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationBIT Durg
 
Cloud File System with GFS and HDFS
Cloud File System with GFS and HDFS  Cloud File System with GFS and HDFS
Cloud File System with GFS and HDFS Dr Neelesh Jain
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Prosanta Ghosh
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraintsmadhav bansal
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelNeil Neelesh
 
UML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionUML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionCherryBerry2
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in androidPrawesh Shrestha
 
Database approach
Database approachDatabase approach
Database approachuzmajamal
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database conceptsTemesgenthanks
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSAshita Agrawal
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity ConstraintsMegha yadav
 
Operator Overloading & Function Overloading
Operator Overloading & Function OverloadingOperator Overloading & Function Overloading
Operator Overloading & Function OverloadingMeghaj Mallick
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and modelssabah N
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 

What's hot (20)

Database , 4 Data Integration
Database , 4 Data IntegrationDatabase , 4 Data Integration
Database , 4 Data Integration
 
[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)[OOP - Lec 08] Encapsulation (Information Hiding)
[OOP - Lec 08] Encapsulation (Information Hiding)
 
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and AggregationDbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
 
Cloud File System with GFS and HDFS
Cloud File System with GFS and HDFS  Cloud File System with GFS and HDFS
Cloud File System with GFS and HDFS
 
Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013Dbms ii mca-ch5-ch6-relational algebra-2013
Dbms ii mca-ch5-ch6-relational algebra-2013
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Oodbms ch 20
Oodbms ch 20Oodbms ch 20
Oodbms ch 20
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
UML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussionUML Diagram @ Software engineering discussion
UML Diagram @ Software engineering discussion
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
Structure in C
Structure in CStructure in C
Structure in C
 
Files Vs DataBase
Files Vs DataBaseFiles Vs DataBase
Files Vs DataBase
 
Database approach
Database approachDatabase approach
Database approach
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMS
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Operator Overloading & Function Overloading
Operator Overloading & Function OverloadingOperator Overloading & Function Overloading
Operator Overloading & Function Overloading
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and models
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 

Similar to Chapter 3 Class Modeling

UML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.pptUML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.pptWorkDrive2
 
Advance database system(part 4)
Advance database system(part 4)Advance database system(part 4)
Advance database system(part 4)Abdullah Khosa
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
EntityrelationshipmodelEnes Bolfidan
 
Structural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docxStructural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docxsusanschei
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)MD Sulaiman
 
ER-MODEL WITH DBMS.pptx
ER-MODEL WITH DBMS.pptxER-MODEL WITH DBMS.pptx
ER-MODEL WITH DBMS.pptxKomal Komal
 
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxDATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxJasmineMichael1
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptxsandeep54552
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data ModelBishrul Haq
 
ICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfInfotech27
 

Similar to Chapter 3 Class Modeling (20)

Database design
Database designDatabase design
Database design
 
UML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.pptUML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.ppt
 
UML-class_diagram.ppt
UML-class_diagram.pptUML-class_diagram.ppt
UML-class_diagram.ppt
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 
Advance database system(part 4)
Advance database system(part 4)Advance database system(part 4)
Advance database system(part 4)
 
Erd
ErdErd
Erd
 
DISE - OOAD Using UML
DISE - OOAD Using UMLDISE - OOAD Using UML
DISE - OOAD Using UML
 
Entityrelationshipmodel
EntityrelationshipmodelEntityrelationshipmodel
Entityrelationshipmodel
 
Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
 
Structural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docxStructural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docx
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
80410172053.pdf
80410172053.pdf80410172053.pdf
80410172053.pdf
 
Database part3-
Database part3-Database part3-
Database part3-
 
ER-MODEL WITH DBMS.pptx
ER-MODEL WITH DBMS.pptxER-MODEL WITH DBMS.pptx
ER-MODEL WITH DBMS.pptx
 
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxDATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data Model
 
Data model
Data modelData model
Data model
 
ICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdfICT DBA3 09 0710 Model Data Objects.pdf
ICT DBA3 09 0710 Model Data Objects.pdf
 

More from anujabeatrice2

More from anujabeatrice2 (6)

Chapter 8 ooad
Chapter  8 ooadChapter  8 ooad
Chapter 8 ooad
 
Chapter 7 ooad
Chapter 7 ooadChapter 7 ooad
Chapter 7 ooad
 
Ooad ch 5
Ooad ch 5Ooad ch 5
Ooad ch 5
 
Ooad ch 2
Ooad ch 2Ooad ch 2
Ooad ch 2
 
Ooad ch 1_2
Ooad ch 1_2Ooad ch 1_2
Ooad ch 1_2
 
Ooad ch 6
Ooad ch 6Ooad ch 6
Ooad ch 6
 

Recently uploaded

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 

Recently uploaded (20)

Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 

Chapter 3 Class Modeling

  • 1. Chapter 3 Class Modeling Computer Department SPIT, Piludara
  • 2. CONTENTS: 1. Object and Class Concepts. 2. Link and Association Concepts 3. Generalization and Inheritance Class Modeling Computer Department SPIT, Piludara
  • 3. Object: •It is a concept, abstraction, or a thing with identity that has meaning for an application . •Each have identity and are distinguishable. •Two apples with the same color, shape, and texture are still individual apples; a person can eat one and then eat the other. •Similarly, identical twins are two distinct persons, even though they may look the same. 1. Object and Class Concepts: Computer Department SPIT, Piludara
  • 4. Class: •Describes a group of objects with the same properties( attributes), behavior (operations), kinds of relationship, and Semantics. (Eg: Person, company, Process and Window ) •Each person has name and birthdate and may work at a job. •Objects in a class have the same attributes and forms of behavior. Classes Computer Department SPIT, Piludara
  • 5. Class Diagram: • Provide a Graphical notation for modeling classes and their relationships, thereby describing possible objects as shown in figure 1. Object Diagram: • Shows individual Objects and their relationships. Class Diagrams Computer Department SPIT, Piludara
  • 6. • Class diagrams are useful both for abstract modeling and for designing actual programs. • A class diagram corresponds to an infinite set of object diagrams. • Object diagrams are helpful for documenting test cases and discussing examples. • In fig. the UML symbol for an object is a box with an object name followed by a colon and the class name. • The object name and class name are both underline. Class Diagrams Computer Department SPIT, Piludara
  • 7. Values and Attributes Computer Department SPIT, Piludara
  • 8. Operations: •It is a function or procedure that may be applied to or by objects in a class as shown in figure. •Hire, fire, and payDividend are operations on class Company. •Open, close, hide and redisplay are operations on class Window. •All objects in a class share the same operations. Operations and Methods Computer Department SPIT, Piludara
  • 9. Polymorphic • Same operation applied to many different class. • That is the same operations takes on different forms in different classes Methods: • It is a implementation of an operation for a class. • For example, the class File may have an operation print. • To implement different methods to print ASCII files, print binary files and print digitized picture files. • All these methods logically perform the same task- printing a file. Operations and Methods Computer Department SPIT, Piludara
  • 10. Signature: • it is important that the methods all have the same signature – the number and types of arguments and the type of result value. • For example, print should not have filename as argument for one method and file pointer as argument for another. Feature: • Generic word for either an attribute or operation. Operations and Methods Computer Department SPIT, Piludara
  • 11. Operations and Methods Computer Department SPIT, Piludara
  • 12. Summary of Notation for Classes Computer Department SPIT, Piludara •The compartments in the box contain, from top to bottom: class name, list of attributes, and list of operations. •Optional details are type, default values, argument list and result type may follow each operation name.
  • 13. direction argumentName : type = defaultValue • Each argument may have a direction, name, type, and default value. • The direction indicates whether an argument is an input (in), output (out), or an input argument that can be modified (inout). • A colon precedes the type. An equal sign precedes the default value. • The default value is used if no argument is supplied for the argument. Summary of Notation for Classes Computer Department SPIT, Piludara
  • 14. Link: •It is a physical / conceptual connection among objects. •For example, Joe Smith Works For Simplex company. •Most links relate two objects, but some links relate three or more object. Association: •It is a description of a group of links with common structure and common semantics. •For example, a person WorksFor a company . •The links of an association connect objects from the same classes. •An association describes a set of potential links in the same way that a class describes a set of potential objects. Link and Associations Computer Department SPIT, Piludara
  • 15. 2. Link and Association Concepts: Computer Department SPIT, Piludara
  • 16. •The UML notation for a link is a line between objects. •An association connects related classes and is also denoted by a line. For example, persons own stock in companies. •In fig. show link and association names in italics and to confine line segments to a rectilinear grid. •The association name is optional, if the model is unambiguous. •Ambiguity arises when a model has multiple associations among the same classes (person works for company and person owns stock in company). •When there are multiple associations, use association names or association end names to resolve the ambiguity. Link and Associations Computer Department SPIT, Piludara
  • 17. •Associations are inherently bidirectional. •The name of the binary association usually reads in a particular direction, but the binary association can be traversed in either direction. •For example, WorksFor connects a person to a company. The inverse of WorksFor could be called employee, and it connects a company to a person. •Both directions of traversal are equally meaningful and refer to the same underlying association. Link and Associations Computer Department SPIT, Piludara
  • 18. Reference: •It 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. •A link is a relationship among objetcs. Link and Associations Computer Department SPIT, Piludara
  • 19. Multiplicity: • Specifies the number of instances of one class that may relate to single instance of other class. • Multiplicity constrains the number of related objects. •UML specifies: “1”: exactly one,“1 ..*” (one or more), “3..5” (three to five inclusive) • The special symbol “*” is a shorthand notation that denotes “many” (zero or more). • In fig. shows a one-to-one association and some corresponding links. Each country has one capital city. • A capital city administers one country. Multiplicity Computer Department SPIT, Piludara
  • 22. • In fig. show a Workstation may have one of its windows designated as the console to receive general error messages. (The word “console” on the diagrams is an association end name) • Multiplicity is a constraint on the size of a collection and Cardinality is the count of elements that are actually in a collection. • Therefore, multiplicity is a constraint on the cardinality. • A multiplicity of “many” specifies that an object may be associated with multiple objects. Multiplicity Computer Department SPIT, Piludara
  • 24. Association End names: • Association End names is an important concept in UML. • Association ends can not only be assigned multiplicity they can also be named. In a problem description they are generally identified by nouns • For example, a one-to-many association has two ends – an end with a multiplicity of “one” and an end with a multiplicity of “many”. • In fig. shows, a name appears next to the association end. In fig. Person and Company participate in association WorksFor . A person is an employee with respect to a company, a company is an employer with respect to a person. Association End Names Computer Department SPIT, Piludara
  • 25. • Use of Association End names is optional, but it is often easier and less confusing to assign association end name instead of , or in addition to, association names. Association end: • Can give names to the association link. Use of associations end name: • to name links b/w object of same class. Association End Names Computer Department SPIT, Piludara
  • 26. Association End Names Computer Department SPIT, Piludara
  • 27. • Association End names are necessary for associations two objects of the same class. • For example, in fig.11 container and contents distinguish the two usages of Directory in the self-association. • Association End names can also distinguish multiple associations between the same pair of classes. • In fig. 11 each Directory has exactly one user who is an owner and many users who are authorized to use the directory. • When there is only a single association between a pair of distinct classes. Association End Names Computer Department SPIT, Piludara
  • 28. Association End Names Computer Department SPIT, Piludara
  • 29. • In fig. shows, in the wrong model, two instances represent a person with a child, one for the child and one for the parent. • In the correct model, one person instance participates in two or more links, twice as a parent and zero or more times as a child. • In the correct model, we must show a child as having an optional parent, so that the recursion eventually terminates. • No association end name should be the same as an attribute name of the source class. Association End Names Computer Department SPIT, Piludara
  • 30. Association End Names Computer Department SPIT, Piludara
  • 32. Bag: • It is a collection of elements with duplicates allowed. Sequence: • Ordered collection of elements with duplicate allowed. • For example, An itinerary is a sequence of airports and the same airport can be visited more than once. • Sequence is ordered bag both allow duplicates, {ordered} and {sequence} is same only difference is sequence allows duplicates as shown in figure 14. Bags and Sequences Computer Department SPIT, Piludara
  • 33. Bags and Sequences Computer Department SPIT, Piludara
  • 34. • It 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. • You can find association classes by looking for adverbs in a problem statement or by abstracting values. • In fig.15, AccessPermission is an attribute of AccessibleBy. • The sample data at the bottom of the fig. shows the value for each link. The UML notation for an association class is a box (a class box) attached to the association by a dashed line. Association Classes Computer Department SPIT, Piludara
  • 36. • Many-to-many associations provide a compelling rationale for association classes. • In fig.15, AccessPermission is a joint property of File and User and cannot be attached to either File or User alone without losing information. • In fig.16 presents attributes for two one-to-many associations • Each person working for a company receives a salary and has a job title. • The boss evaluates the performance of each worker. • Attributes may also occur for one-to-one associations. Association Classes Computer Department SPIT, Piludara
  • 39. • In fig.17 shows how it is possible to fold attributes for one-to- one and one-to-many associations into the class opposite a “one” end. This is not possible for many-to-many associations. • In fig. 18 shows 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 users can share the same home directory. Association Classes Computer Department SPIT, Piludara
  • 41. • In fig.19 shows the difference. The association class has only one occurrence for each pairing of Person and Company. • In ordinary class there can be any number of occurrence of a Purchase for each Person and Company. • Each Purchase is distinct and has its own quantity, date and cost. Association Classes Computer Department SPIT, Piludara
  • 43. • An association in which an attribute called the qualifier disambiguates the objects for a “many” association end. • Job of qualifier is to reduce the many association to one. Can only work for m-m and 1-m. • Also facilitates traversal of class models • Stock exchange gives special unique symbol to each company • Using qualified association we can make traversal easy. • Ref Figure 20,21. Qualified Association Computer Department SPIT, Piludara
  • 44. • In fig.20 show the most common use of a qualifier – for association with one-to-many multiplicity. • A bank services multiple accounts. An account belongs to a single bank. Within the context of a bank, the account number specifies a unique account. • Bank and Account are classes and AccountNumber is the qualifier. • Qualification reduces the effective multiplicity of this association from one-to-many to one-to-one. • Both models are acceptable, but the qualified model adds information. The qualified model adds multiplicity conctraint, that the combination of a bank and an account number yields at most one account. Qualified Association Computer Department SPIT, Piludara
  • 46. • In fig.23 show a stock exchange lists many companies. • However, a stock exchange lists only one company with a given ticker symbol. • A company may be listed on many stock exchanges, possibly under different symbols.(If every stock had a single ticker symbol that was invariant ) Qualified Association Computer Department SPIT, Piludara
  • 48. • Generalization is the relationship between a class (the super class) and one or more variations of the class (sub class) • Super class holds the common attributes, operations and associations. Subclass adds specific attributes, operations, and associations. • Each subclass inherits features of super class. • Generalization is some times called the “is-a” relationship, because each instance of a subclass is an instance of the superclass as well. • There can be multiple levels of generalizations. Generalization and Inheritance Computer Department SPIT, Piludara
  • 49. • Generalization is the relationship between a class (the super class) and one or more variations of the class (sub class) • Serves three purposes • Support for polymorphism. (call at super class level automatically resolved) • Second purpose is to structure the description of objects.( a taxonomy is formed) • Third purpose is to enable reuse of code. • The terms generalization, specialization and inheritance all refer to aspects of the same idea. • Generalization: derives from the fact that the superclass generalizes the subclasses. Use of Generalization Computer Department SPIT, Piludara
  • 50. • Specialization: refers to the fact that the subclasses refine or specialize the Superclass. • Inheritance: is the mechanism for sharing attributes, operations, and associations via generalization / specialization relationship. Overriding Features: • A subclass may override a super class feature by defining a feature with the same name. • We can override methods and default values of attributes. • Never override the signature, or form, of a feature. Use of Generalization Computer Department SPIT, Piludara