SlideShare a Scribd company logo
Software Engineering Principles
Ajit K Nayak, Ph.D.
ajitnayak@soauniversity.ac.in
UML Class Diagram
Acknowledgements
• Slides of Prof. Rajib Mall, IIT, KGP
Class Diagram
• Entities with common features, i.e.
attributes and operations.
• Represented as solid outline rectangle
with compartments for name, attributes,
and operations.
• Attribute and operation compartments
are optional depending on the purpose of
a diagram.
Window
size: Size
visibility: boolean
display()
hide()
• Java Syntax UML Syntax
• Date birthday Birthday:Date
• Public int duration = 100 +duration:int = 100
• Private Student students[MAX_Size]
Students[MAX_Size]:Student
Example: Class Diagram
LibraryMember
Member Name
Membership Number
Address
Phone Number
E-Mail Address
Membership Admission Date
Membership Expiry Date
Books Issued
issueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
LibraryMember
issueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
LibraryMember
Different representations of the
LibraryMember class
Visibility
Visibilty Java Syntax UML Syntax
public public +
protected protected #
package ~
private private -
Relationships Between Classes
• Association
– Permanent, structural, “has a”
– Solid line (arrowhead optional)
• Aggregation
– Permanent, structural, a whole created from parts
– Solid line with hollow diamond from whole
• Composition
– Whole part relationship (solely owns the part)
– Solid line with solid diamond from whole
• Dependency
– Temporary, “uses a”
– Dotted line with arrowhead
• Generalization
– Inheritance, “is a”
– Solid line with open (triangular) arrowhead
• Implementation
– Dotted line with open (triangular) arrowhead
OR
Class Relationships
Relation
AssociationGeneralization Dependency
Aggregation
Binary Association N-ary Association
Composition
Association
• Denotes permanent, structural relationship
• State of class A contains class B
• Represented by solid line (arrowhead optional)
• Example: Car and Engine classes know about each other
Associations with Navigation Information
• Can indicate direction of relationship
• Represented by solid line with arrowhead
• Gas Pedal class knows about Engine class.
• Engine class doesn’t know about Gas Pedal class
• “Gas Pedal “has an” Engine
• State of Gas Pedal class contains instance of Engine class  can
invoke its methods
1-1 Association – example
People
Rakesh Shukla
V. Ramesh
Tax_files
760901-1234
691205-5678
tax_file
People Tax_files
1 1
Associated with
Multiple Association – example
Kunti
Women People
Bhim
Arjun
Yudhistir
Women People
1 *
Mother of
motherOf
UML Syntax: Association
• A Person works for a Company.
works for
Person Companyemployee employer
Association Name
Role
Member Book1 0..5borrowed
Lion Animal**
eats
Class A Class B
role A
role B
Example 1: Association
• A teacher teaches 1 to 3 courses (subjects)
• Each course is taught by only one teacher.
• A student can take between 1 to 5 courses.
• A course can have 10 to 300 students.
Teacher Course
teaches 1..31
Students takes
1..5
10..300
Example 2: Association
• A Student can take up to five Courses.
• A student has to enroll in at least one course.
• Up to 300 students can enroll in a course.
• A class should have at least 10 students.
Student Coursecredits
10..300
1..5
hasEnrolmentOf
Enrols in
Student Course
credits
10..300 1..5
hasEnrolmentOf
Enrols in
Student Coursecredits
10..300 1..5
hasEnrolmentOf
Enrols in
Recursive/Reflexive Association
• A class is associated with itself
Person Friend of
Computer
Connects to
*
*
LinkedListNode
next
previous
Implementation of Association
• Java Implementation
– Use a reference variable
of one class as an
attribute of another class
Member Book
1 1Borrowed
by
aBook
bookName: OOSD
author: Gamaa
ISBN: 12234434Book Reference
Book instance
bookName:
memberName: AKK
memberNumber: 412323
• Member Class
public class Member{
private Book book;
public issueBook(Book aBook){
setBook(aBook);
abook.setLender(this);}
setBook(Book aBook){
book=aBook; }
…}//end class
Implementation contd.
• Java Implementation
– Use a reference variable
of one class as an
attribute of another class
Member Book
1 1Borrowed
by
abook
bookName: OOSD
author: Gamaa
ISBN: 12234434Book Reference
Book instance
bookName:
memberName: AKK
memberNumber: 412323
• Book Class
public class Book{
private Member member;
setLender(Member aLender){
member=aLender;
}
…
}//end class
Implementation Example 2
• Java Code
class Customer{
private ArrayList <Account> accounts =
new ArrayList<Account>();
public Customer(){
Account defaultAccount = new
Account();
accounts.add(defaultAccount);
}
}
Customer Account
1..*1
has
Ternary Association
• Decompose it to a set of
binary associations
Man Woman
1 1
Priest
1..3
Man Woman
Priest
Performed by
1 1
1..3
Marriage
Participates
in
1 1
Participates
in*
Aggregation
• A special kind of association
• Models whole-part relationship
between things
• Whole is usually referred to as
composite
• the child can exist independently of the
parent.
• Composition
– child cannot exist independent of the
parent
Library
Books
1 0..7
Hand Finger
Aggregation Implementation
public class Car{
private Wheel wheels[4];
public Car (Wheel w[4]){
wheels[0] = w[0];
wheels[1] = w[1];
wheels[2] = w[2];
wheels[3] = w[3];
}
}
Car Wheel1 4
Composition Implementation
public class Car{
private Wheel wheels[4];
public Car (){
wheels[0] = new Wheel();
wheels[1] = new Wheel();
wheels[2] = new Wheel();
wheels[3] = new Wheel();
}
}
Car Wheel1 4
Dependency
• Denotes dependence between
classes
• Always directed (Class A depends
on B)
A B
• Represented by dotted line with arrowhead
• Caused by class methods
– Method in Class A temporarily “uses a” object of
type Class B
– Change in Class B may affect class A
• Dependence may be caused by
– Local variable
– Parameter
– Return value
class A {
B Foo(B x) {
B y = new B();
return y;
}
}
Generalization
• Denotes inheritance between classes
• Can view as “is-a” relationship
• Represented by line ending in (open) triangle
Laptop, Desktop, PDA inherit state & behavior
from Computers
Implementation
• Denotes class implements Java interface
• Represented by dotted line ending in (open) triangle
A implements interface B
A «B»
UML Example – I
• Read the UML Diagrams
– 1 or more Pets associated with 1 PetOwner
– 1 CPU associated with 0 or more Controllers
– 1-4 DiskDrives associated with 1 SCSIController
– SCSIController is a (specialized) Controller
UML Example – II
• 1 Bank associated with 0 or more Accounts
• Checking, Savings, MoneyMarket are Accounts
Example - III
• Each Thermostat has 1 Room
• Each Thermostat associated with 0 or more
Heaters
• ElectricHeater is a specialized Heater
• AubeTH101D is a specialized Thermostat
Draw class diagram of A Web Browser
• The user can enter a URL and as a result, the
corresponding file is fetched and its contents is displayed
in the main window.
• At each moment in time, only one file is open, whose URL
is written in the status bar.
• There are two types of files, HTML files and image files;
each type has its own display method.
• An HTML file may in turn have references to image files.
• The display method of both types of files takes a canvas to
draw the contents on it, and when the browser wants to
display a file, the canvas is the main window of the
browser.
• There is a “home” button on the browser, which takes the
browser to a pre-set URL. The “home” URL can be set at
any time by the user.
Class diagram of the WEB BROWSER
Thank You

