Saturday 22 December 2018

Good programming practises for storing / displaying data?

Hey guys, I am a cs student and still learning so I apologize in advance if this comes off as a little simple. Also if this is the wrong sub, I apologize but I think Electron runs on top of Node.jsI have an electron app and am storing data in a NoSQL db, NeDB (something like a NoSQL version of SQLite) . This data is also being displayed on screen. Should IStore everything in memory, display the changes as they occur, and write to the database upon exiting the program?Read / write to the db, and pull data from the DB to show to the screen?Hold the data in memory (in some variable) so I can display it on screen, and also continuously add to the DB as it is updated?The first option seems a little unstable as obviously, if the program crashes, you could lose a good chunk of data if you've had an app running for some time.The second option - I'm worried whether or not this would be too slow / redundant to both write to DB and then pull it back to display to screen? I think NeDB stores the whole thing in memory anyways, so it's less about the efficiency and more about just plain code redundancy.The third option - I don't know why I thought it was any good when I was running through options but I think I had some logical reasoning behind it at the time.Any help would be appreciated!​

Submitted December 23, 2018 at 01:03AM by tdot456

No comments:

Post a Comment