vimwiki/tech/names_in_code.wiki

22 lines
852 B
Plaintext
Raw Normal View History

2022-11-30 02:00:01 +00:00
= Names in Code =
Standards and conventions for naming stuff, in code
1) Dont abbreviate names
* Abbreviation relies on context. Context you may not have re-reading your
code
2) Dont put types in variable names
* Thats a Windows.h C99 moment
3) Add units to variables unless the type tells you
* IE a delay function takes a paramater _delaySeconds_, not just _delay_.
* If you have a unit like `chronos::timespan`, however, you dont need that
4) Dont put types in your types
* IE AbstractX, BaseX, etc...
* If you need to to this, maybe try renaming the child class instead to be
more specific
5) Refactor if you find yourself naming code "utils" or "helper"
* 99% of the time those utils can be broken into their own classes
* This is true even if you have a 'utils' type function just for Cookies,
Math, etc