Page 137 - DCAP405_SOFTWARE_ENGINEERING
P. 137

Software Engineering




                    Notes          The direction of the arrow in Figure 8.3 indicates the worst degree of cohesion to the best degree
                                   of cohesion. The worst degree of cohesion, coincidental, exists in the modules that are not
                                   related to each other in any way. So, all the functions, processes and data exist in the same
                                   module.
                                   Logical is the next higher level where several logically related functions or data are placed in the
                                   same module.
                                   At times a module initializes a system or a set of variables. Such a module performs several
                                   functions in sequence, but these functions are related only by the timing involved. Such cohesion
                                   is said to be temporal.
                                   When the functions are grouped in a module to ensure that they are performed in a particular
                                   order, the module is said to be procedurally cohesive. Alternatively, some functions that use the
                                   same data set and produce the same output are combined in one module. This is known as
                                   communicational cohesion.
                                   If the output of one part of a module acts as an input to the next part, the module is said to have
                                   sequential cohesion. Because the module is in the process of construction, it is possible that it
                                   does not contain all the processes of a function. The most ideal of all module cohesion techniques
                                   is functional cohesion. Here, every processing element is important to the function and all the
                                   important functions are contained in the same module. A functionally cohesive function performs
                                   only one kind of function and only that kind of function.
                                   Given a procedure carrying out operations A and B, we can identify various forms of cohesion
                                   between A and B:

                                   (a)  Functional Cohesion: A and B are part of one function and hence, are contained in the same
                                       procedure.
                                   (b)  Sequential Cohesion: A produces an output that is used as input to B. Thus they can be a
                                       part of the same procedure.
                                   (c)  Communicational Cohesion: A and B take the same input or generate the same output.
                                       They can be parts of different procedures.
                                   (d)  Procedural Cohesion: A and B are structured in the similar manner. Thus, it is not advisable
                                       to put them both in the same procedure.



                                   (e)  Temporal Cohesion: Both A and B are performed at moreover the same time. Thus, they
                                       cannot necessarily be put in the same procedure because they may or may not be performed
                                       at once.
                                   (f)  Logical Cohesion: A and B perform logically similar operations.
                                   (g)  Coincidental Cohesion: A and B are not conceptually related but share the same code.

                                   Information Hiding: In computer science, information hiding is the principle of segregation of
                                   the design decisions in a computer program that are most likely to change, thus protecting other
                                   parts of the program from extensive modification if the design decision is changed. The protection
                                   involves providing a stable interface which protects the remainder of the program from the
                                   implementation (the details that are most likely to change).
                                   Written another way, information hiding is the ability to prevent certain aspects of a class or
                                   software component from being accessible to its clients, through an explicit exporting policy
                                   and through reliance on the short form as the primary vehicle for class documentation.






          130                               LOVELY PROFESSIONAL UNIVERSITY
   132   133   134   135   136   137   138   139   140   141   142