Of all the wishlist posts I’ve seen for Flex Builder, the comment about removing refactoring was perhaps my favorite, if only for the irony. It managed to show up at the perfect time: I was heads down working on the code for reference detection (base technology for refactoring) and I had just broken everything. I was staring at my code, trying to figure out what on earth I could have done and then up pops this e-mail. Honestly, if it were that easy, if all I had to do was flip a bit to make refactoring magically work, I would have been on a beach in Mexico getting a tan. And believe me, I’d love to be on vacation.
The JDT (Eclipse’s Java development tool) and other IDEs like IntelliJ really have changed the game when it comes to expectations in the IDE space. Refactoring used to be one of those dreamt about features that languages like C++ make nearly impossible. Look at Visual Studio, the standard-bearer for C++ development: they still don’t provide refactoring support, rather they let third-parties do it. And now, a 1.0 product (really, Flex Builder 2 was a 1.0 product) is expected to provide functionality that even the biggest IDE’s don’t provide. I love competition and as a developer, I’m glad expectations have reached this point. But as an engineer working on language intelligence for a modern IDE, it’s a bit frustrating. But the future is bright for refactoring support in Builder, very bright.
ActionScript 3.0 is not C++ (thank god), and is much closer to Java in terms of class hierarchy. This means Flex Builder will be able to provide refactoring support in future versions. If all goes well (and so far it’s going very well), basic refactorings will be available in the next release of Flex Builder, code named Moxie. If you were lucky enough to be at 360Flex for either my presentation or Ted Patrick’s keynote, you saw a sneak-peak of this technology already.
Ok, here’s some dirt: I’m working on refactoring. I’m sure you’ve figured this out by now but I thought I would just come out and say it. Here’s what we’re supporting (right now) in Moxie:
-Find all References across files, projects and the workspace
-Mark Occurrences in files
-Rename
-Move type (classes and interfaces)
Of course, none of this is in stone and it could change at anytime. But I’d love to hear what you guys think about this so feel free to comment away!


As well as adding Find Usages and Rename Variable, Rename Method, please consider adding Extract Method (for ActionScript).
Hi Bernard-
Thanks for the feedback! Extract method is on the shortlist of refactorings to add, and I’m sure you’ll see it in the future. Probably not for Moxie, but soon after that I hope
Probably it could be reasonable to ask Eclipse DLTK (http://www.eclipse.org/dltk) guys to help on this task? What they are doing for Ruby is just amazing, and I believe ActionScript is not harder.
So we started Flex Builder before the DLTK began, and we have written the architecture to support about 95% of what the DLTK does. I’ve watched their progress and I’m happy with the direction they are moving, but we can’t use their architecture at this point. Also, the version of AS3 we support is not really a dynamic language but that’s besides the point.
And in terms of needing help, we have find references and refactoring working already. It’s not a question of needing help, rather it’s a resources issue. Being a commercial, closed-source project, we can’t ask the community for help so we do what we can within the confines of our schedule and man-power. And it’s really a scheduling issue more than anything else.
I am currently working with the free Flex 2 SDK and a text editor which does nothing for me. It does not fill in the names of imports, it does not know how many arguments I have in my functions, it certainly does not do Extract Method. I can open up more than one file at a time, though, how cool is that? And so useful in refactoring, too!
I’m sure I’ll hear when refactoring support is available in Flex Builder, maybe from the local flash user group in L.A., or maybe from you. I don’t think I could bring myself to buy an IDE that doesn’t support refactoring. I mean, doesn’t Flex B cost about the same as IntelliJ? Let me know ASAP! (Hope this helps your in-company scheduling efforts)
Powerflasher guys have this since their FDT 1.5 plugin for AS 2.0. And it was a huge step back (for me) when switching to AS 3.0 and start using Flex Builder 2.0 which is a basic editor with some additional thingies (for the moment) when doing Actionscript 3.0 only projects.
FlashDevelop combined with some small plugins like FindReplace gives some very basic refactoring but it’s cripple. Well, better something than nothing.
FDT guys are on a version 3 of their plugin and I hear great news like possibility to compile not only from a .AS file (like FB does) but from a FLA file either.
Hence merging the gap netween Flex and Flash when switching between different editors.
I like FB (basically because it doesn;t have a real competitor yet). But I love FDT plugin and can;t wait the official beta of version 3.0 at June.
Well, if you guys can make Moxie to compile from a FLA as well as pushing all these refactoring options then FB 3 can be a great tool to use it daily.
RIght now though Flex Builder (again, for actionscript only development, not MXML) is way behind even a standard code environment.
Oh well, MS doesn;t support refactoring in their VS not because it’s hard for them but because they know there are plenty of companies to do this for the different languages used in a common VS development.
Right now AS 3.0 code development depends entirely on your support and eventually the guys from FlashDevelop and Powerflasher and probably few more (Sapien with their Primalscript is just noise and the tool sucks) and if you don;t support it with all goodies into it, too bad for us, the developers.
Cross fingers to get is soon and without problems.
Good luck!
yes, im sure its easy for us actionscript developers to underestimate how hard it is for you guys to do all the “real work” that makes our lives so easy. thanks for everything. robust refactoring support would be awesome.
but back into whine mode. i have to agree with some of the thoughts of the previous post.
i first worked on a flex builder project 8 months ago. prior to that i was a tremendous FDT fan and FB2 seemed like a LEAP backwards.
i am coming back to flex to assess it for a new employer. working with a fresh install of FB2 it seems that code templates are still not there, and quickfix is not officially supported. am i missing an update? if not, im surpised that this tool seems to not have evolved much in the past 8 months.
can the author or any commenters give status on FB2 and when the next major update will released?
sorry if i am off base, but i have been skipping flex blogs for a while and feel out of the loop. and my googling is not bringing much info up that wasnt there last summer.
except that JSEclipse has code templates and not flex!!! waahhh!
I downloaded and am using FB3 now…having worked in Java development with Eclipse for 6+ years I am very excited to see the refactoring additions that you have added…so, how do I turn on “Find Occurrences”?…I’ve been looking everywhere and it doesn’t seem to work inside of FB3 beta 1…am I missing something?
Hi Gary-
There’s a highlighter icon in the toolbar that will turn on “Find Occurences” in the editor. Let me know if it’s not working
-david
I can’t find a Find Occurrences icon. I assume that you’re referring to the main tool bar – the one with Run and Debug buttons. I have build 3.0.172437.
I spent my entire day today refactoring pieces out of one package and into a common library.
I can’t wait until IntellIJ 8 drops. I’ll probably keep FB Pro, but I will only have to use it for GUI RAD when IntelliJ finally gives me access to all the nice refactoring goodness.
Unless, of course, FB4 finally decides that for $699 an IDE should be able to handle refactoring a class from one package to another and updating all the references. IntelliJ does ten times that that for Java for $249…
FB4 will support package refactoring, as well as move.
The hilighlight occurances feature is neat! Working with FB3 for half a year now, no previous Eclipse experience, and now by chance i read about the mark occurances button and tried it, Helpful!
Refactoring is indeed painfull, but since we have to do our jobs, and refactoring is part of a programmers job I guess, we still do it.
Before you move one or more classes to another package, first copy the package path, then move the classes, then hit Ctrl+Shift+F for search/replace in files.
Search for the package path you copied to the clipboard, and replace it with the changed/new path.
With a little bit of concentration, this works quite safely. It’s a bit manual, but it’s just what “real” refactoring would do anyway.
Question:
Any way that FB3 might benefit from the refactoring improvements implemented into FB4?