ELI5: Explain Like I'm 5

Cohesion (computer science)

Cohesion in computer science means that everything in a computer program should have a specific job that fits with the other parts of the program.

Think of your toys. If you have a toy box, you wouldn't put your stuffed teddy bear in there with your building blocks, right? That wouldn't make sense! Cohesion is like separating your toys into different boxes so that the ones with similar jobs are together.

In a program, this means that everything that works together should be grouped together. This helps the program work correctly and makes it easier to understand and change in the future. It's a bit like making sure all your toy cars are in one box, all your toy animals are in another, and all your art supplies are in yet another. By keeping things together that are related, everything works better and you can find what you need more easily.
Related topics others have asked about: