Page 141 - DCAP305_PRINCIPLES_OF_SOFTWARE_ENGINEERING
P. 141

Unit 6: Functional Design



            6.8 Cohesion                                                                          Notes


            The degree to which all rudiments of a component are heading for towards a single task and
            all elements directed towards that task are contained in a single component. A Module with
            cohesion represents how the lightly bound the internal elements of the module are to one another.
            Whenever the Cohesion is greater, the coupling between the modules is lower. The internal
            Cohesion of a module is measured in terms of the strength of the hiding of the elements within
            the modules itself. In computer programming, cohesion is a measure of how well the lines of
            source code within a module work together to provide a specific piece of functionality. Cohesion
            is an ordinal type of measurement and is usually expressed as “high cohesion” or “low cohesion”
            when being discussed. Modules with high cohesion tend to be preferable because high cohesion
            is associated with several desirable traits of software including robustness, reliability, reusability,
            and understandability whereas low cohesion is associated with undesirable traits such as being
            difficult to maintain, difficult to test, difficult to reuse, and even difficult to understand. Cohesion
            is usually contrasted with coupling. High cohesion often correlates with low coupling, and vice
            versa. The software quality metrics of coupling and cohesion.
            6.8.1 Types of Cohesion

            There are many different levels of Cohesion are used in several levels of an module.

            Coincidental Cohesion: It is one level of cohesion. It occurs when the elements within a given
            module have no apparent relationship  to each other.  It  occurs  when an  existing  program is
            making different pieces of modules.
            Logical Cohesion: A Module has Logical Cohesion only if there is some Logical relationship
            between the elements of the module. The elements of the module perform functions which fall
            in the same logical class.

            Temporal Cohesion: This level cohesion is same as logical cohesion, the only different is that
            the elements are also related in time and are executed at the same time.
            Procedural Cohesion: This level Cohesion contains the elements which belong to a common
            procedural unit. Procedural Cohesion often cuts across functional lines.

            Communicational Cohesion: A Module which contains Communicational Cohesion has the
            elements that are related by a reference to the same Input or Output data.
            Sequential Cohesion: This Cohesion occurs only when the output of one element is the input
            for the next element.

            Functional Cohesion: This level Cohesion is the strongest cohesion when compared to other
            levels. In a functionally bound module, all the elements of the module are related to performing
            a single function.

            6.8.2 Cohesion: degree of dependence among components

            Enumerate different types of coupling and cohesion that may exists between and within the
            module respectively giving examples.




                                             LOVELY PROFESSIONAL UNIVERSITY                                   135
   136   137   138   139   140   141   142   143   144   145   146