AddThis Social Bookmark Button

Print
Java Programming on the Mac

The IDEs of Mac

by Daniel H. Steinberg
04/16/2002

Sure, this article should have been published mid-March to play off of the title. It would have been nice to include my favorite recipe for Caesar Salad dressing. It didn't happen. If you want, I can bring in an excuse note from my mom. Some of you sent in your favorite Integrated Development Environments (IDEs) and I tried them all. I expect that many of you will have much to add to this discussion. Please use the comments at the end of the article to highlight features or weaknesses in the various IDEs.

Until mid-December I never used an IDE except as a teaching tool. I always used a text editor and command line tools for my real work. When I taught, I used the environment the school supported. For those schools determined to standardize on an IDE I even pushed the ones I liked the best. For the most part, the students used Windows boxes for development.

For the past four years, I've most often recommended JBuilder for schools. Borland (http://www.borland.com), the makers of JBuilder, has a very generous license for academic organizations and offers a solid tool that works well on different platforms. I do sometimes use it at home and, for the most part, really like what they've done with it. It works well on Mac OS X and includes features not available in other IDEs. I've enjoyed using JBuilder and recognize their commitment and contributions to Java on the Mac.

That being said, I now use IDEA from JetBrains (formerly IntelliJ) for my daily work. There are no RAD tools and it isn't as slick as some of the other offerings. They've done nothing to provide support for a Mac look and feel. On the other hand, the support for coding is darn near perfect. IDEA helps me write code. It thinks of things before I do and lets me know what it's come up with in a nice way. It helps me write and refactor code.

For example, once I've moved a couple of methods out of a class and no longer need a particular import statement, it provides me with a gentle visual reminder that I can remove that line of code. Their slogan is "Develop with Pleasure," and I think they help make that happen.

In this article, I'll look at JBuilder, IDEA, and a few other IDEs. There's a bigger issue here that I'll address in the Pre-ramble: look at the number of choices you have for developing in Java on Mac OS X.

Looking ahead, Apple holds their Worldwide Developers Conference (WWDC) next month in San Jose. The Web page promises that this year's WWDC looks to the "future of Mac OS X." Also, Apple announced that at that time we can expect a beta of JDK 1.4.

If you aren't an Apple Developer Connection (ADC) member, at least sign up for the free subscription (http://developer.apple.com). Although they've made no announcements about the details of their distribution plans for JDK 1.4 betas in the past, Apple has made the Java pre-releases available to all ADC members. As always, you can send me email about this column or with suggestions for future columns to DSteinberg@core.com, with the subject line "O'Reilly Mac Java."

Pre-ramble

Apple ran two technical sessions and a BOF (Birds of a Feather) at last month's JavaOne Conference in San Francisco. The sessions were targeted more at those attendees who weren't familiar with what Apple is doing with Java on Mac OS X.

Ted Goldstein, Apple's new "guy in charge of Java and other stuff," presented an overview of Java on Mac OS X. Goldstein's actual title is vice president, Development Tools. In addition to highlighting J2SE on Mac OS X, he listed J2EE certified offerings from Pramati and Lutris that run on the platform. JBoss and Orion also run well on a Mac.

Goldstein told a story about how hours before this session he had approached the guys at the Trifork booth to challenge them to port their application to Mac OS X. Half an hour later the port was finished. For Goldstein, that's a big part of the Java story on the Mac: stuff just works.

An interesting thing happened at the JavaOne Mac BOF. Alan Samuel, Apple's Java Technology evangelist, and Allen Dennison, Apple's Java Product marketing manager, started off the session by answering the inevitable questions before they were even asked. They said Java 1.4 was on the way and although Apple has already been working on the 1.4 release, the focus was to deliver a solid 1.3.1 version of Java on the platform.

Audience members then asked about this feature or that. One after another the questions were either "when are we going to see" a given technology or "when are you going to fix" some problem with another technology. This isn't unusual. Sun's Swing team had a similar BOF the next night. When developers are able to meet with the engineers responsible for a technology, they tend to ask these type of questions. Alan, Allen, and the engineers present answered all of the questions as they were asked. And then the interesting thing happened

Up until this point Goldstein had been quietly standing against a wall, way off to the side. At this point he asked if there was anything about Java on Mac OS X that people liked.

The mood in the room completely changed. Longtime Mac developers raised their hands to make comments about how the issues being raised were, by and large, minor and that in general they were very pleased with the performance of Java on the Mac. It was as if the family of Mac developers in the audience realized that they were in front of company.

The company may not know the context of these public complaints about flaws in Apple's support of Java. Goldstein's comment was able to redirect the feeling of the room because Alan, Allen, and the engineers weren't dodging the questions being asked. By the end of the BOF, audience members were again asking about plans for supporting their pet features.

After that BOF I checked with various friends who had worked with Goldstein before and asked if people had made the mistake of underestimating him. They all smiled and answered, "Not twice." Much of the reason that Java on the Mac is so solid is due to Goldstein's predecessor Steve Naroff, and the quality of the engineers working on the project. The great news is that Naroff is still at Apple. It's early, but I think we're lucky to have Goldstein working at Apple as the guy in charge of Java. With his ties to Sun, I hope that Goldstein can help Sun see how valuable Apple is to the Java story.

