SlideShare a Scribd company logo
1 of 23
Download to read offline
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

Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dineshDinesh Kumar
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
Modern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsModern JavaScript Applications: Design Patterns
Modern JavaScript Applications: Design PatternsVolodymyr 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
 
Object Interconnections
Object InterconnectionsObject Interconnections
Object Interconnectionsadil 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 studentsrajvirsinghkanwar200
 
"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
 
Bt0066 database management system2
Bt0066 database management system2Bt0066 database management system2
Bt0066 database management system2Techglyphs
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.pptEIjerry
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software DesignGiorgio 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 UPTUMohammad Faizan
 
Unit-III(Design).pptx
Unit-III(Design).pptxUnit-III(Design).pptx
Unit-III(Design).pptxFajar Baskoro
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)stanbridge
 

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
 
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
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 

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

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

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
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
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
(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
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
(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
 
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
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
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
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
(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...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
(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...
 
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...
 

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