Let's say I have a product that has different features, or different feature access depending on things (i.e Premium User, Beta, Demo, Logged-in User, etc..).What's the best way to organize a system to where it's not a set of static checks (i.e a bunch of if statements, for example)?The platform isn't important, I'm precisely asking for design principles / general design.
Feature organization / authentication?
design;features;design principles
The Proxy design pattern may be an interesting starting point. One of the variations described in Design Patterns: Elements of Reusable Object-Oriented Software is called the protection proxy, which is designed for access control when different objects should have different access rights. The Decorator pattern may also be interesting, especially since a protection proxy might be implemented exactly like a decorator.I'm assuming that you are representing your User as an object. A protection proxy to perform authentication or a decorator to add additional rights/privileges seems like a natural solution. But without knowing how you are representing your user and how it interacts with other aspects of your system, it's hard to say anything more concrete.