Special Thanks to FlexBuilder Team

Tuesday, November 25, 2008

This year at MAX, I had the privilege of speaking with several members of the FlexBuilder team during the "Flex Meet the Team" BOF. I went to that BOF with one question to ask, something along the lines of: "When you're programming Eclipse, how do you learn what APIs to use to achieve a given task". I know, that's a very broad question. Hear me out. The Eclipse framework is massive. Not Grand Canyon massive. Jupiter Massive. It's not just the programming APIs but the entire command/action framework which comprises gazillions of potential lines of XML configuration. It's actually not terribly complicated once you actually know what you're doing, but until you know what you're doing, it can be fairly intimidating. This is made both better and worse by the fact that there is an incredible amount of documentation, at least in API form, available. Better in that, hey, at least it's out there. Worse in that, hey, reading API docs doesn't really show you how to do something. Also potentially worse in that a lot of the examples online are older and so one can't be sure if those examples are relevant or deprecated. And Reading the schema for plugin xml extension points, while eye-opening, does not click right away.
So when I was asking my question, I wasn't asking "how do you do X", but "if you need to do X, how do you find -- in all this vast information available -- the example or the guide that you need to get you on the right path?"
To illustrate, let me give you a recent example. I'm tired of using this example, but it's relevant, so suck it up. I was refactoring the code inside the MXUnit plugin that collects tests and converts them to their CFC path. Imagine you've got a big ol' directory of tests, with subdirectories and whatnot. And you want to convert c:\inetpub\wwwroot\blah\tests\.... into blah.tests.XXXX for every test. You're probably thinking, "Simple. Just do a recursive directory list and for each file found, perform some string manipulation".
And that's how I did it originally. But here's the thing: once you start working with Eclipse, you start to realize that there's usually the right way, the wrong way, and "The Eclipse Way". And I wanted to use "The Eclipse way". My gut told me that this type of recursion was so common that Eclipse surely had a way to go about it. So in your head, think to yourself, "I need to loop over a directory, and all its children, and do stuff". If you know a little about Eclipse, you're thinking "How do I traverse resources?" or something like that.
So that's the problem statement: "How do you traverse resources and perform operations on each resource?"
Now... go look at the Eclipse API documentation and find the answer. Go on. Try it. I'll be here waiting.**
If I were asked this question, I'd probably be somewhat annoyed, especially at 8 PM after a few beers. "Do your homework, douche". "Read the f'n manual". "Ask the newsgroups". "Get away from me".
But not the FB guys. T, A, and S* were incredibly gracious with my probably stupid-seeming question. They were a complete delight to speak with! And they didn't blow me off. They engaged, and for that I am extremely grateful.
Both T and A told me that they struggled -- and to some degree continue to struggle with -- these kinds of problems. I don't know why, but I felt somewhat comforted hearing that. These are people putting out some kickass stuff, and they don't have everything memorized, either. For what it's worth, A told me he looks at the Eclipse source code itself, which I've only recently started doing but which was a lesson worth hearing again.
S, who is the in-house Eclipse guru, suggested among other things that I check out EclipseCon. This is kind of a pickle for me: I love programming the MXUnit plugin. I want to contribute more to CFEclipse (especially to the views that will NOT be replicated in Bolt when it comes out in 09). But I don't think I can justify the 3-4k it would cost to attend the conference considering that my only Eclipse programming work is open source. It's not like there's an MXUnit foundation! My company doesn't give a sh*t about my Eclipse programming, so there's no benefit to paying for my attendance. I wouldn't pay if I were them.
I'm hoping that, down the road, EclipseCon does what Adobe is doing this year with MAX: putting the presentations online for all to see.
Anyway, that's a long post just to say, "Thanks guys! You rock".
*Names changed. I'm honestly not sure if you're allowed to talk about people's names working on products. Better safe than sorry. Guys, you know who you are.
**Regarding the resource traversal question, it's simply resource.accept() passing in an IResourceVisitor. I was able to cut out nearly 100 lines of old shitty code and replace it with nice tight simple shiny code once I finally waded through the API and found what I needed. Took 2-3 hours to find where to look (you go down a LOT of dead ends) and less than an hour to get it all working. Once you see the finished product, you're like "Duh. Of course that's how it should be".


exbostonian said...

There are many good books that cover Eclipse plugin development extensively. My favorite is Java Developer's Guide to Eclipse. It would have taken you minutes to find the solution to that particular problem using the book.

No offense intended but I find amazing (and frankly appalling) how many people of the Google generation don't ever think of getting a book for research/learning. There are other sources of knowledge apart from the web.

Marc Esher said...

None taken. I've been using Building Commercial Quality Eclipse Plugins as my guide since I started, along wiht the SWT and JFace examples. I hadn't that particular book but will add it to the list.

Thanks for the suggestion.