Everybody knows that the best way for objects to collaborate involves a lot of annotations (see for example Spring and EJB), some XML (Spring and EJB again), even more XML (Oracle ADF) and even some drag and drop in an obscure visual editor (ADF again). This is the industry standard, and it is pretty good, because consultants can make a lot of money, and consulting companies can bring in even more consultants into projects.
Anyway, there might be situations where you need something different, so Oliver Szymanski and I have invented the direct call pattern (in a cocktail bar) a couple of days ago (BTW, you can use the text of the pattern without permission, as long as you clearly mention our names - that is Oliver Szymanski and David Tanzer):
Direct-Call pattern (by Oliver Szymanski and David Tanzer):
(also known as Collaborateur-With-No-Intermediator pattern)
</h3>Introduction:</h3> 2 Objects want to communicate with each other. One is the caller, the other the callee. The callee is fine with that and the caller does everything that is needed before and after the call gratefully on his own.
2 Objects, sometimes 1 Object in 2 roles (Caller, Callee) Nothing else
The caller calls the callee directly. No proxy, interceptor, or any other intermediator objects are involved in this call. Really, just one call from one trusted friend to another. Perhaps third party is logging the call, but that is hard to avoid in these times.
Fast call Clean stack traces Less confusion What you see is what will happen
Lots of “WTF is the dependency injection” and “how do I find the interceptor” comments Sucks the non-needed annotation and aspect orientation stuff People could understand what you have written Less money with the software support
No money for application server Not the time to debug frameworks Long times of exclusive consulting not longed for Project will be running for more than a few weeks/month (and you should make the support)