JRuby ready for prime time
May 7th, 2007I’ve been hard at work lately on ThoughtWorks new product offering, ThoughtWorks Studios. Here’s a write-up of some of the stuff we’ve been doing lately with JRuby.
I’ve been hard at work lately on ThoughtWorks new product offering, ThoughtWorks Studios. Here’s a write-up of some of the stuff we’ve been doing lately with JRuby.
I did not
see this one coming. Microsoft has ported Ruby to .NET through Silverlight, the “Flash killer”. Officially supported and even available on the Mac platform. It is a cold day in hell.
Adobe better do something quick, I would write my Flash whizbangs in Ruby over ActionScript any day of the week.
Andrew Kuklewicz just checked in a significant overhaul of ActiveMessaging he
describes the changes better himself, but here’s a quick summary:
All the changes are documented on the wiki.
All in all with the addition of the WebSphere MQ and JMS support ActiveMessaging is certainly ready for prime time. Got an old mainframe system you want to expose to the web? Crank up that CICS MQ connector, get your flat file parsers ready and you’re set to go!
Truly superb work by Andrew and Sylvain!
I’m working on a new full text search index Ruby on Rails plugin that works completely in the database. This makes it possible to:
Right now you can do:
class Author < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
belongs_to :author
acts_as_full_text_searchable
end
@jon = Author.create!(:name => ‘Jon Tirsen’)
@post = @jon.posts.create!(
:title => ‘Hitta, the full text search plugin’,
:body => ‘Blah blah blah’)
@jon.posts.find(:all, :full_text_search => ‘hitta’)
So I’ve managed to extend ActiveRecord::Base.find to support a new option called :full_text_search.
Problem is:
I can’t seem to get alias_method_chain to work on ActiveRecord::Base.find.
It seems to be something about it being a class method or whatever. I’ve tried (anyone that has ever written an acts_as-plugin should be familiar with this terminology):
alias_method_chain in ClassMethods.alias_method_chain in SingletonMethods.ActiveRecord::Base.send(:alias_method_chain, ...).InstanceMethods.Here’s the code:
http://hitta.googlecode.com/svn/trunk/hitta/lib/acts_as_full_text_searchable.rb
Wouldn’t it be so cool if Rails plugins could add options to find that gets expanded into for example :conditions and :joins?
Please help!
(Btw, “hitta” means “to find” in swedish.)
This is probably an old trick to most of my readers, but anyways…
I can’t recall all the times I’ve set up test data in tests and the test has mysteriously not worked because failed validations refused to save an object. Chuck a bang on your “create” or “save” and you’ll get an exception instead!
Will mysteriously not work:
@blog.posts.create(:title => ‘Bang that create’)
Will throw an exception instead:
@blog.posts.create!(:title => ‘Bang that create’)
We’re there. We’ve crossed refactoring’s Rubicon for Ruby:
(Thanks to Hakan who found it.)
ActiveMessaging now has a new home at Google Code. As I barely have time to even post to this blog any more we also have a new maintainer: Andrew Kuklewicz.
Please direct all questions, thoughts, ideas to the new mailing list.
Sun investing in JRuby is very cool. Having a Java implementation of Ruby isn’t a big deal for me but there’s two other reasons it makes me excited:
I would not be surprised if we see a similar move from Microsoft soon. I mean, who doesn’t want to be on the marketing bandwagon and hype of the century (only 6.5 years into it but nevertheless).
I’ve kind of put behavioral-driven development in the “interesting but a bit whacky”-bucket. Maybe something will get out of it but right now it’s not compelling enough for me to use it and certainly not to involve myself.
That said, this great tutorial by Luke Redpath did impress me. Those tests specs certainly look more better than normal Rails unit tests.
On the other hand, I am a bit cautious about doing super-detailed unit-testing of validations. I always get suspicious when the test code is orders of magnitude more lines of code than the actual application code.
They fight with the Javacs all the time and even though they are basicaly Camp this does not mean they do not kick ass! They have a religion that is called ‘Getting Real’ that costs 20 dollars and is based on Zen (like Rubby).