[ajug-members] boolean best?

AGoodspeed at cfglife.com AGoodspeed at cfglife.com
Fri Dec 12 10:25:56 EST 2008


The most important thing is not how you implement it, but that it meets 
your requirements. Certain applications may require separate sex and 
gender attributes (and/or multiples for an individual, like birth, 
current...) for example, and either of them can have more than two values 
depending on the requirements.

Also, you can wrap the attribute in as many ways as you need - 
isMale/isFemale, getGender... - and none of them have to directly relate 
to its representation in persistent storage if it is stored. I would 
suggest using the tenet of doing the minimum that will provide the desired 
function. If you have a required attribute that has two fixed possible 
values that you will always know the value for then boolean would be a 
fine representation; if you may not know the value then the object form 
(Boolean) would be better. An enum would be a reasonable approach, 
particularly if you need more than two values. A string would be good if 
it is descriptive rather than discreet values.

Pick a working approach for your requirements and move on.

-Andrew Goodspeed




"521" <521 at ofig.org> 
12/12/2008 08:51 AM
Please respond to
ajug-members at ajug.org


To
ajug-members at ajug.org
cc

Subject
[ajug-members] boolean best?






would boolean be best...:
an object/class named Living...
?have a string gender ("male"/"female") OR have a boolean isMale or 
isFemale?
which is more efficient (better design/etc.)?
barclay_______________________________________________
ajug-members mailing list
ajug-members at ajug.org
http://www.ajug.org/mailman/listinfo/ajug-members

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ajug.org/pipermail/ajug-members/attachments/20081212/711f2cc5/attachment.html 


More information about the ajug-members mailing list