SlideShare a Scribd company logo
1 of 37
Think Pair ShareThink Pair Share
ActivityActivity
Course Instructor
Preeti Mishra
Cohesion and CouplingCohesion and Coupling
About TPS
• For a given topic “The class needs to” :
1. Think/ explore/find
2. Pair up with similar topic people and discuss
your ideas
3. Share the conclusions in class
• This exercise is worth 10 points and will
be accordingly counted in your term
work!!
So lets Begin…So lets Begin…
Some Design Goals
• Extension
– facilitate adding features
• Change
– facilitate changing requirements
• Simplicity
– make easy to understand
– make easy to implement
• Efficiency
– attain high speed: execution and/or compilation
– attain low size: runtime and/or code base
Coupling
• The degree of interdependence between two
modules”
• We aim to minimise coupling - to make modules as
independent as possible
Low coupling can be achieve by:​
– eliminating unnecessary relationships
– reducing the number of necessary relationships
– easeing the ‘tightness’ of necessary relationships
Definition of Coupling
• The fewer the connection, the less chance there is for
the ripple effect.
– Ideally, changing one component should not require a
change in another.
– Should not have to understand details of one component
in order to change another (c.f.principle of locality).
Coupling Principles
• Create narrow connections
• Create direct Connections
• Create local connections
• Create obvious connections
• Create flexible connections
Narrow (vs. Broad) Connections
• The breadth of connections is number of connections that
link two components.
– A connection that passes 15 pieces of information from one
component to another is broader than a connection in which
only two are passed.
– The greater the number of parameters in a method call the
broader the connection
Direct vs. Indirect Connections
• A direct connection is one in which the interface between
two components can be understood without having to refer
to other pieces of information.
– A method definition including pre- and postconditions has a more
direct interface than one that does not.
Local vs. Remote Connections
• Local Connection
– All information required to understand the connection is
present in the connection itself.
• Remote Connection
– Coupled through global data.
– May be hundreds of lines removed from a call
point.
– May be remote in time.
Flexible Connections
• Systems evolve over time.
– information being passed changes.
– May want to switch to a different logical or
physical devices
Types of Coupling
1. Data coupling       (Most Required)
                         
2. Stamp coupling
 
3. Control coupling
 
4. Hybrid coupling
 
5. Common coupling
 
6. Content coupling  (Least Required)
Normal Coupling
• Two components, A and B, are normally coupled if
– A calls B
– B returns to A
– All information passed between them is by parameters in the
call (or a return).
• Types of Normal Coupling
– Data Coupling
– Stamp Coupling
– Control Coupling
Data Coupling
• Keep interfaces as narrow as possible.
• Avoid tramp data:
– Data passed from component to component that
is unwanted and meaningless to most.
Stamp coupling
• A composite data is passed between modules
 
• Internal structure contains data not used
 
• Bundling - grouping of unrelated data into an artificial
structure
Stamp coupling warnings
Do not pass aggregate structures containing many fields when
only one or two are needed by callee.
– You do not want to couple caller to the structure of the aggregate.
– Creates dependencies between otherwise unrelated components.
• Do not bundle unrelated data.
Control coupling
• A module controls the logic of another module
through the parameter
 
• Controlling module needs to know how the other
module works - not flexible
Common coupling
Use of global data as communication between modules  Common (Global)
Coupling
• Two components are common coupled if they refer to the same global
data area.
• This is an undesirable form of coupling.
• Defect in one component using common global data can affect others.
• Introduces remoteness (with respect to time).
Dangers of:
ripple effect
inflexibility
 
difficult to understand the use of data
Content coupling
Two components exhibit content coupling if
one refers to the internals of the other in any way.
• This form of coupling is unacceptable. It forces you to
understand the semantics implemented in another
component
• Hybrid coupling
• A subset of data used as control
 
• Example: account numbers 00001 to 99999
​
• If 90000 - 90999, send mail to area code of last 3 digit
(000 - 999)
Determine Coupling Type
• Ask:
– Can programmers work independently? To what degree?
– What may change that may cause changes to multiple
components?
• A pair of components may be coupled in more than one
way:
– Their coupling is determined by their worst type that they
exhibit.
“Good” vs. “bad” coupling
• Modules that are loosely coupled (or uncoupled)
are better than those that are tightly coupled
• Why? Because of the objective of modules to help
with human limitations
• The more tightly coupled are two modules, the
harder it is to think about them separately, and
thus the benefits become more limited
Effects of Object Technology on
Coupling
• Object Technology adds additional relationships that often
result in increased coupling.
• Proper application of design principles can reduce the
complexity often found in procedural programs.
– E.g. effective use of access control can eliminate common coupling.
Cohesion
• “The measure of the strength of functional
relatedness of elements within a module” 
• Elements: instructions, groups of instructions,
data definition, call of another module                 
                                       ​
