Code Style Guidelines
This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文
- Put each statement on its own line and end it with a semicolon.
- When declaring variables, put each declaration on its own line whenever possible, even if the variables share the same data type. This makes it easier to add comments. Initialize local variables when declaring them.
- In java code, multiple spaces between keywords are treated as a single space, so use only one space.
- To make future maintenance easier, avoid overly complex statements that are hard to understand or whose logic is ambiguous. Since development and maintenance may be handled by different people, use simple techniques wherever possible to implement the required functionality.
- Add more comments to key methods to help readers understand the code structure.
Last updated 2024-01-14
Comments 0