Modularity specifies the separation of concerned ‘components’ of the software which can be addressed and named separately. These separated components are referred to as ‘modules’. These modules can be integrated to satisfy the requirement of other software.
In this context, we will be discussing the concept of modularity in software design, why do we require modularity, classification of the components. We will wind up our discussion with the relevant terms coupling and cohesion along with the benefits of modularity.
Content: Modularity in Software Engineering
- Define Modularity
- Why Modularity?
- Classification of Components
- Coupling and Cohesion
- Benefits of Modularity
Modularity can be defined as a mechanism where a complex system is divided into several components that are referred to as ‘modules’. Now, whenever a customer requests to develop software we can use or integrate these modules to develop new software.
The required modules can be selected and integrated to develop new software in this way, we can customize the software according to users need.
Consider an example, we all have been playing Legos to build different structures. Here we have several components i.e. blocks which we integrate to build the structure that we want to.
Similarly, we can break the complex codes into different components and using or integrating those components you can create a new program to develop new software.
Consider that if we have to divide an automobile into several subsystems then the components or subsystems would be: engines, breaks, wheels, chassis etc.
To understand the importance of modularity, consider that we have a monolithic software that has a large program including a single module. Now if we ask any software engineer to understand this large program, then it is not that easy for him to do so.
There will be a lot of local variables, global variables their span of reference, several control paths etc. This will increase the complexity of the large program making it hard to digest. As a solution to this, the large program must be divided into several components or modules as it will become easy to understand the modules.
If you subdivide software into infinite components or modules it will reduce the efforts required to develop software. But this is going to revert somewhere.
As we are saying that effort or the developing cost will get reduced with the increase in modules. But as the number, if modules get increased, the cost required to integrate the several modules also get increased.
So, you must be careful while modularizing the software. The software should neither be left as un-modularized nor it must be over-modularized.
Now, with modularity when you try to develop software using the modules that are independent of each other and has very few references to each other then you have to be conscious at all the stages of software development such as:
1. Architectural Design
In the architectural design phase, the large-scale structure of the software is determined. You have to be very careful while creating modularity at this phase as you have to the entire logical structure of the software.
2. Components Design
If you have created modularity in the architectural design of the software it becomes easy to figure out and design the individual components. The modular components have a well-defined purpose and they have a few connections with the other components.
If the components are designed using modularity then it becomes easy to track them down. You can easily debug which component is responsible for the error.
Now as we say that the components have little connection to other components of the software so correcting a single component will not have an adverse effect on the other component.
Once the components are integrated to develop software it becomes almost impossible to test the entire software at once. Testing one component at a time is much easier.
Maintenance is a process of fixing or enhancing the system, to perform according to users need. Here also modularity plays a vital role. As making changes to a module must not affect another connected module in the system.
6. Independent Development
Software is never developed by one person. There is a team of people who develop the software in terms of modules and components. Each person in a team is assigned to develop an individual component that’s why they also have to take care that the interfaces between the components are few and all of them are clear.
7. Damage Control
If the connection between the components of the system is few and clear then the error in one component will not spread damage to the other components of the system.
8. Software Reuse
Good modularity makes you reuse the component of the earlier software. The reusable components must:
- Provide some useful service.
- It must perform a single function.
- Have few and clear connections to other components in the systems.
Classification of Components
As modularity speaks of dividing a system into subsystems, components or modules. The components of software can be classified into:
- Computation-only: The computation-only component is the module that performs calculations or some computations requested by the user. Well, the data used or produced during the computation does not retain in the computation-only component during subsequent uses.
- Memory: The memory component of the software stores data and this data is beyond the life of a program or other component.
- Manager: Manager components of a program can be the abstract data type such as stacks or queues. These components manage and maintain the data and operations performed on this data.
- Controller: The controller component of the software controls when and how should the other components of the software interact with each other.
- Link: The link components of the software are responsible for transferring the data between the interacting components.
Coupling and Cohesion
Coupling and cohesion are the terms that we come across when we study the interaction between the components or within the component of the software.
As we have seen above that any software that we develop is developed by integrating several components that satisfy the user’s requirement.
While integrating the components we must take care that there must be minimum interaction between the components of the software which we refer to as low coupling. And there must be more interaction within the component which we refer to as high cohesion.
Benefits of Modularity
- Modularity let the development of software be divided into several components that can be implemented simultaneously by the team of developers. This minimizes the time that is required to develop software.
- Modularity makes the components of the software reusable.
- As modularity breaks the large complex program into components, it improves manageability. As it is easy to develop, test, and maintain the small components.
- It is also easy to debug and trace the error in modular programs.
So, this is all about modularity in software engineering. We have seen the importance of modularity and how it can be used to develop efficient software. We have also learned about the term cohesion and coupling plays an important role in creating good modularity and we have ended up discussing the benefits of modularity.