While a grammar app and a health app use vastly different code, they are, however, the same in some ways. Both users expect the app to consistently and reliably perform its intended functions. In other words, code quality is essential for mobile apps.
That is, no matter how critical the intended function is, code must perform reliably.
Measuring and managing code quality is integral in the Mobile DevOps lifecycle for one simple reason: good code is clean code. Clean code stands the test of time, but low-quality or bad code never lasts long.
What defines code quality is subjective, and that definition can differ from team to team. Often, a team will predefine what code quality means for their specific build. But, bottom line, no matter how you define, measure, or validate it — code quality impacts how safe, secure, and reliable your codebase is and how fast you can deliver value.
Therefore, mobile teams have at least four things to consider to ensure they are measuring and managing code quality.
Maintainability is affected by various low-level code quality attributes, like readability, source code metrics, code duplications, clone smells, and coding issues. It is related to the codebase’s structure, complexity, consistency, and size.
At its core, maintainable code is simple, clean, and easy to read.
Companies with growing codebases often get caught up in writing custom code that constantly needs checking and becomes increasingly difficult to maintain. That’s just not efficient for Mobile DevOps.
November Five, a Belgian digital transformation agency with a considerable client base, needed a robust solution to manage the complexities of its ever-growing number of codebases. November Five was looking for an alternative to Jenkins and a way to build better mobile apps — faster.
November Five found the perfect solution with Bitrise’s step library. Before, setting up custom builds required a lot of maintenance and checks. Now, the company can customize its Bitrise Workflows to minimize the amount of manual work and guarantee its apps’ quality and increased stability. One solution the team set up is a quality pipeline that automatically checks pull requests made by the engineers. Now its apps are maintainable and reliable.
Read more about how Bitrise helps November Five maintain its ever-growing codebase.
Reliability measures the likelihood that a system will run without failure for a specific period.
This metric is relatively simple to measure with tools like crashlytics. As your mobile build becomes larger, the need to make the app more modular and build it from individually tested elements becomes more and more important.
There are other types of automated tests that improve the robustness and reliability of your mobile builds. And by maintaining code coverage, these tests help prevent regression areas.
Testability measures how well the code supports testing efforts and evaluates how well you can control, observe, isolate, and automate testing (among other factors). It is measured by how many test cases you need to find potential faults in the system.
Applying methods at the code level will help you improve your code’s testability. Similarly, breaking your code into smaller functional pieces benefits the testability of your code base (and your API designer mindset).
No matter how you do it, tests make your code safe and more reliable. Mobile continuous integration and continuous delivery (CI/CD) is made for running tests like this. Learn more about the benefits and how to write tests for your mobile builds with Swift and Bitrise here.
Portability measures how usable the same code is in different environments.
For mobile builds, this means taking an existing working mobile application (utility, game, web service, etc.) and making a port of the application to other tablets or handsets, etc.
Any generic core bug in the lead devices will spill down to the ported devices. Therefore, it is essential to pick the “lead” device that is new enough, stable, and represents a host of other existing devices — for example, the Samsung Galaxy S II for the Android OS.
With Bitrise’s Fastlane integration, portability for your mobile build is a massive advantage because it provides a coding standard. Once you integrate, you can run your code on iOS, Android, or the cloud.
Learn more from one of our senior iOS developers on how to automate iOS builds & tests to make your code portable with Fastlane.
Learn even more about your Mobile DevOps processes with MODAS
Measuring and managing code quality vastly improves your mobile product delivery. The process may feel overwhelming at first, but it will reduce your technical debt and leave you with high-quality code in the long run.
Measuring code quality is just the tip of the iceberg, though. Development teams can gain even more insights into their mobile builds and development processes with the Mobile DevOps Assessment Survey (MODAS). With insights from the MODAS, you will be better able to support and enhance your end-to-end Mobile DevOps performance.
Whether your team is looking into measuring and managing code quality or improving other areas of mobile development, the MODAS can help. If you’re interested to learn about your Mobile Product Organization’s maturity, the MODAS assessment only takes about 15 minutes to complete.