ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@apache.org>
Subject Re: [patch] mainly name-hiding
Date Fri, 11 Mar 2005 05:23:51 GMT
> 
> I believe these are responses to Jikes' complaining
> about shadowed instance variables.
> 
> 

No doubt - I'm not sure that Jikes should dictate the code.

>>Likewise, I do not see converting an if-else to a
>>ternary conditional 
>>makes the code clearer - on the contrary it makes it
>>more convoluted.
> 
> 
> Ternary conditionals are one of my favorite things.  I
> riddle the code with them in the interest of making it
> smaller... surely it doesn't raise the barrier of
> entry to understanding Ant's code _that_ much?  :)
> 

No, not *that* much but it's not really necessary. As an example, I 
personally find in the following, the original code is *much* clearer in 
intent and even in formatting.

-        if (callee != null) {
-            return callee.handleInput(buffer, offset, length);
-        } else {
-            return super.handleInput(buffer, offset, length);
-        }
+    	return (callee != null ?
+    			callee.handleInput(buffer, offset, length) :
+    				super.handleInput(buffer, offset, length)
+    			);

Personally, I primarily use terneraries for situations such as parameter 
passing, where I need to pass one of two values. In general, I much 
prefer readable code with good variable names over smaller code with 
abbrv vrbl nms.

Conor


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message