What guidelines should I follow when given the task of reviewing code, and making…
- User
What guidelines should I follow when given the task of reviewing code, and making necessary optimisations
- Assistant
The guidelines may vary depending on your language, but here are a few general rules:
- Ensure the code works. Not just that it doesn't crash, but that it does what people want. This can be done with tests.
- Make sure the code is self explaining. Someone should be able to tell what it does by reading it over. This also means names should make sense.
- Make sure there is good documentation. There should be docstrings for functions and classes. In many IDEs, these will popup whenever someone hovers over a function, and they will also be used in documentation generators like Sphinx.
- Use linters. These tools will automatically tell you if the formatting is right, if things are too complex, etc.
- Make sure the code isn't too complex. Some linters will measure complexity, but if there are massive functions with many branches, breaking it up into multiple functions that are easier to understand should help with maintenance.
- User
Can you give some examples of good and bad documentation?
- Assistant
Below are some examples of good and bad documentation of code review:
Good documentation:
-
Clear and concise: Documentation is clear, concise, and easy to understand. It explains what the code does, how it works, and how it should be used.
-
Well-organized: Documentation is well-organized and easy to navigate. It has clear headings and subheadings, and was broken up into manageable chunks.
-
Includes examples: Documentation includes examples that demonstrate how to use the code.
-
Updated regularly: Documentation is updated regularly to reflect changes to the code.
Bad documentation:
-
Outdated: Documentation that is outdated or no longer accurate can be confusing and frustrating for users.
-
Incomplete: Incomplete documentation can be frustrating for users who are trying to understand how the code works.
-
Poorly organized: Documentation that is poorly organized can be difficult to navigate and understand.
-
Lacks examples: Documentation that lacks examples can be difficult to follow. Including examples can make it easier for users to understand how to use the code.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)