Observe Your Objects Today, in part 4 of my series on OOP programming, I would like to introduce the Observer pattern. After all, that's one of the reasons to use Object Orientation. One of the main problems that prevents a lot of reuse is tight binding between classes.
Tight binding means that one class has to know about another class in order to function.
This is not necessarily a Bad Thing, but it becomes one as soon as this knowledge of other classes is tied to a single application. A good example of what I unfortunately did in the past is binding between Functionality and the User Interface. When I'm developing something, I like to see what's going on inside my objects. Both cases prevent reuse because the Functionality needs the UI to function properly, and a UI is very application specific. The Observer pattern allows an object to let other objects know about its internal values without knowing anything specific about the classes of these other objects.