• We aim for strongly cohesive modules
• Everything in module should be related to one
another - focus on the task  
• Strong cohesion will reduce relations between
modules - minimise coupling
Seven levels of cohesion
1. • Coincidental (Worst Maintainability)
2. • Logical
3. • Temporal
4. • Procedural
5. • Communicational
6. • Sequential
7. • Functional (Best Maintainability)
Type of cohesion no. Assigned to roll no.
1 12,39
2 15,38
3 17,37
4 21,36,40
5 2434,
6 26,31
7 27,30
Functional cohesion
• All elements contribute to the execution of one and only one
problem-related task
 
• Focussed - strong, single-minded purpose
 
• No elements doing unrelated activities
​
• Examples of functional cohesive modules:
– Compute cosine of angle
 
– Read transaction record
 
– Assign seat to airline passenger
Sequential cohesion
• Elements are involved in activities such that output data
from one activity becomes input data to the next 
• Usually has good coupling and is easily maintained 
• Not so readily reusable because activities that will not in
general be useful together 
• Example of Sequential Cohesion 
– module format and cross-validate record 
–    use raw record 
–     format raw record 
–    cross-validate fields in raw record 
–    return formatted cross-validated record
•                  
Communicational Cohesion
• Elements contribute to activities that use the same input or
output data
 
• Not flexible, for example, if we need to focus on some
activities and not the others
 
• Possible links that cause activities to affect each other
 
• Better to split to functional cohesive ones
 
Procedural cohesion
• Elements are related only by sequence, otherwise
the activities are unrelated
 
• Similar to sequential cohesion, except for the
fact that elements are unrelated
 
• Commonly found at the top of hierarchy, such as
the main program module
 
Temporal cohesion
• Elements are involved in activities that are
related in time
 
• Commonly found in initialisation and termination
modules
 
• Elements are basically unrelated, so the module
will be difficult to reuse
 
• Good practice is to initialise as late as possible
and terminate as early as possible
 
Logical cohesion
• Elements contribute to activities of the same
general category (type)
 
• For example, a report module, display module or
I/O module
 
• Usually have control coupling, since one of the
activities will be selected
 
Coincidental cohesion
• Elements contribute to activities with no
meaningful relationship to one another
 
• Similar to logical cohesion, except the activities
may not even be the same type
 
• Mixture of activities - like ‘rojak’!
 
• Difficult to understand and maintain, with strong
possibilities of causing ‘side effects’ every time
the module is modified
“Good” vs. “bad” cohesion
• Bergland talks about different levels of cohesion
– Best: functional, where the elements collectively provide
a specific behavior or related behaviors
– Worst: coincidental, where the elements are collected
for no reason at all
• Many other levels in between
• Cohesion is not measurable quantitatively
Cohesion and Coupling
1
2 3 4
5 6High cohesion Low couplingBridge
component
component
 
Cohesion and Coupling
1
2 3 4
5 6High cohesion Low coupling
High coupling
Bridge
component
component
component



Steel
truss

More Related Content

What's hot

Design process and concepts
Design process and conceptsDesign process and concepts
Design process and conceptsSlideshare
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case DiagramKumar
 
Analysis modeling & scenario based modeling
Analysis modeling &  scenario based modeling Analysis modeling &  scenario based modeling
Analysis modeling & scenario based modeling Benazir Fathima
 
Seii unit7 component-level-design
Seii unit7 component-level-designSeii unit7 component-level-design
Seii unit7 component-level-designAhmad sohail Kakar
 
Structural modeling and analysis
Structural modeling and analysisStructural modeling and analysis
Structural modeling and analysisJIGAR MAKHIJA
 
Chapter 4 software design
Chapter 4  software designChapter 4  software design
Chapter 4 software designCliftone Mullah
 
Modeling software with UML
Modeling software with UMLModeling software with UML
Modeling software with UML6020 peaks
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategiesghayour abbas
 
Software Design and Modularity
Software Design and ModularitySoftware Design and Modularity
Software Design and ModularityDanyal Ahmad
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram Rahul Pola
 
Software analysis and it's principles
Software analysis and it's principlesSoftware analysis and it's principles
Software analysis and it's principlesGhulam Abbas
 
Pressman ch-11-component-level-design
Pressman ch-11-component-level-designPressman ch-11-component-level-design
Pressman ch-11-component-level-designOliver Cheng
 
Lecture 19 design concepts
Lecture 19   design conceptsLecture 19   design concepts
Lecture 19 design conceptsIIUI
 
Design and Implementation in Software Engineering
Design and Implementation in Software EngineeringDesign and Implementation in Software Engineering
Design and Implementation in Software EngineeringKourosh Sajjadi
 
Unit 5- Architectural Design in software engineering
Unit 5- Architectural Design in software engineering Unit 5- Architectural Design in software engineering
Unit 5- Architectural Design in software engineering arvind pandey
 
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesionSe 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesionbabak danyal
 

What's hot (20)

Design process and concepts
Design process and conceptsDesign process and concepts
Design process and concepts
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
 
Analysis modeling & scenario based modeling
Analysis modeling &  scenario based modeling Analysis modeling &  scenario based modeling
Analysis modeling & scenario based modeling
 
Analysis modeling
Analysis modelingAnalysis modeling
Analysis modeling
 
Seii unit7 component-level-design
Seii unit7 component-level-designSeii unit7 component-level-design
Seii unit7 component-level-design
 
Structural modeling and analysis
Structural modeling and analysisStructural modeling and analysis
Structural modeling and analysis
 
Slides chapter 11
Slides chapter 11Slides chapter 11
Slides chapter 11
 
Chapter 4 software design
Chapter 4  software designChapter 4  software design
Chapter 4 software design
 
Modeling and analysis
Modeling and analysisModeling and analysis
Modeling and analysis
 
Modeling software with UML
Modeling software with UMLModeling software with UML
Modeling software with UML
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategies
 
Software Design Concepts
Software Design ConceptsSoftware Design Concepts
Software Design Concepts
 
Software Design and Modularity
Software Design and ModularitySoftware Design and Modularity
Software Design and Modularity
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
 
Software analysis and it's principles
Software analysis and it's principlesSoftware analysis and it's principles
Software analysis and it's principles
 
Pressman ch-11-component-level-design
Pressman ch-11-component-level-designPressman ch-11-component-level-design
Pressman ch-11-component-level-design
 
Lecture 19 design concepts
Lecture 19   design conceptsLecture 19   design concepts
Lecture 19 design concepts
 
Design and Implementation in Software Engineering
Design and Implementation in Software EngineeringDesign and Implementation in Software Engineering
Design and Implementation in Software Engineering
 
Unit 5- Architectural Design in software engineering
Unit 5- Architectural Design in software engineering Unit 5- Architectural Design in software engineering
Unit 5- Architectural Design in software engineering
 
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesionSe 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
 

Similar to Coupling coheshion tps

Se 381 - lec 22 - 24 - 12 may15 - modularity - i - coupling
Se 381 - lec 22 - 24  - 12 may15 - modularity - i - couplingSe 381 - lec 22 - 24  - 12 may15 - modularity - i - coupling
Se 381 - lec 22 - 24 - 12 may15 - modularity - i - couplingbabak danyal
 
Effective Software Design
Effective Software Design Effective Software Design
Effective Software Design Darshan Ashpal
 
Software Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptxSoftware Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptxgauriVarshney8
 
SE-coupling and cohesion.ppt
SE-coupling and cohesion.pptSE-coupling and cohesion.ppt
SE-coupling and cohesion.pptvishal choudhary
 
effective modular design.pptx
effective modular design.pptxeffective modular design.pptx
effective modular design.pptxDr.Shweta
 
System software design1
System software design1System software design1
System software design1PrityRawat2
 
session on pattern oriented software architecture
session on pattern oriented software architecturesession on pattern oriented software architecture
session on pattern oriented software architectureSUJOY SETT
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dineshDinesh Kumar
 
Sharbani Bhattacharya SE design & Implementation
Sharbani Bhattacharya SE design & ImplementationSharbani Bhattacharya SE design & Implementation
Sharbani Bhattacharya SE design & ImplementationSharbani Bhattacharya
 
Couplingand cohesion student
Couplingand cohesion studentCouplingand cohesion student
Couplingand cohesion studentsaurabh kumar
 
Management information systems
Management information systemsManagement information systems
Management information systemsPeterson Zhou
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfDukeCalvin
 
Software design, software engineering
Software design, software engineeringSoftware design, software engineering
Software design, software engineeringRupesh Vaishnav
 
Shared information systems
Shared information systemsShared information systems
Shared information systemsHimanshu
 

Similar to Coupling coheshion tps (20)

EFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptxEFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptx
 
Software Design - SDLC Model
Software Design - SDLC ModelSoftware Design - SDLC Model
Software Design - SDLC Model
 
Se 381 - lec 22 - 24 - 12 may15 - modularity - i - coupling
Se 381 - lec 22 - 24  - 12 may15 - modularity - i - couplingSe 381 - lec 22 - 24  - 12 may15 - modularity - i - coupling
Se 381 - lec 22 - 24 - 12 may15 - modularity - i - coupling
 
Effective Software Design
Effective Software Design Effective Software Design
Effective Software Design
 
Software Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptxSoftware Eng S3 ( Software Design ).pptx
Software Eng S3 ( Software Design ).pptx
 
SE-coupling and cohesion.ppt
SE-coupling and cohesion.pptSE-coupling and cohesion.ppt
SE-coupling and cohesion.ppt
 
effective modular design.pptx
effective modular design.pptxeffective modular design.pptx
effective modular design.pptx
 
System software design1
System software design1System software design1
System software design1
 
Ch 11-component-level-design
Ch 11-component-level-designCh 11-component-level-design
Ch 11-component-level-design
 
session on pattern oriented software architecture
session on pattern oriented software architecturesession on pattern oriented software architecture
session on pattern oriented software architecture
 
Programming in the large
Programming in the largeProgramming in the large
Programming in the large
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dinesh
 
Sharbani Bhattacharya SE design & Implementation
Sharbani Bhattacharya SE design & ImplementationSharbani Bhattacharya SE design & Implementation
Sharbani Bhattacharya SE design & Implementation
 
Couplingand cohesion student
Couplingand cohesion studentCouplingand cohesion student
Couplingand cohesion student
 
Management information systems
Management information systemsManagement information systems
Management information systems
 
Week4 grasp-into
Week4 grasp-intoWeek4 grasp-into
Week4 grasp-into
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdf
 
Software design, software engineering
Software design, software engineeringSoftware design, software engineering
Software design, software engineering
 
CPP19 - Revision
CPP19 - RevisionCPP19 - Revision
CPP19 - Revision
 
Shared information systems
Shared information systemsShared information systems
Shared information systems
 

More from Preeti Mishra

Effective Ways to Conduct Programming labs
Effective Ways to Conduct Programming labsEffective Ways to Conduct Programming labs
Effective Ways to Conduct Programming labsPreeti Mishra
 
Unit 8 software quality and matrices
Unit 8 software quality and matricesUnit 8 software quality and matrices
Unit 8 software quality and matricesPreeti Mishra
 
Unit 7 performing user interface design
Unit 7 performing user interface designUnit 7 performing user interface design
Unit 7 performing user interface designPreeti Mishra
 
testing strategies and tactics
 testing strategies and tactics testing strategies and tactics
testing strategies and tacticsPreeti Mishra
 
requirements analysis and design
requirements analysis and designrequirements analysis and design
requirements analysis and designPreeti Mishra
 
Design process interaction design basics
Design process interaction design basicsDesign process interaction design basics
Design process interaction design basicsPreeti Mishra
 
Design process design rules
Design process  design rulesDesign process  design rules
Design process design rulesPreeti Mishra
 
Design process evaluating interactive_designs
Design process  evaluating interactive_designsDesign process  evaluating interactive_designs
Design process evaluating interactive_designsPreeti Mishra
 
Foundations understanding users and interactions
Foundations  understanding users and interactionsFoundations  understanding users and interactions
Foundations understanding users and interactionsPreeti Mishra
 
Software testing part
Software testing partSoftware testing part
Software testing partPreeti Mishra
 

More from Preeti Mishra (20)

Effective Ways to Conduct Programming labs
Effective Ways to Conduct Programming labsEffective Ways to Conduct Programming labs
Effective Ways to Conduct Programming labs
 
Component diagram
Component diagramComponent diagram
Component diagram
 
Activity diag
Activity diagActivity diag
Activity diag
 
Object diagram
Object diagramObject diagram
Object diagram
 
Sequence diagrams
Sequence diagramsSequence diagrams
Sequence diagrams
 
State chart diagram
State chart diagramState chart diagram
State chart diagram
 
Use case Diagram
Use case DiagramUse case Diagram
Use case Diagram
 
Unit 8 software quality and matrices
Unit 8 software quality and matricesUnit 8 software quality and matrices
Unit 8 software quality and matrices
 
