Files
vibe-coding-cn/i18n/en/documents/04-resources/Code Organization.md
T
tukuaiai f8868dbd61 refactor(en): restructure en/documents to match zh structure
- Reorganize from 7 flat directories to 5 aggregated directories
- 00-fundamentals: core concepts, glue coding, methodology
- 01-getting-started: environment setup guides
- 02-methodology: tools, tutorials, development guides
- 03-practice: project examples (polymarket, telegram, fate-engine, etc.)
- 04-resources: templates, tools, external resources
- Remove duplicate files with underscore naming
- Add README.md for 00-fundamentals and 02-methodology
2025-12-19 02:02:06 +08:00

1.9 KiB

Code Organization

Modular Programming

  • Divide code into small, reusable modules or functions, with each module responsible for doing only one thing.
  • Use clear modular structures and directory structures to organize code, making it easier to navigate.

Naming Conventions

  • Use meaningful and consistent naming conventions so that the purpose of variables, functions, and classes can be understood from their names.
  • Follow naming conventions, such as CamelCase for class names and snake_case for function and variable names.

Code Comments

  • Add comments to complex code segments to explain the code's functionality and logic.
  • Use block comments (/.../) and line comments (//) to distinguish between different types of comments.

Code Formatting

  • Use consistent code style and formatting rules, and use tools like Prettier or Black to automatically format code.
  • Use blank lines, indentation, and spaces to increase code readability.

Documentation

Docstrings

  • Use docstrings at the beginning of each module, class, and function to explain its purpose, parameters, and return values.
  • Choose a consistent docstring format, such as Google Style, NumPy/SciPy Style, or Sphinx Style.

Automated Document Generation

  • Use tools like Sphinx, Doxygen, or JSDoc to automatically generate documentation from code.
  • Keep documentation and code synchronized to ensure documentation is always up-to-date.

README File

  • Include a detailed README file in the root directory of each project, explaining the project's purpose, installation steps, usage, and examples.
  • Write README files using Markdown syntax to make them easy to read and maintain.

Tools

IDE

  • Use powerful IDEs such as Visual Studio Code, PyCharm, or IntelliJ, leveraging their code auto-completion, error checking, and debugging features.
  • Configure IDE plugins, such as linters (e.g., ESLint, Pylint) and code formatters.