Software development is craftsmanship and art.

Oliver Szymanski, Owner and Director Source Knights Ltd

From business ideas to software products:
we take care of the complete lifecycle.

Direct call pattern

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 David Tanzer have invented the direct call pattern (in a cocktail bar) a couple of years 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)

Introduction

Also known as Collaborateur-With-No-Intermediator pattern; by Oliver Szymanski and David Tanzer

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 Object 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)

© Source Knights Ltd 2018