Reading Code

repos setup

Get the code

  • go to the pull requests page for this assignment
  • find your partner's pull request
  • click into their profile to find their repo
  • click on the repo address so that you can clone it git clone {copied address} (note: you are cloneing not forking!)
  • make sure that you run the command outside of where you have your own forked repo

Become a collaborator

  • invite your partner as a collaborator to your own repo

    • go to the settings tab of your repo
    • on the left-hand bar click "collaborators"
    • enter their github username
  • recieve your repo collaboration invite (check your github email)

Run

Run the code. See the output and what the code does and how it runs.

Read

Read the code. Take time to see how the code makes the output you are seeing.

Read the code in a linear way from where you think it starts to where you think it outputs. If you don't know where it starts, try it backwards- begin where you think it outputs and try to work your way back to where you think it starts.

You can make changes:

  • Write console.log for any part of the code where it's difficult to understand what the values are.
  • Wrtie comments to youreself as you go to understand what the code is doing.

Note any questions you have about how the code works or what the reasoning is behind it working that way.

Meet

Meet with the person who wrote the code and ask them the questions you have, or if you are still not clear on how it works, ask them to explain it to you.

Changing the Code

Make a branch for the changes you're going to make: git branch yourbranchname

Make changes to the code as you see fit.

If possible try to work on these three areas- they are listed in order of importance.

Documentation

Is each function propery documented? Is the documentation accurate?

Errors

Does the code have any errors?

Does it handle all cases / kinds of inputs well? (i.e., empty input, long input, short input)

Could it check for input in a better or more thorough way?

Refactor

Once you have an idea of how the code works, is there anything you would do to rearrange or change it, to make it work better, or be written more clearly? Are there formatting changes you can make? Variables you would rename?

Add

Work on one of the furthers for this exercise in order to add new code.

Add code from today's lesson into this code.

Comment

  • go to your partner's pull request. Make at least one comment on one of their commits.

Pull Request

git push origin yourbranchname

Make a new pull request with your changes so that we can see it.

results matching ""

    No results matching ""