# Code Reviews
## Plan
- what is **code**?
- what does it mean to **review** it?
- **how** do we do it?
- **why** do we do it?
- **examples**
- **discussion**
## Code
Code is anything you can show your peers as an answer to "what did you do yesterday?". Everything that we data scientists create that's not **data** is code. What is data? It's anything that's not code. I promise I have prepared for this presentation.
## Review
We review code to make sure it meets some standards. There are at least two ways of conducting them:
- walkthroughs
- pull-requests
Walkthroughs: a bunch of people gather in a room, project some code onto a screen and start asking questions trying to understand what's going on. If you read the code in advance then I imagine this can be a productive gathering.
Pull Requests: Github, Bitbucket, Gitlab (Chegg is transitioning to this, so celebrate!) allow for creating PRs to make changes to the codebase. Reviews via PR are easy to implement: you have a repository with a `master` branch. You branch off into a `feature` branch, make whatever changes you want to the repository, then try to convince your coworkers that they should let all that garbage into `master` by raising a Pull Request. If the PR is approved, the changes get merged into `master` and everyone updates their repository state to fetch the latest work of genius you've contributed to the codebase.
## Why do we do it?
For the product stakeholders, it's important that your code be understandable and maintainable. They need to know that if tomorrow you decide to go work for a flying car company, they'll be able to hire a new data scientist to do what you were doing. If the code is garbage, they're going to waste resources recreating it.
For your peers, it's important for sharing knowledge and experience. No one is born with python 3.8 documentation imbedded in their brain. You'll know some tricks and others will know other tricks; by reviewing each others' code, we can all learn something. If everyone always reviews everybody else's code, everyone will eventually be on the same level.
## Hallelujah!
Chegg is in the process of transitioning to Gitlab from Bitbucket. Once this is done, we'll all be able to collaborate on projects, reviewing each others' code even if we work on different products. Right now Writing Tools folks are on Github, while most others are on Bitbucket. We've used Bitbucket successfully at WriteLab for doing code reviews, but it's not nearly as nice.
## Examples & discussion
Go through some examples and ask how other teams share and review code.