• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading database file assumption?

 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just wondering is it possible not to read all values in database file, e.g. magicCookie, record length, etc. and just assume an offset into the actual file content since we know the schema and the actual file format or does 1 have to implement and return all file content and headers in file? Or would 1 automatically fail if didn't implement this?
Thanks.
 
Roel De Nijs
Sheriff
Posts: 10213
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

You could hard-code the position where the records section starts (and maybe document this decision). Because the assignment has no must requirement about having to read the database schema, you certainly won't fail taking such an approach. Maybe you will lose some points, because this approach is not really flexible for future changes (like columns getting bigger, smaller, being added, removed,...)

Kind regards,
Roel
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Mark!

Also, some people choose not to read the magic cookie value and just assume that the file provided to the application is a valid one. This is really your choice; just remember to document it!
 
Jason Moors
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

I agree with the Roberto and Roel, I don't think your approach would automatically fail but I'd be surprised if you didn't lose some marks, as I'm not sure how you could justify not checking the magic cookie, it's there to check you are opening file in the correct format, i.e. what would happen if didn't check the magic cookie and tried to open a Word document for example.

I definitely agree with keeping it simple, but not to the extent where I cannot reasonably justify implementing functionality.

Regards,
Jason
 
Gert-Jan den Besten
Ranch Hand
Posts: 56
Java Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

In my assignment I hard-coded the starting position of the records section. But I did check the magic cookie.
No points were deducted.
 
Mark O' Sullivan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers, thanks to everyone for all their kind help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic