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/
Replace nested-if's with proper exception-handling
-
" Why handle exceptions separately:
■ Handling exceptions separately enables you to define the main logic of
your
code together.
■ Without the use of sepa...
2 years ago
No comments:
Post a Comment