Making of Artham Dictionary
Few days before I published my first Android app Artham in Google Play Store. It's not the first app I have developed. I have designed apps before for companies and websites. But this is the first time I am publishing one under my name. It is an English - Malayalam dictionary app. It is something special to me because I had put some extra effort to build it. In this post I will try to explain the development process.
What is special in it ?
Well.. Every smartphone user has one common problem - insufficient internal storage. All the apps want to stay in internal memory not in SD card. Because internal memory is super fast and it is permanent. But external memories are not.
So when we get an error message saying insufficient storage we would delete the apps which use lot of storage space to save some for the new guests. But there are many apps you use less frequently but may need it very urgently some times.
A dictionary app comes under this category. But the problem is almost all the dictionary apps are space killers on the other hand if it uses less space it will need internet. Offline dictionaries available now in play store use an average of 40MB from internal memory. That is huge, at least for me. That is why i decided my app would be a solution to this.
I designed Artham with a primary target of reducing the storage consumption. And I was incredibly successful because I could build the complete app in 4MB which is the 10% of the average space consumption as I mentioned earlier. I built it with Material design and clipboard capture which is pretty rare in dictionary app category.
The mighty database
The first thing I did was obviously optimizing the database. The database I used is an open source crowed sourced data set called Olam. It has almost 2,15,000 definitions. It comes from the Olam.in online dictionary developed by Kailash Nadh. He is a great guy. All the credits for the database goes to him.
The database was a CSV (Comma Seperated Values) file. It is a very simple format to play with. It was around 14MB. I then analyzed how the existing apps works with my reverse engineering techniques. I do that whenever I meet a new app or software, just to understand how those stuffs work.
The result was as expected. Almost all of them where using SQLite databases. They are pretty fast and have APIs to access them which is built in to Android OS. But they are storage killers. They expands the content by including hashes and indexes to it for supporting all kinds of SQL queries. But in our case we don't need them all. We just need to compare the user query with the words and bring up the meaning.
So I first split the words and meanings still keeping an index to access meaning from words. The reason I did this was because only the words has to be in the memory all the time. Meaning has to be loaded only when the word is chosen.
Next I did some conversion on meanings. The meanings where UTF8 encoded. So they where using 2 bytes for each character since meanings where in Malayalam. But in Malayalam language nearly 100 characters are required for representation. I made a conversion system to translate those 16 bit characters to 7 bit characters. And that made the meaning set very small.
Again as a final step I zipped it with maximum dictionary size at maximum possible compression level. The result was dramatic.
There are lot of interesting things in Material design for providing a superb User Experience (UX). But the problem is the compatibility across different API levels of Android. Luckily Google has provided AppCompat library to solve this issue. But adding this compatibility library to app increases the size. So limited the UI elements to only to the AppCompat library.
I didn't use the Design Support library either which has the most interesting things such as Cards, Coordinator View and lots of other stuff. And for the Floating Action Menu on the bottom right corner I used a library from GitHub. I modded it a little bit though.
Coding and Testing
I hate Java ! They say it is portable, robust, this and that. I know how to code in Java but I hate it. Seriously, I have to write a lot of things to do a simple task. In my opinion there is nothing better than Python. Somebody must develop a better abstract scripting layer on top of Java, like Python or AQuery.
I first wrote the entire encoding, decoding, searching procedures in Python. Then I converted it to Java. It was much more easier than coding directly in Java. Because if you write some code in Python it is a program, an algorithm and the documentation at the same time.
I used AsycTask during resource intensive procedures such as loading the word list to memory at the startup so that it will not affect the UI responsiveness. And for searching the words I used binary search which was very efficient in this case because all the words were sorted.
For testing I had to use my Moto G Turbo Edition instead of emulator. Because when Android Studio and Emulator runs together my Windows 10 is in SloMo. I made a small program to easily put the phone in ADB over WiFi mode so that I can debug the app wireless.
After publishing app in Play Store and beta testing done by my friends and my father I posted about the app in Facebook. The response was unexpected. It was kind of an explosion. Especially from the Android Community Malayalam group I got very good support as well as suggestions.
Most people suggested to include the facility to clean the recent searches. I still regrets about it. I literally forgot it while building the app. If there is a history then there should be an option to clear it. Privacy does matters ! As a temporary solution I asked everyone to clear the data of app.
I would definitely bring a quick update for that. By the time I publish this post I would have completed the final testing of update. So stay tuned !
Anyway I am thanking everyone for the feedback and suggestions. That gave me a lot of motivation. I will surely bring future updates for Artham and build more apps for you guys. Thanks for your support !!