More Related Content

What's hot

Uml in software engineering
Uml in software engineeringUml in software engineering
Uml in software engineering
Mubashir Jutt
 
Object diagram
Object diagramObject diagram
Object diagram
Rahul Pola
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
Kartik Raghuvanshi
 
Collaboration diagram- UML diagram
Collaboration diagram- UML diagram Collaboration diagram- UML diagram
Collaboration diagram- UML diagram
Ramakant Soni
 
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
Creately
 
UML Class Diagram G-3-122139
UML Class Diagram G-3-122139UML Class Diagram G-3-122139
UML Class Diagram G-3-122139
Hansi Thenuwara
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
Raj Thilak S
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
Satyamevjayte Haxor
 
Class diagram presentation
Class diagram presentationClass diagram presentation
Class diagram presentation
SayedFarhan110
 
Object Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLObject Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UML
Malek Sumaiya
 
Domain Modeling
Domain ModelingDomain Modeling
Domain Modeling
Harsh Jegadeesan
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
Shruti Dalela
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
Kumar
 
Class diagram
Class diagramClass diagram
Class diagram
SESP123
 
Uml
UmlUml
Unified Modeling Language
Unified Modeling LanguageUnified Modeling Language
Unified Modeling Language
Debajyoti Biswas
 
Uml
UmlUml
Sequence diagram- UML diagram
Sequence diagram- UML diagramSequence diagram- UML diagram
Sequence diagram- UML diagram
Ramakant Soni
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
barney92
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
LOKENDRA PRAJAPATI
 

What's hot (20)

Uml in software engineering
Uml in software engineeringUml in software engineering
Uml in software engineering
 
Object diagram
Object diagramObject diagram
Object diagram
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Collaboration diagram- UML diagram
Collaboration diagram- UML diagram Collaboration diagram- UML diagram
Collaboration diagram- UML diagram
 
The Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram TutorialThe Ultimate Sequence Diagram Tutorial
The Ultimate Sequence Diagram Tutorial
 
UML Class Diagram G-3-122139
UML Class Diagram G-3-122139UML Class Diagram G-3-122139
UML Class Diagram G-3-122139
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
Class diagram presentation
Class diagram presentationClass diagram presentation
Class diagram presentation
 
Object Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UMLObject Oriented Modeling and Design with UML
Object Oriented Modeling and Design with UML
 
Domain Modeling
Domain ModelingDomain Modeling
Domain Modeling
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
 
Class diagram
Class diagramClass diagram
Class diagram
 
Uml
UmlUml
Uml
 
Unified Modeling Language
Unified Modeling LanguageUnified Modeling Language
Unified Modeling Language
 
Uml
UmlUml
Uml
 
Sequence diagram- UML diagram
Sequence diagram- UML diagramSequence diagram- UML diagram
Sequence diagram- UML diagram
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
 

Viewers also liked

UML Part1-Introduction Mansouri
UML Part1-Introduction MansouriUML Part1-Introduction Mansouri
UML Part1-Introduction Mansouri
Mansouri Khalifa
 
Software Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationSoftware Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & Specification
Ajit Nayak
 
Software Engineering an Introduction
Software Engineering an IntroductionSoftware Engineering an Introduction
Software Engineering an Introduction
Ajit Nayak
 
Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram
Ajit Nayak
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
artgreen
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UML
Ajit Nayak
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagram
Ajit Nayak
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
Ashesh R
 

Viewers also liked (8)

UML Part1-Introduction Mansouri
UML Part1-Introduction MansouriUML Part1-Introduction Mansouri
UML Part1-Introduction Mansouri
 
Software Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationSoftware Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & Specification
 
Software Engineering an Introduction
Software Engineering an IntroductionSoftware Engineering an Introduction
Software Engineering an Introduction
 
Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UML
 
Software Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagramSoftware Engineering :Behavioral Modelling - II State diagram
Software Engineering :Behavioral Modelling - II State diagram
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
 

Similar to Software Engineering :UML class diagrams

O6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdfO6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdf
MohamedRamadan454985
 
10-System-ModelingFL22-sketch-19122022-091234am.pptx
10-System-ModelingFL22-sketch-19122022-091234am.pptx10-System-ModelingFL22-sketch-19122022-091234am.pptx
10-System-ModelingFL22-sketch-19122022-091234am.pptx
huzaifaahmed79
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
Abdullah Jan
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0
Ganapathi M
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
JavedKhan524377
 
Lecture 1 - Objects and classes
Lecture 1 - Objects and classesLecture 1 - Objects and classes
Lecture 1 - Objects and classes
Syed Afaq Shah MACS CP
 
UML Modeling in Java
UML Modeling in JavaUML Modeling in Java
UML Modeling in Java
Daffodil International University
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
Muhammad Hammad Waseem
 
Ooad ch 2
Ooad ch 2Ooad ch 2
Ooad ch 2
anujabeatrice2
 
[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects
Muhammad Hammad Waseem
 
1. introduction to uml
1. introduction to uml1. introduction to uml
1. introduction to uml
PRABU M
 
Core Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class pptCore Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class ppt
Mochi263119
 
Core Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class pptCore Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class ppt
Mochi263119
 
VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
BharathiLakshmiAAssi
 
Structural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docxStructural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docx
susanschei
 
Ooad ch 3
Ooad ch 3Ooad ch 3
Ooad ch 3
anujabeatrice2
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
 
Introduction to C++ Class & Objects. Book Notes
Introduction to C++ Class & Objects. Book NotesIntroduction to C++ Class & Objects. Book Notes
Introduction to C++ Class & Objects. Book Notes
DSMS Group of Institutes
 

Similar to Software Engineering :UML class diagrams (20)

O6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdfO6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdf
 
10-System-ModelingFL22-sketch-19122022-091234am.pptx
10-System-ModelingFL22-sketch-19122022-091234am.pptx10-System-ModelingFL22-sketch-19122022-091234am.pptx
10-System-ModelingFL22-sketch-19122022-091234am.pptx
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0Object oriented analysis_and_design_v2.0
Object oriented analysis_and_design_v2.0
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
 
Lecture 1 - Objects and classes
Lecture 1 - Objects and classesLecture 1 - Objects and classes
Lecture 1 - Objects and classes
 
UML Modeling in Java
UML Modeling in JavaUML Modeling in Java
UML Modeling in Java
 
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
 
Ooad ch 2
Ooad ch 2Ooad ch 2
Ooad ch 2
 
[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects[OOP - Lec 06] Classes and Objects
[OOP - Lec 06] Classes and Objects
 
1. introduction to uml
1. introduction to uml1. introduction to uml
1. introduction to uml
 
Core Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class pptCore Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class ppt
 
Core Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class pptCore Java unit no. 1 object and class ppt
Core Java unit no. 1 object and class ppt
 
VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
 
Structural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docxStructural ModelingDr. Ardeshir BadrObjectives• .docx
Structural ModelingDr. Ardeshir BadrObjectives• .docx
 
Ooad ch 3
Ooad ch 3Ooad ch 3
Ooad ch 3
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Introduction to C++ Class & Objects. Book Notes
Introduction to C++ Class & Objects. Book NotesIntroduction to C++ Class & Objects. Book Notes
Introduction to C++ Class & Objects. Book Notes
 

More from Ajit Nayak

Software Engineering : Software testing
Software Engineering : Software testingSoftware Engineering : Software testing
Software Engineering : Software testing
Ajit Nayak
 
Software Engineering : Process Models
Software Engineering : Process ModelsSoftware Engineering : Process Models
Software Engineering : Process Models
Ajit Nayak
 
Database Programming using SQL
Database Programming using SQLDatabase Programming using SQL
Database Programming using SQL
Ajit Nayak
 
Ns2: Introduction - Part I
Ns2: Introduction - Part INs2: Introduction - Part I
Ns2: Introduction - Part I
Ajit Nayak
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt II
Ajit Nayak
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
Ajit Nayak
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
Ajit Nayak
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
Ajit Nayak
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
Ajit Nayak
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
Ajit Nayak
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-Basics
Ajit Nayak
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Ajit Nayak
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
Ajit Nayak
 
Introduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusIntroduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculus
Ajit Nayak
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
Ajit Nayak
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER Model
Ajit Nayak
 
Computer Networks Module III
Computer Networks Module IIIComputer Networks Module III
Computer Networks Module III
Ajit Nayak
 
Computer Networks Module II
Computer Networks Module IIComputer Networks Module II
Computer Networks Module II
Ajit Nayak
 
Computer Networks Module I
Computer Networks Module IComputer Networks Module I
Computer Networks Module I
Ajit Nayak
 
Object Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIObject Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part III
Ajit Nayak
 

More from Ajit Nayak (20)

Software Engineering : Software testing
Software Engineering : Software testingSoftware Engineering : Software testing
Software Engineering : Software testing
 
Software Engineering : Process Models
Software Engineering : Process ModelsSoftware Engineering : Process Models
Software Engineering : Process Models
 
Database Programming using SQL
Database Programming using SQLDatabase Programming using SQL
Database Programming using SQL
 
Ns2: Introduction - Part I
Ns2: Introduction - Part INs2: Introduction - Part I
Ns2: Introduction - Part I
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt II
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-Basics
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
Introduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusIntroduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculus
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER Model
 
Computer Networks Module III
Computer Networks Module IIIComputer Networks Module III
Computer Networks Module III
 
Computer Networks Module II
Computer Networks Module IIComputer Networks Module II
Computer Networks Module II
 
Computer Networks Module I
Computer Networks Module IComputer Networks Module I
Computer Networks Module I
 
Object Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIObject Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part III
 

Recently uploaded

Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
zubairahmad848137
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
KrishnaveniKrishnara1
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
Aditya Rajan Patra
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
HODECEDSIET
 

Recently uploaded (20)

Casting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdfCasting-Defect-inSlab continuous casting.pdf
Casting-Defect-inSlab continuous casting.pdf
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt22CYT12-Unit-V-E Waste and its Management.ppt
22CYT12-Unit-V-E Waste and its Management.ppt
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Recycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part IIRecycled Concrete Aggregate in Construction Part II
Recycled Concrete Aggregate in Construction Part II
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEMTIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
TIME DIVISION MULTIPLEXING TECHNIQUE FOR COMMUNICATION SYSTEM
 

Software Engineering :UML class diagrams

  • 1. Software Engineering Principles Ajit K Nayak, Ph.D. ajitnayak@soauniversity.ac.in UML Class Diagram
  • 2. Acknowledgements • Slides of Prof. Rajib Mall, IIT, KGP
  • 3. Class Diagram • Entities with common features, i.e. attributes and operations. • Represented as solid outline rectangle with compartments for name, attributes, and operations. • Attribute and operation compartments are optional depending on the purpose of a diagram. Window size: Size visibility: boolean display() hide() • Java Syntax UML Syntax • Date birthday Birthday:Date • Public int duration = 100 +duration:int = 100 • Private Student students[MAX_Size] Students[MAX_Size]:Student
  • 4. Example: Class Diagram LibraryMember Member Name Membership Number Address Phone Number E-Mail Address Membership Admission Date Membership Expiry Date Books Issued issueBook( ); findPendingBooks( ); findOverdueBooks( ); returnBook( ); findMembershipDetails( ); LibraryMember issueBook( ); findPendingBooks( ); findOverdueBooks( ); returnBook( ); findMembershipDetails( ); LibraryMember Different representations of the LibraryMember class
  • 5. Visibility Visibilty Java Syntax UML Syntax public public + protected protected # package ~ private private -
  • 6. Relationships Between Classes • Association – Permanent, structural, “has a” – Solid line (arrowhead optional) • Aggregation – Permanent, structural, a whole created from parts – Solid line with hollow diamond from whole • Composition – Whole part relationship (solely owns the part) – Solid line with solid diamond from whole • Dependency – Temporary, “uses a” – Dotted line with arrowhead • Generalization – Inheritance, “is a” – Solid line with open (triangular) arrowhead • Implementation – Dotted line with open (triangular) arrowhead OR
  • 8. Association • Denotes permanent, structural relationship • State of class A contains class B • Represented by solid line (arrowhead optional) • Example: Car and Engine classes know about each other
  • 9. Associations with Navigation Information • Can indicate direction of relationship • Represented by solid line with arrowhead • Gas Pedal class knows about Engine class. • Engine class doesn’t know about Gas Pedal class • “Gas Pedal “has an” Engine • State of Gas Pedal class contains instance of Engine class  can invoke its methods
  • 10. 1-1 Association – example People Rakesh Shukla V. Ramesh Tax_files 760901-1234 691205-5678 tax_file People Tax_files 1 1 Associated with
  • 11. Multiple Association – example Kunti Women People Bhim Arjun Yudhistir Women People 1 * Mother of motherOf
  • 12. UML Syntax: Association • A Person works for a Company. works for Person Companyemployee employer Association Name Role Member Book1 0..5borrowed Lion Animal** eats Class A Class B role A role B
  • 13. Example 1: Association • A teacher teaches 1 to 3 courses (subjects) • Each course is taught by only one teacher. • A student can take between 1 to 5 courses. • A course can have 10 to 300 students. Teacher Course teaches 1..31 Students takes 1..5 10..300
  • 14. Example 2: Association • A Student can take up to five Courses. • A student has to enroll in at least one course. • Up to 300 students can enroll in a course. • A class should have at least 10 students. Student Coursecredits 10..300 1..5 hasEnrolmentOf Enrols in Student Course credits 10..300 1..5 hasEnrolmentOf Enrols in Student Coursecredits 10..300 1..5 hasEnrolmentOf Enrols in
  • 15. Recursive/Reflexive Association • A class is associated with itself Person Friend of Computer Connects to * * LinkedListNode next previous
  • 16. Implementation of Association • Java Implementation – Use a reference variable of one class as an attribute of another class Member Book 1 1Borrowed by aBook bookName: OOSD author: Gamaa ISBN: 12234434Book Reference Book instance bookName: memberName: AKK memberNumber: 412323 • Member Class public class Member{ private Book book; public issueBook(Book aBook){ setBook(aBook); abook.setLender(this);} setBook(Book aBook){ book=aBook; } …}//end class
  • 17. Implementation contd. • Java Implementation – Use a reference variable of one class as an attribute of another class Member Book 1 1Borrowed by abook bookName: OOSD author: Gamaa ISBN: 12234434Book Reference Book instance bookName: memberName: AKK memberNumber: 412323 • Book Class public class Book{ private Member member; setLender(Member aLender){ member=aLender; } … }//end class
  • 18. Implementation Example 2 • Java Code class Customer{ private ArrayList <Account> accounts = new ArrayList<Account>(); public Customer(){ Account defaultAccount = new Account(); accounts.add(defaultAccount); } } Customer Account 1..*1 has
  • 19. Ternary Association • Decompose it to a set of binary associations Man Woman 1 1 Priest 1..3 Man Woman Priest Performed by 1 1 1..3 Marriage Participates in 1 1 Participates in*
  • 20. Aggregation • A special kind of association • Models whole-part relationship between things • Whole is usually referred to as composite • the child can exist independently of the parent. • Composition – child cannot exist independent of the parent Library Books 1 0..7 Hand Finger
  • 21. Aggregation Implementation public class Car{ private Wheel wheels[4]; public Car (Wheel w[4]){ wheels[0] = w[0]; wheels[1] = w[1]; wheels[2] = w[2]; wheels[3] = w[3]; } } Car Wheel1 4
  • 22. Composition Implementation public class Car{ private Wheel wheels[4]; public Car (){ wheels[0] = new Wheel(); wheels[1] = new Wheel(); wheels[2] = new Wheel(); wheels[3] = new Wheel(); } } Car Wheel1 4
  • 23. Dependency • Denotes dependence between classes • Always directed (Class A depends on B) A B • Represented by dotted line with arrowhead • Caused by class methods – Method in Class A temporarily “uses a” object of type Class B – Change in Class B may affect class A • Dependence may be caused by – Local variable – Parameter – Return value class A { B Foo(B x) { B y = new B(); return y; } }
  • 24. Generalization • Denotes inheritance between classes • Can view as “is-a” relationship • Represented by line ending in (open) triangle Laptop, Desktop, PDA inherit state & behavior from Computers
  • 25. Implementation • Denotes class implements Java interface • Represented by dotted line ending in (open) triangle A implements interface B A «B»
  • 26. UML Example – I • Read the UML Diagrams – 1 or more Pets associated with 1 PetOwner – 1 CPU associated with 0 or more Controllers – 1-4 DiskDrives associated with 1 SCSIController – SCSIController is a (specialized) Controller
  • 27. UML Example – II • 1 Bank associated with 0 or more Accounts • Checking, Savings, MoneyMarket are Accounts
  • 28. Example - III • Each Thermostat has 1 Room • Each Thermostat associated with 0 or more Heaters • ElectricHeater is a specialized Heater • AubeTH101D is a specialized Thermostat
  • 29. Draw class diagram of A Web Browser • The user can enter a URL and as a result, the corresponding file is fetched and its contents is displayed in the main window. • At each moment in time, only one file is open, whose URL is written in the status bar. • There are two types of files, HTML files and image files; each type has its own display method. • An HTML file may in turn have references to image files. • The display method of both types of files takes a canvas to draw the contents on it, and when the browser wants to display a file, the canvas is the main window of the browser. • There is a “home” button on the browser, which takes the browser to a pre-set URL. The “home” URL can be set at any time by the user.
  • 30. Class diagram of the WEB BROWSER