Hello. Been a while. I wrote a new small app that involves the use of an rms. upon confirming user's identity, app moves from login.java to contacts.java. this file represents my contacts screen. in its constructor, the fields, commands, etc are initialized and at the end, populateList() is called. populateList() accesses the rms and displays all its records on that screen. say a list of names. i have other screens that perform functions like add and search. these have BACK buttons. pressing back takes me to contacts.java screen again where its constructor is called and hence populateList() is called leading to rms being accessed and a list displayed. this didnt feel right to me. having to access the rms everytime i wanted to go to my main screen.
my friend told me that i can just access the rms ONCE and store the contents in a vector for example. then everytime i press back, i just display contents of the vector. this helps with search and sort. but if i do add, delete, update, then ill need to access the rms and vector for sure and change them according to what happens in these three methods.
MY QUESTION IS (yes finally): which is better, his way or my way? assume the worst like 200 records with images too and 6 back buttons! :P i know that it's TO EACH HIS OWN when it comes to implementing functions and approaching a problem. but surely there's a standard regarding handling the rms itself. is it normal to constantly call the rms for data or not? should it b limited like he said? there has to be some recommended list or policy or rules of communicating with an rms. right?
SECOND QUESTION: deleting a record in rms means no longer being able to use the id of that record since rms auto generates the IDs. regardless of the ID, it does look ugly (and possibly inefficient?) when the current ID is 200 yet there are only in fact 100 records. something needs to be done about the space in between yes? so my friend suggested we use vectors again. we copy contents of current store. delete the store. create a new one with the same name and store the contents there. this of course will be time consuming and possibly requires some processing power like my previous scenario. so i told him ill just have this 'clearing' method donet every 500 records. is this a good idea or i shouldnt care aout clearing/cleaning it up?

Reply With Quote


