Explain different types of cohesion and coupling in system design.
Question
Explain different types of cohesion and coupling in system design.
Solution
Cohesion and coupling are two key characteristics that are used to evaluate the quality of a system design. They are often used in the context of object-oriented programming and software engineering.
-
Cohesion: Cohesion refers to the degree to which the elements of a module belong together. In other words, it measures the single-mindedness of a module. There are seven types of cohesion, listed from worst to best:
- Coincidental cohesion: It's when parts of a module are grouped arbitrarily.
- Logical cohesion: It's when parts of a module are grouped because they are logically categorized to do the same thing.
- Temporal cohesion: It's when parts of a module are grouped by when they are processed - the time they are processed.
- Procedural cohesion: It's when parts of a module are grouped because they always follow a certain sequence of execution.
- Communicational cohesion: It's when parts of a module are grouped because they operate on the same data (i.e., they communicate with the same data).
- Sequential cohesion: It's when parts of a module are grouped such that the output from one part is the input to another part like a pipeline.
- Functional cohesion: It's when parts of a module are grouped because they all contribute to a single well-defined task.
-
Coupling: Coupling is the degree to which one module depends on the other modules of a program. It is a measure of the strength of the interconnections between modules. There are five levels of coupling, listed from best to worst:
- No coupling: Modules do not communicate at all.
- Data coupling: Modules communicate using only data parameters.
- Stamp coupling: Modules communicate using composite data structures.
- Control coupling: One module controlling the flow of another, by passing it information on what to do.
- Content coupling: When one module uses the code of another module, such as a branch.
In general, a good system design will aim for high cohesion (preferably functional cohesion) and low coupling (preferably no coupling or data coupling).
Similar Questions
Discuss 2 reasons as to why low Coupling and high Cohesion result in systems that are easier to reuse and maintain. One to two sentences for each reason.
Choose the most accurate answer: Cohesion describes...1 pointdecomposability.how changes do not cross boundaries of modules.loose coupling.how well everything within a module fits together.
Stack operations representsOptions :common couplingProcedural Cohesionstamp couplingCommunicational Cohesion
One piece of code runs after the other. This is an example of what type of cohesion?1 pointProcedural cohesionLogical association cohesionCoincidental cohesionTemporal cohesion
High coupling, low cohesion
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.