AWG Blogs

Monday, April 30, 2012

Middleman Pattern

The DCI paradigm, specifically the canonical example of the account transfer seems unnatural. If I'm not mistaken, in most business domains the act of transferring resources between entities is performed by a middleman entity. Behavior is no more injected into entities than are entry-level checking account clerks trained on the spot to make transfers to investment accounts (imagine this is a bank in the pre-computing days).

So I propose the "Middleman Pattern." The following is an example. Note: the example could be abstracted in that concrete classes could be decoupled via interface implementation and dependency injection.



Edit: See also suggestion of "money transferrer" at http://pettermahlen.com/2010/09/10/dci-architecture-good-not-great-or-both/