Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the recommended way to reference feature flag name in README #275

Merged
merged 5 commits into from
Oct 13, 2023

Conversation

zhiyuanliang-ms
Copy link
Contributor

@zhiyuanliang-ms zhiyuanliang-ms commented Oct 9, 2023

Issue #269

Change the recommended approach to reference the feature flag names from enum to const strings.

README.md Outdated
@@ -144,12 +144,12 @@ In the above example, `FeatureW` specifies a `RequirementType` of `All`, meaning
To make it easier to reference these feature flags in code, we recommend to define feature flag variables like below.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we recommend to define feature flag variables like below

I'm thinking, is it worth a recommendation? This is fairly basic definition of strings. I would imagine just removing this section would be fine.

The only issue I can think with that is that we reference MyFeatureFlags.FeatureX and others below. Perhaps though, it's clear enough that those references should be the names of the flags.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to remove the recommendation, maybe we can just use string "FeatureX" instead of the reference.
If I am a user, I can understand that this is just the name of the feature flag which is a string variable.
But there is a customer who raised an issue for this. He expected us to update the recommendation.

@jimmyca15
Copy link
Member

References of nameof() should be removed.

README.md Outdated
public const string FeatureV = "FeatureV";
}
```
In the following code examples, MyFeatureFlags.FeatureX which is a const string property of the MyFeatureFlags class, is used for referencing the name of feature flag "FeatureX".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about just removing MyFeatureFlags altogether and using string literals?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. That's my original thought #275 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry. Missed it.

@zhiyuanliang-ms zhiyuanliang-ms merged commit 39bc3ed into main Oct 13, 2023
2 checks passed
@zhiyuanliang-ms zhiyuanliang-ms deleted the zhiyuanliang/readme-feature-name-referencing branch October 13, 2023 00:02
@zhiyuanliang-ms zhiyuanliang-ms restored the zhiyuanliang/readme-feature-name-referencing branch October 13, 2023 00:03
@zhiyuanliang-ms zhiyuanliang-ms deleted the zhiyuanliang/readme-feature-name-referencing branch October 18, 2023 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants