Should Apple Buy Sun?

That question was posed on the LAJUG mailing list in a response to a rumor about IBM buying Sun. I think it’s clear that Apple doesn’t really want to get into enterprise computing. Their entry, the OS X Server, at that price point, shows they are not serious about it.

This may sound ridiculous, but I believe Apple doesn’t think enterprise computing is a cool enough market to enter. They really seem to love being in the spotlight with consumer products. And the fact that the art and entertainment industries use their stuff. It’s glamorous and I don’t blame them for it.

Because of all that, acquiring Sun, or even merging with them, doesn’t make strategic sense. The only major synergy would be Apple’s GUI and integration from their server OS added to Solaris. Sun would lose training income driven by an OS that’s unwieldy to manage, but they could charge for it as a product. It would certainly save their customers money on admin labor costs. However, they could probably license that from Apple and avoid a fruitless merger.

In addition, Sun is a bigger pill to swallow than most realize. IBM is much better suited for them. And despite heavy list traffic on the subject, I haven’t heard anyone voice their opposition to the idea.

I Want a Java Example Project Directory

I’m starting a new project with some new (to me) technologies and finding the start up process – setting up my IDE and build script to play nice together – to be somewhat frustrating. I kept thinking to myself, “Somebody already solved this; wouldn’t it be great if I could grab their project and just start coding?”

My idea is for a directory of Java example projects.1 It would make it easy to search projects by stack: IDE, tools, frameworks, libraries, and app server. Projects would include the minimum to show the integration points. The directory would also have basic social features: a way to vote up projects and a forum for discussing integration, setup, and architecture best practices. This is probably something a CMS expert could tackle fairly easily.

I admit there are a few problems with this idea. People expect to thrash around during project startup. They learn from it. When it’s over, they start doing real work. They probably don’t want to share their lessons learned. Those that do are typically evangelists for a particular framework. Spring, as an integration framework, comes to mind with its Pet Clinic and Pet Store examples. Hibernate’s Caveat Emptor is probably the best example app I’ve seen. AppFuse also demonstrates integration, although earlier versions seemed more explicit (the new version built with Maven seems to hide a lot of the details).

However, these apps don’t cover IDE configuration, and the IDE/build tool mismatch problem is where most of the difficulty lies. The most important IDE features, IMHO, are incremental building for syntax checking, and debugging. So you have this natural duplication of effort. The IDE/build script conversion tools (in either direction) seem narrow in scope; granted, I’m limiting myself to Eclipse/Flex Builder to/from Ant. I don’t know if full integration between the IDE and the build tool is the answer, but it would certainly go a long way in making things easier.

In the meantime, however, a project directory would be a welcome resource.

  1. You don’t need to host the projects themselves when there are already sites like code.google.com and Source Forge. []

Syncing Thunderbird Contacts and Calendar with Blackberry

Sometime late last year I switched from Outlook 2003 to Thunderbird.1 I liked Outlook, I was used to it from work, so I didn’t want to switch. But it didn’t take long before it’s abysmal IMAP support drove me nuts with bogus error messages. I know Microsoft makes money off Exchange servers, not IMAP servers, but how hard can it be? Every other free mail client works great with IMAP!

This includes Thunderbird. Sure, it’s not as polished or mature as Outlook when it comes to contacts2 or tasks, but I am no longer getting error messages every 10 minutes. Unfortunately, Blackberry Desktop software won’t sync Thunderbird contacts and calendar items.

Enter Google. Now, I still haven’t jumped on the Gmail bandwagon; I use Yahoo Mail for my spammy accounts, simply because I already had that account. But I do have a Google account, and I recently learned that their Contact Manager and Calendar apps have their own home pages that don’t require Gmail accounts. And they allow 2-way syncing! So here’s what you need:

A Google Calendar – use the links above. Make note of the private XML link; to find that, you must click on Settings, then the link for your calendar.

Lightning
This Thunderbird add-on gives you calendar and task functions. I’m assuming you already have this installed.

Provider for Google Calendar
This Thunderbird add-on allows syncing with your Google calendar. Unfortunately, your current Thunderbird calendar is no good anymore. If you already have stuff in it, you have to export it. Use iCalendar (.ics) format! The other formats do not support recurring events like birthdays or any weekly reminders you have set up. Import that file into Google Calendar, disable your current Thunderbird calendar (under Properties), and then create a new Google calendar within Thunderbird (this requires the private XML calendar link).

Zindus
This Thunderbird add-on syncs your contacts with Google Contact Manager. Make sure your contacts are clean before you sync. For instance, I imported my Outlook Contacts into a Contacts address book, but Thunderbird defaults to a Personal Address Book. I should have copied them over right away, but didn’t. Thunderbird automatically collected addresses, so I wound up with duplicates I had to merge or delete. Zindus will spot duplicates during the syncing process and let you pick one and delete the other, but it’s probably safer to do this by hand. When that’s done, go to Tools >> Zindus and sync.

Google Sync

This mobile app syncs your contacts and calendar with what you just set up on Google. It can be installed from within Google Mobile, which I already had installed so I could get Google Maps Mobile.3 Install it, sign in, and you’re done!

  1. This was after switching from SquirrelMail to Outlook. []
  2. Why can’t I highlight text on the contact card? This drives me nuts! []
  3. BTW, Maps is way better than Sprint Navigation. Sure, there’s no voice nav (which I admit is important), but for seeing where you are, scrolling around that map, and doing local searches, it wins hands down. Its routes are far superior, so if you can remember the directions, you’ll get where you’re going faster than the Sprint voice navigation. []

When Do You Stop Adding Unit Tests?

Joel Spolsky recently posted a transcript of a conversation he and Jeff Atwood had on the Stack Overflow podcast.  It’s a nice reminder to think about the situations where unit tests add value and where they add maintenance hassle.

The takeaway was that there are a few places where code coverage makes a lot of sense because change is rare and breakage has a big negative impact. These include APIs, especially plugin architectures where others are depending on the contract of your code, and mature business logic that should rarely change. You really want to think about the number of people or LOC that are depending on that code to work.

In contrast, there are a lot more places where you’re slowing down your coders and their ability to respond to customer needs.

Another contradiction Spolsky suggests: many of the same agile programmers who espouse YAGNI require an arbitrary percentage for code coverage (often close to 100%). Shouldn’t YAGNI also apply to unit tests?

I believe the key is simply thinking about what you’re doing. Here are some guidelines:

  • If it’s foundation code (frameworks, libraries, etc. – anything that gets called a lot) write the tests.
  • If you’re about to refactor the code, write the tests.
  • Even if you’re not going to write the test, channel the spirit of Test First Development – design the code so that it’s easy to unit test should you have to later on.

I realize this might sound obvious, but a) not everyone agrees with this, and b) sometimes you can lose sight of what’s “obvious” when others are persuasively defending blind adherence to “principles”.

Eclipse “cannot be resolved to a type” error

So I’m coding along and all of a sudden, Eclipse (3.4) can’t resolve classes. Classes that are in the same package as the class I’m editing. Classes that are fully qualified in the import statement.

Not good.

The last thing I had done was add a Spring @Autowired annotation. I saved the file and voila, everything goes to crap. I then spend a stupid amount of time trying to track down the cause. I took the changes out. I did a clean and rebuild and retest (everything passed; this was Eclipse-only). I added new classes to see if they broke (they did). I did a false modify (add space, remove space, save) to see if that broke said file (it did). It was a death spiral. No matter how I changed the code, the same problem was there.

Turns out, it wasn’t the annotation, or anything else in Spring, or any of my code, or any of my Eclipse plugins. It was a step before that killed me. I was doing a little cleanup and I created a temp directory at the top of my project folder so I could move some files there. It wasn’t nested in anything, other than the top level directory. What could go wrong?

Apparently, that makes Eclipse see red. Squiggly red.

The solution was simply to do a refresh (F5) on my project. Just as quickly as it started, the problem went away. That smells like a bug to me, but if it was I figure I’d see a lot more mentions in Google or the Eclipse bug tracker. I’m really hoping this helps someone save some time.

Update: If that doesn’t work, try:

Clean, refresh, build, restart

Also, remember any external build/clean scripts you might be using. For instance, Grails has a command line “clean” you may have to invoke. Same if you have Ant or Maven builds.

David Resnick (comment below) discovered this tip for those with an external build script:

Windows–>Preferences–>Java–>Compiler–>Building–>Output folder–>”Rebuild class files modified by others”.

This exists in Eclipse 3.5; I’m not sure about earlier versions.

Another issue I’ve found over the years is problems when upgrading Eclipse. In theory, new versions of Eclipse should update your workspace and project files just fine. In practice, they can become corrupted. My new rule is to create a new workspace for every major version upgrade of Eclipse (maybe more often if you’re cautious). Then I copy those projects and import the copy. This ensures I have a backup plan should something go awry. You may need to reimport your project(s) if there’s a problem that won’t go away after an upgrade.

Many commenters offered other solutions, so check below. Thanks to those who contributed them!

Update: I switched to IntelliJ. Click that link for details why, it’s not the usual hand-wavy “it’s just so much better” that never got me to switch. Not saying it’s bug free, but nothing is, and I’ve never seen errors like this there.

Keywords: false error, bogus error, eclipse bug