Dr Nic

Smart people doing smart things in Netherlands – RubyEnRails 2007

Summary: click to select

rubyenrails2007-me-presenting-by-fngtps.jpg

Photo by Thijs van der Vossen,
Fingertips

For one million people in Amsterdam, time stood still as a parade of Rails gurus in Netherlands/ Belgium talked up a storm at RubyEnRails 2007. Only 240 were allow inside to the free, one day conference, so riots ensued at the doorsteps of the building. Police were called in. Helicopters. Tanks.

Or so I’m told. I was too busy inside meeting many very clever developers and sharp business people. The buzz of excitement for Rails in the foyer during the breaks was tremendous. The conference organisers recorded the audio of all presentations which will be great to listen to.

I was flown in my private jet, helicoptered to the conference building and shepherded in by 24 Dutch Special Forces men, all of equal height and build, identical in every fashion. Before my keynote, I was interviewed by all the major TV networks. I have no idea what drives me to make this all up.

But I was given a free RubyEnRails conference t-shirt. I was also able to give a couple of presentations:

Keynote

It was a wonderful opportunity to start the day, and I shared “What’s cool with Rails?” focusing on some hot potatoes like scaling and deployment, as well as RESTfulness. Slides here.

Ultimately the basic theme of the keynote was “Its all just text”, and choosing between Rails, Merb, Camping, Mongrel handlers, becomes a design/architectural decision to be made for each portion of each application you build.

I included a live demo of the Magic Model Generator, and encouraged people to write RubyGems instead of Rails plugins, as they provide better support for: dependencies, versioning, and reuse outside of Rails.

DIY syntax

The ability to extend my programming language tickles me pink. Often you write a block of code and you just think “That should be prettier and simpler”.

With Ruby meta-programming, blocks, method_missing, const_missing and optional parentheses you can craft nearly any syntactic sugar you like to replace lengthy, complicated code.

Slides here.

Dr Nic Academy

I also took the opportunity to introduce Dr Nic Academy – training courses in Ruby on Rails by me. The first course will be 7th and 8th of July in Amsterdam. If you are thinking of attending, hold off buying tickets!! The new website and a special bonus discount price will be coming soon. I’d hate you to miss out.

Dr Nic’s Magic Show at RejectConf2007

Update: there is a patch available for edge rails to support merging by generators; add comments to the ticket.


The original Dr Nic’s Magic Models were named as such because I entertained the idea of showing them off as a live magic show. So, given 3 minutes in front of some of the Ruby community’s hottest hackers, I got my chance! Not the Original Magic Models, but the never-before-released Magic Model Generator.

How to install and use the magic_model_generator follows the video from RejectConf:

The Magic Show

How to use it

Create a rails application, and point it to your database.

$ rails magic_show -d [mysql|sqlite|postgresql|oracle|etc|etc]
$ cd magic_show
$ cp database.yml.sample database.yml
and point it to your database.yml to your legacy database

I use the database created for the ActiveRecord test cases – activerecord_unittest. If you’ve never downloaded the activerecord gem, run rake build_[mysql|sqlite|postgresql|oracle|etc|etc]_databases, and then rake test_[mysql|sqlite|postgresql|oracle|etc|etc], then you’ve probably got more free time than I do as a result and I appreciate that. And so does my wife.

Now install the magic_model_generator gem:

$ sudo gem install magic_model_generator

Nonetheless, you’re done. That’s all the preparation I did for the video.

Next I recreated the schema.rb file and the schema_info database table via rake db:migrate.

Next I ran the generator:

$ ./script/generate magic_model

And we’re done.

Coming soon

The MMG is awesome.

The one major drawback of the MMG is the same drawback of all rails generators: if you want to regenerate your models (say you update your schema via migrations) then you cannot regenerate your model associations and validations without completely recreating the file, thus destroying anything else you wrote. Which is useless.

The world of version control (subversion, cvs, etc etc) already solved this problem: merging. So I’m investigating adding merging to the rails_generator. That should be neat.

New Gem Generate to get merging too?

Currently the newgem command doesn’t use the rails_generator for creating files. So adding merging to rails_generator won’t help newgem. That is, unless I rewrite newgem. So, I’ll look into that too.