Announcing the Realm C++ SDK Alpha
Rate this article
Today, we are excited to announce the Realm C++ SDK Alpha and the continuation of the work toward a private preview. Our C++ SDK was built to address increasing demand — for seamless data management and on-device data storage solutions — from our developer community in industries such as automotive, healthcare, and retail. This interest tracks with the continued popularity of C++ as illustrated in the recent survey by Tiobe and the .
The Realm C++ SDK allows developers to easily store data on devices for offline availability — and automatically sync data to and from the cloud — in an idiomatic way within their C++ applications. Realm is a modern data store, an alternative to SQLite, which is simple to use because it is an object-oriented database and does not require a separate mapping layer or ORM. In line with the mission of MongoDB’s developer data platform — designing technologies to make the development process for developers seamless — networking retry logic and sophisticated conflict merging functionality is built right into this technology, eliminating the need to write and maintain a large volume of code that would traditionally be required.
We consider the Realm C++ SDK to be especially well suited for areas such as embedded devices, IoT, and cross-platform applications:
- Realm is a fully fledged object-oriented persistence layer for edge, mobile, and embedded devices that comes with out-of-the-box support for synchronizing to the MongoDB Atlas cloud back end. As devices become increasingly “smart” and connected, they require more data, such as historical data enabling automated decision making, and necessitate efficient persistence layer and real-time cloud-syncing technologies.
- Realm is mature, feature-rich and enterprise-ready, with over 10 years of history. The technology is integrated with tens of thousands of applications in Google Play and the Apple App Store that have been downloaded by billions of users in the past six months alone.
- Realm is designed and developed for resource constrained environments — it is lightweight and optimizes for constraints like compute, memory, bandwidth, and battery.
- Realm can be embedded in the application code and does not require any additional deployment tasks or activities.
- Realm is fully object-oriented, which makes data modeling straightforward and idiomatic. Alternative technologies like SQLite require an object-relational mapping library, which adds complexity and makes future development, maintenance, and debugging painful.
- Updates to the underlying data store in Realm are reflected instantly in the objects which help drive reactive UI layers in different environments.
Let’s dive deeper into a concrete example of using Realm.
Next, we’ll open a local Realm and store an object in it:
With the object stored, we are ready to fetch the object back from Realm and modify it:
While the above query examples are simple, enables developers to easily express queries even for complex use cases. Realm uses lazy loading and memory mapping with each object reference pointing directly to the location on disk where the state is stored. This increases lookup and query speed performance as it eliminates the loading of pages of state into memory to perform calculations. It also reduces the amount of memory pressure on the device while working with the data layer.
The Qt framework contains a comprehensive set of highly intuitive and modularized C++ libraries and cross-platform APIs to simplify UI application development. Qt produces highly readable, easily maintainable, and reusable code with high runtime performance and small footprint.
The example provided together with Qt is a smart coffee machine application. We have integrated Realm and Atlas Device Sync into the coffee machine application by extending the existing coffee selection and brewing menu, and by adding local data storage and cloud-syncing — essentially turning the coffee machine into a fleet of machines. The image below clarifies:
This fleet could be operated and controlled remotely by an operator and could include separate applications for the field workers maintaining the machines. Atlas Device Sync makes it easy for developers to build reactive applications for multi-device scenarios by sharing the state in real-time with the cloud and local devices.
We are working hard to improve the Realm C++ SDK and will be moving quickly to private preview. We look forward to hearing feedback from our users and partners on applications they are looking to build and how the SDK might be extended to support their use case. In the private preview phase, we hope to deliver Windows support and package managers such as Conan, as well as continuing to close the gap when compared to other Realm SDKs. While we don’t anticipate major breaking changes, the API may change based on feedback from our community. We expect the ongoing private preview phase to finalize in the next few quarters and we are closely monitoring the feedback from the users via .