
Originally Posted by
ahmedsharaf2006
this some hints on RMS Development from my work experience i am wishing for comments
With respect to record store implementation we have to do the following for our application to be reliable and to minimize bugs as much as possible in record store operation
1.only one record store for the application try to make as few number of record stores as you can (one record store for the application is the ideal case)
2.single manager class handle record store operation make only single class that communicate with record stored (for data update, addition, delete, retrieval) and this class have all required methods(interface) for the application to do his work with database
3.only one record per record store every record store must have only one record(deal with the record store as its only plain text file and make you code handle all needed work) to avoid call to delete record method this will introduce many bugs in the future
4.use readUTF8 and writeUTF8 use the method readUTF8() and writeUTF8() to write strings to the record store don’t prepare the byte array with your self these two methods will do all work for you and will be nice for internationalization as you can store strings in any language(Arabic, English,…)
5.primitive data types that needed to be stored we you have primitive data types like (integer, Boolean, short, double,..) and your application need to deal with them as they are (integers,..) don’t convert them to string and store in record store and when retrieving them you have to parse them to convert the m again to their original types but use the already exit methods in the DataOuputStream and DataInputStream classes to deal with primitive data types you will find methods writeBoolean(), readBoolean() to read and write Boolean data types , readInt(),writeInt() to deal with integers data types.
6.avoid using the methods deleteRecordStore this operation can break the reliability of the application
7.don’t repeat the parsing process read and write your data using readUTF8 and writeUTF8 to avoid need to make your own tokenizer as the order you write tokens you can read them without the need for repeat the parsing process
ahmed sharaf