You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Gallardo <ag...@agssa.net> on 2004/03/04 03:12:17 UTC

Re: cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding RepeaterJXPathBinding.java

joerg@apache.org dijo:
> joerg       2004/03/03 11:47:35
>
>   Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
>                         RepeaterJXPathBinding.java
>   Log:
>   clean up: removed unused code (for reverting changes we have CVS, so
> please remove old stuff always), JavaDoc added, comments fixed;
>   changed isNullAllListElements() => isAnyListElementNotNull(): the
> duplicate negation at usage time breaks my brain ;-)

This depends of the POV you see it:

isNullAllListElements() -> This is not a negation. It check if :

All elements on the List are null. Where is the negation?

isAnyListElementNotNull() -> Here is a negation "Not null"  :-D

Best Regards,

Antonio Gallardo.

Re: cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding RepeaterJXPathBinding.java

Posted by Antonio Gallardo <ag...@agssa.net>.
Sylvain Wallez dijo:
> Antonio Gallardo wrote:
>
>>joerg@apache.org dijo:
>>
>>
>>>joerg       2004/03/03 11:47:35
>>>
>>>  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
>>>                        RepeaterJXPathBinding.java
>>>  Log:
>>>  clean up: removed unused code (for reverting changes we have CVS, so
>>>please remove old stuff always), JavaDoc added, comments fixed;
>>>  changed isNullAllListElements() => isAnyListElementNotNull(): the
>>>duplicate negation at usage time breaks my brain ;-)
>>>
>>>
>>
>>This depends of the POV you see it:
>>
>>isNullAllListElements() -> This is not a negation. It check if :
>>
>>All elements on the List are null. Where is the negation?
>>
>>isAnyListElementNotNull() -> Here is a negation "Not null"  :-D
>>
>>
>
> Generally speaking, negative forms should be avoided, as their
> interpretation may be difficult depending on people's linguistic
> background. I used to work with Japanese people long time ago, and I'm
> sure this name, even with a single negation, would be very hard for them
> to understand.

I agree.
>
> So what about "hasNonNullElements()"?

The problem again is the "hidden" Non. This is a kind of negative.

Look as the "standard" isNull() function. Why it is not isNotNull()?
Because there is a negation.

Then, the original function name is better to me:

isNullAllListElements() or

areNullAllListElements()

To me it clearly states what we had in mind.

Goerg changed the function name (and behavior) to write:

if (isAnyListElementNotNull(...))

instead of

if (!isNullAllListElements(...))

As a rule I try to avoid negation inside the names.

In the case hasNonNullElements(), we can write also:

if (hasNonNullElements())

Interesting is that  the method need to check for each element if the
value is null.

At the end, I think I am not the best to decide the best name of the
function. :-D

Best Regards,

Antonio Gallardo.

Re: cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding RepeaterJXPathBinding.java

Posted by Antonio Gallardo <ag...@agssa.net>.
In fact we can call it:


isValidKey(...)     <--- I prefer this one over the below name.
isValidUniqueRowId(...)

The other names are too specific to what the function do. Sometimes it is
good to call the functions by what solve and not by how is the internal
implementation (using List, Set or whatever).

WDYT?

Best Regards,

Antonio Gallardo.


Joerg Heinicke dijo:
> On 04.03.2004 09:31, Sylvain Wallez wrote:
>
>>>>  changed isNullAllListElements() => isAnyListElementNotNull(): the
>>>> duplicate negation at usage time breaks my brain ;-)
>>>
>>> This depends of the POV you see it:
>>>
>>> isNullAllListElements() -> This is not a negation. It check if :
>>>
>>> All elements on the List are null. Where is the negation?
>>>
>>> isAnyListElementNotNull() -> Here is a negation "Not null"  :-D
>
> Hmm, that's true. But what I meant was the usage of
> !isNullAllListElements and ListElement != null inside the function.
>
> What you are really testing for is the availableness/usability of the
> list for unique identification. So the function itself should not return
> true if it only contains nulls.
>
>> Generally speaking, negative forms should be avoided, as their
>> interpretation may be difficult depending on people's linguistic
>> background. I used to work with Japanese people long time ago, and I'm
>> sure this name, even with a single negation, would be very hard for them
>> to understand.
>>
>> So what about "hasNonNullElements()"?
>
> Yes, this might be more obvious/understandable than "any" and "not" in
> my version.
>
> Joerg
>


Re: cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding RepeaterJXPathBinding.java

Posted by Joerg Heinicke <jo...@gmx.de>.
On 04.03.2004 09:31, Sylvain Wallez wrote:

>>>  changed isNullAllListElements() => isAnyListElementNotNull(): the
>>> duplicate negation at usage time breaks my brain ;-)
>>
>> This depends of the POV you see it:
>>
>> isNullAllListElements() -> This is not a negation. It check if :
>>
>> All elements on the List are null. Where is the negation?
>>
>> isAnyListElementNotNull() -> Here is a negation "Not null"  :-D

Hmm, that's true. But what I meant was the usage of 
!isNullAllListElements and ListElement != null inside the function.

What you are really testing for is the availableness/usability of the 
list for unique identification. So the function itself should not return 
true if it only contains nulls.

> Generally speaking, negative forms should be avoided, as their 
> interpretation may be difficult depending on people's linguistic 
> background. I used to work with Japanese people long time ago, and I'm 
> sure this name, even with a single negation, would be very hard for them 
> to understand.
> 
> So what about "hasNonNullElements()"?

Yes, this might be more obvious/understandable than "any" and "not" in 
my version.

Joerg

Re: cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding RepeaterJXPathBinding.java

Posted by Sylvain Wallez <sy...@apache.org>.
Antonio Gallardo wrote:

>joerg@apache.org dijo:
>  
>
>>joerg       2004/03/03 11:47:35
>>
>>  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
>>                        RepeaterJXPathBinding.java
>>  Log:
>>  clean up: removed unused code (for reverting changes we have CVS, so
>>please remove old stuff always), JavaDoc added, comments fixed;
>>  changed isNullAllListElements() => isAnyListElementNotNull(): the
>>duplicate negation at usage time breaks my brain ;-)
>>    
>>
>
>This depends of the POV you see it:
>
>isNullAllListElements() -> This is not a negation. It check if :
>
>All elements on the List are null. Where is the negation?
>
>isAnyListElementNotNull() -> Here is a negation "Not null"  :-D
>  
>

Generally speaking, negative forms should be avoided, as their 
interpretation may be difficult depending on people's linguistic 
background. I used to work with Japanese people long time ago, and I'm 
sure this name, even with a single negation, would be very hard for them 
to understand.

So what about "hasNonNullElements()"?

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }