What types of storage for desktop applications?

Asked

Viewed 327 times

2

Well, I’m developing a Java application to manage my bank statement, to separate the releases by categories and date, to generate charts in the future.

What are the means to save, modify and query the data? So that I can easily pass on the application, without having to install a separate database, Mysql for example.

I already know 4 ways, but I don’t know if they’re long term:

  1. Manipulate a Json.
  2. Handle an Xml.
  3. Create a database with SQL Lite and the like.
  4. Save serialized object in Java.

Questions:

  • What are the advantages and disadvantages of these forms?
  • What is the most viable for this project to be easy to distribute?
  • Is there a better solution I could adopt?
  • 1

    Welcome to Stackoverflow English. Your question is based on opinions and it can be closed. Adopt the technology that best fits your need, if you have doubts (Programming) in the course of using it, you can post the question here that the community will help you. Also remember to post your code.

  • Your application database will have many tables?

  • 2

    I think the issue has made the question broad.

  • is too broad..

1 answer

3


What are the advantages and disadvantages of these forms?

Methods 1 and 2 are good for read-only data as it is easy to load and access what you want.

However, considering that you will often want to query and filter the data in different ways, I believe it is more coherent to use a database embedded in the program as a proposal in 3. Good alternatives are:

The item 4 i wouldn’t even consider it as a decent storage form. This can generate several problems if you need to evolve your data structure.

Another problem with 1, 2 and 4 is that you will have to manipulate everything in memory and, to avoid data loss, make constant flush to the disk. You will also have to worry about file integrity, etc.

On the other hand, if the program aims to be simple and there is not much concern with data consistency, nor with more complex queries, managing everything in memory and serializing to the disk in JSON is not a bad idea.

What is the most viable for this project to be easy to distribute?

The best distribution nowadays would be in a web application. If you need to make use offline, you can create an APP that works autonomously, but is able to sync to a remote server using, for example, a REST API.

It’s more work, but it’s certainly better than storing a database or file locally, especially if the idea is that the data is accessible and modified from multiple locations.

Moving files back and forth can be a headache. One day you leave home and forget to take the latest copy of the file. Then you’re prevented from making any changes until you come home. The other day you make a change and do not remember if the current file is even the latest. If you forget which environment you last changed the file in, or make changes to two environments unintentionally, how will you ensure that current data is consistent?

However, if you still prefer a purely desktop version, the most flexible method would be to use the database from a file on disk. This is perfectly possible and easy using the databases I mentioned above.

Is there a better solution I could adopt?

Web app, if possible with a mobile app for simple offline releases and subsequent sync.

Considerations

Although I have tried to stick to the context of the question, some points here are somewhat opinionated and depend on the specific needs of those who will use the program, in addition to the specific restrictions.

For example, who will use the program has a smartphone? Does it often run out of internet access? Always carry a personal laptop?

  • The first instance, the program will run out of internet. And only on laptop or personal computer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.