Differences between Coupling and Cohesion - Software Engineering
Last Updated :
03 Jan, 2025
Coupling and Cohesion are two key concepts in software engineering that are used to measure the quality of a software system’s design. Both coupling and cohesion are important factors in determining the maintainability, scalability, and reliability of a software system. High coupling and low cohesion can make a system difficult to change and test, while low coupling and high cohesion make a system easier to maintain and improve.
Coupling vs CohesionWhat is Cohesion?
Cohesion refers to the degree to which elements within a module work together to fulfill a single, well-defined purpose. High cohesion means that elements are closely related and focused on a single purpose, while low cohesion means that elements are loosely related and serve multiple purposes.
Types of Cohesion
The following are the types of cohesion:
- Functional Cohesion
- Procedural Cohesion
- Temporal Cohesion:
- Sequential Cohesion.
- Layer Cohesion.
- Communication Cohesion.
Types of CohesionWhat is Coupling
Coupling refers to the degree of interdependence between software modules. High coupling means that modules are closely connected and changes in one module may affect other modules. Low coupling means that modules are independent, and changes in one module have little impact on other modules.
Types of Coupling
Following are the types of Coupling:
- Data Coupling
- Stamp Coupling
- Control Coupling
- External Coupling
- Common Coupling
- Content Coupling
Types of CouplingDifferences between Coupling and Cohesion
The differences between cohesion and coupling are given below:
Aspect | Cohesion | Coupling |
---|
Definition | Cohesion refers to the degree to which elements within a module work together to fulfill a single, well-defined purpose. | Coupling refers to the degree of interdependence between software modules. High coupling means that modules are closely connected and changes in one module may affect other modules. |
---|
Module Dependency | Cohesion is the concept of an intro-module. | Coupling is the concept of inter-module. |
---|
Purpose | Cohesion represents the relationship within a module. | Coupling represents the relationships between modules. |
---|
Quality | Increasing cohesion is good for software. | Increasing coupling is avoided for software. |
---|
Focus | Cohesion represents the functional strength of modules. | Coupling represents the independence among modules. |
---|
Relationship | Highly cohesive gives the best software. | Whereas loosely coupling gives the best software. |
---|
Example | In cohesion, the module focuses on a single thing. | In coupling, modules are connected to the other modules. |
---|
Creation | Cohesion is created between the same module. | Coupling is created between two different modules. |
---|
Types | Types of Cohesion - Functional Cohesion.
- Procedural Cohesion.
- Temporal Cohesion.
- Sequential Cohesion.
- Layer Cohesion.
- Communication Cohesion.
| Types of Coupling - Data Coupling
- Stamp Coupling
- Control Coupling
- External Coupling
- Common Coupling
- Content Coupling
|
---|
Example of High Cohesion and Low Coupling
Below diagram shows the example of high cohesive and low coupling:
High Cohesive and Low CouplingExplanation
High Cohesion: User Module
The User Module is designed to handle all user-related functionalities:
- Attributes: It has attributes like
id
, name
, and email
. - Functions: It includes functions such as
register()
, login()
, and logout()
.
Why is it high cohesion?
- Single Purpose: All the functions in the User Module are related to managing users. This means everything in this module is focused on one specific task - handling user operations.
Low Coupling: Book and Member Modules
The Library System consists of two separate modules: Book
and Member
.
- Book Module:
- Attributes: It has attributes like
title
and author
. - Functions: It includes functions such as
addBook()
and removeBook()
.
- Member Module:
- Attributes: It has attributes like
memberId
and memberName
. - Functions: It includes functions such as
addMember()
and removeMember()
.
Why is it low coupling?
- Independent Modules: The Book and Member modules operate independently. They have their own specific functions and attributes and don’t need to know the internal workings of each other.
- Minimal Interaction: The only interaction is through simple actions like borrowing a book or managing memberships, but they don't rely on each other for their main tasks.
Important Questions on Coupling vs Cohesion
1. In the context of modular software design, which one of the following combinations is desirable? [ ISRO CS 2017 - May ]
(A) High cohesion and high coupling
(B) High cohesion and low coupling
(C) Low cohesion and high coupling
(D) Low cohesion and low coupling
Solution: The Correct answer is (B)
(A) cohesion is functional and coupling is data type.
(B) cohesion is coincidental and coupling is data type.
(C) cohesion is sequential and coupling is content type.
(D) cohesion is functional and coupling is stamp type.
Solution: The Correct answer is (A)
3. Which of the following statement(s) is/are true with respect to software architecture ? S1 : Coupling is a measure of how well the things grouped together in a module belong together logically. S2 : Cohesion is a measure of the degree of interaction between software modules. S3 : If coupling is low and cohesion is high then it is easier to change one module without affecting others. [ UGC NET CS 2017 Jan - II ]
(A) Only S1 and S2
(B) Only S3
(C) All of S1, S2 and S3
(D) Only S1
Solution: The Correct answer is (B)
Similar Reads
Coupling and Cohesion - Software Engineering
The purpose of the Design phase in the Software Development Life Cycle is to produce a solution to a problem given in the SRS(Software Requirement Specification) document. The output of the design phase is a Software Design Document (SDD). Coupling and Cohesion are two key concepts in software engin
10 min read
Difference between Good Design and Bad Design in Software Engineering
The term design is used in two ways. While used as verb, it means - the design process and used as noun, it means- the result of design process. Design is a meaningful engineering representation of something that is to be built. The result of a design process is called as design model or the design
2 min read
Difference between Software Engineering and Computer Engineering
Software engineering and Computer engineering are two distinct disciplines that focus on different aspects of computer systems. While both fields require a strong foundation in computer science and mathematics, software engineering is focused on software development processes, while computer enginee
6 min read
Difference Between Technical Design and Conceptual Design in Software Engineering
What is Software Design?Software design is a process to convert the user requirements into client requirements user interface form, that helps the software developer in coding and implementation. The software design deals with portraying the client's requirement which is described in Software Requir
3 min read
Difference between System Engineer and Software Engineer
System Engineer and Software Engineer both have important roles in the IT industry. System Engineer and Software Engineer have some similarity such as involvement in the development of computer-based systems, but they have different roles and responsibilities. In this article, we will see the differ
3 min read
Difference Between Software Components and Connectors
In the field of software architecture and design, it is essential to comprehend the basic components of a system. Software components and connections are two essential ideas that are crucial to this field. These components serve as the foundation for the organization, communication, and functionalit
4 min read
Difference between Software Engineering process and Conventional Engineering Process
Software Engineering Process and Conventional Engineering Process, both are processes related to computers and development. In this article, we will see the similarities as well as differences between both, that is Software Engineering Process and the Conventional Engineering Process. Table of Conte
4 min read
Common Coupling in Software Engineering
What is Coupling? Coupling is simply a measure of the interdependence between multiple modules or we can say the dependence of two or more modules in a software development process. It addresses how programming parts are dependent on one another. For very much planned programming, there ought to be
3 min read
Difference between Generic Software Development and Custom Software Development
Software development can be broadly categorized into two approaches: Generic Software Development and Custom Software Development. These methodologies cater to different market needs and user requirements. These approaches differ significantly in terms of their target audience, level of customizatio
3 min read
Difference between Software and Program
Software and programs are closely related but have distinct roles in computing. Software is a collection of programs, procedures, and data that instructs a computer to perform specific tasks. Programs, on the other hand, are individual sets of instructions designed to accomplish particular functions
3 min read