Google Professional Cloud Developer Question 317
Select 3Google Cloud PlatformYour team is deploying a new feature to a high-traffic application hosted on Google Cloud. To minimize risk, you decide to use feature flags. Which of the following are best practices when implementing feature flags in your application?
- A
Use a centralized service to manage feature flag configurations.
- B
Hardcode feature flags directly into your application code for better performance.
- C
Implement monitoring and logging to track the usage and impact of feature flags.
- D
Remove unused feature flags from the codebase after they are no longer needed.
- E
Enable all feature flags by default in production to ensure consistency.
Show answer and explanation
Correct answers: A, C, D
Explanation
Feature flags are a powerful tool for progressive feature rollouts and risk mitigation in application development. Best practices include using a centralized service for dynamic management, monitoring the impact of flags, and cleaning up unused flags to ensure maintainability. Avoid hardcoding flags or enabling all features by default, as these practices reduce flexibility and control.
- A. Correct.
A centralized service allows you to dynamically manage feature flag configurations without redeploying your application, making it easier to enable or disable features across different environments.
- B. Incorrect.
Hardcoding feature flags into the application code is a poor practice as it requires code changes and redeployment to update the flag logic, reducing flexibility.
- C. Correct.
Monitoring and logging are critical to understanding the impact of feature flags, tracking their usage, and ensuring they do not introduce unexpected issues.
- D. Correct.
Removing unused feature flags is essential to maintain code quality and reduce technical debt. Keeping unused flags can lead to confusion and maintenance challenges.
- E. Incorrect.
Enabling all feature flags by default in production can lead to unexpected behavior and defeats the purpose of controlled feature rollout.