Skip to main content

Java Development on MacOSX Pretty "Swell" to Me

Posted by eitan on November 15, 2004 at 10:36 AM PST

There have been a number of threads and discussions on Java development on macosx. I'd like to relate my personal experiences in case it's of interest to anyone.

Preliminaries

Allow me to begin by giving a quick outline on the nature of my programming work:

  • I work on a small workgroup business application with a backend database
  • The technologies and APIs I use include: J2SE, Swing, Hibernate, Java Web Start
  • I develop on macosx (both client and server code run on the same powerbook g4), and
  • deploy to a Linux server and primarily to Windows clients

Next, my primary development tool choices are:

  • IDE: Eclipse w/ revised key bindings
  • For builds, I use Ant
  • The Bash Shell
  • Postgresql DB
  • For source control, I recently switched to (and am very happy with) Subversion
  • For javadocs, I run my own dear tool 'ashkelon' on top of a local copy of Tomcat 5
  • And I still use vi..

I rarely find tools availability a limitation. That is, I don't feel that because I run a mac, that I'm somehow limited to using specific tools.

There has been one occasion where I had to switch to using a windows machine for a few days to do memory debugging work.

I had decided to work with a trial version of Quest's JProbe, which does not come in a macosx flavor. That's not to say there are no tools for memory debugging on the mac. But it does show that not all Java tools vendors out there have become macosx friendly (yet). For most APIs there's no OS issue. In terms IDEs, the number of choices is pretty good: Eclipse, IntelliJ, Netbeans, and XCode are all sensible alternatives. Lighter solutions such as vi, emacs, or subethaedit are there as well.

Some of you may not know that there exists a package for macosx called Fink, which makes a variety of Linux software distributions available to macosx. That includes X applications. With Fink I can run Gnome or KDE desktops and various Linux apps concurrently, alongside macosx. What I personally find nice is that I have the choice of building from source or of downloading prepackaged binaries.

General Niceties

1. What i like about working on a mac in general is the philosophy that the software subservient to the human, and not the other way around. On some other OS, the first experience one has after booting up is being disrupted by a barrage of requests from various software applications needing the immediate attention of the end user:

  • Your license for x is about to expire in y days, what would you like to do?
  • Security updates available, should I donwload now?
  • Please register your blah
  • New virus definitions available
  • Program x is attempting to do y, should I let it?
  • ..

What's interesting is that these requests are important only to the various applications making the request, and not necessarily the other way around.

At the same time, a bunch of programs such as virus checkers and firewalls hum in the background or display progress dialogs. To me, that's not the way to start the day. A person needs to be able to focus on their work; they don't need distractions (see jef raskin for more on this).

So the first thing you do is have to answer questions about things that are not your priority at the moment. Then you scratch your head and ask yourself: what was it I turned on this computer for in the first place? .. and it's time to go to lunch. :-)

2. This reminds of me another general feature I really like about the mac: I'm almost never in a situation where i'm waiting for it to boot up. My Powerbook G4 has been in sleep mode for most of its life and I just flip open the screen, enter my password, and start working.

The importance of Consistency, and dealing with it on macosx

The pragmatic programmer says: learn one tool but learn it well. That's very true. On the other hand, Dave Thomas was probably among the first to don a Powerbook G4. Who said that you can't use the same old tools on a brand new OS?

I think a most sensible choice in terms of tools selection is to pick ones that are "OS neutral." That is, tools that are essentially the same, no matter what OS you run. jEdit, Eclipse, vi, emacs, Google, Firefox all fall under that category. It's important because it means you won't have to learn new tools if for some reason you have to work on a different OS.

Java also falls in that category. The caveat with Java is a lag of a few months to get the latest release of J2SE. So on the mac right now J2SE is at v1.4.2_05. J2SE v5 is expected around Q1 or Q2 of 2005. I can see how this can be a big deal to some and no big deal to others. Luckily for me, I fall in the latter camp. We've already had a number of discussions on this issue on java.net and I won't belabor it here.

There are a number of adaptations and enhancements that go into "porting" J2SE to the mac, and I am by no means an expert in this area. One small but cool feature in J2SE for the mac is that if you run a Swing app in MDI mode (JDesktopPane and JInternalFrames), minimized JInternalFrames are given an effect similar to minimized apps on your macosx desktop: their icons are snapshots of the actual frame (that is, if you use the default platform look and feel).

There are certain concerns however that are OS-specific. Each OS has its philosophy on UIs and publishes interface design guidelines that "all good apps" should adhere to. One aspect of these guidelines is how one interfaces with editors. I've had to adjust to essentially letting go of my precious 'home' and 'end' keys in favor of another mechanism that uses combinations of 'Command', 'Option', and arrow keys. But it's sensible enough once you learn it. The dilemma I ran into is that I wanted to have the same basic key bindings for all my editors on the mac (to prevent me from going crazy) from TextEdit to jEdit to SubEthaEdit to Eclipse. So i had to break down and take a little time to adjust my jEdit and Eclipse key bindings to match TextEdit and SubEthaEdit. (In truth I primarily use three editors: vi, Eclipse's Java Editor, and SubEthaEdit).

Input Methods

One other thing that's very intriguing is the difficulty I had in getting used to the powerbook keyboard. I won't tell you how many times I openly cursed my keyboard during my transition period to the mac. The intriguing part is that my opinion has changed 180 degrees. Once you get used to it, it's a wonderful keyboard. It's noticeably lighter on the fingers (i.e. you don't have to apply too much pressure on the keys). The bottom line is that there are minute differences across keyboards which break old habits and force us to develop new ones. So in a small way, I am now locked in to the powerbook g4 keyboard. The same goes for the trackpad. I really hated it at first. Now I'm ok with it. I still favor an external USB mouse and plug one in about 99% of the time.

A related issue is that of keyboard accessibility in General. I'm a big fan of doing everything from the key board. I don't really like mice. I still think that other OSs are better at this than the mac. One thing I'll never get used to is navigating my source tree in Eclipse (not Eclipse's fault, mind you; Eclipse uses native widgets). Typing the first letter of a file or directory will not cause the focus to switch to that file or directory node in the tree. That is most annoying. Yes, it's true that macosx is better than any of its predecessors in terms of keyboard accessibility. But compared to its competition, it's still lagging. Yet, I've found ways to avoid using the mouse for 90% of my work. That's pretty good.

Summing Things Up

I'm personally very happy with my choice of OS and tools for software development.

If you're considering switching to macosx, I won't lie to you: for me there was a severe adjustment period. You will be less productive for some time while you break lots of old habits and form new ones. It's not easy especially for those of us who are older. I recall how easy it was for me to learn new things in my twenties. It's more difficult for me now in my thirties.

Let me provide an analogy here because it's not all bad news. Actually, it's as much good news as it is bad news: learning a second language is difficult. Actually so difficult that most of us spend most of our lives knowing only a single language. Are there benefits to being multi-lingual? You bet! I'm not sure if qualifying for a job at the UN should be considered a benefit of being multi-lingual. But on the other hand, the insight you get into the general concept of languages, having access to other cultures and communities, being more agile and versatile are all absolutely terrific benefits. You discover other ways (possibly radically different ways) of doing things. And that's what I find fascinating about life in general. Are there other solutions to a problem?

Overall, I find macosx to be a mature platform for doing Java development. Not only is J2SE available for macosx, but the various APIs that run on top of it are available, lots of Java tools run on macosx, and the same goes for servers such as Tomcat or JBoss. So all the prerequisites have been met. Add to this the mac-specific aspects of computing and interfacing with your system, unix-specific aspects of computing and interfacing with your system, and you've got a wonderful machine. It doesn't actually stop there, the Apple hardware is really nice and is just as crucial in making the whole experience an enjoyable one.

Related Topics >>