I’ll start off by saying that this is more of a personal vent. I’ve not been in the coding game for too long but I’ve experienced different cultures when it comes to software engineering.
So here’s why I think we need Code Reviews - in no specific order.
Code Reviews allow us to check for any potential security issues. As systems become more complex, we all want to make it easier to ship the code or want to test a new feature and, sometimes, we let security standards slip. We might accidentally include personal credentials in the code, expose APIs or misunderstand the consequences of our code which could have security implications.
Code Reviews allow us to work together to ensure these potential issues don't become reality.
We all should want to produce great quality code, but we are faced with reality that it's not going to happen all the time. We are faced with combinations of deadlines, obscure requirements, growing complexity and most importantly: being human.
Code Reviews allow our peers to let us know if the code isn't up to standards and improve it before it becomes a burden later on in maintenance.
We have all written code that we look back at and question why.
Knowing that our Code is going to be reviewed allows us the opportunity to reflect on what we've done. We don't want to send bad code to get told to redo it.
When preparing our Code for review, we should reflect on what we've done, question if it meet the requirement(s), does the Commit messages make sense, does it meet internal/external standards, etc.
Being on both sides of a Code Review - receiving and giving - has its benefits.
As someone who's put their code up for review, we can be given knowledge and tips from others about how to improve it, told about functionality we never knew about that simplifies things, or told about the dreaded typo that we've totally overlooked and are now embarrassed about.
When giving the Code Review, we can learn from overlooking new code and styles which we can implement back into our own work.
Code Reviews, if done properly, enable us to learn and develop to become better.
As systems grow and become more complex, we will start having less understanding of all the moving parts. We may have to use code that we never built but someone else in our team did.
Using Code Reviews, we can enable team members to share their work and give more people a better understanding of the changes being made that we might have to use or work on in the future.