Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a nightmare


Why


Because you'll end up with lots of "if (user.isPaidUser) {...}"


I 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.


For me personally, I don't see the issue with this. It's an accurate representation of the app's behavior.


Well, 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.


Ok this makes sense to me. Bundling feature sets by SKU.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: