-
Notifications
You must be signed in to change notification settings - Fork 7
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
Naming Convention #9
Comments
underscore_case in implementation and alllowercase for the public API whenever possible. |
@elliottslaughter do you have any insight into the choice of naming conventions for the original Terra libraries to offer? |
@capr's suggestion is what Terra uses, so it seems like a reasonable choice. My main gripe with using alllowercase for public APIs makes names hard to read. I think the main question is whether the upgrade in readability (to e.g. snake_case everywhere) is worth the inconsistency with Terra's main APIs. |
I'm willing to change all of Terra's main APIs to whatever naming convention we want if necessary. As long as I don't have to use alllowercase. |
We could add aliases but I'd rather avoid breaking changes. Anyway, I think it's ok for the standard library to use a different convention. My personal choice would be snake_case but I'm open to suggestions. |
Strange suggestion: What about PascalCase for composite type names, camelCase for methods of objects and entries of objects, snake_case for functions and variables that aren't OO members, and UPPER_SNAKE_CASE for constants. I'm very happy with snake case, as long as we pick one, document it, and enforce it on PRs. |
a sure way to make yourself very unpopular among existing terra users :)) A quick note on consistency: I personally use snake_case for almost everything and yet sometimes I find that the underscore doesn't look right and I skip it. Sometimes I find that an abbreviated name is actually more popular in my head than the full version. And sometimes it's both rule violations in the same name, like how I'd rather say |
to make matters worse (or better), I'm not even following the UPPER_CASE for constants 100%, eg. I'd rather say |
So, naming conventions are hard, and we should just try to make things reasonably sane? I'm not opposed to that. I'd still like to have a standard for consistency, but "always break consistency for intelligence" is a fine convention to have. |
👍 for snake case. Agreed with the point about all lowercase readability. |
My inclination is to go with lower_snake_case for most names, and UPPER_SNAKE_CASE for constants, with the understanding that some discretion is allowed when that doesn't feel right for whatever reason. There is of course some subjectivity to all of this, but this seems reasonably Terra-ish and is consistent with at least the Terra libraries I'm familiar with. |
Alright. I've converted my work on the allocators over to that naming convention. I'm happy to declare that the official naming convention. Should I make a PR on terralib to offer snake_case aliases for everything reasonable? |
Sure, go ahead. |
oh god |
If you object, please speak now. :-) |
I thought I just did :)) |
I think we should pick a naming convention. I don't want to end up with randomly mixed naming conventions. The alllowercase naming convention used by most of the terra public API is consistent, but it isn't exactly the easiest to read. the mix of underscore_case into the private code in terra as well as in a few sections of the public API isn't very appealing either. We should pick one for this and stick to it. I'm a bit partial to using camelCase or underscore_case, possibly with PascalCase for structs with camelCase for variables and functions. Does anyone else have a preference or suggestion?
The text was updated successfully, but these errors were encountered: