Code Review And Best Practices for Android Developers
- November 5, 2018
- Posted by: Ramadan
- Category: Android Development
No one can deny that the Code Review is very important for software development Process in general.Code review is very important for any team because it help us to prevent or reduce bugs before moving the feature or the issue fix to QA team and also before move this code to production.Code Review helps the team to be on the same page because the reviewer will be aware of the fix or the new feature that developed so there is no single point of failure for delivery when the developer that wrote this piece of software is not existed or leave the company for example.
Why we do code review?
Code Review is an essential role in your daily life as software engineer so some of your time will spent for reviewing some pull requests from your team so be ready for this. let’s tell you some benefits from code review process, the first thing from point of view is to learn some good stuff from your team mates because no one know every thing and others know some stuff you don’t know so be humble and accept their request changes so my advice to you is “DO NOT LOVE YOUR CODE”.
As I said before code review helps developers to be in the same page because we are humans and some times you will be not in your company for any reason vacation,emergency,etc.Suppose there is a crash or critical bug and author of this feature is not existed ,I think that it will be a problem if we don’t have substitution for you DO YOU AGREE?.
One of the most Important benefits of code review is improve the CODE QUALITY because as developers we think only how we will implement this feature only and we do not think where the weak points in our code or how can I make this code fails or breaks so the tester role comes to the stage.
Also one of the benefits of code review is to build a DEVELOPING CULTURE between the team. When we follow the code guide lines many times it will be a culture in the team and it will become a habit.
Confidence increases when we do code review because your code is reviewed and compiled before moving to the QA team also you will feel confident about your code and feel you do your job like professionals in your career.
Why code review some times may be difficult for newbies
Although the importance of code review ,some newbies for this process do not love this and there are always some complains about it.Let me clear more ,some members in a team may be like shooters ,they though that this pull request as chance to blame and point fingers for the author especially if this author is junior so my advice to you as junior or even senior is to look to the request changes with logical mindset and see if these request are valid or not so if they are valid points so do them else challenge the reviewer with your evidence ,please do not make it personal and as said before “DO NOT LOVE YOUR CODE” we are a team and our role is to deliver high quality software.
How Can I do code review for android development?
Now someone of your team created a branch for an awesome feature and created a pull request for you to review his code and to approve this pull request if it is good or to request code changes if it is not good so how to review?
- Make sure the CI server build is success and tests passed
- Make sure the feature has unit tests and UI tests
- If the build of CI fails or there is no tests so you should not review any thing and tell developers to fix them first
- If the previous steps are done then take this branch and make sure it works and runs successfully and see the APK
- Read the User story for this feature to understand the business requirement
- Try the feature on the emulator or real device as a user
- If the app meets the requirement so move to review else tell the author
- Read the pull request many times before approve it or not because you review code does not written by you and it will take some time from you to understand it correctly
- Review if the author follows the architecture for example Clean Architecture by Uncle Bob or not
- Try to find break points in the code and document them in you review to allow developers to know them
- Check the test cases and try to see if the author does not miss any test case and code coverage is good
- Make sure if the developer follows the guide lines for android coding
- Check if all the previous points are done so approve the pull request and delete the branch then you can merge the branch into develop or your production as your need
I hope this article will help you to do your code review in efficient way and remember to leave your EGO out the door , WE ARE A TEAM