Code Organization Recommendations #1157
average-gary
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let consolidate on a code style that can be enforced (mostly) by a linter/formatter.
Some of my personal recommendations below:
Code Organization
struct
andimpl
Blocksimpl
blocks should be written immediately after the declaration of the respectivestruct
orenum
.Avoid mixing
impl
blocks for different entities together. If they need to co-exist in the same file, they should be grouped logically in different regions of the file so the reader can easily find methods right next to the declaration of thestruct
orenum
they belong to.Enums
Alphabetize all enums and other "lists" of items
Variable Naming
Default to full variable names instead of abbreviations. Since we are not limited to line length in modern IDEs, we should not constrain readability by abbreviating variables. Short lambda functions are exceptions to be considered.
Beta Was this translation helpful? Give feedback.
All reactions