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

Review naming recommendation for fields #249

Open
Keboo opened this issue Feb 16, 2023 · 6 comments
Open

Review naming recommendation for fields #249

Keboo opened this issue Feb 16, 2023 · 6 comments
Assignees
Labels
C# coding guidelines Content related to the C# coding guidelines .editorconfig Changes here are to the editorconfig proposal Items flagged with this are up for discussion to be included in the IntelliTect coding standards

Comments

@Keboo
Copy link
Member

Keboo commented Feb 16, 2023

Right now our naming standard (Underscore + CamelCase) differs from the more common (Underscore + PascalCase).
Following our guideline is now getting flagged in Visual Studio due to new .editconfig defaults.
https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules#rule-id-ide1006-naming-rule-violation

This can be mitigated by adjusting your editorconfig, but requires someone making a change from the default.

@Keboo Keboo added proposal Items flagged with this are up for discussion to be included in the IntelliTect coding standards .editorconfig Changes here are to the editorconfig C# coding guidelines Content related to the C# coding guidelines labels Feb 16, 2023
@ascott18
Copy link
Contributor

Isn't our current standard Underscore + PascalCase? Not Underscore + CamelCase?

image
image

@ascott18
Copy link
Contributor

cc @GrantErickson @mitch-rickman

@MarkMichaelis
Copy link
Member

After discussion, @Keboo and I agree on the following:
This essentially comes down to whether the advantages of _ outweigh the convention/tradition of _.
Recommendation:
State the pros and cons of _ _ case and then leave it to the developer (team) to choose.
In our coding guidelines (which currently only allow for a one-sentence guideline with no explanation), remove the guideline entirely.

Thoughts?

@Keboo
Copy link
Member Author

Keboo commented Jan 16, 2024

I think I would change the guidelines to be something like:
DO: Name all fields consistently, regardless of any field modifiers.

Specifically looking to call out that we don't think separating naming of things like static, readonly, public, private etc is beneficial.

@MarkMichaelis
Copy link
Member

Isn't that true for all naming conventions... not just fields?

@Keboo
Copy link
Member Author

Keboo commented Jan 16, 2024

It is, however, fields naming based on modifiers is an area with lots of conflicting information online (including some MS docs) so it may be worth calling out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# coding guidelines Content related to the C# coding guidelines .editorconfig Changes here are to the editorconfig proposal Items flagged with this are up for discussion to be included in the IntelliTect coding standards
Projects
None yet
Development

No branches or pull requests

4 participants