- Coupling And Cohesion In Software Engineering Ppt Download
- Coupling And Cohesion In Software Engineering Ppt Slideshare
Cohesion: Cohesion can be defined as the degree of the closeness of the relationship between its components. In general, it measures the relationship strength between the pieces of functionality within a given module in the software programming. It is an ordinal type of measurement, which is described as low cohesion or high cohesion.
In a good module, the various parts having high cohesion is preferable due to its association with many desirable traits of the software such as reliability, re-usability, robustness and understand-ability.
Jul 30, 2018 Software Engineering Coupling and Cohesion Introduction: The purpose of Design phase in the Software Development Life Cycle is to produce a solution to a problem given in the SRS(Software Requirement Specification) document. Coupling And Cohesion In Software Engineering Ppts Designers tend to design modules such that they can be executed and/or compiled separately and independently. Modular design unintentionally follows the rules of. Software engineering → Try to find a better way to. The goal of modular design is to minimize coupling and maximize cohesion. Informational Cohesion. Informational cohesion describes a module as performing a number of actions, each with a unique entry point, independent code for each action, and all operations are performed on the same data. – In informational cohesion, each function in a module can perform exactly one action. Coupling and Cohesion Design Prof. Akila Victor Modularization. Modularization is the process of dividing a software system into multiple independent modules where each module works independently. There are many advantages of Modularization in software engineering. Some of these are given below: – Easy to understand the system.
On the other hand, a low cohesion is associated with the undesirable traits, including difficulty in maintaining, reusing and understanding. If the functionalities embedded in a class have much in common, then the cohesion will be increased in a system.
High cohesion leads to the increased module re-usability because the developers of the application will easily find the component they look for in the cohesive set of operations offered by the module.
The system maintainability will be increased due to logical changes in the domain effecting fewer modules.The module complexity also reduces, when there is a high cohesion in the programming.
i. Coincidental cohesion: the parts of a component are not related but simply bundled into a single component. Harder to understand and not reusable.
ii. Logical association: similar functions such as input, error handling, etc. put together. Functions fall in same logical class. May pass a flag to determine which ones executed. Interface difficult to understand. Code for more than one function may be intertwined, leading to severe maintenance problems. Difficult to reuse
iii. Temporal cohesion: all of statements activated at a single time, such as start up or shut down, are brought together. Initialization, clean up. Functions weakly related to one another, but more strongly related to functions in other modules so may need to change lots of modules when do maintenance.
iv. Procedural cohesion: a single control sequence, e.g., a loop or sequence of decision statements. Often cuts across functional lines. May contain only part of a complete function or parts of several functions. Functions still weakly connected, and again unlikely to be reusable in another product.
v. Communicational cohesion: operate on same input data or produce same output data. May be performing more than one function. Generally acceptable if alternate structures with higher cohesion cannot be easily identified. Still problems with reusability.
vi. Sequential cohesion: output from one part serves as input for another part. May contain several functions or parts of different functions.
vii. Informational cohesion: performs a number of functions, each with its own entry point, with independent code for each function, all performed on same data structure. Different than logical cohesion because functions not intertwined.
viii. Functional cohesion: each part necessary for execution of a single function. e.g., compute square root or sort the array. Usually reusable in other contexts. Maintenance easier.
ix. Type cohesion: modules that support a data abstraction. Not strictly a linear scale. Functional much stronger than rest while first two much weaker than others. Often many levels may be applicable when considering two elements of a module. Cohesion of module considered as highest level of cohesion that is applicable to all elements in the module.
Coupling: In software engineering, the coupling can be defined as the measurement to which the components of the software depend upon each other. Normally, the coupling is contrasted with the cohesion. If the system has a low coupling, it is a sign of a well-structured computer system and a great design.
A low coupling combined with the high cohesion, it supports the mission of high readability and maintainability. The coupling term generally occurs together with the cohesion very frequently. The coupling is an indication of the strength of the interconnection between all the components in a system. The highly coupled systems have interconnections, in which the program units depend upon each other, whereas in the loosely coupled systems made up of components that are independent of each other and have no dependence on each other.
1. Content Coupling: Content Coupling is the highest type of coupling which occurs when one of the module relies on the other module’s internal working. It means a change in the second module will lead to the changes in the dependent module.
2. Common Coupling: It is the second highest type of coupling also known as Global Coupling. It occurs when the same global data are shared by the two modules. In this, the modules will undergo changes if there are changes in the shared resource.
3. External Coupling: This type of coupling occurs when an external imposed data format and communication protocol are shared by two modules. External Coupling is generally related to the communication to external devices.
4. Control Coupling: In this type of coupling, one module controls the flow of another and passes information from one to another.
5. Message Coupling: This type of coupling can be achieved by the state decentralization. It is the loosest type of coupling, in which the component communication is performed through message passing.
6. Data Coupling: The modules are connected by the data coupling, if only data can be passed between them.
7. Stamp Coupling: In this type of coupling, the data structure is used to transfer information from one component to another.
COUPLING
An indication of the strength of interconnections between program units.Highly coupled have program units dependent on each other. Loosely coupledare made up of units that are independent or almost independent.
Modules are independent if they can function completely without the presence ofthe other. Obviously, can't have modules completely independent of each other.Must interact so that can produce desired outputs. The more connectionsbetween modules, the more dependent they are in the sense that more infoabout one modules is required to understand the other module.
Three factors: number of interfaces, complexity of interfaces, type ofinfo flow along interfaces.
Want to minimize number of interfaces between modules, minimize thecomplexity of each interface, and control the type of info flow. An interface of a module is used to pass information to and from other modules.
In general, modules tightly coupled if they use shared variables or if they exchange control info.
Loose coupling if info held within a unit and interface with other unitsvia parameter lists. Tight coupling if shared global data.
If need only one field of a record, don't pass entire record. Keep interfaceas simple and small as possible.
Two types of info flow: data or control.
- Passing or receiving back control info means that the action of themodule will depend on this control info, which makes it difficult tounderstand the module.
- Interfaces with only data communication result in lowest degree ofcoupling, followed by interfaces that only transfer control data. Highest ifdata is hybrid.
- Content coupling: if one directly references the contents of the other.
When one module modifies local data values or instructions in anothermodule. (can happen in assembly language)
if one refers to local data in another module.
if one branches into a local label of another.
- Common coupling: access to global data.
modules bound together by global data structures.
- Control coupling: passing control flags (as parameters or globals) sothat one module controls the sequence of processing steps in another module.
- Stamp coupling: similar to common coupling except that global variablesare shared selectively among routines that require the data. E.g., packagesin Ada. More desirable than common coupling because fewer modules will haveto be modified if a shared data structure is modified. Pass entire datastructure but need only parts of it.
- Data coupling: use of parameter lists to pass data items between routines.
COHESION
Measure of how well module fits together.A component should implement a single logical function or single logical entity. All the parts should contribute to the implementation.
Coupling And Cohesion In Software Engineering Ppt Download
Many levels of cohesion:
- Coincidental cohesion: the parts of a component are not related butsimply bundled into a single component.
harder to understand and not reusable.
- Logical association: similar functions such as input, error handling,etc. put together. Functions fall in same logical class. May pass aflag to determine which ones executed.
interface difficult to understand. Code for more than one function may be intertwined, leading to severe maintenance problems. Difficult to reuse
- Temporal cohesion: all of statements activated at a single time, suchas start up or shut down, are brought together. Initialization, clean up.
Functions weakly related to one another, but more strongly related to functions in other modules so may need to change lots of modules when do maintenance.
- Procedural cohesion: a single control sequence, e.g., a loop or sequenceof decision statements. Often cuts across functional lines. May containonly part of a complete function or parts of several functions.
Functions still weakly connected, and again unlikely to be reusable in another product.
- Communicational cohesion: operate on same input data or produce sameoutput data. May be performing more than one function. Generally acceptableif alternate structures with higher cohesion cannot be easily identified.
still problems with reusability.
- Sequential cohesion: output from one part serves as input for anotherpart. May contain several functions or parts of different functions.
- Informational cohesion: performs a number of functions, each with its ownentry point, with independent code for each function, all performed on samedata structure. Different than logical cohesion because functions not intertwined.
- Functional cohesion: each part necessary for execution of a singlefunction. e.g., compute square root or sort the array.
Usually reusable in other contexts. Maintenance easier.
- Type cohesion: modules that support a data abstraction.
Not strictly a linear scale. Functional much stronger than rest while firsttwo much weaker than others. Often many levels may be applicable whenconsidering two elements of a module. Cohesion of module considered ashighest level of cohesion that is applicable to all elements in the module.