今日推荐英文原文：《Key Tips to Choose the Ideal Database Solution for Your Mobile App》
推荐理由：GitHub 之前有过像样的微信小程序——虽然已经停止运行了，这个是一个新的小程序。你可以像平时一样翻 Trending，翻 issue 等等，尽管用在工作上的效率比起电脑浏览器来说还是低了不少，不过平时利用碎片时间看一看新出现的项目来长长见识的话这会是个好选择。
今日推荐英文原文：《Key Tips to Choose the Ideal Database Solution for Your Mobile App》作者：Juned Ghanchi
推荐理由：但凡是要存点东西的 app 都可能用得到数据库，这篇文章就是选择数据库时的一些小 tips
Key Tips to Choose the Ideal Database Solution for Your Mobile AppWhat is a database for a mobile app? It is basically responsible for keeping all the user information and making them available at the right time and the proper context. Naturally, using the right kind of database is very important to secure user data and deliver a rewarding experience.
As far as choosing the right database technology is concerned, there are some considerations that every mobile app developer should go through. Here we are going to explain some of these considerations.
The choice isn’t just limited to SQL vs NoSQLYou probably have come across various posts on the pros and cons of the SQL and NoSQL database, and you often think these are the two main database options to choose from. But seriously, choosing the database isn’t just limited to this duality between SQL and NoSQL. There are several other things to consider.
The app developers need to choose a database with right size, structure and performance to support the demands of the app in question. • The database structure basically is all about how you choose to store and retrieve the data at the time of the need. Choosing the right database depends on finding the appropriate structure to deal with the type of application data. Often by selecting the database with appropriate structure, you can reduce the development efforts to a minimum. • The database size refers to the capacity of the database for storage and retrieval. A database with advanced partition system can easily store data across multiple systems and servers. • Database speed and scalability refers to the time taken by the database in reading and writing the data. While there are databases characterized to serve read-heavy apps better, there are several others that are appropriate for write-heavy apps. When choosing a database for your application, you need to go through all these considerations instead of choosing just a SQL or NoSQL database.
Data Safety and SecurityThe second significant consideration is ensuring optimum safety and security of the data. When your application needs to use decentralized data storage with synchronize accessibility, you must have proper data security in place to ensure an appropriate authentication and have to address the needs for restful data, data in motion and accessibility for reading and writing.
When it is about the authentication, it needs to be flexible, and you need to integrate public, custom or standard authentication providers. Offering a secure file system and data-level encryption is also essential to secure restful data at both servers and client-side.
When it comes to data in motion, security must be ensured through secure channels like TLS or SSL. At the same time, the database must offer all appropriate controls to allow users interactions with accessible and modifiable data.
Using a Flexible Data ModelUsing the right data model is really a mission-critical consideration for the app developers. The right data model ensures how well the database can be integrated with the app. The right model also ensures how over time it can go through changes with the evolving requirements.
Data modelling basically help the developers to map all the features of an app into the data structure. The model will easily allow you to see all the entities and their related aspects and their corresponding relations. When fitting your app data into the structure, you easily know the appropriate structure for your app.
Let’s have a look at the vital database models.
Relational database model: This model classifies data through tables, and each table consists of rows. Data keys identify these tables and their constituent rows. These keys help relating multiple tables of data and help to access data as per the contexts or requirements.
Document-based: This database model basically stores data in a structure made up of fields with simple or complex values. In such a database, each document can be represented through different fields. Such database by supporting complex hierarchies of documents allows embedding them inside the apps. This type of data model is not limited to fixed schemas are preferred by developers for flexibility.
KeyValue-based: Key/Value-based database systems are known for simplicity and easier accessibility. As per this system, data values are stored with unique keys.
Column-based: Column-based databases work much like the relational database systems and keep data stored in rows and columns. The columns of data can have multiple values. The data can be fetched either by row or column as per the required type of data.
Graph: Graph-based database model actually stores data entities governed by their internal relationships. For easy navigation across various data entities and retrieving data through the relationships, this storage type comes with great help.
Resolving Data ConflictsLast but not least of all critical considerations regarding the choice of the database should be resolving the data conflicts. Just because in the context of mobile apps, some data can be modified simultaneously by several different devices, conflicts between data versions is a common issue. This is why developers need to choose a database with a robust system to resolve such conflicts.
The resolving conflict system of the database has to be flexible and accommodating as well. The resolution of conflicts should be carried across devices, users, cloud systems and other third-party integrations. Conflict resolving should work differently in various systems.
As of now, a system like the Couchbase Mobile seems to be an ideal solution as it addresses the differences with the revision trees ruled by the protocol of picking the most active branch. Instead of clock based systems where clock differences across different devices are a common issue, this revision tree model is ideal for conflict resolution for mobile apps.
ConclusionAll the tips mentioned above concerning the choice of the right database system can work hand in hand to help you pick the ideal model, structure, security and conflict resolution for your application.