Rails, You Have Turned into Java. Congratulations!

Rails isn’t the easy framework it once was, age has brought along a good deal of complexity both in the way Rails applications are deployed and in the number of technologies you need to assemble together to get anything meaningful done.

Update (2/20/13): Hello all, one additional note.   I’m surprised to be saying this, but I think the key difference between Rails and Java is that the Java “ecosystem” has this imperfect, somewhat ad-hoc standards group called the JCP.  This means that Hibernate and MyBatis or Spring and Oracle aren’t just pulling another framework out of thin air, they have to agree on standards and APIs.   This slows things down a bit, but, in the long run, this makes things more interchangeable.   It’s odd for me to write this because I’ve railed against the JCP for years, but I do think that Rails is a picture of what happens to “frameworks” in the absence of standards.   Call me old for saying it, but I did.  So there.

Frameworks atop Frameworks atop Opaque Hosting Platforms

Sure, Rails itself is straightforward, but the frameworks you slap on top of it can quickly become burdensome abstractions:  RefineryCMS, Devise, Omniauth, Carrierwave, Unicorn, Rack Rewrite, Fog, New Relic, Foreman, AMQP, and Honeybadger, not to mention the extra magic that Heroku gems throw into the mix (backups and other fun).

Why is the site slow today?  I don’t know maybe AWS is having problems?  Nope.  Ok, maybe the Unicorn configuration is screwy?  No.   Alright, everything works except Refinery take a look at New Relic.   That didn’t help.   Ok, let’s restart the application.   Great, that fixed it.  Why?  Not sure.  Was it a worker thread that was stuck?  Who knows, and who cares the site works now…

Maybe I’m reacting more to Heroku’s recent unpredictably and mysterious performance issues.   Maybe, I’m not fully dissatisfied with Rails or Ruby, but I can’t help but notice that Rails has become heavier these days.

Is it the complexity that Refinery brings to the table?  Maybe.  Refinery does what it does, but it is something of a beast.   If you follow the rules closely, you’ll end up developing a Rails application with an excessive number of Engines, which is really just another way of saying that you’ll be fumbling through a messy file explosion.  (What view is that engine in?   Hold on, let me click through five levels of folders….)    There are those of you who will shout “Sinatra, you should use Sinatra?”  But that’s really not what I came to Rails for.

I know I have unrealistic expectations.  I want it all, and I want it to be easy: I want straightforward defaults, but I also want customizations to be things I can understand.    Take the intersection of Devise, Refinery, and Omniauth as an example.  All three of these frameworks are first-class, don’t get me wrong.   (I lied, Devise and Omniauth are first-class, and Refinery is an awful mess.) Making them work seamlessly together is an obtuse nightmare  – a documentation desert littered with wreckage.

Frameworks that Eat Frameworks don’t like it when you Customize the Frameworks they Eat

The problem is really that once you start making use of Rails and all of the frameworks built atop of Rails you end up creating an opaque mess of customization.   One framework, say Refinery depends on something like Devise.   Customize anything and good luck upgrading.

Who really knows what happens during the login process?  Oh, I know, we’ll use RubyMine to step through this unpredictable mess.     I need to make a simple change to how routes work… oh look Routes have become incomprehensible because you now have 12 difference Refinery engines.

You’ll find yourself staring at incomprehensible mega-frameworks maintained by developers who are unapologetic about how little they care for writing documentation.     You’ll also end up with the most common pattern from Hell: the single Rails application that runs an entire business.

I’m starting to think that Rails has turned into the new Java, and that it is time to return to Java and ask it a simple question…

…Java, have you learned to “easy” yet? 

 

Loukides: “The winner in the case isn’t just Google; it’s all software developers”

Mike Loukides sums up the end of this phase of the Oracle v. Google trial in the title of his piece on Radar: “The End of a Fishing Expedition”.

First, Mike is right, as he very often is, but this sentence gives me pause:

The winner in the case isn’t just Google; it’s all software developers, who don’t have to worry as much about creative interpretations of copyright law, and are free to develop compatible implementations of an API.

Yes, Alsup’s decision is something of a victory for Open Source and people interested in compatibility, but Alsup also mentioned something in the summary that I’m still trying to understand:

This order does not hold that Java API packages are free for all to use without license.

While this was a win for Dalvik, Java is still confined in this annoying “box”. OpenJDK is open source, but the language and is still gated by this TCK. I have yet to see any analysis from people I trust (aka groklaw) on this topic. Java still isn’t free, but, at least, there’s no barrier to people creating an alternative implementation (they just can’t call it Java).

It will be interesting to see what an Oracle scorned does to the licensing terms it uses to distribute Java. While the APIs are not copyrightable, my lawyer friends have told me that there’s not much limit to what Oracle could put into a EULA that accompanies the JDK. (Just look at how Apple uses the EULA for the iOS SDK for proof that anything is possible.) If they are rational and want the platform to succeed they won’t do this, but I’m worried that now that Java isn’t as lucrative as they thought it was that they might just discard it (and ruin it in the process).

I also fear the appeal. I’m a pessimist, if this case makes it to the Supremes all bets are off.

I do agree with Mike, Alsup is something of a modern hero.

The Day After the Verdict, I Open a Sun Time Capsule

I never published this interview because I didn’t find it notable. Don’t get me wrong, Tim Bray is a brilliant engineer and a great interview subject, but the interview itself was a bit meandering. The interview wasn’t worth publishing more because it was too long, it wasn’t focused. If anything the fact that the thing wasn’t published was more a reflection on my failure to conduct a more interesting interview than Bray’s content – again, Bray is made of awesome.

