You are here: Home Blog Hackfest Winner Interview: Matt Aimonetti

Matt Aimonetti is a Web application designer/developer experienced in world wide scale projects with a particular interest in User Experience and "agile" methodologies. He is a Rails core contributor and a winner of the June 2007 Hackfest

In this interview find out why Matt and his team chose Ruby on Rails over Symfony and Django. Discover the different tools and libraries that he uses in his projects.

Get an insight into the neat improvements currently being made to ActiveRecord on the Rails trunk as a result of his contributions in this Hackfest.

Matt Aimonetti

Q: What is your connection to Ruby on Rails?

A bit more than a year ago, the company I was working for was interested in switching to a MVC web framework. Two other developers and myself looked at three different solutions: Symfony, Django and obviously Ruby on Rails

We wrote the same demo app using the 3 frameworks and benchmarked them (the results where quite surprising and even made it to the top 10 Digg stories). Anyway, to cut the story short, we opted for Rails after we all fell in love with Ruby (RoR benchmarks weren't that great).

I had been a fan of Object Oriented Programming for a while but since I had to mainly use PHP and Perl at work. The only OOP fun I had was when working on Flash ActionScript 2 (which by the way is truly OOP and very close to Java). I always liked Java but the verbosity of the language was just annoying. At the same time I was getting seriously tired of maintaining spaghetti PHP code.

Ruby was just there for a while and I was ignoring "her" thinking that "she" was just like any other programming language. Oh boy, I was so wrong. I fell in love almost right away. Rails was just a good use of Ruby and since, on top of that, I was 200% in agreement with the framework's concepts, the switch was easy.

I'm quite faithful to Ruby, even though I keep looking at other languages. Rails, on the other hand, has been more of an excuse to use Ruby. Don't get me wrong, I really like this framework. But I've been spending more and more time lately playing with her little sisters: Camping and Merb

Regarding my professional situation, things are quite simple, I left my job a couple of weeks ago and I decided to become a full time Rails Mercenary(c).

Q: Tell us about the sort of contribution you made during the contest.

I focused my efforts in two areas which ended up merging: better bootstrapping process and better unicode support.

Before the contest, I worked with Josh Knowles from the Integrum hall of fame on a plugin called rake_tasks. Rake_tasks was a Rails plugin full of very useful tasks we would use on most of our projects. Josh started writing the plugin to quickly setup a project by creating databases and setting up SVN. I joined him in the task of making things easier and we added more tasks. And since I needed a better utf-8 support I ended up having to hot patch Rails. We decided to divide the plugin in two, one part related to the database stuff and one part related to the SVN stuff.

I was still really annoyed that I had to overwrite some of Rails functions to get everything working. I followed Josh Susser's excellent guide to contribute to Rails. The Core team saw that some of the plugin features could be really useful and we ended up improving Rails/Active Record/MySQL adapter by adding support for more character sets and collations when you create a database.

What does it mean in practice?

By default, the ActiveRecord create_database method will now create a unicode database. That also means that all the tables you will create will also be utf-8.

Try the following in Edge:

ActiveRecord::Base.connection.create_database 'matt_development'

And you will notice that your new database is utf-8, but that's not all! You can also define the charset and collation if you wish:

ActiveRecord::Base.connection.create_database 'charset_test', :charset => 'latin1', :collation => 'latin1_bin'

or just the charset (the default collation for the defined charset will be figured out):

ActiveRecord::Base.connection.create_database 'matt_development', :charset => :big5

We also added methods to retrieve the databases variables such as the charset or collation. However, it also seemed to make sense to create rake tasks to access all these cool new features.

Based on the rake_tasks example, I added rake db:create which will create the database defined in your current environment (if it's a local database). The tasks support MySQL, PostreSQL and SQLite databases.

I also added rake db:create:all which will simply create all your local databases using the info provided in your config/database.yml file.

Let's not forget rake db:drop (drops the current environment database) and the very useful rake db:reset.

rake db:reset will drop your database, re-create it and migrate it. A very useful feature in development. I personally use it all the time.

(I also added some minor tasks such as rake db:charset and db:collation)

To sum up here is the rake -T list of added tasks based on my patches:

rake db:charset                      # Retrieves the charset for the current environment's database
rake db:collation                    # Retrieves the collation for the current environment's database
rake db:create                       # Creates the local database defined in config/database.yml for the current RAILS_ENV
rake db:create:all                   # Creates all the local databases defined in config/database.yml
rake db:drop                         # Drops the database for the current environment
rake db:reset                        # Drops, creates and then migrates the database for the current environment. Target specific version with VERSION=x

Next time you start a project, just do:

$ rails my_new_project
$ cd my_new_project
$ mate config/database.yml  (edit your database file)
$ rake db:create:all

And you will be ready to go. I'll also try to enhance the db:create task a bit so it will prompt the user for the DB root account instead of directly using the info from the database.yml file.

Q: How did you first get involved contributing to the Rails source?

I contributed to various other open source projects in the past and it was very natural for me to give something back to the Rails community which gave me so much. Josh Susser's guide was really neat and the fact that I had direct access to the core members using the Google Group was definitely really helpful.

Q: Tell us about your development environment

I develop on OSX using a sexy !Black MacBook and an extra LCD mornitor.

I setup most of my libraries using macports. I use/test/play with MySQL, PostreSQL and SQLite locally (though I generally deploy on MySQL).

Here is a list of plugins/gems/libs/tools I use on most of my projects:

Q: Rails 2.0 - What kind of features and functionality do you think

REST will be a big thing in Rails 2.0. I also really like the new routing (polymorphic urls), the cool new respond_to, better namespacing, caching of queries, sexy migrations. The core shouldn't grow too much and a few things will be deprecated and moved to plugins (paginator, for instance). There's a cool new debugger and plenty of bug fixes. Most of my projects are developed on Rails Edge and it's always a pain for me to go back to working on a 1.2.x based project. I can't wait for 2.0 to be released.

What would I like to see in 2.0? Not much more than what we have in Edge already. I would like to maybe focus on 3.0 already and rethink some major parts of the Rails architecture such as the rendering and maybe learn more from merb and maybe get rid of CGI.rb ;)

Q: Closing words

I'd like to thank all the people in the community who have been really helpful and patient. Especially Josh Knowles who is a really active community member and a great source of knowledge.

I would also like to encourage everyone to push features they think could be helpful to the rest of the community (Core patches or plugins).

Finally, shameless self-promotion if you need an agile Rails expert/mercenary to work on your awesome project, or if you just need advice regarding your project, feel free to contact me, I might be able to help you out.

You can hopefully catch me at the San Diego Ruby Brigade every first Thursday of the month or else check out my blog.

Enjoy the article? Digg It and help promote Rails.

Sorry, comments are closed for this article.