Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(B&S) Clarification about instructions

 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
In my instructions it says: "All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII. "
This is how i understand it: If i am trying to write data that is less than the fieldsize I should be able to pad the remaining spaces with null?Is this correct? What and how to I pad the excess spaces? And when the string is over the actual space i shud trim it to the size of the field?
Shoud I do the check in the GUI or within the data class? I figure that i would allow users to input stuff and when it is over the required value, i warn them in the GUI!Is this Ok(Frankly i like the idea)!An insight would be appreciated!Thanks!
 
Surya De
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point. I would like it to be clarified as well. Personally I am calling the trim function when I am picking up the individual field values. My guess is that when writing back the values using the RandomAccessFile api, since we have to write back at specific positions and we are to use a file pointer for that purpose, I think the api would handle it automatically. But I am not sure.

Cheers,
Surya
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saheed,

Sun have acknowledged that there are parts of the assignment that deliberately contradict other parts of the assignment - the fact that the instructions specify null-terminated fields while the data file itself contains space-filled fields is one that they have explicitly set up for us .

One way or the other you are going to have to resolve this discrepancy. And you should make some comment in your design decisions about what you chose to do, and why you made that decision.

As for being provided with data that is larger than the allowable field sizes - you can set it up so that your GUI does not allow the user to enter data greater than the maximum field size, so the problem won't occur.

But that still leaves the problem of what to do at the Data level - personally I beleive that silently trimming the data is wrong (the user may loose what they consider to be valuable data without realising it). So I would have the Data class check the provided field sizes against the schema, and throw some exception if the allowable sizes are exceeded.

Regards, Andrew
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for ur insight! I guess the option of checking it in the GUI is quite a relief! Have a nice day all!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic