Published: December 21, 2020

If you are looking to improve the quality of your code and save time for your Android app, then it’s of utmost importance to conduct a fair code review.

However, submitting a code for review can turn out to be a stressful event. Why would it not? Exposing your hard work to criticism can be terrifying regardless of the industry. But code review can also be a great activity for learning and improvement.

While every project will differ on what’s most important to review, there are some key elements to consider if you want your code review to be as effective as possible. Let’s take a look:

1. Check for Code Standard Compliance

A poor-quality code leaves room for vulnerabilities that could be easily exploited. Therefore, it becomes crucial to check against code standard compliance.

Some of the best ways to do that include setting goals to capture specific metrics using a well thought out compliance checklist.

After you identify compliance-related issues, you can extend quantified feedback to the developer, such as the rate of defects, and number of errors found per code line.

2. Code Reuse

When you reuse a high-quality, reliable, and secure code, it can help to eliminate any new crashes while in production. Reusing a code can also help in simplifying the coding for your Android app. Additionally, it can also help in evading hacking incidents.

In fact, a recent study conducted by the Singapore Management University found that code reuse techniques, such as return-oriented programming or object-oriented systems, are helpful in dodging reverse engineering tactics hackers leverage to repackage Android apps with harmful code.

3. Document with Clarity

For a coder, reliable documentation is of utmost importance. Good documentation helps keep track of all aspects of an application and it enhances the quality of a software product. Moreover, it helps in development, maintenance and knowledge transfer to other developers.

In case code is modified or changed, it’s imperative to update all relevant documentation (README, g3doc pages, etc.). Clean documentation facilitates faster app development and ensures that your organization spends less on resources.

Comment for each function and comment for logic blocks should be a part of Definition of Done.

4. Security

The goal here is to review the security code for vulnerabilities and any weaknesses. Insufficiently secure coding policies or faulty business logic in the internal structure or in the system’s design can be the root causes of such issues.

For instance, during the security checks, it can be confirmed whether a program uses HTTPS/SSL for data transfer between the server and client or if the data is encrypted. The security code reviews can also reveal potential security bugs and hidden backdoors.

5. Test Coverage

Test Coverage aims to ascertain the effectiveness of testing in a qualitative way. Therefore, testing early can help us find and fix bugs at the beginning of the project life cycle.

Seeing what percentage of code is actually covered by unit tests is crucial during Android code inspection. It is important to put the most attention on unit testing business logic and running UI tests.

70–80% of the tests should be unit tests to ensure the stability of your codebase, whereas, 20–30% of tests should be functional tests to ensure that the application really works.

6. Implement Localization

If you have a global audience, it becomes critical for your android app to function in several languages. This calls for verifying support languages used within the app.

7. Set Time Limits

App development companies should aim to review no more than 200 to 400 lines of code per day, says a study by Cisco.

The ideal time taken to complete the code review should not be more than 30 minutes to 1 hour. To ensure you’re using your time efficiently, it is considered best to number the lines of code you are reviewing.

Once you streamline the process and limit the number of code lines you review, it becomes possible to effectively capture errors and use your time productively.

8. Architectural Patterns

When reviewing a code, it is important to check for architectural patterns, its purity, and correctness of the connections between components. Begin by asking the following questions:

  • If this code is following our architectural pattern – MVP, MVC, MVVM, Event-Bus?
  • Is there an operation being performed in a wrong class?
  • Check if the business logic is decoupled from the view layer?

9. Anomalies or Error Handling

Errors are a common part of any software. So, it is crucial to consider all possible errors arising from:

  • User Input
  • Server Responses
  • Database Transactions

It helps not only to inform the user about what exactly went wrong in the application, but also enables developers to identify the error.

Android error handling is very strong, still developers need to catch the errors of the business logic and handle it gracefully.

Summing Up

The whole point of conducting code review is to better the quality of the code leveraged for the Android-based app. However, in the absence of meaningful suggestions for making appropriate changes, the entire activity of conducting code review can go in vain.

Always make sure whenever you’re providing recommendations, they are thorough and explicit. Explain each line of code or error that requires adjustments to make the code cleaner, more reliable, and maintainable. By taking the time to provide effective feedback, your developers will have the relevant information in hand to make the changes that can enhance the quality of the code to a great extent.

Please follow and share

Leave a comment