Thomas Singer wrote:

   > Honestly, *that* would be MUCH simpler:
   >    private String getStringNotNull(String string) {
   >      if (string == null) {
   >        return "";
   >      }
   >      return string;
   >    }

...

True BUT,
refactoring is an iterative process :
   - I look at a part of the code
   - I refactor a little
   - I look at a part of the code
   - I refactor a little
   ...

In that context, it makes sense to first compress 9 lines into 1

 From :

 >>    public String getX1 ()
 >>    {
 >>         if ( __X1 == null ){
 >>                 return "";
 >>         }
 >>         else {
 >>                 return __X1 ;
 >>         }
 >>    }

To:
    public String getX1 (){  return (__X1 == null ? "" : __X1 ) ;}



Once you have replaced 2 such methods (18 lines), into
    public String getX1 (){  return (__X1 == null ? "" : __X1 ) ;}
    public String getX2 (){  return (__X2 == null ? "" : __X2 ) ;}

you can spot the similarities/duplications a lot more easily than before 
compressing them.

Alain Ravet


_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

Reply via email to