Files
vibe-coding-cn/i18n/en/documents/00-fundamentals/Code Organization.md
T
tukuaiai 8b0c19fef6 fix(en): correct file locations to match zh structure
- Move Code Organization.md, General Project Architecture Template.md to 00-fundamentals
- Move Learning Experience.md, Gemini Headless..., vibe-coding-experience... to 02-methodology
- Update README files
2025-12-19 02:03:23 +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.