Design at the Routine Level

The idea of cohesion was introduced in a paper by
Wayne Stevens, Glenford Myers, and Larry Constantine (1974). Other more modern
concepts, including abstraction and encapsulation, tend to yield more insight at the
class level (and have, in fact, largely superceded cohesion at the class level), but
cohesion is still alive and well as the workhorse design heuristic at the
individual-routine level.

For routines, cohesion refers to how closely the operations in a routine are
related. Some programmers prefer the term "strength": how strongly related are the
operations in a routine? A function like Cosine() is perfectly
cohesive because the whole routine is dedicated to performing one function. A
function like CosineAndTan() ...

The best content for your career. Discover unlimited learning
on demand for around $1/day.