I made some research to better understand the concept of functional cohesion. Myers in his book "Composite structured design" has written about functional cohesion:
A functional-strength module is defined as a module that performs a single specific function.
He also wrote in "Reliable software through composite design" about that:
In a functional-strength module all of the elements are related to the performance of a single function.
Others authors expressed similar views:
Every essential element to a single computation is contained in the component. So functionally cohesive component is :
- One that not only performs the task for which it was designed but
- it performs only that function and nothing else.
Functional cohesion: each part necessary for execution of a single function. e.g., compute square root or sort the array.
My question is:
- is the single specific function in above definitions the same as "Single Responsibility Principle"?
- or does functional cohesion mean that a java class shall have one public method only, and if there would be more public methods you wouldn’t have a functionally cohesive component?