SlideShare a Scribd company logo
Software Design
Cohesion & Coupling
1
Cohesion ?
❑ Degree of interaction within the module.
❑ Cohesion is a measure of the degree to which the
elements of module are functionally related.
2
Cohesion
3
class A {
private F1 f1;
private F2 f1;
public void m1() {
[...]
f1.m();
}
public void m2() {
[...]
f2.m();
}
}
4
Types of Cohesion
Functional | Sequential (best)
Communicational
Procedural
Temporal
Logical
Coincidental (worst)
5
1. Coincidental Cohesion
❖ Def. ?
• module performs multiple completely unplanned,
unrelated or random actions.
❖ How could this happen?
• hard organizational rules about module size
❖ Why is this bad?
• degrades maintainability & modules are not
reusable
6
2. Logical Cohesion
❖ Def.
• modules defines same logical function and class
one of which is selected by calling module.
❖ Why is this bad?
• interface difficult to understand
• code for more than one action may be intertwined
• difficult to reuse
7
3. Temporal Cohesion
❖ Def. ?
• module performs series of actions related within the
same time.
❖ Why is this bad?
• actions weakly related to one another, but
strongly related to actions in other modules
• code spread out -> not maintainable or reusable
8
4. Procedural Cohesion
❖ Def. ?
• module performs series of actions in a sequential way.
❖ Why is this bad?
• actions are still weakly related to one another
• not reusable
9
5. Communicational Cohesion
❖ Def.
• module performs series of actions related by procedure to
be followed, but in addition all the actions shares the
same data.
❖ Why is this bad?
• still leads to less reusability -> break it up
10
6. Sequential Cohesion
❖ Def.
• When elements of module are grouped because the
output of one element serves as input to another element
and so on,
11
7. Functional Cohesion
❖ Def.
• module performs exactly one action
❖ Why is this good?
• more reusable
• corrective maintenance easier
fault isolation
reduced regression faults
• easier to extend product
12
Coupling ?
❑ Degree of interaction between two or more
modules.
❑ A measure of the strength of the inter-connections
between system components.
13
Coupling
A B
14
Reasons of coupling
Duplication
Dependency
15
class A {
private B b;
[..]
public void m() {
b.setZ(b.getX() + b.getY());
}
}
class B {
private int x, y, z;
int getX() { return x; }
int getY() { return y; }
void setZ(int z) { this.z = z; }
}
16
Types of Coupling
Data (best)
Stamp
Control
Common
Content (worst)
17
1. Content Coupling
❖ Def.
• one module directly references contents of the other
❖ Why is this bad?
• almost any change to b requires changes to a
18
2. Common Coupling
❖ Def.
• two modules have write access to the same global data
❖ Why is this bad?
• resulting code is unreadable
modules can have side-effects
must read entire module to understand
• difficult to reuse
• module exposed to more data than necessary
cca
ccb
global variable
19
3. Control Coupling
❖ Def.
• one module passes an element of control to the other
❖ Why is this bad?
• modules are not independent
module b must know the internal structure of module a
affects reusability
20
4. Stamp Coupling
❖ Def.
• data structure is passed as parameter, but called module
operates on only some of individual components
❖ Why is this bad?
• affects understanding
not clear, without reading entire module, which fields of record are
accessed or changed
• unlikely to be reusable
other products have to use the same higher level data structures
• passes more data than necessary
e.g., uncontrolled data access can lead to computer crime
21
5. Data Coupling
❖ Def.
• every argument is either a simple argument or a data
structure in which all elements are used by the called
module
❖ Why is this good?
• maintenance is easier
• good design has high cohesion & weak coupling
22
23

More Related Content

Similar to Cohesion and coupling software desgin engineering

Grasp principles
Grasp principlesGrasp principles
Grasp principles
Yuriy Shapovalov
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dinesh
Dinesh Kumar
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
Software Engineering - SOFTWARE DESIGN Process
Software Engineering - SOFTWARE DESIGN ProcessSoftware Engineering - SOFTWARE DESIGN Process
Software Engineering - SOFTWARE DESIGN Process
Dr Anuranjan Misra
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
Volodymyr Voytyshyn
 
Effective Software Design
Effective Software Design Effective Software Design
Effective Software Design
Darshan Ashpal
 
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
SalesforceBY
 
software engineering
software engineeringsoftware engineering
software engineering
Vijay Bhadouria
 
Object Interconnections
Object InterconnectionsObject Interconnections
Object Interconnections
adil raja
 
5.Software Design.ppt it is for software eng students
5.Software Design.ppt it is for software eng students5.Software Design.ppt it is for software eng students
5.Software Design.ppt it is for software eng students
rajvirsinghkanwar200
 
"Design Phase: A Deep Dive into Software Design and Development"
"Design Phase: A Deep Dive into Software Design and Development""Design Phase: A Deep Dive into Software Design and Development"
"Design Phase: A Deep Dive into Software Design and Development"
babulaldta
 
EFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptxEFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptx
DrTThendralCompSci
 
Bt0066 database management system2
Bt0066 database management system2Bt0066 database management system2
Bt0066 database management system2
Techglyphs
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
EIjerry
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software Design
Giorgio Zoppi
 
Pure functions using Javascript.
Pure functions using Javascript.Pure functions using Javascript.
Pure functions using Javascript.
Leon Maia
 
Software engg. pressman_ch-11
Software engg. pressman_ch-11Software engg. pressman_ch-11
Software engg. pressman_ch-11Dhairya Joshi
 
Unit3 Software engineering UPTU
Unit3 Software engineering UPTUUnit3 Software engineering UPTU
Unit3 Software engineering UPTU
Mohammad Faizan
 
Unit-III(Design).pptx
Unit-III(Design).pptxUnit-III(Design).pptx
Unit-III(Design).pptx
Fajar Baskoro
 

Similar to Cohesion and coupling software desgin engineering (20)

Grasp principles
Grasp principlesGrasp principles
Grasp principles
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dinesh
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Software Engineering - SOFTWARE DESIGN Process
Software Engineering - SOFTWARE DESIGN ProcessSoftware Engineering - SOFTWARE DESIGN Process
Software Engineering - SOFTWARE DESIGN Process
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design Patterns
 
Effective Software Design
Effective Software Design Effective Software Design
Effective Software Design
 
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
 
software engineering
software engineeringsoftware engineering
software engineering
 
Object Interconnections
Object InterconnectionsObject Interconnections
Object Interconnections
 
5.Software Design.ppt it is for software eng students
5.Software Design.ppt it is for software eng students5.Software Design.ppt it is for software eng students
5.Software Design.ppt it is for software eng students
 
"Design Phase: A Deep Dive into Software Design and Development"
"Design Phase: A Deep Dive into Software Design and Development""Design Phase: A Deep Dive into Software Design and Development"
"Design Phase: A Deep Dive into Software Design and Development"
 
EFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptxEFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptx
 
Bt0066 database management system2
Bt0066 database management system2Bt0066 database management system2
Bt0066 database management system2
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software Design
 
Pure functions using Javascript.
Pure functions using Javascript.Pure functions using Javascript.
Pure functions using Javascript.
 
Software engg. pressman_ch-11
Software engg. pressman_ch-11Software engg. pressman_ch-11
Software engg. pressman_ch-11
 
Unit3 Software engineering UPTU
Unit3 Software engineering UPTUUnit3 Software engineering UPTU
Unit3 Software engineering UPTU
 
Unit-III(Design).pptx
Unit-III(Design).pptxUnit-III(Design).pptx
Unit-III(Design).pptx
 

More from QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH

JEST AND PST TEST PREPARATIONS MCQS
JEST AND PST TEST PREPARATIONS MCQSJEST AND PST TEST PREPARATIONS MCQS
Square roots and Cube roots
Square roots and Cube rootsSquare roots and Cube roots
Prime numbers,whole numbers and composite numbers
Prime numbers,whole numbers and composite numbersPrime numbers,whole numbers and composite numbers
Prime numbers,whole numbers and composite numbers
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
PAST PAPER OF JEST AND PST TEST
PAST PAPER OF JEST AND PST TESTPAST PAPER OF JEST AND PST TEST
SINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATION
SINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATIONSINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATION
SINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...
CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...
CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
GENERAL SCIENCE NOTES FOR CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATION
GENERAL SCIENCE NOTES FOR  CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATIONGENERAL SCIENCE NOTES FOR  CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATION
GENERAL SCIENCE NOTES FOR CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
Whole ENGLISH Notes of class 5 for JEST and PST Test Preparation
Whole ENGLISH Notes of class 5 for JEST and PST Test  PreparationWhole ENGLISH Notes of class 5 for JEST and PST Test  Preparation
Whole ENGLISH Notes of class 5 for JEST and PST Test Preparation
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
JEST and PST past papers for JEST & PST test preparation
JEST and PST past papers for JEST & PST test preparationJEST and PST past papers for JEST & PST test preparation
JEST and PST past papers for JEST & PST test preparation
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
Important Solved Analogy for any test Preparation
Important Solved Analogy for any test PreparationImportant Solved Analogy for any test Preparation
Important Solved Analogy for any test Preparation
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
Multiplication
MultiplicationMultiplication
PEDAGOGY NOTES FOR JEST AND PST TEST PREPARATION
PEDAGOGY NOTES FOR JEST AND PST TEST PREPARATIONPEDAGOGY NOTES FOR JEST AND PST TEST PREPARATION
PEDAGOGY NOTES FOR JEST AND PST TEST PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATIONGENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATIONGENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
PREPOSITION NOTES FOR JEST AND PST TEST PREPARATION
PREPOSITION NOTES FOR JEST AND PST TEST PREPARATIONPREPOSITION NOTES FOR JEST AND PST TEST PREPARATION
PREPOSITION NOTES FOR JEST AND PST TEST PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION
ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION
ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION
QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH
 
SYNONYMS NOTES FOR JEST AND PST JOB
SYNONYMS NOTES FOR JEST AND PST JOBSYNONYMS NOTES FOR JEST AND PST JOB
Comprehension notes for JEST JOB
Comprehension notes for JEST JOBComprehension notes for JEST JOB
Comprehension Notes for PST JOB
Comprehension Notes for PST JOBComprehension Notes for PST JOB
Addition with different strategies
Addition with different strategies Addition with different strategies

More from QUAID E AWAM UNIVERSITY OF ENGINEERING SCIENCE AND TECHONOLOGY NAWABSHAH (20)

JEST AND PST TEST PREPARATIONS MCQS
JEST AND PST TEST PREPARATIONS MCQSJEST AND PST TEST PREPARATIONS MCQS
JEST AND PST TEST PREPARATIONS MCQS
 
Square roots and Cube roots
Square roots and Cube rootsSquare roots and Cube roots
Square roots and Cube roots
 
Prime numbers,whole numbers and composite numbers
Prime numbers,whole numbers and composite numbersPrime numbers,whole numbers and composite numbers
Prime numbers,whole numbers and composite numbers
 
PAST PAPER OF JEST AND PST TEST
PAST PAPER OF JEST AND PST TESTPAST PAPER OF JEST AND PST TEST
PAST PAPER OF JEST AND PST TEST
 
SINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATION
SINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATIONSINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATION
SINDHI GRAMMAR NOTES FOR JEST AND PST TEST PREPARATION
 
CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...
CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...
CLASS 5 ENGLISH NOTES FROM SINDH TEXT BOARD BOOK FOR JEST AND PST TEST PREPAR...
 
GENERAL SCIENCE NOTES FOR CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATION
GENERAL SCIENCE NOTES FOR  CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATIONGENERAL SCIENCE NOTES FOR  CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATION
GENERAL SCIENCE NOTES FOR CCE,CSS,JEST AND PST AND OTHER TESTS PREPARATION
 
Whole ENGLISH Notes of class 5 for JEST and PST Test Preparation
Whole ENGLISH Notes of class 5 for JEST and PST Test  PreparationWhole ENGLISH Notes of class 5 for JEST and PST Test  Preparation
Whole ENGLISH Notes of class 5 for JEST and PST Test Preparation
 
JEST and PST past papers for JEST & PST test preparation
JEST and PST past papers for JEST & PST test preparationJEST and PST past papers for JEST & PST test preparation
JEST and PST past papers for JEST & PST test preparation
 
Important Solved Analogy for any test Preparation
Important Solved Analogy for any test PreparationImportant Solved Analogy for any test Preparation
Important Solved Analogy for any test Preparation
 
Multiplication
MultiplicationMultiplication
Multiplication
 
PEDAGOGY NOTES FOR JEST AND PST TEST PREPARATION
PEDAGOGY NOTES FOR JEST AND PST TEST PREPARATIONPEDAGOGY NOTES FOR JEST AND PST TEST PREPARATION
PEDAGOGY NOTES FOR JEST AND PST TEST PREPARATION
 
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATIONGENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
 
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATIONGENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
GENERAL SCIENCE NOTES FOR JEST AND PST TEST PREPARATION
 
PREPOSITION NOTES FOR JEST AND PST TEST PREPARATION
PREPOSITION NOTES FOR JEST AND PST TEST PREPARATIONPREPOSITION NOTES FOR JEST AND PST TEST PREPARATION
PREPOSITION NOTES FOR JEST AND PST TEST PREPARATION
 
ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION
ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION
ANTONYMS NOTES FOR JEST AND PST TEST PREPARATION
 
SYNONYMS NOTES FOR JEST AND PST JOB
SYNONYMS NOTES FOR JEST AND PST JOBSYNONYMS NOTES FOR JEST AND PST JOB
SYNONYMS NOTES FOR JEST AND PST JOB
 
Comprehension notes for JEST JOB
Comprehension notes for JEST JOBComprehension notes for JEST JOB
Comprehension notes for JEST JOB
 
Comprehension Notes for PST JOB
Comprehension Notes for PST JOBComprehension Notes for PST JOB
Comprehension Notes for PST JOB
 
Addition with different strategies
Addition with different strategies Addition with different strategies
Addition with different strategies
 

Recently uploaded

DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 

Recently uploaded (20)

DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 

Cohesion and coupling software desgin engineering

  • 2. Cohesion ? ❑ Degree of interaction within the module. ❑ Cohesion is a measure of the degree to which the elements of module are functionally related. 2
  • 4. class A { private F1 f1; private F2 f1; public void m1() { [...] f1.m(); } public void m2() { [...] f2.m(); } } 4
  • 5. Types of Cohesion Functional | Sequential (best) Communicational Procedural Temporal Logical Coincidental (worst) 5
  • 6. 1. Coincidental Cohesion ❖ Def. ? • module performs multiple completely unplanned, unrelated or random actions. ❖ How could this happen? • hard organizational rules about module size ❖ Why is this bad? • degrades maintainability & modules are not reusable 6
  • 7. 2. Logical Cohesion ❖ Def. • modules defines same logical function and class one of which is selected by calling module. ❖ Why is this bad? • interface difficult to understand • code for more than one action may be intertwined • difficult to reuse 7
  • 8. 3. Temporal Cohesion ❖ Def. ? • module performs series of actions related within the same time. ❖ Why is this bad? • actions weakly related to one another, but strongly related to actions in other modules • code spread out -> not maintainable or reusable 8
  • 9. 4. Procedural Cohesion ❖ Def. ? • module performs series of actions in a sequential way. ❖ Why is this bad? • actions are still weakly related to one another • not reusable 9
  • 10. 5. Communicational Cohesion ❖ Def. • module performs series of actions related by procedure to be followed, but in addition all the actions shares the same data. ❖ Why is this bad? • still leads to less reusability -> break it up 10
  • 11. 6. Sequential Cohesion ❖ Def. • When elements of module are grouped because the output of one element serves as input to another element and so on, 11
  • 12. 7. Functional Cohesion ❖ Def. • module performs exactly one action ❖ Why is this good? • more reusable • corrective maintenance easier fault isolation reduced regression faults • easier to extend product 12
  • 13. Coupling ? ❑ Degree of interaction between two or more modules. ❑ A measure of the strength of the inter-connections between system components. 13
  • 16. class A { private B b; [..] public void m() { b.setZ(b.getX() + b.getY()); } } class B { private int x, y, z; int getX() { return x; } int getY() { return y; } void setZ(int z) { this.z = z; } } 16
  • 17. Types of Coupling Data (best) Stamp Control Common Content (worst) 17
  • 18. 1. Content Coupling ❖ Def. • one module directly references contents of the other ❖ Why is this bad? • almost any change to b requires changes to a 18
  • 19. 2. Common Coupling ❖ Def. • two modules have write access to the same global data ❖ Why is this bad? • resulting code is unreadable modules can have side-effects must read entire module to understand • difficult to reuse • module exposed to more data than necessary cca ccb global variable 19
  • 20. 3. Control Coupling ❖ Def. • one module passes an element of control to the other ❖ Why is this bad? • modules are not independent module b must know the internal structure of module a affects reusability 20
  • 21. 4. Stamp Coupling ❖ Def. • data structure is passed as parameter, but called module operates on only some of individual components ❖ Why is this bad? • affects understanding not clear, without reading entire module, which fields of record are accessed or changed • unlikely to be reusable other products have to use the same higher level data structures • passes more data than necessary e.g., uncontrolled data access can lead to computer crime 21
  • 22. 5. Data Coupling ❖ Def. • every argument is either a simple argument or a data structure in which all elements are used by the called module ❖ Why is this good? • maintenance is easier • good design has high cohesion & weak coupling 22
  • 23. 23