You are in a maze of twisty little classes, all alike.

OK, so maybe going with WPF wasn’t such a great idea after all. It is just so incredibly over-generalized and over-engineered. I am hitting my gag limit. I don’t have the time or the interest to become an expert on this monstrosity. I am scared of having to debug the mysteries hidden within this black box. They are simplifying it for Silverlight, but that is not ready. I have this sinking feeling that I have made a big mistake.

I am also feeling uncomfortable with C#. It is just different enough from Java to be confusing. The library docs are not very good. Speaking of which, they don’t even have a Javadoc equivalent – they have an XML format for embedded docs, but there is no way to compile it to a human readable form! Weak stories on version control and unit testing – you need to go with crufty Microsoft tools (SourceSafe is famous for corrupting repositories) or thinly supported third party tools. Jetbrains makes an amazing plugin for Visual Studio called Resharper that eclipses Eclipse. Unfortunately it doesn’t support the C# 3.0 language features, and I would rather forgo them than give up Resharper. Overall, C# feels a little provincial – Java has a more diverse and vibrant community.

What got me into this situation is my anger with Swing. Here is an anecdote. Take a look at the SwingSet2 demo that ships with every JDK. It is only in 1.6, 10 years on, that it finally uses antialiased fonts on Windows. They have been able to do this since 1.4. What is wrong with these guys? What kind of UI framework team doesn’t care how ugly its demo app looks? Why did they wait till 1.6 to make this a default?

I am really at a loss about how to handle my UI. Flash looks like the right thing, but ActionScript is too limited. Silverlight and JavaFX look promising, but they are not ready.

Vineet suggested I check out Draw2D. I also just discovered Zest, which builds on it. Draw2D is a SWT framework for box-and-line diagrams, which comes close to my needs. It supports the layout of overlapping graphical components carrying behavior. There is support for scaling. Some primitive (synchronous) animation. No transparency. Maybe I can hack it up to add the features I need. That might be easier than using WPF. Ironically, the SWT team is currently porting to WPF.

There is also SWG, which is essentially a Flash clone on SWT. Unfortunately it forked SWT and is not being maintained. But maybe I could copy parts of it, like the animation framework. That is the beauty of open source – you can pierce the API to read it or hack it. The impenetrable black box of WPF is scaring me.

Any advice?

21 Replies to “You are in a maze of twisty little classes, all alike.”

  1. Perhaps you could post a picture or two of a small piece of Subtext and a description of the type of behavior you want. Invite the readers to offer solutions. Who knows what cleverness lies out there!


    [See my latest paper – Jonathan]

  2. I know what you mean about gagging on the “richness” of WPF. In my case I’ll keep chewing :). “Over-engineered” is not the worst thing you could say about a system. It reminds me of the sign on the mechanic’s wall: “fast, good, cheap; pick two”. On the API vendor’s wall the sign might read: “powerful or simple; pick one”.

    I see WPF as a 20-year scale technology. If it takes a year to learn it rather than two months, that’s OK, because I expect to be using it until we hit Kurzweil’s “singularity”, after which my 4096-core cell-phone/supercomputer will hopefully be doing the heavy lifting.

    Alan Cobb

  3. Hi Jonathan,

    I’ve been a long time Subtext follower and have too suffered the Swing blues. I found my joy in Adobe Flex. I don’t what you’re experience with Flash and ActionScript are but Flex 2 and ActionScript 3 are significantly different from predecessors.

    Prior versions of ActionScript though a good effort were a bit startling from the programming perspective. AS3 resolved all of my major ActionScript complaints without compromising dynamic capability.

    Though big frameworks and XML markup aren’t my first choice, Flex 2 is better than anything I’ve used before: Java Swing, Cocoa, Mozilla XUL, etc.

    There are some twisty little classes, but they all seem to do something semantically relevant. In contrast, I find many Java classes exist as murky implementation details.

    If in-browser limitation is a concern, Adobe Apollo provides straightforward access to the filesystem.

    Despite definite limitations and some anoyances (why does the Flash cursor blink as you type?), I think Flex and Apollo are the best choice for scale development or research involving graphical applications with the possibility of wide deployment.

    May you adventures be colossal,

  4. Rule one when writing any paper, always include the figures near where you reference them in the text. You should never group them at the end of the paper. Nothing’s more annoying than having to scroll back and forth across 13 pages just to see what you’re talking about.

  5. At the stage you’re at with Subtext, don’t even try and write or use a cross-platform GUI toolkit. It’s a problem that’s been around for about 20 years and still has not been solved satisfactorily been solved.

    Just pick a platform and write a compelling tool. Then people will be happy to work to make it run on their favourite platform.

    To get up stuff up and running I’ve been very happy with Gtk+, Pango and Cairo. But it you prefer something else, it’s no big deal.

  6. I’ve expressed my interest in Subtext on Python before, so I don’t need to repeat that here. However, I’m surprised to find myself disagreeing today. Use Flash, seriously. Flex, Apollo, whatever. ActionScript really isn’t that bad, and actually has some things about it that would lend itself well to implementing Subtext, which is kind of prototype based language, if it can be fit moderately into such text language categories at all.

    There is even the possibility of developing in such a way that subtext could work in both JavaScript and ActionScript, and maybe someone then would write the utilities to hook an interface into html and turn Subtext into a cool web2.0 programming whateveryoucallit!

  7. I’ll add myself to the choir: use Flash.
    Use Apollo to have filesystem access. AS3 is quite like java.
    You can also try haXe ( for an agile “type inferenced” language for Flash and Neko.
    The best thing would be to use Flash for the GUI and a mature language for the logic.

  8. I didn’t know you were trying to write a subtext-UI in WPF until I visited this blog just now, but I have been toying with the idea of writing my own experimental version of subtext in C#/WPF ever since I saw your demo (quite impressive, btw). It took me a while before I could really wrap my head around WPF, but now that I have it seems quite well designed for how powerful it is. But, it may not be everyone’s cup of tea, particularly if you aren’t already familiar with C#.

    By the way, there is a way to generate javadoc-like documentation for C#. Its called NDoc, and you can find it at . Its worked well for me. In any case, good luck with your development.

  9. I can’t say from direct analysis, but a friend whose programming I respect is enthusiastic enough about Flex that he’s convinced me to take a close look. Sounds like you might find it worthwhile, too.

  10. I have the same problem when I’m programming to SWT, Swing, or Java2D (to implement SuperGlue). The interfaces are complicated, inconsistent, and often inflexible. Relatively, Swing is cleaner than SWT, but doesn’t integrate naturally with Eclipse, Java2D is a low-level toolkit, but I have to do my own windows (which is kind of nice actually). There is also JOGL to consider, which is the next toolkit I want to look at.

    WPF looks interesting, seems like Quartz/Cocoa but we don’t have to program in Objective C (or have a Mac) to use it. Seems like an advantage. Maybe just hold your nose for awhile and see if you can eventually ignore the smell 🙂 Hope it turns out OK.

  11. am I the only one who thinks anti-aliasing is often misapplied, ugly, and unreadable? Sure, there are plenty of situations where it makes things look better, but there are at least as many where it makes things worse.

  12. (err. the point of that was: maybe they didn’t add anti-aliasing because they didn’t /want/ anti-aliasing everywhere. I’ve never seen the example in question, though)

  13. If you want to use WPF, I suggest reading Chris Anderson’s book called “Essential Windows Presentation Foundation”. His clear presentation of underlying philosophies make this huge platform seem much simpler.

  14. You may want to try building the app on straight WebKit. It is a very flexible UI, and with the recent Safari 3.1 even supports neat CSS animations with SVG. It’s quite powerful. It’s also cross-platform (if you use QT or GTK ports). It is non-proprietary. The API is reasonable. Many tasks are already taken care of for you (the language could easily be represented as an XMLDOM).

Comments are closed.