Unit 7 performing user interface design
Unit 7 performing user interface designUnit 7 performing user interface design
Unit 7 performing user interface design
 
testing strategies and tactics
 testing strategies and tactics testing strategies and tactics
testing strategies and tactics
 
requirements analysis and design
requirements analysis and designrequirements analysis and design
requirements analysis and design
 
Design process interaction design basics
Design process interaction design basicsDesign process interaction design basics
Design process interaction design basics
 
Design process design rules
Design process  design rulesDesign process  design rules
Design process design rules
 
Design process evaluating interactive_designs
Design process  evaluating interactive_designsDesign process  evaluating interactive_designs
Design process evaluating interactive_designs
 
Foundations understanding users and interactions
Foundations  understanding users and interactionsFoundations  understanding users and interactions
Foundations understanding users and interactions
 
IntrIntroduction
IntrIntroductionIntrIntroduction
IntrIntroduction
 
Analysis
AnalysisAnalysis
Analysis
 
Software testing part
Software testing partSoftware testing part
Software testing part
 
Object modeling
Object modelingObject modeling
Object modeling
 
Introduction
IntroductionIntroduction
Introduction
 

Recently uploaded

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call 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
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
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
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
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
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
(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
 
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
 
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
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 

Recently uploaded (20)

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
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
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
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
 
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...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
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
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
(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...
 
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
 
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
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 

Coupling coheshion tps

  • 1. Think Pair ShareThink Pair Share ActivityActivity Course Instructor Preeti Mishra
  • 3. About TPS • For a given topic “The class needs to” : 1. Think/ explore/find 2. Pair up with similar topic people and discuss your ideas 3. Share the conclusions in class • This exercise is worth 10 points and will be accordingly counted in your term work!!
  • 4. So lets Begin…So lets Begin…
  • 5. Some Design Goals • Extension – facilitate adding features • Change – facilitate changing requirements • Simplicity – make easy to understand – make easy to implement • Efficiency – attain high speed: execution and/or compilation – attain low size: runtime and/or code base
  • 6. Coupling • The degree of interdependence between two modules” • We aim to minimise coupling - to make modules as independent as possible Low coupling can be achieve by:​ – eliminating unnecessary relationships – reducing the number of necessary relationships – easeing the ‘tightness’ of necessary relationships
  • 7. Definition of Coupling • The fewer the connection, the less chance there is for the ripple effect. – Ideally, changing one component should not require a change in another. – Should not have to understand details of one component in order to change another (c.f.principle of locality).
  • 8. Coupling Principles • Create narrow connections • Create direct Connections • Create local connections • Create obvious connections • Create flexible connections
  • 9. Narrow (vs. Broad) Connections • The breadth of connections is number of connections that link two components. – A connection that passes 15 pieces of information from one component to another is broader than a connection in which only two are passed. – The greater the number of parameters in a method call the broader the connection
  • 10. Direct vs. Indirect Connections • A direct connection is one in which the interface between two components can be understood without having to refer to other pieces of information. – A method definition including pre- and postconditions has a more direct interface than one that does not.
  • 11. Local vs. Remote Connections • Local Connection – All information required to understand the connection is present in the connection itself. • Remote Connection – Coupled through global data. – May be hundreds of lines removed from a call point. – May be remote in time.
  • 12. Flexible Connections • Systems evolve over time. – information being passed changes. – May want to switch to a different logical or physical devices
  • 13. Types of Coupling 1. Data coupling       (Most Required)                           2. Stamp coupling   3. Control coupling   4. Hybrid coupling   5. Common coupling   6. Content coupling  (Least Required)
  • 14. Normal Coupling • Two components, A and B, are normally coupled if – A calls B – B returns to A – All information passed between them is by parameters in the call (or a return). • Types of Normal Coupling – Data Coupling – Stamp Coupling – Control Coupling
  • 15. Data Coupling • Keep interfaces as narrow as possible. • Avoid tramp data: – Data passed from component to component that is unwanted and meaningless to most.
  • 16. Stamp coupling • A composite data is passed between modules   • Internal structure contains data not used   • Bundling - grouping of unrelated data into an artificial structure
  • 17. Stamp coupling warnings Do not pass aggregate structures containing many fields when only one or two are needed by callee. – You do not want to couple caller to the structure of the aggregate. – Creates dependencies between otherwise unrelated components. • Do not bundle unrelated data.
  • 18. Control coupling • A module controls the logic of another module through the parameter   • Controlling module needs to know how the other module works - not flexible
  • 19. Common coupling Use of global data as communication between modules  Common (Global) Coupling • Two components are common coupled if they refer to the same global data area. • This is an undesirable form of coupling. • Defect in one component using common global data can affect others. • Introduces remoteness (with respect to time). Dangers of: ripple effect inflexibility   difficult to understand the use of data
  • 20. Content coupling Two components exhibit content coupling if one refers to the internals of the other in any way. • This form of coupling is unacceptable. It forces you to understand the semantics implemented in another component
  • 21. • Hybrid coupling • A subset of data used as control   • Example: account numbers 00001 to 99999 ​ • If 90000 - 90999, send mail to area code of last 3 digit (000 - 999)
  • 22. Determine Coupling Type • Ask: – Can programmers work independently? To what degree? – What may change that may cause changes to multiple components? • A pair of components may be coupled in more than one way: – Their coupling is determined by their worst type that they exhibit.
  • 23. “Good” vs. “bad” coupling • Modules that are loosely coupled (or uncoupled) are better than those that are tightly coupled • Why? Because of the objective of modules to help with human limitations • The more tightly coupled are two modules, the harder it is to think about them separately, and thus the benefits become more limited
  • 24. Effects of Object Technology on Coupling • Object Technology adds additional relationships that often result in increased coupling. • Proper application of design principles can reduce the complexity often found in procedural programs. – E.g. effective use of access control can eliminate common coupling.
  • 25. Cohesion • “The measure of the strength of functional relatedness of elements within a module”  • Elements: instructions, groups of instructions, data definition, call of another module                                                         ​ • We aim for strongly cohesive modules • Everything in module should be related to one another - focus on the task   • Strong cohesion will reduce relations between modules - minimise coupling
  • 26. Seven levels of cohesion 1. • Coincidental (Worst Maintainability) 2. • Logical 3. • Temporal 4. • Procedural 5. • Communicational 6. • Sequential 7. • Functional (Best Maintainability) Type of cohesion no. Assigned to roll no. 1 12,39 2 15,38 3 17,37 4 21,36,40 5 2434, 6 26,31 7 27,30
  • 27. Functional cohesion • All elements contribute to the execution of one and only one problem-related task   • Focussed - strong, single-minded purpose   • No elements doing unrelated activities ​ • Examples of functional cohesive modules: – Compute cosine of angle   – Read transaction record   – Assign seat to airline passenger
  • 28. Sequential cohesion • Elements are involved in activities such that output data from one activity becomes input data to the next  • Usually has good coupling and is easily maintained  • Not so readily reusable because activities that will not in general be useful together  • Example of Sequential Cohesion  – module format and cross-validate record  –    use raw record  –     format raw record  –    cross-validate fields in raw record  –    return formatted cross-validated record •                  
  • 29. Communicational Cohesion • Elements contribute to activities that use the same input or output data   • Not flexible, for example, if we need to focus on some activities and not the others   • Possible links that cause activities to affect each other   • Better to split to functional cohesive ones  
  • 30. Procedural cohesion • Elements are related only by sequence, otherwise the activities are unrelated   • Similar to sequential cohesion, except for the fact that elements are unrelated   • Commonly found at the top of hierarchy, such as the main program module  
  • 31. Temporal cohesion • Elements are involved in activities that are related in time   • Commonly found in initialisation and termination modules   • Elements are basically unrelated, so the module will be difficult to reuse   • Good practice is to initialise as late as possible and terminate as early as possible  
  • 32. Logical cohesion • Elements contribute to activities of the same general category (type)   • For example, a report module, display module or I/O module   • Usually have control coupling, since one of the activities will be selected  
  • 33. Coincidental cohesion • Elements contribute to activities with no meaningful relationship to one another   • Similar to logical cohesion, except the activities may not even be the same type   • Mixture of activities - like ‘rojak’!   • Difficult to understand and maintain, with strong possibilities of causing ‘side effects’ every time the module is modified
  • 34.
  • 35. “Good” vs. “bad” cohesion • Bergland talks about different levels of cohesion – Best: functional, where the elements collectively provide a specific behavior or related behaviors – Worst: coincidental, where the elements are collected for no reason at all • Many other levels in between • Cohesion is not measurable quantitatively
  • 36. Cohesion and Coupling 1 2 3 4 5 6High cohesion Low couplingBridge component component  
  • 37. Cohesion and Coupling 1 2 3 4 5 6High cohesion Low coupling High coupling Bridge component component component    Steel truss