Code Review and its importance
I am not good code reviwer . I am still learning the things and will continue to do it untill i am in programming
The way we write code
When we write some piece of code it takes time dedication for us to come up with that code as result we are always proud of that code and we should be . we should be proud of our work it should give a satisfaction at the day end
But when someone tells bad about that code it directly hurts our ego . because we have given time for writing that code .And belive me majority of the times it is very simple mistakes like missing semicolon; or extra spaces or use of let insted of const and so on .. and we just think why is he pointing at such small things .
but rather its our mistake if it is so simple thing we should have not made that mistake . if someone has not pointed out we might have repeated the same thing again and again . And thats the need of a code review inshort code reviews are ofcourse good for organizations for projects but majorly its best for developers its for improving developers .if you contineusly do a mistake and someone points to that again and again you will slowly just not do that mistake anymore not only in that project but anywhere you write code it just becomes habit to write quality code .
Make it a habbit to maintain quality coding practices
No one is perfect It is always ok to be wrong and accept it and improve on it . if someone asks us to make some improvments in the code it does not mean that you are faulty or we are bad developer no its the other persons(however is reviewing your code ) is eligible to comment on your code and he might be knowing what can go wrong indeed you should ask for the reasons also so that next time it wont be repeated and it makes your understanding more clear
Why Code Reviews
When we write code we mostly think of the present situation and just want our code to work at that point and time and then we move ahead we do not always think of the code readbility , scalibility or other ifs and buts . which may cause a serius problem afterwords
because going backword and making changes is always hard then making it correct from the ground up altough i know no software is perfect in one go . but we should always aim for it
If you aim for stars you might land on treetop . Always aim high
when ever you write code you should always ask at least few questions to your self
- Can my team member understand this code without me explaining them .
- Will I understand the code just by looking at it after 6 -7 months .
- Am i really satisfied with the code quality
1 & 2 Question will motivate you to maake your code more readable write comments in the code where ever possible .
3 rd quation is very sensitive to me
lets see it by a small example can it happen that you joined driving classes after you have learnt how to drive no write its foolish . then why we apply this concept in programming we write something it works but we dont know how it worked .
see the point is we should always have a very solid reason for the way we write the code as we might have thought of various ways and then chosen one out of them
At the end its just your improvment in terms of coding style .your understanding , you are heading towards a better development
Mith complex code is more valued then simple code . absolutly wrong the moment your code is complex its sign of something incorrect . Never make simple things complicated
Try to make code better then what you found
I have seen many times that people dont care about others code or the code which is not written by them they just contineus on the project the way .
Whenever you find something in the code which you think should be improved go ahead and do it everywhere in the project . its your pride you have done somthing to improve the code .
Should always leave the world in a better place then we found
Always be harsh on your self
you should be very strick while looking at your code you should be finding simple mistakes a lot then before others go through your code twice thrice unless you are sattisfied (which you should'nt be )