Coupling And Cohesion In Software Engineering Ppt

Coupling: Two modules are considered independent if one can function completely without the presence of other. Obviously, if two modules are independent, they are solvable and modifiable separately. However, all the modules in a system cannot be independent of each other, as they must interact so that together they produce the desired external behavior of the system.

  1. Cohesion And Coupling Difference
  2. Coupling And Cohesion In Software Engineering Ppt Presentation
  3. Coupling And Cohesion In Software Engineering Ppt Free
  • High cohesion is generally used in support of low coupling. High cohesion means that the responsibilities of a given element are strongly related and highly focused. Breaking programs into classes and subsystems is an example of activities that increase the cohesive properties of a system.
  • CSE3308 - Software Engineering: Analysis and Design, 2005 Lecture 5A.6 Software Engineering: Analysis and Design. Structured Design Lecture Outline. The Structure Chart Qualities of Good Design Coupling Cohesion Factoring Fan-out Fan-in Transform Analysis The Structure Chart - 1. Principal tool of Structured Design.

The more connections between modules, the more dependent they are in the sense that more knowledge about one module is required to understand or solve the other module. Hence, the fewer and simpler the connections between modules, the easier it is to understand one without understanding the other. Coupling between modules is the strength of interconnection between modules or a measure of independence among modules.

To solve and modify a module separately, we would like the module to be loosely coupled with other modules. The choice of modules decides the coupling between modules. Coupling is an abstract concept and is not easily quantifiable. So, no formulas can be given to determine the coupling between two modules. However, some major factors can be identified as influencing coupling between modules.

Among them the most important are the type of connection between modules, the complexity of the interface, and the type of information flow between modules. Coupling increase with the complexity and obscurity of the interface between modules. To keep coupling low we would like to minimize the number of interfaces per module and the complexity of each interface. An interface of a module is used to pass information to and from other modules. Complexity of the interface is another factor affecting coupling.

The more complex each interface is, higher will be the degree of coupling. The type of information flow along the interfaces is the third major factor-affecting coupling. There are two kinds of information that can flow along an interface: data or control, Passing or receiving control information means that the action of the module will depend on this control information, which makes it more difficult to understand the module and provide its abstraction. Transfer of data information means that a module passes as input some data to another module and gets in return some data as output.

Cohesion: Cohesion is the concept that tries to capture this intra-module. With cohesion we are interested in determining how closely the elements of a module are related to each other. Cohesion of a module represents how tightly bound the internal elements of the module are to one another. Cohesion of a module gives the designer an idea about whether the different elements of a module belong together in the same module. Cohesion and coupling are clearly related. Usually the greater the cohesion of each module in the system, the lower the coupling between modules is. There are several levels of Cohesion:

Coincidental

Cohesion Cohesion is an intramodule concept Focuses on why elements are together Only elements tightly related should exist together in a module (class) This gives a module a clear abstraction and makes it easier to understand Higher cohesion leads to lower coupling as many otherwise interacting elements are already contained in the module.

Logical

Temporal

Procedural

Communicational

Sequential

Functional

Coincidental is the lowest level, and functional is the highest. Coincidental Cohesion occurs when there is no meaningful relationship among the elements of a module. Coincidental Cohesion can occur if an existing program is modularized by chopping it into pieces and making different pieces modules.

A module has logical cohesion if there is some logical relationship between the elements of a module, and the elements perform functions that fill in the same logical class. A typical example of this kind of cohesion is a module that performs all the inputs or all the outputs. Temporal cohesion is the same as logical cohesion, except that the elements are also related in time and are executed together. Modules that perform activities like “initialization”, “clean-up” and “termination” are usually temporally bound.

A procedurally cohesive module contains elements that belong to a common procedural unit. For example, a loop or a sequence of decision statements in a module may be combined to form a separate module. A module with communicational cohesion has elements that are related by a reference to the same input or output data. That is, in a communicationally bound module, the elements are together because they operate on the same input or output data.

When the elements are together in a module because the output of one forms the input to another, we get sequential cohesion. Functional cohesion is the strongest cohesion. In a functionally bound module, all the elements of the module are related to performing a single function. By function, we do not mean simply mathematical functions; modules accomplishing a single goal are also included.

You’ll also like:

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.

Engineering

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.

Coupling And Cohesion In Software Engineering Ppt

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.

Cohesion And Coupling Difference

4. Control Coupling: In this type of coupling, one module controls the flow of another and passes information from one to another.

Coupling And Cohesion In Software Engineering Ppt Presentation

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.

Coupling And Cohesion In Software Engineering Ppt Free

7. Stamp Coupling: In this type of coupling, the data structure is used to transfer information from one component to another.