2

I recently started developing a small calendar application, in which I can add and view several calendar entries, which contain several data like name, date, alarm settings and so on.

Those values have to be saved locally, so the user can see his calendar entries from earlier sessions as well.

Right now this is solved with serialization, but I am not quite happy with this, as editing serialized data can turn out to become quite nasty the more stuff I am saving, and I think the process of iterating through the entries could also become a case for performance problems, even though this would most likely need a lot of data to happen.

I recently got the idea to use a local SQL table with a library like SQLite, and I think that this would make the process of editing single values a lot easier. Also I guess that this solution would scale way better with possible later additions.

Is there a good rule of thumb to determine which storage technology one should use? What are the ups and downs of commonly used technology like serialization or SQL tables?

2

What does a local database give you ? Referential integrity, atomicity and transactionality. I'd look at a serialisation mechanism for small applications, but as soon as you start maintaining sets of data, and particularly when you have to update subsets of that data, then I'd start looking at a local database.

e.g. if you're looking to save a tree of data, then saving a serialised version might work well. If you subsequently have to save a subtree of that tree, and reference it from the original tree, then a serialisation solution could be problematic (you could save the whole tree again, granted, but that could have performance implications). Of course you have the development overhead of mapping to your database schema to take into account.

0

What serialization brings to the party is that it makes it easier (in theory at least) to swap out one DB with another. Taking this one stage further, your app might talk to some kind of mid-tier which then interfaces with the DB. Having a platform agnostic data transfer method gives you a greater breadth of options as to how you architect the various layers.

If you're master of your own destiny or a fairly small development shop, these things might not matter to you so much, but at an enterprise level, they might.

You don't say what you're using to do the serialization but modern languages should make this fairly painless. There might be some work to do if you're firing serialized payloads directly to the DB but if you have a mid-tier, you can handle this more gracefully here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.