Home > Articles > Programming > Java

The Java Perspective: Cocoa's Interface Builder

Marcus Zarra
  • PrintPrint
  • Share ThisShare This
  • DiscussDiscuss
Close WindowMarcus Zarra

Marcus Zarra

Learn more…

Basic Animations with Core Animation
Dec 28, 2009
Marcus Zarra and Matt Long on Core Animation
Jun 5, 2009
Introduction to Migration in Apple's Core Data
Mar 7, 2008
A Look at Apple's Core Animation
Feb 1, 2008
The State of Java Development on OS X
Jan 4, 2008
Packaging Your Application for OS X
Nov 21, 2007
Tiger vs. Leopard: Which Should You Develop For?
Oct 26, 2007
Building on Apple Sync Services
Sep 8, 2006
Getting in Sync with OS X
Sep 1, 2006
Syncing Your Data the Cocoa Way
Aug 11, 2006
Controlling Both Ends of the Communications Channel: From Cocoa to Servlets
Jun 2, 2006
Cocoa: Working with XML
May 19, 2006
Java EJB 3.0: A Hibernate Clone?
Apr 28, 2006
Document Level Parameters Using Core Data: A Guide for Cocoa Developers
Apr 7, 2006
Tips for J2EE Development
Feb 24, 2006
The Cross-Platform Java GUI: Designing Code for More Than One Operating System
Feb 10, 2006
Avoiding Java Exception Abuse
Dec 22, 2005
Java Perspective: Advanced Core Data
Dec 16, 2005
Java Perspective: Cocoa-Java Bridge
Dec 1, 2005
Java Perspective: Core Data and the Mac OS X Developer
Nov 23, 2005
Java Perspective: Key-Value Protocols, Behind the Magic of Mac OS X Development
Nov 11, 2005
Java Perspective: Cocoa Subclasses and Delegates
Nov 4, 2005
The Java Perspective: Cocoa's Interface Builder
Oct 21, 2005
Maven: Handling Multiprojects
Sep 23, 2005
Java, Maven, and Your Web Development Project
Aug 26, 2005
Ant User, Let Me Introduce Maven
Jul 29, 2005
Using JAAS Authentication with JBoss
Jun 17, 2005
Building a Custom JBoss Login Module
Jun 10, 2005
Testing Java Enterprise Applications with Cactus
May 20, 2005
Ant: Building a Better Build File
May 6, 2005
XDoclet: Entity Bean Relationships
Apr 8, 2005
The Java Developers' Introduction to XDoclet
Jan 7, 2005
An Introduction to Cactus
Dec 30, 2004
Using Multiple Databases with JBoss
Nov 24, 2004
JBoss Application Configuration Breakdown
Nov 5, 2004
Sortable Swing JTable
Oct 1, 2004
Building a Professional Swing JTable
Sep 10, 2004
Creating a Custom Java Swing Tablemodel
Aug 27, 2004
Adding Workflow Control to Your Java Applications
Mar 26, 2004
The Mac Developer Network
By on November 21, 2007 No Comments
Steve Scott of Late Night Cocoa has started a new podcast targeted specifically at Macintosh Developers.  One of the first episodes on this podcast is a roundtable of developers with several very well known developers starting with Daniel Jalkut, Uli Kusterer and Fraser Spiers along with myself.
Once more unto the [Beta Cycle], dear friends, once more
By on November 16, 2007 No Comments
Today marks the first semi-public release of iWeb Buddy, a new application that I have been developing for the past few months.  Unlike seSales or applications developed as a consultant, this development cycle has been a blur of activity.
Apple -- You Did Me A Disservice
By on October 26, 20073 Comments
Today is the day that most Mac users have been looking forward to for over a year.  Ever since Steve Jobs got up on stage last August and showed us Leopard for the first time.  Ever since that first peak almost all Mac users and I dare say ALL Mac developers have been looking forward to this release.  Unfortunately, today is also a day that Mac developers are going to be scrambling like rats on a burning ship.  This is because Apple decide to thumb their nose at us.
Further development of Bullfrog 2 for OS X
By on October 11, 2007 No Comments
Things are starting to speed up on the development of Bullfrog 2 previously mentioned here.  In our continuing disclosure about the development process, Jon Trainer has written a very informative article on how the actors are configured.
Starting over is hard to do
By on September 18, 2007 No Comments
I mentioned before that I am working with Jon Trainer of Outer Level to write Bullfrog 2 for OS X.  This development effort will be targeted at the as of yet unreleased OS X 10.5 Leopard.  We also promised to blog about the development as it moved forward.  Unfortunately not everything has been roses.
Programming in Objective-C

Like this article? We recommend
Programming in Objective-C

Coming into Apple's Cocoa programming from the Java world has been a huge eye-opener for Marcus Zarra. Whenever he speaks with other developers who have worked with Cocoa, he hears praises about Apple's development tools. See if you agree with his conclusions about Apple's Interface Builder from a Java developer's point of view.

For more information on Java development, visit our Java Reference Guide or sign up for our Java Newsletter.

Let me start off by saying that I am rather "hard-core" when it comes to Java GUI development. I am a strong believer in the Swing/JFC API and have written several articles on the subject. I write all my Swing GUI code by hand. I do not use any WYSIWYG tools in my Swing development, and I enjoy using GridBagLayout (arguably the hardest layout manager out there).

Until recently, I did all of my development using vim and only recently switched over to using Intellij's IDEA. That switch was mainly due to my aging memory and inability to keep 100 percent of the methods and packages straight in my head. However, even using that IDE, I still avoid graphical Swing development tools like the plague because they produce slow and bloated code and because these tools do not write code the same way that I do (so they produce code that is difficult to maintain).

Introduction to Interface Builder

When I first approached Cocoa development, I started by walking through the tutorials provided by Apple on its developer website and worked with every tutorial in Aaron Hillegass' excellent book, Cocoa Programming for Mac OS X. I admit to some trepidation when I approached Interface Builder. All the tutorials used it—I checked. I looked for programmatic ways to build the GUIs in the tutorials and I could not find them. (I eventually found them, but that's another story.)

So with my dislike of WYSIWYG tools in hand, I approached Interface Builder and started working through the tutorials. My first tutorial was trivial: It involved a simple GUI with one window, two buttons, and a label. After I completed the tutorial I looked back at it with wonder.

In that small project I learned the following:

  • Interface Builder is not a code generator.
  • Interface Builder is an integral part of the development process on Cocoa.
  • You can build Cocoa projects without Interface Builder, but it would be just plain silly.

Interface Builder approaches GUI design in a way that is quite foreign to a Java developer. It took quite awhile for me to properly grok it. Once I did, I realized that its solution made perfect sense and I enjoyed using it.

Interface Builder works by creating a real instance of the GUI. When you drag and drop a button onto a window in Interface Builder, the underlying code actually instantiates that button and places it on the GUI. When you are done with a GUI and save it, the GUI is serialized to disk. When your application starts up, the GUI's nib file is de-serialized back into memory, which produces faster startup times because the objects do not need to be initialized, nor do any of the connections need to be established.

  • Share ThisShare This
  • Your Account

Discussions

Make a New Comment

You must log in in order to post a comment.

Related Resources

Jennifer  BortelWin FREE iPhone Developer Books and Videos- Introducing @InformIT Giveaways
By Jennifer Bortel on February 5, 2010 No Comments

Apples’s recent iPad announcement made our hearts flutter so we couldn’t resist making an announcement of our own!

Today marks the first ever @InformIT Giveaway!

We’ll regularly post a video like this one profiling spectacular prizes we’re giving away—from books and videos to T-shirts and other exciting stuff. Check out the video below to see the giveaways for today, and then scroll down for more prize details and instructions on how to win them!

So Far So Good
By John Traenkenschuh on February 2, 2010 No Comments

So far, Win 7 is making a thoroughbred of what has been a plough mule laptop

Dustin Sullivan"Every OSX developer should have this book on their desk."
By Dustin Sullivan on February 1, 2010 No Comments

That was the sentence Mike Riley ended his recent Dr Dobb's CodeTalk review of Cocoa Programming Developer's Handbook with.

See All Related Blogs

Informit Network