Primary IDE

Friday, February 5, 2010

Experience of Switching to Mac for Java Development

I decided it was finally time.
For a couple years now, I've been an extreme minority as a PC carrier in a sea of Mac wielders in virtually every Java developer-related gathering. I've come to the humble conclusion that they must know something I don't. It's not just the "cool kids"-- the young bucks fresh out of college, barely able to render visible facial hair; even the grizzled, battle-hardened gurus and leaders in our field are sporting Macs.
As an "Average Joe" developer, I'll admit the idea of straying from the development platform I'd painstakingly chiseled a comfortable cockpit out of was somewhat daunting. I began my Java escapade in Fall 1999 on Windows NT, bouncing back and forth between Microsoft J++ and VisualCafe. I jumped around IDE's when VisualCafe fell out of favor, trying in vein to stay away from the Swing-based GUI IDE's (NetBeans, JBuilder, etc.). Alas, circa 2002 Eclipse 2.0 arrived and I was instantly hooked. It gelled with me and I've been with it ever since. So it's been Windows XP and Eclipse, until this week.
I am fortunate enough to work for an employer and manager willing and able to invest in both education and hardware for its developers. I decided to take advantage of this generosity and put in an order for a MacBook Pro. I acquired my new machine on Monday, and spent the better part of this week getting oriented to the new machine and setting up my environment and tools. The following outlines the steps I took to get up and running doing enterprise Java development on my new Mac.
Let me first describe our development stack: JSF/RichFaces front end; mix of SEAM, Spring, and stateless session EJB's for the middle tier, JPA/Hibernate for DAO layer, running on Geronimo J2EE app server. Full open source stack, deployed on Red Hat, hitting a Postgres DB. Maven 2 is our build system. We are also using Eclipse BIRT as an embedded report generation engine. This was all perfectly manageable developing with Eclipse Ganymede and Galileo.
So, time to leave my comfort zone. Enter the Mac... Needless to say, it's a beautiful machine. But you already know that from the fan boys, the Apple marketing machine, and probably the kid sitting next to you. I'm going to talk about practical issues I faced as I re-tooled on this sleek machine, bearing in mind my Unix familiarity is just so-so, and I haven't used a Mac since my LC II got me through college. This was my plan of attack:
  • Browse system, Finder, etc. Get oriented.
  • Check system specs: 3.06Ghz Intel Core 2Duo, 8gb 1067Ghz DDR3 Ram-- yeah baby!
  • Install FireFox, FireBug
  • Install Java
  • Install Maven
  • Install Geronimo App Server
  • Install IntelliJ IDEA 9 (yep, switching IDE's too!)
  • Install Cisco VPN
Here are some notes:
  • The Finder is ok, nothing mind blowing. Pretty much the same as I remember. It is possible to customize the listings on the left of the Finder window, something I never figured out how to do on the similarly purposed Windows File Open dialogs. The default view is multi-columned, much like the default view for iTunes.
  • One of the first things I did was launch a console window. My machine was set up by a network administrator, and while I have admin privileges, I'm not "root", so I have to do sudo commands to write to certain directories like /etc.
  • One annoying behavior I'm running up against is the directories listed in the Finder do not represent the actual file structure found on the command line. The main issue is that many folders are hidden in the GUI. Perhaps this is simply a permissions issue and I'll be able to change some of these so they show up in the Finder. For instance, I can't see /tmp or /etc in the Finder.
  • Java comes pre-installed on all Macs. In fact, you can't even get it from Sun, er I mean Oracle. The JDK download page will instruct you to update your system software to ensure you have the latest Java software installed.
  • Maven is also pre-installed, believe it or not. Make sure the installed version is the one you require, otherwise install your own and don't forget to modify your PATH env var in ~/.profile or ~/.bash_login.
  • Speaking of setting environment variables, this I spent a little time on. The method prescribed by Apple is to set env vars in a special file called environment.plist. Instructions are Here. This will make the vars available in the command shell and in all apps. The one known caveat to this approach is that evidently the vars are not accessible in apps launched via Spotlight (a fancy desktop search utility). To address this issue, I found this post. Lastly, here is a nice little utility applet which allows edits to the magical environment.plist file from the System Preferences window, much like we do in Windows via System->Environment Variables.
  • I had to copy my maven settings.xml file over from my windows machine to ~/.m2/settings.xml. This points to our internal Nexus repository.
  • After installing Geronimo, I utilized a feature of OS X called Automator to create a keyboard shortcut for launching the app server startup shell script. Automator is a fairly elaborate macro builder for automating just about any conceivable series of operations on the machine. Here's an article explaining how to do this.
  • I'm not a huge IM junkie, but I liked using Pidgin on Windows, which is an open source multi-protocol chat client. I went to the Pidgin website to grab a Mac version, but it looked like their Mac support is not quite prime time; it uses some windowing platform other than GTK, and I had to build from source, so I said no thanks. I found a worthy alternative in Adium.
  • The multi-touch track pad on the laptop is very nice. It's very large, and it supports 1, 2, 3, and 4 finger gestures.
Parallels for Windows
I asked our desktop support team to install Parallels and Windows XP on my machine, both as a safety net and because we have a few apps which require Windows and IE: HP Quality Center (a hideous client-server desktop app ported to IE via ActiveX controls), SharePoint, and Outlook. Parallels is a virtual machine which allows the installation of another OS and even melds the Windows and OS X desktops into one if you want. It supports all recent versions of Windows. I don't know if it supports any Linux distros. Since my machine is fairly well equipped, it runs the VM with relative ease. The Windows OS looks absolutely native, and it feels almost native-- very slight lag dragging windows and such, but all operations perform in about the same speed as my newish Dell laptop. I highly recommend running Windows in Parallels if you are at all uneasy about switching to Mac. This at least offers you a gradual transition to Mac land.

Final thoughts
So here I am at the end of my first week on my new Mac, and I can honestly say I have no regrets. I'm still getting used to the slightly different keyboard layout, window operations, and file locations, but other than that I'm feeling relatively at home. I believe it's a good thing to leave one's comfort zone once in a while-- take on a new role, assume new responsibilities, or just try something different. It's not always a good time to leave one's comfort zone; your gut should be able to tell you whether it's ok or not. Butterflies are generally ok; nausea or ulcers mean you should probably wait ;-)

No comments:

Post a Comment