Anyway, there might be situations where you need something different, so David Tanzer 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)
Introduction:
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.
Requirements:
2 Objects, sometimes 1 Objects in 2 roles (Caller, Callee)
Nothing else
Solution:
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.
Pros:
Fast call
Clean stack traces
Less confusion
What you see is what will happen
Contra:
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
Use when:
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)



2 Kommentare:
This reminds me of the Carrier Pigeon RFC, 1149. http://www.faqs.org/rfcs/rfc1149.html
...but the Carrier Pigeon RFC ist a joke, while Direct Call is a practical solution to a real-world problem. By stripping out all the unnecessary configurability, flexibility, interfaces, patterns and technologies, software magically becomes navigable in an IDE, maintainable and easy to use as well as much, much smaller. (I reduced a software component from 30000 to 3000 lines of code by doing just that.) Thank you Oliver and David!
Kommentar veröffentlichen