Programming is collaborative work, when you work together you help each other! Code reviews is one of the most important ways developers can help each other grow and deliver the best possible software.
The goal of a code review is provide constructive feedback. You study your colleague's code and let them know what is good, what could be better, and suggest improvements if you can. The most important thing to keep in mind when writing a code review is:
- Review the code, not the person.
If there is something you would change in the code don't say "you used a bad variable name", say something like "this variable name could be more clear". Remember that you're working towards the same goal and trying to help each other learn.
Code review is also subjective, there is not a single correct answer. In a collaborative project code review is a conversation not an exam. To practice this conversation try completing these Code Review exercises with a study partner or in a small group.
Learn how to collaborate with a group on a single project hosted in a GitHub repository. Practice using GitHub's project management features to organize your group's tasks and to double-check your project's code quality.
- 🥚 Contributor Guidelines: Your group can define contributor guidelines that describes how everyone can add their work to the project.
- 🥚 Code of Conduct: Your group can write a code of conduct for your project that describes how everyone should communicate and what behavior is considered unproductive.
- 🥚 Repository Contributors: You can add group members as collaborators in a repository.
- 🥚 Issue Templates: Your group can use issue templates to make sure all issues are complete and relevant to the project. in your repository and merge changes without causing any conflicts.
- 🥚 Continuous Integration: You can check your code's correctness before pushing, and fix any mistakes that are caught by Continuous Integration actions.
- 🥚 Code Review: You can use the PR Template and CI checks to review
another group member's code - discussing trade-offs in behavior, strategy
and implementation to help your classmates write their best solutions
before merging to
main. - 🐣 GitHub Project Management: You can ...
- Use issues to define tasks in a group project. Each issue should have a helpful title, complete description, and helpful labels.
- Use a Project Board to organize a project's issues
- Claim issues and track your progress with the project board
- Link a PR to your claimed issue
- Assign someone to review your PR
- Use GitHub code review features to discuss your code with your reviewer
- 🐣 Fixing Merge Conflicts: You can fix merge conflicts by selecting which change to keep, or deciding how to combine them. If a conflict occurs in a GitHub PR you can pull both branches and fix the conflict locally.