Hi. I am going to start on my assignment. I have a question on the code that reads the db file. Not to get into too much detail (I hope I am not going against the rules, if so, please tell me so), I have a html file with requirements. Among others, it describes a file in a great detail - what fields are there, what is the length in byes of every field, their names and so on. My questions is - this is so specific, is it ok to just hardcode the values in my db reading code? The names, the lengths, and offset could all be hadrcoded as constants, and the code to read the file would be much simpler. I could of course do it dynamically, but does this make any sense? Will the points be cut if I do one or the other?
You know, I myself also hardcoded the values. I created an interface called DBConstants that has all the values, and this interface is also implemented by the Data class. But the code that I created for the DBFileReader tool reads the file dinamically, just so everybody can use it, and more people may make use of it.
I justified my choice of hardcoding the values saying that nothing was mentioned about the database schema changing, so I thought there were no problems, and the code would be simpler.
I read my database schema completely dynamically. My main argumentation was it would become very easy to use the Data class (I created for handling the room bookings) to handle a similar file with customers, hotels,... So it makes your Data class completely independent of the database file you are using (without adding too much complexity to the Data class).