Analogy to explain Cohesion
In your house, do you put garbage, food and jewelery in the same box and keep it in the same place? Why not?
Coz they don’t belong together.
But why don’t they belong together?
Coz they have very different purpose & you don’t intent to use them at the same time in the same context. We even go further and separate each item. For example, we put gold jewelery in one box and silver in another. We even separate the jewelery based on the occasion we plan to wear them and so on.
When you apply the same thinking in your code, you achieve high cohesion. Keep related concepts in your code together based on their usage or consumption is the very essence of high-cohesion.
Its also worth highlighting that as time goes by, as you accumulate more things, every time you want to add something new, we go back, reorganize and rearrange those items in our boxes. Sometimes we even rethinking our whole organizing strategy. Sometimes we go buy new boxes to help us organize things better so its easy to find them. We can’t think of it all upfront and get it right the first time. Same applies in software design.