there is nothing in the assignment that says that we have to read fields' information of the database (such as field length, name etc).
but if we want our GUI to be separate from the DB layer i think we should read that kind of information of the DB and provide the functionality of querying that info to the Data class to allow the GUI to be as separate as possible.
not quite sure if i made my point clear but what do you think ? is there anyone who didn't read the DB fields of the database and passed with an excellent/ V.Good grade?
The way I read it, it's your choice if you want to hard code the field names or to read them dynamically, and I think both can be ok, as long as you documents what considerations you went through while you reached your decision.
The documentation of your thoughts and reasons for your decisions, is more important than your actual choices, as I understand it.
well.. the sample database IS your database, so whatever order the fields are in is the order they are..
And the magic cookie allows you to identify that the file is really your database.. So SUN will only be able to use the correct database with your application...
As for handling that dynamically or not, it's a design choice.. However, I believe you will have to write the code (throwable or not) to find the exact size of your header.. might as well read the value, keep the code and do it dynamically