Hi,

I would like to describe some additional behavior for objects when they are
interacting with another objects.

The prime example is GTInspector; by default to add presentation you
implement a method with "gtInspectorPresentationOrder:". This is fine if
there is just one method like this, but when the object can serve multiple
purposes it can quite mess up the protocol (in my opinion).

Example of that could be (Spec) TreeModel; there are many methods like
menu:, displayBlock:, childrenBlock: etc. that should be different based on
the particular object.

However having a method for each of those cases in the observed method is
just a mess. So how could one approach this?

The first thing that comes to my mind is a visitor. That might possibly
work for code that I've written, but not for spotter/inspector as they work
directly on the target object.

Thanks,
Peter

Reply via email to