I'm currently developing a mobile application in Objective C for iOS devices. While doing the application I reach the point where I have to retrieve data from a database and show it on a table (the name of a specific workout routine and his description).
The way I see it I can do this in two ways:
- I can select every workout from the database and the associated description, build a collection of objects, send it to the appropriate controller and show in a table all the names, when one is selected I can send the appropriate object to another controller (the one from the next view) and show the appropriate description (this way I just do one operation over the database and manage a lot of objects).
- The other way of doing this is just retrieving all the workouts names, when one is selected retrieve the associated description from the database and show it (this way I do two operations over the database but manage a lot of less data and objects in the application).
What I'm concerned about is performance. Is it better to do more operations over the database and manage less information and objects in the application or is it better to do less operations over the database and manage more information and objects? I know that every application is different and one answer can't be applied to everyone of them, but how should I think about it when developing one?