In 2008, I was focused on the struggle between Apache Harmony and Sun Microsystems and I was really frustrated with what I felt was “doublespeak” coming from Sun at the time. Right before I sat down with Bray, I had a quick talk with Geir M. which is somewhat off-the-record. He was at 10gen at the time IIRC, and I was asking him about the TCK dispute. When I sat for the interview, it was my goal to try to get Bray to make news about TCK licensing, you see that I failed at that goal, but four years later this video does have a few moments relevant to the Oracle v. Google trial.

This long interview covers many topics (maybe too many?), and it doesn’t start to get interesting until the end. You’ll see that I’m asking questions you wouldn’t expect me to ask Bray because I’m trying to zero in on the Sun and Harmony issue. I also figured that this was my chance to ask about bigger issues. I’m asking some fairly general questions about layoffs because there was a disconnect between Sun’s public message and what I was seeing on CNBC. The company was simultaneously struggling and making increasingly more audacious claims, this trend would continue later that year at JavaOne 2008.

Interesting parts of this interview:

I ask him to respond to a quote from his blog on the 18th of July in which he said he “didn’t want to be a share cropper on Massa Steve’s plantation” quote.

“It’s a great device, I’m probably going to get one. It is triumph of industrial design. Despite the fact that these puppies have been able to access the internet for a decade. the iPhone is the first device where people have been able to access the internet at scale and at volume.”

At the end of the day, I’m disappointed that there is a single vendor that controls the platform. You don’t have to ask anyone’s permission to do anything to do something on the web.

Q: “What is Sun doing to make it more realistic to have an open market on a mobile platform?”

“we are substantially in the business for selling the backend network infrastructure. Now a lot of us at Sun think they would do better and they would make more money if they were radically to open the network. We think that it is quite plausible that the operators could open the billing systems…”

“Even assuming that the network operator gets half of that. I’ve been saying that in public for years. Inevitably I think it will happen, let’s radically open up and we’ll see an explosion of creativity. Google seems to be trying to do that with the Android platform.”

“Android looks pretty slick and it looks like a more [modern environment]… I have a couple of issues with Android, It seems to have stalled. There is no hardware yet.”

“I’m a little disappointed in the licensing around Android. If you look at the licensing on Android they can ship devices that have the same walled garden.”

I asked this question, “If Android is released and there is massive uptake, do you see any pressure on Sun to call Harmony a real implementation of Java?” He quite deftly refuses to take me up on the offer to make news. But he does say something along the lines of “It is Google after all, but the phone companies are bigger than Google.”

Two quick asides:

  • This story would have been uploaded earlier, but YouTube kept on removing it. I find something about this to be ironic.
  • Maybe this is ironic: Google used a screen capture from my interview with Bob Lee in its opening statement. It’s unclear to me if this is covered under “fair use”, did they just ignore O’Reilly’s copyright notice (just kidding).

The Debian Java Package Team: Futility Defined

Maybe a year ago, maybe a bit longer, I was motivated to jump in and help get Maven 3 on Debian. Right? Maven 3 in Ubuntu, should be easy right? No, these people are smoking some strong, strong stuff. Evidently, they don’t like the Maven repository because it distributes binaries and distributing binaries is counter to the way linux distributions work.

You think this is crazy? Tough.

So, Central has 400,000 artifacts on it. 400,000 is not a small number, and the only way these Debian folks are going to keep up is if they figure out a way to map all of that into a system that fits into this idea of Linux source distribution. So, I dove in, sent some emails. The only way Maven 3 is going to get packaged is if all of the projects that Maven 3 depends on are packaged in the appropriate source…. zzzzzz. Translation: months and months of busy work just so that some Linux distro can be happy that everything is being compiled from source.

Whatever, back then I was motivated by the idea of “1. Install Ubuntu, 2. Run ‘apt-get install maven3’, 3. Make great victory” So I dove in and started to uncover a vast conspiracy of idiocy at the core of this distribution’s approach to Java libraries.

They have created a series of bash and Perl scripts (Perl, you ask, who brought that guy to the party.) These bash and Perl scripts perform a series of magical incantations that trick Maven into using a new repository. This repository has little to do with Central, it’s a special repository full of special POMs that have different versions. You’d have to be very strange to think this made any sense whatsoever. They even have a whole page dedicated to some idiotic interpretation of the Maven repository specification that shoehorns Maven into how Debian should work: http://wiki.debian.org/Java/MavenRepoSpec.

So, do something sensible and ignore all of this, it just creates problems for people who need to use Maven. Install it manually or just use the binary deb I’ve created. Don’t wait for these people because it will take them years to catch up with the rate at which the Maven community is moving.

I love these posts about Maven

It begins with “I hate maven.”, and it goes on and on. This is a person who is trying to use the Sonar plugin, and who hates Maven so much he can’t bring himself to understand the idea of running a repository manager, or even that he should think about upgrading to a version of Maven that was released two years ago.

Part of my mission is the help people understand Maven, but when I see a chap like this: someone so dead set against investing even a tiny particle of effort in getting things to work. I like to sit back and just watch. I like to see just how bad it can get.

The solution to this dude’s woes are simple: use a repository manager (there are several, they are all free) and upgrade to the latest version of Maven. You can see people in that thread giving him hints, and you can see the resistance.