Modularity
- The modularity principle is the essential software design principle. According to that, Systems should be built from cohesive, loosely coupled components.
- A cohesive part has a well-defined function or purpose. If their interdependencies are minimized, then elements will be loosely coupled. And hence they are easy to understand, reuse, and replace.
-
It is a structural principle used to manage complexity in systems. It involves identifying functional clusters of similarity in designs and transforming the groups into interdependent self-contained systems (modules).
The main properties of a modular system are:-
- Modules are simpler from the outside than inside.
- Each module is a well-defined system that can be used with other applications.
- Modules must be easier to use than to build.
- Modules must be easier to use than to build.
Hence, it is clear from above that modular design reduces design complexity and results in easier and faster implementation by allowing parallel development of various parts of a system.
Cohesion
It refers to the degree of intra-dependability inside elements of the module. The program design will be better if the cohesion is greater.
It is mainly of seven types:
-
Functional cohesion
It is considered the highest degree of cohesion, and it is highly expected. Elements of modules in functional cohesion are grouped because they all contribute to a single well-defined function. It can also be reused.
-
Sequential cohesion
When elements of a module are grouped because the output of one piece serves as input to another, it is called sequential cohesion.
-
Communicational cohesion
When elements of the module are grouped, executed sequentially, and work on the same data (information), it is called communicational cohesion.
-
Procedural cohesion
When elements of a module are grouped executed sequentially to perform a task, it is called procedural cohesion.
-
Temporal Cohesion
When elements of a module are organized to be processed at a similar point in time, it is called temporal cohesion.
-
Logical cohesion
When logically categorized details are put together into a module, it is called logical cohesion.
-
Co-incidental cohesion -
It results from breaking the program into smaller modules for modularization. Because it is incidental, it may confuse the programmers and is generally not accepted.
So now you get the idea of cohesion in Software Engineering. There is another concept that is used with cohesion, known as coupling.
Coupling
It refers to the level of inter-dependability among modules of a program. It states at what level the modules interfere and interact with each other—the lower the coupling, the better the program.
There are five levels of coupling:
-
Data coupling
It occurs when two modules interact utilizing passing data (as a parameter). The receiving module must use all its components in case of a module passes data structure as a parameter.
-
Stamp coupling
When multiple modules share a typical data structure and work on a different part, it is called stamp coupling.
-
Control coupling
When one of them among the two modules decides to change its flow of execution, then it is called control-coupled.
-
Common coupling
When they have read and write access to some global data, it is called common or global coupling.
-
Content coupling
When a module can directly modify or access or refer to the content of another module, it is called content level coupling.
Among all of them, Data coupling is considered best since it occurs when methods share data regularly through parameters. The module takes precisely what it needs without knowing the format of a particular data structure. The content coupling is considered worst as in this type, and one module can alter the data of another module or control flow when it is passed from one module to the other.
FAQs
-
What is the role of design principles in Software Engineering design?
The role of design principles in Software Engineering design is to arrange and organize the structural components of Software Engineering design.
-
What are the software design pattern types?
Software design pattern types are Structural Design patterns, Creational Design patterns, and Behavioral Design Pattern are the types of design patterns.
-
What are the 5 OOP principles?
The 5 OOP principles are open-closed, single responsibility, interface segregation, Liskov substitution, and dependency inversion principle.
-
How is software design different from coding?
The computer uses software and instructions designed to perform well-defined functions and allow users to perform a specific task. At the same time, coding is a language written using language protocol to develop apps, software, etc.
-
Which two activities are related to software design concepts?
Software requirements analysis and software coding and testing are two activities are related to software design concepts.
Key Takeaways
In this article, we learned about different types of software design principles, we learned about Modularity with its properties. At the end of this blog, we also discussed cohesion and coupling.
Recommended Readings:
You can also consider our System Design Course to give your career an edge over others.