Why flex/flash developers should be excited about Flash Builder 4

! Warning: this post hasn't been updated in over three years and so may contain out of date information.

flashbuilderFlash Builder has a great selection of new features, such as new workflow integration with Flash Catalyst and Professional, improved debugger, refractoring and profiling tools and great data services integration. Beyond these headline features though, there are some nice little enhancements to the developer experience that seem to have been overlooked by most.

Annoying “XML in .as files” bug fixed
The first enhancement with Flash Builder 4 (FB4) that I’m excited about is one that many folk have likely not encountered. It has driven me mad with frustration recently though. With Flex Builder 3 (FB3), if you created the following code:

You would get the following result in the Outline view:

fb3_xml_test

The reason that C() doesn’t show up is due to the fact that we declare b={} before c=””. If you put a dynamic property before a static one like this, it breaks the outlining parser. Function B() appears OK as A() puts b={} last.

In FB4, the exact same code results in the following outline view:

fb4_xml_test

The bug is fixed and one need no longer take care to order XML properties around this bug.

Cut & paste indentation support
If you cut a line of code in FB3 and paste it elsewhere, the code’s original indentation is preserved. So consider the folloing (rather useless) piece of code:

If we move the declaration of c outside of the if statement, it becomes:

We then have to manually correct the indentation of the declaration line. With FB4, the indentation is corrected automatically to match the surrounding code. So with FB4 it becomes:

Fix indentation
Following on from the last point, FB4 now also offers an easy way to automatically correct the indentation of a large block of code. With FB3, if you had the misfortune to encounter the following piece of code:

The only way to correct it would be to manually edit it. With FB4, hit ctrl-I and the code becomes:

Note how the position of braces, whitespace around brackets etc is left unchanged. Ctrl-I doesn’t attempt to impose a code style on your code, it just makes the indentation consistent. By default, tabs, with a four character spacing, are used. You can change that to spaces or a different width tab if you wish. For this post, I set it to 2 spaces.

So What?
Compared with the headline features, like data services integration, ASDoc support in MXML files and Flash Professional integration, these might seem rather irrelevant additions. This is to ignore the daily work practices of many developers though. It is the little changes like this that help to make Flash Builder 4 a bit more of a pleasure to use all day long; day in, day out. As Aral Balkan’s blog pronounces these days: “The age of features is dead;Welcome to the age of User Experience.” There is no better user experience than a product being a pleasure to use.