Open
Description
Porytiles code uses somewhat inconsistent style conventions. Pick a convention and refactor the code to use it, and stick to it. Document the style in a STYLE.md file. The legacy code currently follows a Java-like style (with some Google mixed in). The C++ Core Guidelines recommend picking a style and then sticking to it.
Style side-by-side comparison can be found here:
https://github.com/motine/cppstylelineup
Missing from this repo is the C++ stdlib style, which basically uses snake_case
for everything.
What I've Tried
So far, I have tried Google style: https://google.github.io/styleguide/cppguide.html#Naming
A few things I don't love about Google Style:
snake_case
for variables (and optionally for getters/setters),PascalCase
for classes/functions is honestly a bit confusing and hard to remember. I find myself absentmindedly usingcamelCase
orPascalCase
for variables if I have just finished typing a function/class definition.- While I don't like
SHOUT_CASE
for constants (macro leakage), I also don't thinkkGoogleCase
is that great. I don't love the little leakage of Hungarian notation into constants when it's not used anywhere else. Advanced IDEs like CLion and VSCode can easily distinguish constants from other variables. They should probably just be named like any other variable. That being said, I do see the argument that it makes them very easily visually identifiable. - Calling methods on objects looks weird, e.g.
my_foo_obj.SomeCoolMethod()
. You end up with an ugly mix of snake case and Pascal case in the same statement.