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

size column -> 6 bytes! (B&S)

 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The "size" column length is 6 bytes, so it is larger that an Integer and shorter that a Long. I store it in a Long variables in my Contractor class.
I'm planning to validate all the inputs in order to verify if they are inside the 6 byte range( -2^47 to 2^47 - 1). Am I correct ? Is that a valid approach ?


Thanks
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one? Am I saying something stupid? Andrew?
 
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 Samuel,

Sorry I missed this. Normally I try not to answer any posts within 24 hours of them being posted, then jump in if there have been no posts or if I think that the questions or answers are going to the wrong areas. But somehow I missed this one after 24 hours.

From the instructions
...all fields (which are text only)...


So at 6 text characters, the maximum number that could be represented is 999999, which falls somewhere between Short.MAX_VALUE (32767) and Integer.MAX_VALUE (2147483647). So you chould store it in an int (or an Integer) if you want to change from using Strings (I agree that displaying numbers as numbers is more user friendly).

Regards, Andrew
 
Lara McCarver
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your approach, of using a Long (or an Integer) and validating is fine. But a Short could be fine too... do you actually think that a contractor is going to have more than 32787 people available to hire out Just document your decision.
 
Samuel Pessorrusso
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
I missed out the "...all fields (which are text only)...".
I'll store it in a Integer.

Lara, I really don't like to make an application not synchronized with the database. If the database supports a value, even a really unfeasible value, in my opinion, the application must support that value too. Some day, this value can become feasible. My experience with real project sponsors tells me that. But thanks for your post! It is always good to discuss some design.

Project almost finished!
[ August 15, 2005: Message edited by: Samuel Pessorrusso ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic