Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Reading database file assumption?

 
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.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • 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!
 
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
 
Ranch Hand
Posts: 56
Python Java Linux
  • 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.
 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic