Donald McLean wrote:
> -1000
Whow, that's a lot.
Honestly, Donald,
isn't it
- MUCH easier to write
- MUCH easier to read
- MUCH easier to notice the similarity between the methods in
and finally
- MUCH easier to find the typo in
version A than in version B :
Version A:
public String getLabel1 (){ return (__label1 == null ? "" :
__label1 ) ;}
public String getLabel2 (){ return (__label2 == null ? "" :
__label2 ) ;}
public String getLabel3 (){ return (__label3 == null ? "" :
__label3 ) ;}
public String getLabel4 (){ return (__label3 == null ? "" :
__label4 ) ;}
public String getLabel5 (){ return (__label5 == null ? "" :
__label5 ) ;}
public String getLabel6 (){ return (__label6 == null ? "" :
__label6 ) ;}
public String getLabel7 (){ return (__label7 == null ? "" :
__label7 ) ;}
or
Version B:
public String getLabel1 ()
{
if ( __label1 == null ){
return "";
}
else {
return __label1 ;
}
}
public String getLabel2 ()
{
if ( __label2 == null ){
return "";
}
else {
return __label2 ;
}
}
public String getLabel3 ()
{
if ( __label3 == null ){
return "";
}
else {
return __label3 ;
}
}
public String getLabel4 ()
{
if ( __label3 == null ){
return "";
}
else {
return __label4 ;
}
}
public String getLabel5 ()
{
if ( __label5 == null ){
return "";
}
else {
return __label5 ;
}
}
public String getLabel6 ()
{
if ( __label6 == null ){
return "";
}
else {
return __label6 ;
}
}
public String getLabel7 ()
{
if ( __label7 == null ){
return "";
}
else {
return __label7 ;
}
}
Alain Ravet
> I thought the whole point of refactoring was to make code
> more readable? If this is the kind of code you want, why
> aren't you programming in C++ or APL?
>
> I'd like to see the OPPOSITE refactoring, which we ALWAYS
> use whenever we see one of those darned ? operators in
> our legacy code.
>
>
>>>"Alain Ravet" wrote
>>>Request : new refactoring
>>>
>>>
>>>From :
>>>
>>> if (__phoneFax == null){
>>> return EMPTY_STRING;
>>> }
>>> else {
>>> return __phoneFax;
>>> }
>>>
>>>
>>>to :
>>> return (__phoneFax == null ? EMPTY_STRING: __phoneFax ) ;
>>>
_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features