Today’s post is by the Scand Mobile Development Team. Scand is a software development firm from Belarus, engaged mainly in the development of cross-platform and native applications under the iOS, Android, and Windows platforms. Over the years, they have gained experience in the spheres of banking, sports, medicine, education, e-commerce, and more.
From the first weapons created by primitive hunters to the pens, palettes, and putty knives used by Renaissance artists, craftspeople have had to choose their tools wisely to solve problems in effective ways. In today’s demanding mobile application market, developers must carefully evaluate the many tools available to them. Scand saw Realm as an effective tool to solve their problems due to its easy integration, flexible scalability, and clear documentation. They also developed Realm Browser for Android, a free, helpful library for viewing and editing files on Realm DB on Android devices.
What Realm is to Us
From the beginning of ages, people have created and carefully chosen weapons and tools for specific purposes. We all know that convenient and reliable tools help to solve problems in a more efficient and effective way. Our ancestors treated stone in a special manner and combined it with other materials to serve various purposes: carcass dressing, hunting, digging, or wood chopping. It was necessary for survival. It is not only human power that built the Egyptian pyramids, but also brazen chisels, ropes, and lever systems. In the Middle Ages, during the rise of the navy, ships carried no fewer than 4 types of guns of different caliber and purpose. That gave opportunity to get away from attack, to capture enemy ships, or even completely destroy them. Artists of the Romantic period used dozens of brushes with different bristles, pens, palettes, and putty knives to translate their ideas into paintings.
Get more development news like this
Today, the mobile application market is dynamic, competitive, and demanding. This requires developers to be pragmatic when choosing tools. Once the scope of task is defined, modern IT developers and architects carefully evaluate available tools and make choices for languages, libraries, IDEs, patterns and algorithms.
Our team builds development processes in accordance with the principles and practices of Lean and Agile methodologies. As such, we did not replace relational SQLite databases with Realm. Instead, we use it as another effective tool for solving our problems.
Choice of Weapon
Our acquaintance with Realm happened recently. Since the time of Windows Mobile 5, we were using SQLite (both native and its wrappers: CoreData, FMDB, ORMLite, GreenDAO, et al.) and serialization to store data on mobile devices. Afterward, due to active development of non-relational solutions and logic optimization, we started integration of small NoSQL storages (key-values or documents). As a result, we used either SQLite solely, or SQLite with relation to NoSQL. NoSQL was used to store data that was rarely updated and didn’t require complex query, while SQLite was used as our main database.
Using a relational database as a primary repository was, and continues to be, a justified choice for mobile applications to solve tasks of specific user, business, or public sector having the following initial requirements:
- Save and cache a large amount of data with hundreds of entities
- Focus on a wide range of queries to local data
- Display information in tables
- Scalability and independence of database for use in multiple projects
- Ensure data integrity and strong ACID properties
At the same time, a relational database has its own constraints towards mobile application development:
- Data access speed is low and might negatively affect users experience
- A lot of time is required for a new developer to jump in on the project
- Changes in project or business cases may require additional labor costs, sometimes quite significant
As the matter of fact, there is a significant increase in cost for mobile app development using SQLite DB for storing data. Despite the fact that the mobile application market can decline business and developers to be agile, not everyone can afford to pay for the benefits of relational DBs that are not required or offset in a particular area. The solution, then, should be chosen depending not on habits and preferences, but on subject area.
Accordingly, our team (as well as many other developers) entered the era of polyglot persistence, where various data storages are used for different requirements. No relational DB is an uncontested datasource. That is why we carefully analyze and evaluate the nature of data. How will it be manipulated? What is its volume? Only then can we choose whether we will use a relational DB, NoSQL DB, or a combination.
Why choose Realm among others?
There are many good NoSQL solutions available that are on active development stage. In order to choose the best option to complete tasks assigned to our team, we created the following list of database functionality requirements:
Easy integration - Realm easily connects through Gradle or CocoaPods.
Low entry requirements - Even novice developers will be able to master Realm in a few days.
Speed - Comparative tests show that Realm is an incredibly fast library for working with the database.
Platform independence - Realm database files are cross-platform and can be used in both OS and Android.
Scalability - Realm is ready to work with large data sets.
Documentation and support - The Realm team has provided readable, well-organized documentation about its product. If problems occur, you can always contact them through email, Twitter, GitHub, or StackOverflow.
Reliability - Realm is used by many developers in multiple mobile applications.
Data protection - Realm provides out-of-the-box data encryption.
Active development - Even though Realm is still below version 1.0, development is still ongoing.
Free - Realm is absolutely free!
We have been actively using Realm in some of our projects. When the “honeymoon” was over, we found out that we lack at least one essential function in Realm: in order to debug and test application logic or UI, we needed a handy viewer and editor of Realm DB. Realm Browser for Mac OS X turned out to be uncomfortable to use for us: it required too many activities, and is limited in functionality for our needs.
Updated October 19, 2017: With the launch of Realm Platform 2.0, Realm Browser for MacOS has been deprecated, and is replaced by Realm Studio for Mac, Linux, and Windows to manage both local and synced Realms.
If you want to solve your problem quickly and efficiently - solve it yourself
We decided to create a library of our own. Realm Browser for Android is a small, free, helpful library for viewing and editing files on Realm DB on Android devices. It allows developers that use Realm in their applications to view saved data and debug modules that are responsible for easier and faster work with DB. The library also provides the ability to automatically generate data.
With Realm Browser for Android, library developers gain direct access to stored data while running the program without having to copy the data file. Developers can open the browser in two ways: by creating a notification, or by calling a method at the right time. The first way allows you to avoid interfering with the application’s UI, while the second provides necessary flexibility.
At first, we created this library for ourselves. However, we decided to share it with other developers. You can view use cases and download the demo application (as well as the library itself) from our website.
In short, our product was created by developers, for developers. It is currently in alpha, and we plan to develop Realm Browser for Android further. The project has a backlog with tasks that imply development of new features and UI improvements. We have many interesting ideas on how to make the product even more useful for developers.
We’re very happy to receive feedback and ideas from other developers that use Realm and Realm Browser. Feel free to share your comments or ideas with us: [email protected]
About the content
This content has been published here with the express permission of the author.