Hmm.. okay, I'll give it a try. Let's consider two classes,
Zoo and
Animal.
Animal also has two subclasses:
Tiger and
Monkey. I'll define all those classes like so (and yes, this is going to be an extremely contrived example):
Have a look at the
Zoo class. Do you notice anything a little bit strange about it's methods? Notice that we have more than one add method, one for each type of
Animal our
Zoo can have. We've
coupled our
Zoo to concrete types of
Animal. Now what would happen if we added a new type of
Animal to our
Zoo? If we added a
Lion, we would need a new add method for that. The
Zoo knows too much about what types of
Animal we have in our system. We can solve that by taking advantage of
polymorphism to
decouple the
Zoo from all of our
Animal types:
There's still a bit of a problem though. Our
Zoo holds a bunch of
Animals, right? But we have those other methods in there for feeding them and cleaning their cages. This is
low cohesion: our
Zoo class has behaviours that don't quite fit with it's primary focus. One way we can fix that is by introducing a new type of object to the system: a
ZooKeeper.
Now our system has
higher cohesion. The Zoo is just a collection of animals and staff, and the special behaviour of caring for the animals (feeding and cleaning) are put together in their own class. The
coupling is lower as well;
Zoo and
ZooKeeper only care about
Animal and have no ties to concrete types, which could easily change as the system evolves.
I hope that sheds some light. If not, maybe someone will think of a better example than I could!