Archive for the ‘Flex Builder’ Category

To bracket or not to bracket, making sense of single line conditionals

Thursday, March 19th, 2009

It’s taking me about 3 months to finally come up with a strong opinion about single line conditionals, but I now have a firm position:

“In the long run, it’s a bad idea to drop the brackets and put a conditional or iterator on a single line.”

Essentially sort of thing:

public function testResults(score:Number):void
{
    if(score < MIN_PASS) sendNotification(YOU_FAIL)
    else sendNotification(YOU_PASS)
}

Should always be this:

public function testResults(score:Number):void
{
    if(value < MIN_PASS)
    {
        sendNotification(YOU_FAIL)
    }
    else
    {
        sendNotification(YOU_PASS)
    }
}

Even when writing in a language that doesn’t use brackets, i.e. so called pure block languages like Python and Visual Basic, proper formatting should be used rather than single lines. If a language does use brackets, there is no excuse not to use them.

My argument follows this logic:

“Since debugging code is 20 times harder than writing it, by that definition you won’t be smart enough to find errors in clever code.”

(more…)

Internal Build Error: Flash -> SWC + Flex = BitmapData Insanity

Saturday, February 16th, 2008

I thought I would present a problem I seem to be having consistently in Flex builder, and see if anyone is searching for like issues.

For some reason, Flex Builder is not handling Bitmap Data with any sort of consistency when it is included as a class in a SWC exported from Flash. In my opinion, using SWCs to import visual content from the Flash IDE, is for the most part a fluid and excellent work flow. However, every once in a while, in seemingly inexplicable fashion, I get internal build errors.

(more…)