How do apps or programs store long term data?

413 views

Beginner programmer here.

Beyond variables which are temporary storage how do programmers keep data, say, after the app is closed and reopened?

​

example: if I enter 4 items on a list and press save – and I close the app, how would one store the data to view later from within that same app?

I always think I should be able to store data from an app onto a spreadsheet and have the app call the data from the spreadsheet – but I’m sure it’s more complicated that this.

Because I’m a noob, perhaps I am not using the proper vocabulary to explain so here’s a more specific idea. I want to make an app that allows me to enter asset numbers or serial numbers of ipads and store information about them- like past repairs/complaints or issues. When I enter the asset number from the app I’d like it to pull up all of this data.

To me I would just say “use a spread sheet” but I would like the challenge and fun of creating the app. The problem is I’m not sure how to interact with any sort of long term storage- the only real thing I understand is variables and the likes.

this is probably way over my head, so, I don’t need a tutorial on how to do this. I’m just curious what is commonly done or how developers solve the issue of needing long-term data storage they will call on later.

THanks!

In: Technology

8 Answers

Anonymous 0 Comments

Others have explained the common ways to do it, but I feel it’s helpful to point out: you *totally* could store all that information in a spreadsheet and load it back in when the app is started again. Your idea isn’t wrong at all, and it doesn’t have to be more complicated than that. (All right, if you’re writing an app used by millions, this might not cut it…)

There are better options of course, but everything has its pros and cons. Databases are optimized, efficient, and easy to manipulate. Text/binary files are simple and quick to implement. I’ve written programs that manipulate spreadsheets before because I didn’t want the up-front cost of setting up a database but still wanted to be able to hand edit and view data (and share with others) in a simple way.

Anonymous 0 Comments

You save it to a file. Either that or send it to some other computer to store it for you (like a central server).

While the “proper” way to do something like this would be a database that organizes the data or something the like I’d suggest you start simply learning how to create, open, read, and save normal files. All programming languages are fully capable of interacting with the file system and it’s a good way to start learning about long term storage.

Anonymous 0 Comments

The information is written on a external memory.
The application asks the OS to save the data in some file, it does that via a system call (there are some CPU instructions that, for safety reasons, only the kernel can make, like reading and writing anywhere on memory ) The OS reads the chunks of data it is supposed to save, and write on the persistent memory (generally a HDD, or some flash memory)

Programming languages have libraries that implement those specific system calls (or you can use an indirect method, like a library that can execute another program, and that program makes the commands to write on external memory).

Anonymous 0 Comments

Depends on the app, sqlite3 is very popular (it’s an regular database that’s super easy to include in an app).

The other method is just have some configuration objects and seralize them and write to some format, then you can read it and deserialize them to get the data back. Many libraries support generic ways of doing this, Apple’s stuff favors .plist files which are mostly XML files, but they have a binary conversion of the XML as an encoding option.

Anonymous 0 Comments

Just adding on top of many other answers here, many programming languages have standard library functions for “serialization,” that is turning data essentially into a string of bytes that can be nicely put into a file, and “deserialization” which does the opposite. If you want to get fancy with access times and program efficiency you can of course deal with databases but this alone will give you an array of bytes you can write and read from a file if you want to mess around with doing these things manually.

Anonymous 0 Comments

In some kind of a storage. Like sql database or a simple file. When the program is started again it read from that storage. So you need to define a structure how to save that date

Anonymous 0 Comments

Write it to a file, incorporate a database into your product (which essentially is just a file), save it to the cloud…lots of ways. If you’re writing your app in an object oriented language there are lots of ways you can literally save objects to a storage ready form like json or xml or whatever. When your app starts back it it simply reads back in all the serialized objects if find lying in its storage area and away you go.

Anonymous 0 Comments

Database. Like mysql, mongodb, nosql and so on. When you save you are writing the value into the database and the program knows how to fetch that value from the database when you return.

Or for local apps it just writes data in some file in similar fashion and when you open the app it reads the value from that file.