The 1.4 support issue is not a small one. The argument on one side is that Sun has only gone final with 1.4 in February so Apple isn't that far behind. Apple has been promising to narrow the gap in Java releases to 60-90 days after Sun's final release for more than four years now. Dennison said the reason the delay was a little longer this time was that Apple's Java engineers have been working on improving the performance of 1.3.1. The 1.3.x release was the first version of Java on Mac OS X and Dennison points out that many of the improvements being made to 1.3.1 will pay off as Apple moves forward to 1.4.

The argument on the other side of the 1.4 support issue is that developers have had access to 1.4 beta releases for over a year now. If Apple wants programmers to develop on Mac OS X then, many argue, Apple needs to supply these pre-release versions in addition to the final releases.

As a practical matter, Apple has answered, it can't provide the engineers to work on a moving target. In discussions in online forums developers have questioned whether the programmers asking for 1.4 support really need 1.4. There have been instances where engineers have said they need particular functionality. Often they have been given workarounds; in other cases they've been told there is no alternative and they'll have to wait for 1.4.

The underlying concern seems to be with the future of Java on the Mac. The question of "When will version xxx be available for the Mac?" has been asked since the first release of Java. At that time, Mac users would have to wait more than a year for the latest release of Java on the platform.

Consider that Mac OS X just became the default operating system a few months ago and that no version of Java 2 (that's versions 1.2, 1.3, and 1.4) is supported on the classic Mac platform. With Mac OS X the default OS, Apple can deliver the latest versions of Java through a software update to both developers and to end users. As the install base of classic Mac OS wanes, the Java on the Mac story gets stronger.

The IDEs

Both IDEA and JBuilder are top choices for the Java developer on Mac OS X. I still think that a new iMac -- with a second keyboard and second mouse, loaded up with IDEA -- is a perfect choice for Extreme Programming, but I also like a lot of what JBuilder offers.

If you're looking for tools that are free as in beer, Apple provides Project Builder and you can also use Net Beans or JEdit. JEdit isn't a full-featured IDE, but it does have many of the features you use most of all. Couple it with an AppleScript that manages your other tasks (see last month's column) or learn to work with Ant, and you have all that you need. Heck, you might have all that you need with Emacs, vi, TextEdit, or BBEdit.

The traditional favorite of Mac Developers, Metrowerk's CodeWarrior, is still the IDE of choice for Mac users coding in C or C++. Metrowerk's says that most of the ports from Classic Mac to Mac OS X were done with CodeWarrior. Unfortunately, the Java tools are still lacking. To be fair to Metrowerks, they are a release behind everyone else. It may not be fair to compare their release from more than a year ago with the more recent releases of other vendors. CodeWarrior 8 is scheduled to be released this summer.

IDEA From IntelliJ

IDEA is available from IntelliJ Software. The current version is 2.5.2, although you can get a look at betas of version 3.0 at http://www.intellij.com/eap. The list price is just under $400, but they are now running a half-price Easter sale for personal licensing. They also make a version available to academia for $99. To run IDEA, open up a terminal window, navigate inside of the bin directory and run the shell script idea.sh. You should see something like this:

IDEA from IntelliJ software

IDEA from IntelliJ software (Click for larger image)

The first thing you'll notice is that it doesn't look very Mac-like. IDEA actually runs much better on my Mac box than on my Windows box but, except for the title bar, the IDEA window looks very much like a Windows application. The menu bar is attached to the window and not to the top of the screen in the standard Mac position. I'm less rabid about this than others. I think that in an IDE it's easy enough to use the menu bar in the same window that you're working in.

Comment on this articleLet's discuss your favorite Java IDE, and any other Java topics that come to mind.
Post your comments.

The third line of code includes an import statement that isn't needed yet. At the right side of the screen you can see a yellow box that signals that something superfluous is in the code. If I click on the yellow stripe, it highlights the offending code and provides me with the message "Import statement is redundant." I can, of course, choose to ignore the warning and the code will compile and run without any problems.

If there was an actual syntax error the box would have been red with red horizontal lines that would take me to any line of code found to contain an error. As with compiler errors, fix the first one first and see which others are taken care of. A dropped bracket could render a lot of code to be non-compilable.

A nice feature of IDEA is that you can configure the help to be presented in a way that works with your coding style. If you don't want to see warnings, you can turn them off. Suppose you introduced an instance variable of type Jframe. IDEA can be configured to add the import statement import javax.swing.Jframe or import javax.swing.*. It can also just insert javax.swing before Jframe where you've typed it in the source file.

You set these defaults so that you aren't annoyed by the help you are getting from the IDE. I initially ignored much of the help that IDEA provided. The more that I work with the IDE and trust it, the more I've come to benefit from its help. One of my favorite tools is the support for refactoring. Click on the Refactor menu item and you'll find support for some of your favorite refactorings.

You can also refactor classes by highlighting a class in the left project window. In that context you can move or rename classes. When you do, the relevant names are changed and imports are altered. You can also extract the interface from a class or create a superclass from a given class. While you're looking around the project hierarchy, you'll notice there's also support for CVS as well as Ant.

I don't tend to use RAD tools. If you do, then IDEA may not be the tool for you. On the other hand, when it comes to programming, I like it more and more each day.

As an aside, as a teacher IDEA is the best tool for me to examine student code. I can use options such as "Find Usages" to see where methods are called and to quickly navigate their code and figure out what they're doing. IDEA also makes it easy to create my own templates to make frequently used coding patterns (such as unit tests) easy to enter.

Pages: 1, 2

Next Pagearrow