Skip to content

Commit

Permalink
added experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
lewislarsen committed Aug 19, 2024
1 parent 26910e2 commit 2b51c62
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vitepress/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default defineConfig({
{ text: 'Removing Your Account', link: '/account-removal' },
{ text: 'Mobile Application', link: '/mobile-app' },
{ text: 'Two Factor Auth', link: '/two-factor-auth' },
{ text: 'Experiments', link: '/experiments'}
],
},
{
Expand Down
78 changes: 77 additions & 1 deletion development-handbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,80 @@ class ExampleClass {
Log::debug($commandOutput);
}
}
```
```
## 11. Feature Flags
Vanguard uses feature flags to manage the rollout of new features and conduct experiments. We utilize [Laravel Pennant](https://laravel.com/docs/11.x/pennant) for implementing feature flags in our application.
### What are Feature Flags?
Feature flags (also known as feature toggles) allow us to enable or disable features in our application without deploying new code. This approach provides several benefits:
1. Gradual rollout of new features
2. Easy rollback if issues are discovered
3. Ability to test features in production with a limited audience
### Using Laravel Pennant
Laravel Pennant provides a simple, expressive API for working with feature flags. Here's a basic example of how we use feature flags in Vanguard:
```php
// Using a feature flag
if (Feature::active('new-dashboard')) {
return view('new-dashboard');
}
return view('old-dashboard');
```
For more detailed information on using Laravel Pennant, refer to the [official documentation](https://laravel.com/docs/11.x/pennant).
### Criteria for Feature Flags
When deciding whether to implement a feature flag, consider the following criteria:
1. **Impact**: Will the feature significantly change user experience or system behavior?
2. **Risk**: Is there a potential for the feature to cause issues in production?
3. **Scope**: Does the feature affect a large portion of the codebase or user base?
4. **Testing**: Would it be beneficial to test the feature with a subset of users before full rollout?
If a feature meets one or more of these criteria, it's a good candidate for a feature flag.
### Experiments Manager
Vanguard includes an Experiments Manager, accessible to all users, where feature flags can be toggled on or off. This interface allows for easy management of feature flags without requiring code changes.
In Vanguard, we define features using an array that includes additional metadata. This approach allows us to pass more data to the Experiments Manager, providing a richer interface for managing features. Here's how we define features:
```php
private function defineFeatures(): void
{
$features = [
'navigation-redesign' => [
'title' => 'Navigation Redesign',
'description' => 'A new, more intuitive navigation structure for improved user experience.',
'group' => 'UI/UX',
'icon' => 'heroicon-o-bars-3',
],
'advanced-search' => [
'title' => 'Advanced Search',
'description' => 'Enhanced search functionality with filters and sorting options.',
'group' => 'Search',
'icon' => 'heroicon-o-magnifying-glass',
],
// Add more features as needed
];
}
```
The Experiments Manager can then use this data to create a user-friendly interface for toggling features and displaying relevant information about each feature.
### Best Practices
1. **Clean Code**: Avoid deeply nested conditionals based on feature flags. Instead, use separate methods or classes for different feature versions.
2. **Temporary Nature**: Remember that feature flags should be temporary. Once a feature is fully rolled out and stable, remove the associated flag.
3. **Testing**: Write tests for both the enabled and disabled states of a feature flag.
4. **Documentation**: Keep an up-to-date list of active feature flags and their purposes.
5. **Metadata Management**: When adding new features, ensure that all necessary metadata fields are included to provide a comprehensive view in the Experiments Manager.
By following these guidelines and utilizing the rich metadata approach, we can effectively use feature flags to improve our development process and user experience in Vanguard, while maintaining an informative Experiments Manager.
45 changes: 45 additions & 0 deletions experiments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Experiments

Vanguard occasionally uses experiments to trial new features before their full release. This guide explains how you can participate in these experiments and help shape the future of Vanguard.

## Accessing Experiments

You can find and manage available experiments through your account settings:

1. Navigate to your account settings.
2. Look for the "Experiments" page.

## Managing Experiments

The Experiments page provides an overview of all available experiments:

![A screenshot of the experiments manager](/images/experiments-example.png)

For each experiment, you can:

1. **View Details**: Click the "View Details" button to learn more about the experiment.
2. **Enable/Disable**: Choose whether to participate in each experiment.

## Experiment Information

When viewing an experiment's details, you'll find:

- A description of the new feature being tested
- The area of the project it affects (e.g., UI/UX, performance)
- Options to enable or disable the feature

## User Control

Unlike traditional A/B testing, Vanguard gives you full control over your participation:

- You can enable or disable any available experiment at any time.
- All experiments are opt-in, allowing you to try new features at your own pace.

## Feedback

Your feedback on experiments is invaluable:

- While using experimental features, pay attention to your experience.
- Use the provided feedback channels to share your thoughts, suggestions, or report any issues.

By participating in experiments, you play a crucial role in Vanguard's development, helping to refine and improve features before their official release.
Binary file added img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/experiments-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2b51c62

Please sign in to comment.