What types of storage for desktop applications?

2

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

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

I already know 4 forms, but I do not know if they are long-term practices:

  • Manipulate a Json.
  • Manipulate an Xml.
  • Create a database with SQL Lite and the like.
  • Save the serialized object in Java.
  • Questions:

    • What are the advantages and disadvantages of these forms?
    • What is the most feasible for this project to be easy to distribute?
    • Is there any better solution I could take?
    asked by anonymous 04.11.2015 / 01:52

    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 data in different ways, I believe it is more consistent to use a database embedded in the program as proposed in 3 . Good alternatives are:

    The 4 item I would not even consider as a decent form of storage. This can lead to several problems if you need to evolve your data structure.

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

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

      

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

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

    It gives 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 to and fro can be a headache. One day you leave home and forget to bring the latest copy of the file. Then you are barred from making any changes until you return home. The other day you make a change and do not remember if the current file is even the most recent. If you forget which environment you last changed the file to, or you make changes in two environments unintentionally, how will you ensure that the 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 any better solution I could take?

    Web application, if possible with a mobile application for simple offline postings and subsequent synchronization.

    Considerations

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

    For example, who will use the program have a smartphone? Do you often not have internet access? Are you always with a personal laptop?

        
    04.11.2015 / 05:44