Comparison
God objectvsMediator pattern
God object
one class is four thousand lines and every feature branch touches it.
One class or module that knows about and does far too much, so every change goes through it. It is the extreme of low cohesion and it has a distinctive organisational symptom: it is the file with the most merge conflicts and the one nobody wants to review. Splitting one is usually a months-long project, which is the argument for noticing at eight hundred lines rather than at four thousand.
Full entry →Mediator pattern
the six components stopped calling each other and all called one object in the middle instead.
Replacing many-to-many references between colleagues with a single object that coordinates them. It turns a tangle into a hub, which is a genuine improvement in the tangle and a genuine risk in the hub — the mediator is the class most likely to grow into a god object. It differs from an observer in direction: an observer broadcasts a change outward, a mediator receives events and decides what everyone should do.
Full entry →