This content has been marked as final. Show 1 reply
903209 wrote:How many variations now? How many realistically (not wildly optimistic and bounded by reality) in the future?
Now let's say I have a business process (like fix vehicule) implemented in multiple services that's exactly the same for all vehicles except one tiny bit of code.
My problem is how do I reuse this common code?
If the answer is very few then create one class with some switch logic.
If many then how realistically likely is that in the future that the common logic will remain the same?
If it is likely then myself I would create a business base class with appropriate children.
If you cannot state that it is likely then I would break the common functionality into helper (class) code and create a distinct business class for each modeled entity. It would then use the helper. Advantage to this is that when the common functionality is no longer common it doesn't introduce external dependency problems.