Re: [Flashcoders] maintainable code

2009-08-18 Thread Keith H
WTF comes from trying to plan for worse case scenarios. I did not write this. My doppleganger did :) var WorstCaseSenario:*=" 0x00 "; trace(toBoolean(WorstCaseSenario) == false); function toBoolean(bool:*):Boolean { if (bool == "" || !bool) { return false; } if (bool is Bool

Re: [Flashcoders] maintainable code

2009-08-18 Thread Juan Pablo Califano
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

[Flashcoders] maintainable code

2009-08-18 Thread Latcho
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; } }