• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: schema info

 
joe black
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I need to write methods to get the information in the schema section such as the field names, number of fields, field length... or can I just hardcode these values since they are given in the spec?
 
Kerry Friesen
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,
Many people have implemented methods or classes to represent the schema information. I didn't choose this route, but used constants in my data access class for the field names, field lengths, etc.
I still ended up with a 40/40 for the datastore section of the assignment without using a schema class. During development, I wrote methods to see what the schema values were and compared them to the spec. I did this to see if the actual and spec values matched before setting the constant values.
Cheers,
Kerry
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to agree with Kerry. I don't think that hardcoding the fields and so forth is going to fail you. I actually refactored my code to use a non-specific schema .. schema.getFieldValue(fieldName) ... etc. Possibly being so object-oriented will get you a few OO points under general considerations or someplace in the scoring. Probably even easier to understand/grade since there's a clear separation of duties in your database subsystem.
There is a bit of a hit on performance by doing everything through a schema, so if your spec says anything about that, it should influence your decision.
But all in all, either approach will work just fine as long as it's done correctly and clearly, I would imagine.
 
joe black
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic