Sunday, July 3, 2011

Managing Jar Hell

When I moved from Netbeans to Eclipse, I couldn't understand why the Eclipse library support was so bad. By bad, I mean it doesn't support relative paths in its user libraries feature. You can see the bug report here. It was reported in July of 2004. Why is it that?

Well, it turns out, it's because the people at Eclipse know that you can handle this just fine now, probably not in 2004 though, using a dependency manager and it will do a much better job of it. Ultimately, the problem with the Netbeans approach, and to be fair, we'll see that Netbeans does support the alternatives suggested here, is that it requires you to check in library modules, the jar files, into source control or some kind of shared resources.

Enter Ivy... and moving on to Maven. Ultimately, these two systems work with Maven central do automatically grab all your jars for you. Not only, but they will also grab javadoc and source jars for you at the same time.

If you're struggling with this, give Ivy and Maven a look. I started using Ivy a little while ago and it worked like advertised but hit some limitations with the AppEngine SDK and native libraries (OpenGL and OpenCL bindings).

Ultimately, I moved our builds to Maven. Not only does Maven manage jar dependencies, including native libraries and big and complex SDKs like AppEngine and GWT, it also allows you to generate your IDE projects.

Having the maven project file be the authoritative source means we can generate projects for Eclipse or IntelliJ and Netbeans can read maven pom files directly. On many tasks, we can move away from Eclipse but still get access to all its plugins when we need it.

There are other up and coming systems like Buildr which uses Ruby instead of XML and Gradle that uses Groovy but for now, my build and dependencies are driven by Maven. Upgrading jars to never versions is changing one digit in an XML file. New team members just need to have a maven aware IDE and everything just starts. No setup time, no nothing.

Wednesday, May 11, 2011

One More

Also top pick is the new svg renderer library for Android. This is the same library that Androinify uses.

Google I/O 2011 Top Picks

Yes, the Android keynote was very interesting and all. Here are my picks for this year's "best of show":

  1. ForPlay. Liked the Angry Birds in Chrome demo? I did too but for technical reasons. I immediately wanted to know what they used to port the game. They obviously have a Java version of the game and the physics are powered by Box2d which has a Java port. Angry Birds for the web is built around GWT and this new library. I'm a big fan of GWT and their new release schedule since version 2.1 is really making it easier to use the library for real work. It will be interesting to see what kind of uptake this has with casual game developers.
  2. Android tools. Hopefully, soon, we will finally get relief here. The current emulator isn't good and really hampers progress. The current visual designers are also horrible.

Monday, March 28, 2011

Some Hope for the Android Emulator

Google has publicly stated that they're working on making the Android emulator faster and that they feel our pain.

I'm all for statements to such effects and all, but nothing says we're doing it like some cold hard commits:


This adds hardware (GPU) acceleration to the emulator.

Friday, March 11, 2011

NoSQL != No SQL

Time and time again, I'm reminded that the NoSQL abbreviation is probably the worst coined term ever.

NoSQL doesn't mean "no SQL", as in there is no SQL here. It means "Not Only SQL". Granted, the two biggest heavyweights in the NoSQL space, Apache's HBase and Cassandra, don't support SQL. However, it doesn't mean you can't use a domain specific query language on them.

Cassandra has CQL which means exactly what you think, i.e., Cassandra Query Language. This is very close in syntax to SQL but adapted to work with Cassandra.

Now, I encourage users of both systems to discover the power of Pig. Pig works works with both HBase and Cassandra. Personally, I find Pig much easier to use than SQL. The key to its simplicity is that it has a concept that represents the current row. If you've ever had to deal with non trivial SQL before, you know all too well the evils of sub-selects that could be easily avoided if you just had a way to refer to the current item when you needed to.


Wednesday, January 26, 2011

Android Emulator Slow?

I have an 8 core Core i7 processor and the emulator was really slow for me. I'm not talking it's slow to start and then it runs fine. I'm saying it takes a long time to start and it's always slow.

The trick it seems, at least for me, is to disable the loading animation, in Eclipse, you can so do in: Debug Configurations > Your Debug Configuration Name > "Target" tab

Thursday, November 4, 2010

Programming Windows Phone for Free

I usually don't bother with books anymore to learn a new platform, don't need it, they just slow me down. However, I would be lying if I didn't have a special place in my heart for the great Charles Petzold.

Back in 1992, I very much needed books to learn a new language or concept and "Programming Windows 3.1" was my introduction to the world of UI programming and event loops.

Not only was it clear and concise, a "problem" that has since been "fixed" with later editions of the book, it was actually quite entertaining. No small feat considering it took over a hundred lines of C code back in the day just get a window to show up.

Now the Great is back with a book on programming for Windows Phone. I haven't read it but Microsoft is comping the book in support of its new platform and is available to all for free. Microsoft is hoping it will introduce a new generation of developers to Windows Phone like the original did for Windows, I can only hope it will introduce a new generation of developers to Petzold.

You can download the book from here.

Saturday, August 21, 2010

The Challenge of Using Multiple Languages

After years of using Netbeans, I finally gave up. We have started using Eclipse. Why? In one word: plugins.

To be more exhaustive, I have not been very comfortable with the acquisition of Sun by Oracle, and that was even before they announced that awful lawsuit against Google. I would have been more comfortable with the acquisition if Oracle hadn't just closed on buying BEA one year before Sun.

Oracle's Java EE application server offering, OC4J, was, and is, simply awful. To their credit, Oracle didn't ignore the problem, so they went out and bought BEA for $1 billion dollars to acquire WebLogic. They also made it clear, that although they will support both application servers for now for their enterprise customers, WebLogic is their "strategic" server. Meaning that OC4J is on the endangered species list.

If it weren't for the BEA acquisition, Glassfish would have taken center stage in Oracle's portfolio. However, even if both servers share common components, e.g., both use the Metro web services' stack which is developed as part of the Glassfish group, Oracle didn't buy Sun for Glassfish, they bought it for Java. Makes sense considering they spent $1 billion to buy WebLogic.

Then we had the Netbeans vs Oracle's JDeveloper scenario. Unfortunately, if that was the only variable, Netbeans' victory is absolute. JDeveloper is not very good, and I'm being polite here. However, JDeveloper is not just an IDE, it's an IDE designed to get you to use as many Oracle middleware products as possible. The other variable is that Oracle, like everybody else, supports Eclipse. Meaning that Oracle is now spending money to support 3 IDEs, I suspect that will not last indefinitely.

All this to say, even if Glassfish is still the best and Oracle is continuing to invest in both Netbeans and Glassfish. We still decided to move ahead and proceed with our migration from these products. We also decided to take it by steps and steps and slowly. We have now successfully migrated to Eclipse but continue to use Glassfish.

So why Eclipse? Well, our primary toolkit is Google's web toolkit(GWT). We use GWT everywhere and profitably too. However, Google's IDE of choice is Eclipse and the plugin for GWT, and AppEngine too, made by and supported by Google is for Eclipse. So it was hard to always be behind on Netbeans when it came to GWT. Not only, but we are targeting AppEngine to replace Glassfish. If that wasn't enough, we also have a very real need to develop for Android and we love Scala. Again, all of these have world class plugins for Eclipse but not for Netbeans. So we just grew tired of being second class citizens all the time.

So how about Eclipse? I'll tell you one thing, I was nervous having had really awful experiences with it before. It has a very steep learning curve. However, once you wrangle it, it definitely pays off and with dividends too. It's definitely a match for Netbeans and more. I can't think of an IDE that has better refactoring and source navigation features. Heck, there's even a Silverlight plugin for Eclipse.

So now we have one IDE for pretty much all platforms and languages: Java SE, Java EE, Scala, Android, AppEngine and C++... or do we? Well it turns out it's not that simple.

Recently, on a project, I had to code in 4 different languages at the same time: C++, Objective C, Java and C#. Java on the server. C++ for some glue code. C# for a Microsoft Office extension and Objective C for an iPhone application... and I ended up using 4 development environments.

I had to use Visual Studio for the Office plugin. I used Eclipse for the Java server stuff. I used Netbeans for the C++ part and finally, I used Xcode for Objective C.

It turns out coding in multiple languages, even on the same day, isn't that hard, however, using multiple IDEs in the same day is a different story. You see, I always keep the default key bindings of an IDE so that I learn them as I go. It also means that if you're a veteran of a particular IDE, Netbeans in my case, it's very, very hard to switch and not continuously mess up which accelerator you're suppose to use.

So there you have it, the real challenge of using multiple languages: the IDE key bindings. So if you're going to be in this situation and you aren't dumb like me, I suggest you import key bindings in all the IDE's that you can.

Friday, June 11, 2010

The Significance of a USB host

For the last 2 years, I've been saying to anyone willing to listen that the future of computing is a incredibly powerful phone that you cradle when you get home or at work, etc. This cradle has a mouse, a keyboard, a large screen and a good sound system.

Android enthusiasts seem to have taken another step to making this vision a reality. Notice in the video that he launches X-Window with a desktop environment from his phone that isn't the Android shell.

That being said, the Nexus One, as powerful as it may be, still isn't the all powerful phone I've been describing for the last 2 years, that phone still doesn't exists.