3 ms·
Why
by squigglydonut 2y ago
Why
- rareitem 2y agoBecause you'll end up with lots of "if (user.isPaidUser) {...}"
- resonious 2y agoFor me personally, I don't see the issue with this. It's an accurate representation of the app's behavior.
- shireboy 2y agoWell, yeah, but this was just pseudocode to convey the concept that you should solve the problem in code, not by maintaining separate code branches, deployments, etc. One approach would be to have an implementation of FooService for each sku, and code that uses the right one based on the current user/tenant/payment status/etc. This gets into dependency injection, inheritance, and other language/framework specific things. The actual approach would vary based on the project. It may be that CurrentUser.Sku and CurrentUser.IsPaymentCurrent is sufficient. Or it may be that you need a FooService per SKU, or any number of other ways to handle.
- squigglydonut 2y agoOk this makes sense to me. Bundling feature sets by SKU.
- squigglydonut 2y agoI get that but then what would the alternative be? I am not saying that there is not an alternative but if you know another way I am curious to hear from you about that.