Choosing the Right Database for Your Web Application
Learn how to choose the right database for your web application based on your project's requirements and constraints.
Feature toggles (or feature flags) are a common practice in software development, it comes to the scene when business requires full control over your application features, so it's easy to turn on/off a feature at any time.
Welcome everyone to a new story on devspedia. Today I'll discuss two methods used to design feature flags (we've discussed feature flags previously in "Here's how you can start using feature flags today"). We'll assume we have two scenarios related to GitHub:
The above table shows a simple feature flags table with 3 columns:
id
: Auto incrementcode
: unique string to identify a particular feature.is_enabled
: a boolean that tells whether this feature is ON or OFF.This way we can easily scale the number of feature flags, and even add extra optional columns if we'd like to attach more details tied to a particular feature, for example we can add review_count
column with value 2
which can imply 2 reviews are required for require_review
flag. Let's see pros and cons of this implementation.
premium
for example as a bool, this means the feature is only applicable to premium
subscribers.The above horizontal example, assume each feature flag is a column (vs. row in prev. example). And that we'll only have one record/row (or more and differentiated with another column, ex: user_group
) which we can query as select * from feature_flags;
or select *from feature_flags where user_group = ...
.
require_review: true
.it's always a good idea to take some time and think of the better and most suitable design for the type and size of your app before implementing feature flags.
That's all for today's story. Thanks for reading devspedia, I love you, and I'll see you the next time :)