Data Management Tools for Embedded Software Development
Sasan Montaseri, ITTIA, http://www.ittia.com/
When it comes to embedded systems and mobile devices software, developers face a choice between flat file and embedded database, as any future change can be very risky and expensive for their application, in a demanding market where shortcomings can result in failure.
For stand-alone applications that store little data, custom flat file formats are a straightforward method to save information. Plain text files use a human-readable format, such as INI, CSV, XML, or JSON that is parsed into application-specific data structures. Similarly, flat binary files are created by writing those data structures directly to disk. However, the simplicity of flat files come with a number of limitations, such as:
Even with binary files, some common problems are:
The need to store data in a software library takes developers of embedded systems and mobile devices to choose an embedded database. Databases can be implemented in many different ways, and the choice of algorithms in a particular database product has a profound impact on performance characteristics and what features are available. Areas most impacted by the implementation of the database include:
All embedded databases serve three main purposes for data management:
Balancing these three areas of functionality is difficult because strong guarantees in one area can weaken the capabilities of the other two areas.
SQLite is an example of open source database available on market. Following, we will study some of the pros and cons SQLite as a database:
To overcome SQLite's shortcomings, developers of embedded systems and mobile devices should look for a database offering the following features:
A feature-level comparison between open source and proprietary databases cannot be done accurately, as there is too much variation within each camp. However, the following table shows how a database combines the best qualities of both plain text and binary file formats, while also overcoming several important limitations:
Plain Text Files |
Flat Binary Files |
Databases |
|
Human-readable format |
Yes |
No |
No |
Convenient for configuration files, any editor can view and save a plain text file. |
|||
Compatible with existing tools and APIs |
Yes |
No |
Yes |
Standard tools make it easy to convert to a spreadsheet or generate reports. |
|||
Platform-independence |
Yes |
No |
Yes |
Variations in data structure alignment and padding tie flat binary formats to one platform. |
|||
Variable-width fields |
Yes |
No |
Yes |
Compact storage formats rely on dynamic buffers, not fixed-width structures. |
|||
Model hierarchical data structures |
Yes |
No |
Yes |
Nodes in a tree map readily to XML elements and database tables alike. |
|||
Minimum overhead |
No |
Yes |
No |
Records in a binary file are copied directly between memory and disk. |
|||
Efficient write throughput |
No |
Yes |
Yes |
In-place updates avoid rewriting an entire file after updating or deleting a record. |
|||
Model relational data structures |
No |
No |
Yes |
Organize records with multiple unique and primary keys. |
|||
Transaction logging |
No |
No |
Yes |
Crash recovery protects data from unexpected power loss and similar failures. |
|||
Isolated shared access |
No |
No |
Yes |
Concurrent tasks must coordinate to access data safely. |
|||
Scalable sorting and searching |
No |
No |
Yes |
To find records quickly, indexes must be continuously maintained over key fields. |
|||
Standard query language (SQL) |
No |
No |
Yes |
Express complex queries with little or no application code. |
|||
High availability |
No |
No |
Yes |
Replication and online backup mitigate media and communication failure risks. |
Final Thought
Relational embedded databases offer solution to those typical problems. When you embed your application with an open source database like SQLite, you decide to become a database company and manage your own updates, upgrades, and patches. Choosing a proprietary database connects you to a dedicated team that will be available to take care of your needs from accountability, assistance in managing the danger of intellectual property and legal risks, and prediction of uncertainties. This helps application development to be simplified, and rather than building separate solutions for each of these problems, the application developer uses a standard framework for accessing and modifying data. Furthermore, reconciling these features with each other in a single application is not trivial and can become a great distraction to developing the business logic of the device.
Database Knowledge
Click here to view the complete list of archived articles
This article was originally published in the Winter 2012 issue of Methods & Tools