-
-
Save eamonnfaherty/2044238 to your computer and use it in GitHub Desktop.
Factory Methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//if you can use polymorphism instead of a switch | |
return _appRequest.marshaller(_payloadSerializer); | |
//If your TargettedAppRequest class is part of another api use an adapter wrapper | |
return new MyAppRequestAdapter(_appRequest).marshaller(_payloadSerializer); | |
//thinking behind - factories are handy for complex object creation and for families of related objects but for this I would use an adapter class with the switch inside it - I find them easier to read. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment