coding style – How to be (more) critical during Code Reviews?


Don’t worry too much about it but definitely strive to improve your code reading skills.

Identifying code smells requires experience. Therefore by its very nature critiqing (rather than being critical of) code is a matter of experience. What kind of experience? Debugging.

Fixing a lot of bugs will slowly train your brain about what kinds of code annoys you. That annoying feeling in your gut is the experience of “smelling” bad code. Over time you will be triggered by certain kinds of coding patterns (not necessarily design patterns) and this forms your personal opinion of what is good and what is not good.

Experience will also inform you of what kinds of patterns don’t matter – weather you use a switch of an if-else sometimes are equivalent but sometimes one is much easier to maintain. Again, this takes experience.

But like any kind of learning, being deliberate about it – actively looking for what kinds of coding patterns lead you to fixing bugs – can accelerate the development of your skill. So next time you go bug hunting and find the root cause, look at the surrounding code and how they may have contributed in the bug being manifested. Additionally, like any skill, learning from those who come before you can help. So read other people’s opinions but always with a pinch of salt: it’s OK if you don’t agree with everything other people think especially if people themselves don’t agree with each other.

PS: As a side note, being critical of your own work may not be the skill you’re looking for. It may be born out of insecurities or the imposter syndrome. What you want is to be critical of all code – to have your own opinion.



Source link

Leave a Comment