Need for Sqlite

Asked

Viewed 86 times

0

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

After I finished all the classes I kept thinking about the need for Sqlite on that occasion, since I won’t use it to authenticate users and bring information from other users.

So I made my entire data layer with complex CRUD’s in vain ? I wonder if as my application is online I would not need a bank Sqlite?

  • 4

    It’s hard to say for sure, without seeing, without understanding your need. But it’s likely that they do, most programmers today do a lot of things they don’t need, most likely because they want to see the house ready, but they don’t understand what it takes to make the house. If you have more information, I can try to answer.

2 answers

1

IS relative, because it depends on how you want your app to work.

A few months ago, I made an app that showed city events receiving data by JSON, I didn’t use a database because I didn’t need to save the events offline and that’s the case you should think about. If you want to save the information on the device, so that the user access it without having to run the webService every time you open the app, use the SQLite. If you don’t need it, the application will work normally, but the information will come whenever the user asks.

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

  • Now you’ve opened my mind, the app is for event tagging and user conversation, it would be really interesting to have these events available offline, had not thought this way. Thank you!

  • <3... Oh, one thing I forgot to mention, I saved the events in Mysql, but allowed users to comment on the events and I saved their comments also in Mysql, without saving on the device. But again, I could not see offline. As I said, think more about the user, the experience he will have... And you are welcome!

1

In a direct way, if you nay need to save data on device, do not need Sqlite.

There is no reason to add something to your code that you will not use (see exception).

Let’s take a look at 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 to the Web Service, you just need to change the way you save a CRUD Sqlite to send data to the Web Service. The way to do this depends very much on the architeur you are using, but it was just one example.

Then I shouldn’t use?

Well, then we skip a bit of your specific case and talk about applications.

Need to use has, however, it is very common to use for connectivity reasons. 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 application to work only when the device has internet, you do not need this data.

Going a little further, even if your application will return all the 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 on the Web Service and save the return on Sqlite. Imagine the system making a request to the Web Service to each page just to get the name of the logged in user? This would consume internet and would be several requests to the Web Service that could be handled just by saving the data in Sqlite.

Now, as has been said by @Maniero in comment, cannot answer to say for sure whether you will need it or not. Only you know the scope of the project and what it will actually need.

  • Understood, so it would be more practical, for example, I save in sqlite information of quick access and frequent search, as logged in user or for example list of friends and list of events of that user? the app basically acts as an event log of users and their "friends" to establishments.

  • @Joshua This depends very much on your need. For example, if you want to save user information, you should ensure that this data is modified in case of changes. If everything is done in the App, this is simple. Now, if you have some other form of insertion outside the App, this can be a little more complicated.

  • But that’s the idea

Browser other questions tagged

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