vendredi 15 janvier 2021

Best way for user interface to deal with database updates

Assume I have a database containing the names of something generic e.g. all my pets and a program that queries these names, saves them to an internal list (that is kept during runtime) and then displays them. The program also has a function to add pets at runtime. Now, I add a pet and both add it to the internal list of pets and save it to the database. Due to the new pet, I also need to update the visual representation. Is it better to query the whole data from the database again and display them or is it better to display the data from the internal list? In this small example it should not make a difference but I can imagine in bigger projects it does (e.g. if the database can be modified from different parts of the programm it could get difficult to keep the internal list updated). (In first place, I´m not looking for frameworks or libraries that can do anything about this for me. I´m interested in how the behaviour is best implemented from scratch.)

Is there a design pattern that targets this situation? Or any article about the topic?

Aucun commentaire:

Enregistrer un commentaire