|
![]() |
Update: Checkout CookbooXUL V2Hey, check out the V2 of CookbooXUL release. It even has 10,000 recipes you can search. Update: Packaged Download AvailableI decided to package up the cookbooxul project so that people will not need to use wget anymore. Enjoy. Ruby On Rails + XUL ExperimentWell, it looks like someone finally wrote the killer app that makes learning Ruby worth it. Ruby On Rails is a super nice web application framework that I’ve been tracking for a little while now. I’m always looking for something that pushes simplicity over complexity—unlike the Java community. In the past I took a quick look at Ruby and thought it was Yet Another Programming Language. There was nothing in it that was more or less than anything else I used, so the incentive to work with it was limited. Rails makes this very different since it is so simple compared to the complexity you get for free. As an experiment, I combined a Rails example from oreillynet.com with some stuff I’d been doing in XUL under Firefox. The end result took a life of it’s own and many people asked for the source. The problem was, I didn’t do that much. I took the original source from the oreillynet.com article, followed through it and then changed a few things to get the new snazzy front end. You can check it out temporarily with any Mozilla based browser. NOTE: Disabled for now. In the end the whole thing took me about one more hour to get working, with most of the work in the code used to get dynamic XUL updates remotely. Once I posted the application to the mailing list I saw the app receive about 10 hits an hour as people played with it. It’s interesting because it’s a dead simple two file hack. Literally, just two files changed and two lines added to a Ruby file. I think this is what impressed me the most about Rails. I was able to modify the sample app to use a completely different interface and I don’t know jack about Ruby or Rails. The Plot ThickensThe source code is available as a directory of files.
If you want to try and run it, then you’ll need SQLite
and you’ll need to create the test.db file mentioned in the database
configuration. There’s a db.sql file which will
create it for you. Once you do that, just run it with The relevant files to review are
list.rhtml and
show.rhtml. These two files
generate the XUL for the interface. In the show.rhtml file you’ll see a
JavaScript function at the bottom that uses the XMLHTTPRequest object to grab
XUL content from the The magic to get the “JavaScript XUL patching” in showRecipe() working is that
your sub-content must have the
The only other real change I made was to add a The Story So FarI’m an old hat at web application development, having developed apps using Java, Python, PHP and even some straight C stuff once in a great while back when I was retarded. I have a fairly consistent way of developing HTML based web applications, but I’ve always thought that HTML forms have outlived their usefulness. I’ve also grown tired of the endless unnecessary complexity that seems to plague Java and “enterprise” applications. It seems that an “enterprise” application must use every GoF pattern, work against a bloated Oracle database, run on top of Hibernate or EJB, work with JMS, and have extensive scalability at the application layer (that means the wrong place for those who don’t know). I’ve actually written two screen applications with none of these things that did the minimum necessary and were extremely simple, but when a so called “enterprise” guru looks at them they freak. “Oh my god, that’s not good. You can’t use a properties file! That went out with bow ties.” My sense of aesthetics demands that things be as simple and straight forward as possible which means I find Java very annoying at times. And I make my living as a Java programmer. It’s almost as if programmers these days are in a code complexity fashion contest. Everyone is wearing diamond encrusted necklaces, Gucci purses, Monolo shoes, fur coats, and every gaudy accessory they can get their hands on while they eat expensive caviar on the Andaman Sea. Meanwhile, I just want to wear jeans and a t-shirt, eat cereal and watch cartoons. It’s no wonder all my programming “relationships” end so horribly. Ruby might be different, but so far only Rails has really showed it off well. I’m also impressed with the Needle project for being cool. I love the fact that both of these projects have rejected the reams of XML toilet paper I’m forced to use in other frameworks. Give me a parser or YAML any day. Apart from these two projects, I haven’t been too wowed by Ruby in the past.
Take the Ruby Gems thing. It took me about 30 minutes to figure out that after
you install something with Ruby Gems, you must now put Now Rails has blown me away in the first few examples. Examples can be like that and it’s only when I try to implement a more serious unusual application that I start to find the warts on the platform’s hands. Once I come up with a project that I’m willing to “Ruby-ize” then I’ll find out the real scoop on Rails and friends. Recommendations To The Rails CrewI’m very eager to explore Rails and other Ruby technology to confirm the Hype. Even if it doesn’t pan out I think it will be fun to learn another language and do some stuff in it. Right off the bat I can make a few recommendations based on my experience with other frameworks:
Other than that, the Rails site is really nice and well run. A lot better than other projects, which is probably why it’s getting more attention. I really should take a page from their book on my wimp goods. I’d also like to mention that the #rubyonrails IRC channel on irc.freenode.net is really good for information. The folks there are very nice, unlike similar channels which want to pound pulpits with their fat heads. |