Ruby has Gems, Java has…?


As a followup to my last post and to prove that I’m not totally against a technology I’ve hardly ever used (only an arrogant bastard would flap his lips about something he knows nothing about) I present to you Gems. What is Gems? It’s the answer to my million dollar question “what does Ruby have…?” I just looked it up two seconds after publishing my last post and decided it is worthy of additional consideration when choosing an implementation technology. “But Java has Maven, and even Maven2!” That’s true but let me let you in on a little secret. I hate Maven2. That’s an overstatement, and anyone who has heard me babble on about how great M2 is will know that I don’t truly hate M2. Anyone who knows me will know that I don’t hate any technology. I have problems with certain features of certain technologies, but I never hate anything, or anyone. My point? M2 is a build system where Gem is a package management system so the two really cannot be fairly compared. Also, I hate the requirements for extending M2. Writing an M2 plugin is complicated. It’s one of those “alls yuh haff tuh do” things. Extending software should not require a project. Extending software should not require multiple XML files. Extending software should not require code generation, or an intimate understanding of the software. Extending software should be a matter of supplying custom logic to meet your needs. That’s where Maven falls short. I’ve been meaning to write my first real M2 plugin for a while and I just haven gotten around to it. I haven’t gotten there because it’s not simple enough to start. It involves the creation of a M2 plugin project. With that there’s a predefined archetype for stubbing out the essentials. That’s easy enough accept for the clumsy command line syntax. That’s another thing, I hate the M2 archetype plugin! Why to I have to pass command line flags? I like it when software gets the job done and gets the hell out of my way. I don’t like to be forced to cater to software. I don’t like to spoon feed my intentions to a program. I want the program to read my mind, kinda like IntelliJ’s Intelli-sense feature in Idea.

Since this is supposed to be a rebuttal of Ruby’s features and not a rant on what I dislike in the Maven project I’ll turn my attention to Raven. How is Gems better? One thing it feels more integrated with Ruby development. I dunno about you but I’m fast growing tired of Java’s dumb jar packaging. I think it’s about time Java gets something better for packaging. The problem with jar files is that they don’t install. They don’t self contain, and they don’t do anything but hold class level resources. Most Java apps depend on other jar files which in turn may have their own dependencies. The most common problem with Java is figuring out how to manage the dependencies with your package. The infamous jar manifest “Class-Path” entry cannot dig dependencies out of your jarred package so you must distribute them separately often as peers or in a peer folder. The best solution Java has is the WAR and EAR specifications, each of which require an appserver or container application be used with the distributed app. Why come we can’t just distribute our apps in a single self managed bundle? (The text “why come” is ghetto-fabulousian speak for “how come”.) Why do we got to do all this fancy stuff to distribute our applications? (My ghetto side is really coming out now…)

I’m not sure but I feel like Ruby Gems takes a better approach to the problem, and as a result Raven may be a good alternative build system or at least a step in the right direction. From my crippled understanding of Ruby Gems, a gem can depend on another gem or other gems. These dependencies are downloaded as needed as the app runs. One could argue that you could achieve the same functionality with a tool like Ivy or Maven2 but it would be a project. That is, there are no such pluggable equivalents that I know of in the Java space at the time of this writing. Maybe its just me, and most likely it is. MAybe I don’t know enough about the Java tools I use everyday, but I still have trouble sharing the little tools and widgets that I build with Maven with the rest of my team. I can mvn install or even mvn deploy but I’m not quite sure how to mvn create-self-contained-distributable-package. If you think I’m crazy or off on something leave me the 411 and drop the bomb on me son…

2 thoughts on “Ruby has Gems, Java has…?

  1. There’s the old JSR-277 spec, which has been around forever and we still don’t have it (read about it on TSS and laugh. Or cry.)

    http://www.theserverside.com/news/thread.tss?thread_id=34578

    You got to the core of our problems: “Extending software should be a matter of supplying custom logic to meet your needs. ” I can add that this custom logic should be available to everybody who needs it.

    I remember a discussion on the JDistro mailing list about this high-level dependency management and extension management. It also didn’t take off.

    It’s like one of those subjects that interests everybody, but they are too busy to take care of it. Weird times.

  2. Tiago,

    I read, I laughed, I cried, I cracked open a brew. I don’t know why somebody somewhere hasn’t done something about the awkward state of Java dependecy management. I imagine the problem runs deeper than it appears on the surface. Maybe there some hidden issue like, “adding Java modules would potentially break backward compatibility with older JVMs and introduce yet more uncertain deployment options to the average developer while simultaneously causing a disruption in the space-time continuum eventually throwing Hiro off of his mission to save the cheerleader which would eventually result in George Bush being re-elected for a third term while the war in Iraq ensues and the universe collapses on itself.”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s