This remainds me of a utility method written by a former coworker at my
previous job, that rightfully belongs in the daily WTF.

public static function mtd_validarVar (variable : Object) :Boolean
{
 if (
  variable == false  ||
  variable == undefined   ||
  variable == ""    ||
  variable == null
  )
 {
  return false
 }else
 {
  return true
 }
}
Had he checked against 0, at least this method could have been used as a
generic replacement for the obscure and unreadable implicit boolean
coercion...

He also had the chutzpah to put this method in our core library, in a class
conveniently named VarUtils, so the whole team could benefit from it.

To add insult to injury, he had a very personal take on hungarian notation
and code formatting as well. Not to mention he was also in the "tabs should
be 8 spaces here, there and everywhere, and if you and the rest of the world
use 4 spaces, rest asured I will reformat any such piece of crap as soon as
I get a chance to put my hands on it" camp.
Nevertheless, he was a cool guy.

Cheers
Juan Pablo Califano

2009/8/18 Latcho <spamtha...@gmail.com>

> some great optimalistations can be found here:
> http://mindprod.com/jgloss/unmain.html
>
> for ex.
>
> class Truth
>  {
>  boolean isTrue ( boolean assertion )
>     {
>     if ( assertion != false )
>        {
>        return assertion;
>        }
>     else
>        {
>        return assertion;
>        }
>     }
>  }
> ...
>
> var doIt:Boolean;
>
> var trutherizer:Truth = new Truth();
> if ( trutherizer.isTrue( s.equals( t ) ) )
>  {
>  doIt = true;
>  }
> else
>  {
>  doIt = false;
>  }
>
>
>
> // hint: all the above accomplishes is:
> doIt = (s==t);
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to