FACTOID # 49: Kazakhstan is the world's largest landlocked country.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

FACTS & STATISTICS    Simple view

  1. Select countries to view: (hold down Control key and click to select several)

     

     

    Compare:

     

     

  1. Select fact or statistic: (* = graphable)

     

     

     

  2. (OPTIONAL) Compare to statistic: (both need to be graphable)

     

     

     

  3. View result as:

     

       
(OR) SEARCH ALL encyclopedia, stats & forums:   

Encyclopedia > Cohesion (computer science)

In computer programming, cohesion is a measure of how strongly-related and focused the various responsibilities of a software module are. 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. Computer programming (often shortened to programming or coding) is the process of writing, testing, and maintaining the source code of computer programs. ... It has been suggested that this article or section be merged into Modularity (programming). ... The level of measurement of a variable in mathematics and statistics is a classification that was proposed in order to describe the nature of information contained within numbers assigned to objects and, therefore, within the variable. ... Various meters Measurement is the estimation of a physical quantity such as length, temperature, or time. ...


Cohesion is often contrasted with coupling, a different concept. Nonethelss high cohesion often correlates with low coupling, and vice versa. The software quality metrics of coupling and cohesion were defined by Wayne P. Stevens, Glenford J. Myers, and Larry L. Constantine from source code analysis they conducted on several programming projects while at IBM, all in an effort to identify the characteristics of "good" programming practices. In computer science, coupling or dependency is the degree to which each program module relies on each other module. ...

Contents

High cohesion

Cohesion is a measure of how strongly-related and focused the responsibilities of a single class are. In object-oriented programming, if the methods that serve the given class tend to be similar in many aspects the class is said to have high cohesion. In a highly-cohesive system, code readability and the likelihood of reuse is increased, while complexity is kept manageable. In object-oriented programming, a class is a programming language construct that is used to group related instance variables and methods. ... Object-oriented programming (OOP) is a programming paradigm that uses objects to design applications and computer programs. ...


Cohesion is decreased if:

  • The responsibilities (methods) of a class have little in common.
  • Methods carry out many varied activities, often using coarsely-grained or unrelated sets of data.

Disadvantages of low cohesion (or "weak cohesion") are: Granularity is a measure of the size of the components, or descriptions of components, that make up a system. ...

  • Increased difficulty in understanding modules.
  • Increased difficulty in maintaining a system, because logical changes in the domain affect multiple modules, and because changes in one module require changes in related modules.
  • Increased difficulty in reusing a module because most applications won’t need the random set of operations provided by a module.

Types of cohesion

Cohesion is a qualitative measure meaning that the source code text to be measured is examined using a rubric to determine a cohesion classification. The types of cohesion, in order of lowest to highest, are as follows: A rubric is a marking system used by teachers, consisting of a chart of criteria for evaluation of students work. ...

Coincidental cohesion (worst)
Coincidental cohesion is when parts of a module are grouped arbitrarily (at random); the parts have no significant relationship (e.g. a module of frequently used mathematical functions).
Logical cohesion
Logical cohesion is when parts of a module are grouped because they logically are categorised to do the same thing, even if they are different by nature (e.g. grouping all I/O handling routines).
Temporal cohesion
Temporal cohesion is when parts of a module are grouped by when they are processed - the parts are processed at a particular time in program execution (e.g. a function which is called after catching an exception which closes open files, creates an error log, and notifies the user).
Procedural cohesion
Procedural cohesion is when parts of a module are grouped because they always follow a certain sequence of execution (e.g. a function which checks file permissions and then opens the file).
Communicational cohesion
Communicational cohesion is when parts of a module are grouped because they operate on the same data (e.g. a module which operates on the same record of information).
Sequential cohesion
Sequential cohesion is when parts of a module are grouped because the output from one part is the input to another part like an assembly line (e.g. a function which reads data from a file and processes the data).
Functional cohesion (best)
Functional cohesion is when parts of a module are grouped because they all contribute to a single well-defined task of the module (e.g. calculating the sine of an angle).

Since cohesion is a ranking type of scale, the ranks do not indicate a steady progression of improved cohesion. Studies by various people including Larry Constantine and Edward Yourdon as well as others indicate that the first two types of cohesion are much inferior to the others and that modules with communicational cohesion or better tend to be much superior than lower types of cohesion. The seventh type, functional cohesion, is considered the best type. Larry L. Constantine is a pioneer of modern software engineering practice, he is regarded as an authority on the human side of software development. ... Edward Nash Yourdon is a computer consultant, an author and lecturer, and a recognised pioneer in the software engineering methodology of structured programming[1]. Ed was the lead developer of the structured systems analysis and design methodology (SSADM) of the 1970s, and was a co-developer of the Yourdon/Whitehead...


However, while functional cohesion is considered the most desirable type of cohesion for a software module, it may not actually be achievable. There are many cases where communicational cohesion is about the best that can be attained in the circumstances. However the emphasis of a software design should be to maintain module cohesion of communicational or better since these types of cohesion are associated with modules of lower lines of code per module with the source code focused on a particular functional objective with less extranous or unnecessary functionality, and tend to be reusable under a greater variety of conditions.


References

  • Yourdon, E.; Constantine, L L. (1979). Structured Design: Fundamentals of a Discipline of Computer Program and Systems Design, copyright 1979 by Prentice-Hall, Yourdon Press. 

See also

Those words found in object-oriented programming. ... In computer science, coupling or dependency is the degree to which each program module relies on each other module. ...

External links



 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments
Please enter the 5-letter protection code

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms.