An Engineer

An Instance of Perspective

GUI Development on the Mac vs. the PC

with 9 comments


GUI apps are like sausages, it is better not to see them made. Apple and Microsoft have a fundamentally different approach to sausage production. Visual Studio integrates its GUI designer right into the IDE. On the Mac, you use Interface builder, a separate application, to create your GUI elements.

The integration of GUI design within Visual Studio follows from Microsoft’s approach to GUI synthesis. The drag-and-drop GUI designer generates C# code that is then compiled into your application, and that code can be edited by the developer. Apple’s Interface Builder generates data files that are read in at runtime to display GUI elements. Considering that the code generated by Visual Studio’s GUI builder is in fact data to the Common Language Runtime after it is compiled into IL, there would seem to be a general equivalence between the techniques. One person’s code is another person’s data. But in terms of developer workflow and customization, the Visual Studio approach is far more efficient.

Here is how you create a button in each environment.

Visual Studio:


    1. Drag a button onto the window
    2. Double click the button
    3. Write code

Xcode/Interface Builder:


    1. In Xcode, go to your window controller header file, add two lines for your outlet and action
    2. Switch to Interface Builder
    3. Drag a button onto the window
    4. Change tab to the class browser
    5. Find your window controller and re-read the file to get your updates
    6. Change back to the object browser
    7. Apple-drag from the window controller instance to the button
    8. Select the outlet you defined before and click 'Connect'
    9. Apple-drag the button onto the window controller instance
    10. Select the action you defined before and click 'Connect'
    11. Switch back to Xcode and into your window controller code file
    12. Add the action method definition and write code

I soon came to dread the UI design work involved with Phanfare Photo for the Mac. The Mac may look nice on the outside, but it is not so nice on the inside.

There is an argument for separating out the GUI design component to a separate application. Ideally, this would allow someone more artistically gifted than I am to do the GUI work and hand me back a bunch of GUI design data objects with a big red bow. But for this separation to work, the GUI designer (and I mean the person) needs to be able to work without requiring fine-grained communication with the application engineer (that would be me).

The Apple approach fails here in that the programmer must muck around in the designer stuff to get anything working (sometimes not getting the behavior quite right), and because the set of built-in GUI controls is so limited that the GUI designer must constantly ask the programmer to create custom controls. There really is nothing wrong with the idea of separation, if well implemented. Microsoft’s new venture into the designer/programmer split with Avalon and their designer tool Sparkle looks promising.

There are two parts of GUI design: the ‘fun stuff’ (laying out the UI) and the ‘boring stuff’ (implementing custom controls/behaviors). That was the layout, now on to the behavior:

As I said, in Visual Studio, the GUI designer generates code that you can tweak by hand if needed. In Interface Builder, serialized objects are written out to be loaded when your application runs. This means that if you don’t like the way Interface Builder does something, you have to rewrite your entire GUI by hand (something I found myself doing with shocking regularity).

One of the nice features of.NET is that it has dozens of built-in controls (over 100 in the latest version) and thousands of custom controls built by users. And because controls in .NET are expressed in text-based code, they are easy to tweak and display on web pages, making for a vibrant user community.

The Mac, on the other hand, comes with a very limited set of controls. There are the basic buttons, grid views, etc, but for anything more than a text editor this isn’t enough. Interface Builder provides about 25 built-in controls (they didn’t even get a date picker until Tiger, and even then it’s almost unusable!) and with the size of the Apple developer community it’s hard to find anything on the net.

In the end, I found myself always writing my own controls. Now, to be fair, I had to do this occasionally in .NET too, but with far less regularity.

In the end, both Apple’s approach to GUI design and Microsoft’s can produce modern GUIs, but Apple’s approach required more effort on my part and significantly more hours spent in the not-so-sweet-smelling sausage factory.

Written by erlichson

October 14, 2005 at 1:04 am

9 Responses

Subscribe to comments with RSS.

  1. You’re doing it wrong.

    mu

    May 17, 2007 at 2:21 pm

  2. WTF? I was using Xcode 15 minutes ago. With AppleScript, I drag the controls, customize them to my needs with the inspector, then link them to a code file from the inspector and strat writing code. Cocoa is your problem, not Xcode.

    Sultan

    June 21, 2007 at 10:42 pm

  3. I’m currently writing a Mac application using Xcode and IB, and the only ‘custom controls’ I made so far is just for eye candy. I don’t see myself writing much more custom controls than I did with .NET.

    About this line: “…and with the size of the Apple developer community it’s hard to find anything on the net.”. Have you looked at iLifeControls?

    And indeed, the way you do Ui programming on the Mac is quite different from .NET, and it looks tedious at first sight. But i’ve grown to like it more than anything else.

    Sijmen

    August 28, 2007 at 3:07 am

  4. nice article! nice site. you're in my rss feed now ;-)keep it up

    Alisha D Herron

    February 3, 2009 at 5:56 pm

  5. This is obviously one great post. Nice and wonderful article for putting it together and this article has very valuable information you post and provided here keep it up!”

    Thesis Paper

    August 29, 2009 at 2:23 am

  6. According to your information that is very simple and clearly understand for students to grip.Thanks for your research on academic knowledge.

    Term Paper Writing

    August 29, 2009 at 3:31 am

  7. Awesome blog. Very informative. Your blog is very valuable from the blogger’s mind. Keep it up!regardscharcoal grill

    max191

    October 4, 2009 at 10:48 pm

  8. this kind of blog always useful for blog readers, it helps people during research. your post is one of the same for blog readers.

    Education Thesis Writing

    February 1, 2010 at 4:55 am

  9. The most recent version of wxDesigner – a GUI builder for wxWidgets and its popular If you are interested in the ongoing development of the library.

    home builder web design

    March 17, 2010 at 6:37 am


Leave a comment