Databases use this three-state for decades. It seems to work fine.
On Dec 4, 2008, at 19:43, Francisco Jose Peredo wrote:
Hi!
Pete Muir escribió:
>
> On 4 Dec 2008, at 16:57, Francisco Jose Peredo wrote:
>
>> Hi!
>>
>> Great job Dan!
>>
>> You missed
>>
http://www.seamframework.org/Community/PossibleBugInOrgjbossseamcoreValid...
>>
>> ;-)
>
> -> JIRA as Dan and I said
Fine, I'll JIRA.
>
>>
>>
>> Oh, and what is you opinon on:
>>
>>
http://www.seamframework.org/Community/IfAMethodReturnsBooleanItShouldntR...
>>
>> ?
>
> I think its fine, null == undefined which is valid state for
> something
> to be in.
Yes, but I have always felt uneasy about a null boolean thing... the
point of boolean is to restrict the possible outcomes of something to
"true" or "false", but with a nullable boolean we now have 3
possible
outcomes "true", "false" and "undefined"... and the problem
is that
"undefined" is also "typeless" and therefore bug prone, the code:
if(isUserInRole("administrator)){
//do something
}
else {
//do something else
}
looks like something perfectly valid, but it turns out it can crash
because isUserInRole can return null.
I mean I can understand it for MailComponent.getBoolean, and
org.jboss.seam.ui.util.JSF.getBooleanValue, but I don't like it for
org.jboss.seam.ui.graphicImage.Image.isRatio or
org.jboss.seam.web.IsUserInRole.isUserInRole.
Wouldn't it be better to use an Enum if there are 3 or more possible
outcomes?
Regards,
Francisco
>
>>
>>
>> Regards,
>>
>> Francisco
>>
_______________________________________________
seam-dev mailing list
seam-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev