Skip to content

Latest commit

 

History

History
43 lines (27 loc) · 3.29 KB

File metadata and controls

43 lines (27 loc) · 3.29 KB

Code Review

Code Quality! Code Review!

In the last two weeks you've explored all the different ways people solve coding problems, and discovered many of the strange things JavaScript is capable of. This week it's time to focus in on best practices. You will learn how to use automated tools to check your own code's quality, and a check-list to review each other's code:

  • Generated Documentation: Use jsdoc-to-markdown to convert your JSDoc comments into markdown documentation in a README file.
  • Testing: Use unit tests to show that your code does what you think it does.
  • Formatting: Use Prettier to format your code, making sure that all the code in your group's repository is formatted the same way and is easy to read.
  • Linting: Just because your code runs doesn't mean it's good! Use ESLint to make sure that everyone's code is easy to read, avoids common mistakes, and uses a consistent style. Linting will be the trickiest thing to get used to, it's basically a loud voice saying "NO!" to all sorts of things in your code. But it's for your own good, linting makes it easier to write quality code and to collaborate on a group exercise.
  • Code Review: Not everything can be automated, you will also learn how to review each other's code. This week's group exercise comes with at Pull Request template that has a big checklist of everything you need to check. Before you can merge any pull request all of the boxes need to be checked. Also a little annoying at first, but better in the long run.

Before Class

Clone the practice-code-review repository and spend some time studying the example solution. You will want to:

  • install the repository dependencies
  • practice running the solution and the tests
  • practice running the code quality scripts

During Class

Before Break

What is code review? Why is it important?

  • All together: Discuss code review, your coach's personal experience, and the code review checklist. (PS. GitHub has great tools for reviewing code in a Pull Request)
  • In small groups: Chose a few solutions your classmates wrote while studying last week and try to review them according to the checklist.

After Break

  • Create new random groups
  • Break into small groups and prepare your exercise repositories for practice-code-review.

After Class

Practice writing high quality solutions to coding challenges and reviewing other people's solutions. This week's group exercise will be to contribute solutions to a shared repository, reviewing each solution against a (very) detailed checklist before merging to main.

And, study examples & exercises suggested for Chapter 3 in the behavior-strategy-implementation repository, and continue studying your favorite tutorial(s).

Study together! Working in small groups and taking turns to predict and explain what is happening with the code is a nice way to spend a few hours. Teaching is a great way to learn.