We recently released a new version (2.4.0) of our popular mobile app at Android – Workarys. Which is a mobile application that helps you with your attendance record. And since this is a case where we rewrote the entire mobile application into a new structure and also a new language, we want to share some interesting observations with you. Just to be clear, we are comparing versions of the application that are 99% the same in terms of functionality, so this is an ideal case for comparison.
Original application
Workarys was originally written as an app for our close circle of users and was not intended to be used by thousands of users as it is today. So its structure was as simple as possible and no architectures were used for larger or longer maintained applications. Also, the application language was the only one at the time, Java. And all this has been carried by the application since 2019, when it was created. Over time, Google presented new options for development on Android, such as the new language Kotlin or new packages such as Android Jetpack.
New application
So for this year, we decided to rewrite the entire application both in the new Kotlin language and using all the best practices and libraries currently recommended by Google. The “main” package recommended by Google is Android Jetpack – which is, for example, using the M-V-VM architecture, aka Model – View – ViewModel – or splitting application to the data-related part (model), then the graphic part – sometimes also as UI (view) and then ViewModel as a connecting element , which stores the data for the View and works with the data from the Model. Another piece from the recommended deck was Hilt, which is Dependency Injection and a successor to Dagger. Hilt works very well in combination with MVVM and also generates code that the developer would otherwise have to write himself, so it’s a very nice simplification of the work when creating a mobile application on Android. Then just briefly other recommended “libraries” such as Room for DB, LiveData, ViewBinding and etc. You can find all information about Android Jetpack on the official website https://developer.android.com/jetpack.
How to compare mobile apps now?
We could probably do a “primitive” counting of files and lines of code, but that probably wouldn’t be quite right, even though it has its value. But we were looking for a “better” way to compare the old and new mobile app. We found the project SCC (Succinct Code Counter
), which can extract various statistics from the code, both the previously mentioned counting of lines and files, and even some complexity of the code or its difficulty. More about the project at https://github.com/boyter/scc.
In the image below, we can see the individual statistics that the SCC tool offers us, and it always shows how much value the old application (Old) has gained and how much the new one (New).
Individual file types are always compared, so XML, Java and Kotlin in particular. The main difference is between Java and Kotlin, where we can see that Kotlin is basically “better” in all parameters. That is that Kotlin is both more efficient in terms of the number of lines and its complexity. Which then results in the tool using the COCOMO method (Constructive Cost Model more about the method e.g. on the wiki – https://en.wikipedia.org/wiki/COCOMO ) tries to estimate the work of the project both in terms of time (how long it would take to write the given code), as well as, for example, how much it might cost. Let’s leave aside the specific values that may be contradictory, but rather a relative assessment. That is that in terms of cost, writing a new application would be cheaper by 20% and about 10% faster. And because we know that in terms of function these are identical applications, it follows that using modern procedures and languages, mobile applications can be written cheaper and faster.
If you would like to develop a mobile application for Android, do not hesitate to write to us, e.g. at hello@visionslabs.io and we will come up with something together.