Why in the world do we need wxWindows?



A few months ago I was put on a project. The goal was to take the code to a project built for Windows using wxWindows and port it to the Mac. It was a speedy process and worked well….at first.

For those of you that don’t know, wxWindows, now called wxWidgets, is a toolkit which allows you to use the same codebase to build applications on more than one platform (Windows, Mac, Linux, X11, etc.). Sounds like a good idea in practice, but it’s a nightmare to support.

Right off the bat, I just want to say that I’m against most open-source solutions when they’re meant to be used for mission critical projects. Exceptions are well-established projects like Apache. If there’s a bug in a commercial application, there’s much more incentive for the commercial developers to get it fixed for a high profile customer ASAP than to let the open source community fix it at their convenience. The problem is that it could take weeks, if not months to fix. Sure, I’ve seen fixes happen fast, but those are few and far between. I’ve seen Metrowerks and Apple fix things much faster; that’s why we’re paying them the big bucks. Of course the open source community will tell you that the source is available and you could (should?) fix it yourself, but when it’s coming down to the wire, I don’t have the time to fix someone else’s mistakes.

For starters, I have to give the wxWidgets developers a lot of credit for what they’re trying to do. Howver, since I started on this project, I’ve noticed several kinks in the wxWidgets armor.

First off, before 2.6 was released this week, I had to use 2.4.2 since it was listed as the most “stable” release. In the meantime, this so-called “stable” release was left behind in terms of Japanese/multibyte text, threading, and Mach-O support. With 2.5.3 listed as “beta” at the time, it seemed like a better idea to use 2.4.2 since I didn’t want any surprises in the end.

Second, it’s extremely difficult to layout a GUI design when you don’t have any GUI tools at all. Unlike MFC and Xcode which have GUI layout tools, wxWidgets has none, and you’re forced to lay everything out programatically. I haven’t done anything like that since I had my Atari 800!

Third, their demos are horribly out of date. On the Mac, I’m using Code Warrior 8.3. The demos are for use with CodeWarrior 5! Nobody uses CW5 anymore. The libraries are named differently, and some code just doesn’t compile. I also found that there’s a serious lack of demo code for important things like GUI elements and localization.

So for the hell of it (and for my own sanity), I decided to use some of my downtime to create the same project using Apple’s own tools (Cocoa/Xcode). Development on OS X is a breeze compared to the antiquated drudgery that is wxWidgets. I was able to do in three days using Cocoa what took weeks in wxWidgets, and it looked much better since wxWidgets can’t seem to get that OS X look and feel. No, the GUI code isn’t portable, but that’s fine. I made sure the core code that deals with the XML files and networking was portable, and it compiled and ran fine on Windows on the first shot.

One other thing that bothers me about wxWidgets is that it adds another layer to an already complex API. I spent from 1990 until now learning the Mac OS Toolkit, Cocoa, Objective C, and MFC on Windows. Why in the world should I learn yet another API when we already have damn good ones that work and are fully supported? There are entire DVDs filled with sample code for Mac and Windows, compared to the pathetic almost floppy-sized list of samples for wxWidgets.

If you’re reading this and you’re thinking about using wxWidgets for a high-profile project, please think twice about it. If you know Cocoa or MFC, use it, but use it wisely. Separate the GUI and core code so that the core code can work on multiple platforms easily. We do that at work with a lot of other projects, there’s no reason why it can’t be done where you are. Make sure you can write command-line versions of your app as a test. If that works, the GUI should be a no-brainer.

Looking back, I really don’t see any advantage wxWidgets has for anything.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)