Need for SQLite [closed]

0

I want to clarify the following question: I have a Android project that uses a webservice , but I did all the data access part in Android and my webservice will be done in Java .

After I finished all the classes, I was thinking about Sqlite on this occasion, since I will not use it to authenticate users and bring information from other users.

So, did I layer my entire data with complex CRUDs in vain? I want to know if my application is online I would not need a Sqlite ?

    
asked by anonymous 13.12.2016 / 13:58

2 answers

1
  

Directly, if you do not need to save data to the device, you do not need SQLite.

There's no reason to add anything to your code that you will not use (see exception).

Let's go to your example.

If you will send all the information to a Web Service and return all the data from it, you will not use SQLite. Now, your CRUD may or may not have been in vain, it depends on how your system is architected. If you will save the data in the Web Service, you just need to change how to save a CRUD SQLite to send data to the Web Service. The way you do this depends a lot on the architecture you're using, but it was just an example.

So should not I use it?

Well, we've skipped some of your specific case and talked about applications.

Need to use does not have, however, is very common to use because of connectivity issues. Not always will the person have access to the Internet, and losing everything that was done (depending on the application) would be a bad experience for the user.

Now, if you want your app to work only when your device has internet, you do not need this data.

Going a little further, even though your application will return all data from the Web Service, there may be cases where it is more performative and less "costly" for the user to perform a single query in the Web Service and save the return in SQLite. Imagine the system making a request to the Web Service to each page just to get the username of the logged in user? This would consume the internet and there would be several requests to the Web Service that could be handled just by saving the data in SQLite.

Now, since by @bigown in comment , you can not reply say whether you will need it or not. Only you know the scope of the project and what it will really need.

    
13.12.2016 / 14:18
1

It's relative , because it depends on how you want your application to work.

Some months ago, I made an application that showed events in the city receiving the data by JSON , I did not use a database because I did not have to save the offline events and in that case you must think If you want to save the information on the device so that the user can access without having to run webService every time the application is opened, use SQLite . If you do not need this, the application will work normally, but the information will come whenever the user asks for it.

To be more precise, think about the user . Think like the user , not as developer . See if you, as a user, would like an application to only work with the internet, knowing that at some time or another you will be offline.

    
13.12.2016 / 14:09