Tip #20 – Minimize channel specific dependencies and behavior
If you want to build assets that are reusable across distribution channels you should encapsulate channel specific data attributes and behavior from the rest of the logic. Often times I have built assets without taking this into consideration and have gone back and refactored the channel logic out of the domain components. If you know that an asset is going to be offered via multiple channels you can certainly take it into account earlier. How will know this? The first place to look will be your systematic reuse roadmap. Is your business planning to offer a capability in a new distribution channel such as interactive voice response or for mobile/iPhone users? Even if it’s too late for the current iteration you always add it to the list of planned refactorings.
Below are examples of channel specific couplings and suggested design alternatives:
|Channel||Coupling Example||Suggested design alternative|
|Online Portal (Self-Service)||Your asset assumes that the caller will provide a certain input identifier always. E.g. login user name||Define an enumeration to support login user name and other kinds of identifiers as input. E.g. your interactive voice response might use social security number as input while your call center might use a customer identifier instead.|
|Your asset assumes that the caller will only want a subset of data.
E.g. asset only provides name and address data for a customer
|Offer multiple flavors of data objects. Based on channel’s preferences a particular flavor can be returned. E.g. Online portal could use a full customer profile while a call center could use a partial customer profile with certain data attributes masked for privacy.|
|Branch||Your asset assumes that the caller will be invoking from a particular technology platform that is specific to the branch. E.g. the asset takes a workstation identifier as input.||If you must capture workstation identifier put it as an optional parameter or a generic name/value pair type data structure.|
This list is just an example and obviously your environment might contain additional channels and different types of channel couplings. As with everything else, you don’t need to rush into fixing them. If a user story requires an asset that has a certain coupling, you can refactor just in time.