in this video I'm going to talk about peer reviews first I'm gonna explain
what peer reviews are then I'm going to talk about the benefits of implementing
peer reviews for your project and finally I'm going to give a demo of how
you can do peer reviews for your project using github okay so what are peer
reviews peer reviews is a technique used in programming to improve the quality of
the code the way that it works is every single change that's done on the
codebase for the project gets reviewed by another developer so if you commit
any changes like a bug fix or a new feature then another developer will look
through that code and see if they can find any bugs or improvements that could
be made there are so many benefits of using peer reviews I find it extremely
beneficial to use peer reviews in a project and it really does improve the
quality of the code the three main benefits of peer reviews are number one
it improves the quality of the code and reduces bugs that you get put into
production the way that it does this is every single changes reviewed by someone
else and in my experience when using peer reviews in pretty much every single
review there's at least one bug fix or one feature that's detected in the peer
review that means in every single change that would have been made those bugs and
those bug fixes would have been put into the main source code so it really does
improve the quality of the code the second benefit of it is it helps you to
learn from other developers and it also helps under developers to learn from you
because you're looking at other people's code and you're looking at how they
approach different problems you're gaining valuable experience into
alternative ways to do things and the same goes for the other developer as
well so if you're submitting a review for someone else then you might explain
in that review a better or improved way of doing what they're doing
that they may not have known about before if you're getting your work
reviewed then someone else can tell you how you could
improve on the code and make it better and this is a valuable learning experience
the third benefit of doing peer reviews is knowledge transfer within the team so
if you're working in a development team one of the problems that can occur is
that one developer only knows about one particular component of the project the
problem with this is if that developer is ever off sick or if they're
overworked with anything or they leave the team then that knowledge is lost
within the team peer reviews help knowledge transfer because it means that
other people have looked at the code so they understand what is going on and
this really improves the efficiency within the team ok so now I'm going to
give you a quick demo of how you can use peer reviews in your project using
github if you don't use github then other git platforms like bitbucket
and git lab support the same kind of features so you can pretty much do it no
matter which one you're using alright so let's get started so I have a sample
project that I'm gonna use to demonstrate how you would do peer
reviews in a working environment so I have this demo peer reviews project and
what you would do is you would be assigned a particular bug fix or a
change that you would need to make to the code so my change is just going to
be I'm going to tidy up this title here and I'm going to add an extra developer
section so just like you would in any other git project I'm gonna clone the
code to my local machine alright and now I'm gonna change into that directory and
I'm gonna check out the develop branch now this really depends on the different
policies that you have in the company that you're working for but it's
generally good practice to have a master branch with the production version of
the code and then a develop branch which has all of the development changes that
are currently in progress so I'm gonna do git checkout develop now the develop
branch is already created if your project doesn't already have a develop
branch then you just need to create that first and then what you would do for
peer reviews is you would create a feature branch off this develop branch so
I'm going to create a feature branch and typically if you're using
something like git flow the branch would be feature /the name of the change
or the feature that you're implementing or you might even use the JIRA ticket
number or something to keep track of it so I'm going to do git checkout b because I'm going
create a new branch and we're going to call this update readme because it's basically
the change that I'm going to make alright so now I'm working on the
feature branch update readme I can open the code in my atom editor and make the
change
alright so I have the code open in atom and it's already open the readme file by
default so I'm going to just change it I'm just going to type demo oops
demo peer reviews and I'm gonna add an extra development section here
alright so now I'm gonna save that change and then just like any other
change you just commit that to the branch so do git commit and I'm gonna
type the change updated readme exit and save alright now I've done the change
I'm gonna push this branch up to the...I'm gonna push this project back to github
so it gives me the instructions here I'm just going to copy that alright so now
it's pushed to github now I can go ahead and create a pull request and the pull
request is what you would use to have your peer review approved I have two
different github accounts signed in here just to demonstrate this so I'm
currently working off this London app dev account and I'm gonna request a peer
review from the London app dev 2 account that I have that is also in
the same github organization that I've committed this code to okay so from
my account the original account that I'm making the changes under if i refresh
this or you can see here that it's detected that the new branch was pushed
here one minute ago so if you click on that will take you to the new branch
alright so you can see that my changes have been implemented here now what I'm
going to do is I'm going to do a new pull request
so in this pull request you can write an explanation of the changes that you made
now you've got to remember to update this to the develop branch because
ideally you want to be merging your changes into the develop branch and then
from the develop branch you'll merge them into the master branch when you're
ready to do a release alright so it's defaulted the title with update
readme which was the git commit comment I put in there and you
can put a note here just saying hi please could you review my
changes alright and then you want to request a reviewer so if you click
request reviewer then it will give you a list of all the people that are in the
current github organization so you choose the person that you want to
review and you can add more than one reviewer now with peer reviews typically
you would just ask for one reviewer but you may want to add a different reviewer
if there's different components to the project that another person knows about
or you just want to have someone else have a look at the code just for their
experience just for them to understand how it's working alright so now that
I've selected the reviewers and I've added some details here I'm gonna click
create pull request and it goes ahead and creates the pull request now
if I minimize this and go over to the other github account so if you pretend
that this is another person who's working on the project then I should
have a notification that says they've requested review or at least it will
say within the project it, sends you an email to
the account when they've been added as a reviewer and that someone is
waiting for a review this is the wrong project I want to go to the correct
organization here so the London app developer organization and here you go
you can see here that London App Dev open pull request and if I click that it
will take me to the pull request and they've asked for a review and it's my
account here so I can then go ahead and add a review to this
alright so if I go to files changed here and then it will give me a list of
all the files that have been changed in this feature branch
alright you can take a look through here and you can get a
comparison of all the different changes so you can see that they've
remove this title they've added a new title and they've added this section
here alright so now what I'm going to do is click on review changes and then you
can leave your feedback so you can say whether you think there could be an
improvement made or if you found a bug or you found a typo or anything and you
can actually click on a specific line that's been changed and you can add an
inline comment here and you can just say oh I found a typo or I found an issue
with this line and you can write the explanation in the comments here
alright so this all looks good so I'm just going to approve this pull request and
click submit and now if you go back to the other account they should have got a
notification via email to say that the pull request has been submitted and has
been approved by the person now you can now merge this pull request so now that
it's been approved you can go ahead and merge the changes automatically in
github it really depends on the process you want to implement in your project in
some projects you have the peer reviewer merge the changes when they're done and
in other projects you have the original developer merge the changes I like to
do it with the original developer just in case there's any merge conflicts or
anything like that so I'm going to confirm merge and there you go you can
now delete the branch to clean it up and the changes have been peer reviewed
and merged into the develop branch so that's how you would use peer reviews in
the project I hope you found this video useful thank you so much for watching if
you have any comments or questions and please leave them in the comments of
this video below and please remember to subscribe for new videos that I create
on various different development technologies and
tutorials and things like that thank you for watching see you next time