💃 Turn your code on with this trick 🕺

Get your mind out of the gutter ...

Good morning, Salesforce Nerds! Allow me to set a scene for you.

You’re working on a dev team that operates in 2 week sprints. You’re agile af … working on features in isolated branches, integrating code daily, CI/CD automation, daily stand ups, plannings, retros.

The works 💪 

All the sudden, your team needs to build out a larger feature. One that will take 4-6 sprints to complete. ⌛️ 

Meanwhile, the team is going to continue building out other small, yet valuable, features as normal. These typically take 3-5 days to complete.

How do you integrate this large feature into your release methodology?

We can’t just stop all other work for 4-6 weeks while we build it - the business won’t have that

We can’t spin up a SBX and build in isolation for 4-6 weeks - there still work being done to the existing codebase your new code needs to work with

We can use a software engineering technique that will allow us to consistently release new code in a disable state - so we can iteratively deploy this new feature.

Today we’ll intro you to Feature Flags.

TABLE OF CONTENTS

WHAT ARE THEY?

Gentle introduction

So what are these things? 🤷 

It’s pretty simple actually … feature flags control which code paths are active at any given time.

Also known as feature toggles, switchers, or flippers, these flags can be switched on and off — either at build time or at runtime — allowing devs to change the behavior of an application without having to update the code. 🧠 

It gives us the ability to ship incomplete features that remain dormant until they’re ready for action.

Once a feature is complete, then the code can be activated with the simple flip of a switch. 💡 

WHAT ARE THE BENEFITS?

Why should I care?

In truth, feature flags can add a layer of complexity to your codebase.

Despite this, they are super powerful when it comes to software delivery:

 Short development cycle: without feature flags, you have to hold off deployment of a feature until it’s thoroughly tested — a process that can take weeks. With them, we can deploy several times per day, try partially-developed features, and get instant feedback. 💪 

 Simplified version control: we can do away with long-lived feature branches. Feature flags encourage the use of trunk-based development. We can merge every day, integrate continuously, minimize merge conflicts, and iterate much more quickly. ⏩️ 

 Test in production: I said what I said. Using feature flags means new features can initially be enabled only for developers and beta users. No separate testing environment is needed. 🔥 

 Rollback/Kill switch: if you have a bug in your new feature that made it through testing. Just flip the switch and iterate on the bug. 🤘 

 Separate deployments from releases: sometimes a feature is ready, but we’re quite not ready to publish it. Feature flags allow us to switch it on when it makes the most sense. 🤝 

SHOW ME THE CODE!

Example implementation

I don’t want to reinvent the wheel here … 🛞 

If you’re in the Salesforce architecture or development space then you’re probably familiar with a dude named Pablo Gonzalez.

If not .. check him out. 👆️ He’s contributed a lot to DevOps, CI/CD, and Feature Flags! 🎏 

He’s also published an open source repo on GitHub with a simple framework for implementing feature flags driven by Custom Metadata and Custom Permissions.

It’s a clean, straightforward framework that can get your team up and running quickly!

BUTTONING IT UP!

Takeaway

Don’t sleep on feature flags! 😴 

If you’re working with a large dev team or have a feature that will take multiple sprints to complete then these will be your friend.

True, they can temporarily add to a system’s complexity, but in the end they will also bring it much more flexibility. 😄 

You can ship code more frequently, test in production, and wow your users by revealing a feature at the right moment. 💥 

SOUL FOOD

Today’s Principle

"Simple things should be simple, complex things should be possible.”

Alan Kay

and now....Salesforce Memes

What did you think about today's newsletter?

Login or Subscribe to participate in polls.