Push the button and it works
By Jacob Kessler on Nov 20, 2008
So, just in case I actually have some regular readers, blogging has become a bit less regular since I've been doing stuff that, while interesting, is not good to blog about. Nobody wants to read about setting up automated tests. Even if they did I'm not the right one to write about it, at least not right now. Take that, English!
However, the other thing that I've been doing is learning about J2EE5 and how that works, especially compared to Rails/Merb, and the other frameworks that I've been learning in Rubyland to integrate them into Glassfish. And, being a
lazy efficent coder, I've been thinking about how Glassfish, and the Jruby part in particular, can steal learn from those frameworks to make our software better.
J2EE and Glassfish v2, by contrast, are walls of knobs, dials, and switches that must all be set before any Stuff will be Done. It is, if you will excuse the generalization, an engineer's framework. It seems like decisions were made to favor configurability and power over everything else, and in the hands of an engineer who knows it it is extremely powerful and configurable. To someone like me, who doesn't have a background in web services, however, it is large, complicated, and unfriendly. Getting your first web page up takes hours, not minutes. Of course, once your website is up, changing it is comparatively easy: all the things you need to adjust are out there for you to easily change. But when I'm brand-new, I'm not thinking about the future. I want my big friendly button to push.
The trick, as always, is to try to get the best of both worlds, where there is a single "Do Stuff" button, as well as the wall of switches. Some of you, who bother reading the tags, may have already guessed what my proposed solution is. The tricky thing about J2EE is not setting all the switches correctly, but knowing what the switches do. And that's something that AI is quite good at (for overkill, check out expert systems. The domain here is smaller than is typical for expert systems, thankfully). You need a system where you can set some (or none, or all) of the switches, and then when you press the "Do Stuff" button it figures out what else needs to be set, sets it, and then Does Stuff. This goes a bit beyond the classic "set sane defaults" mantra, since here it would be examining the options that you have set and trying to choose sane defaults based on those, rather than having a single sane default that it went to.
That's where we are trying to go with things like the dynamic pool, the logic behind the framework autodetection in gem, and so on: You can set the pool size if you want to, but if you don't the program will figure out where it should be an set that dial for you. You can tell the gem what kind of application you've got, but if you don't it will try to figure it out for itself. Nobody can know what your application wants better than you can, but that doesn't mean that there can't be something to help you out when you just want to get the thing off the ground. You should be able to push the button and have it work.