forlooptanzania / ride-my-way

Car pooling app (of developers) by developers for developers in Tanzania
22 stars 6 forks source link

Code review the better way #43

Open chrisoemma opened 5 years ago

chrisoemma commented 5 years ago

What is code review?

It is an important ongoing process during the software development phase, where pieces of source code are made available to the peers for inspection with an aim to catch bugs, highlighting mistakes, remove vulnerabilities before they form a part of the product.

It also involves sharing knowledge between author and reviewer...So that means @BenMaruchu was learning also from us.

Why do we review code?

  1. Keeping the team up to date with a changing codebase

  2. Improving the quality of the project

  3. Mentoring new developers

Keeping the team up to date with a changing codebase

Giving code reviews helps developers to read parts of the codes they didn’t work on, which improve overall knowledge of the codebase among developers.

This can only be done if we are all on the same plate so, take your time to understand the change

Most of us review code without understanding what and why changes were made, Its always best practice to understand why the developer made a particular change so as you can bring your insights, and one of the way to know the changes is through the description of the pull request. Make sure you read the code and understand the changes.

Note: The rule of thumb is, you always want to understand the reason for the code change so you can give a great code review.

Improving the quality of the project

I hope we are all on the same page in this, it's always easy for a second eye to spot a bug that yourself. It helps intensely to develop quality software by early catching of mistakes and avoiding bad problems in the product. Software’s are developed by human and to err is human. Hence quite obvious reasons to have reviews.

Mentoring new developers

We all know how difficult it is to do peer programming with Senior developers, be it in your current office or that dream developer you wish to meet. One effective way you can use is to make him/her be your code reviewer, he will make suggestions on the areas to improve in your code. Hence your mentor.

Is their a room to say thanks here? I am gonna say it anyway, Thanks to alcwithforloop for giving us amazing mentors they really shaped my carrier I fill am better Profesional coder now.

OK...Let's continue

Best practice in code review. Here is what we should consider in code reviewing

  1. Review a small number of codes

  2. Use code review tools

    1. Run the code
  3. Use the checklist so they don’t repeat the same mistake

  4. No Blame to that coder

Let's check

Review a small number of codes

It is advised to review not more than 400 lines of code. Human brains capability to find defects beyond 400 lines might diminish.

Use code review tools

To optimize the time and efforts your team on code review it is highly recommended to use some automated code review tools.

Run the code

One-line change? Run the code. Some CSS changes? Run the code. Just translations? RUN. THE. CODE. Do not think every developer issues their code runs before they submit a PR. We all had those moments when we were required to submit the code before 00:00 pm in alcwithforloop challenges...am pretty sure not all developers run the code before PR.

Rule: Run the code don't trust the developer.

Use the checklist so they don’t repeat the same mistake

It is commonly found that your team repeats the same mistakes over and over. Checklist proves to be an effective way to frequently made mistakes. The checklist reminds the author and the reviewers to look over something that might miss out during the code review and ultimately improve their coding skills.

No Blame to that coder

It's really not a blame game here when I was given my task in code reviewing I used some hush word like…Your code looks nasty please use find something else to do[hahahaha]…This kind of words is bad because it always hurts developers ego, hence underperformance.

Remember code reviewers aims at finding defects in code, not people. so keep it professional.

Wrap Up

So I finally come to an end of code review explanation. I would like to really say thank you to all the team behind alcwithforloop. It was an honor attending this program since I have learned a lot. THANKS, THANKS, THANKS.....

Also, I wanna thanks our mentors @joshuamabina, @issyzac, @BenMaruchu for all the efforts they put, it was really special to have some moments with these legendaries.

Last, to all learners. Are they leaners? probably, but to me they are kickass developers. Thanks for their support throughout the program. Just reminding you the only way is up

Cheers