3
Jan/082
Jan/082
Function cohesion
High cohesion means that you code is reusable, reliable, etc. Now quess what low cohesion means?
Best kind of function cohesion is when a routine performs only one operation without using any other routines. Why does this matter? It is easier to maintain than a routine that does 100 things and contains 1000 lines. Compare that routine to a routine that does 1 thing and contains only 10 lines.
There has been research statistic about this, and the lowest amount of bugs was in small routines with high cohesion. But that is obvious, so everytime you create a new function, try to remember the rule of doing only one thing.
Try to keep things as simple as possible.