DHH on Rails and Django
The creator of Rails talks about the recent Snakes and Rubies event in Chicago this last Saturday. The thing that really strikes me (besides the very cool presentation [PDF] David gave) is the Django vs Rails code:
class Project(meta.Model):
project_manager = meta.ForeignKey(ProjectManager)
milestones = meta.OneToOneField(Milestone)
categories = meta.ManyToManyField(Category)
p = projects.get_object(id__exact=1)
pp = projects.get_list
The Python code looks a lot like Java code to me.
class Person < ActiveRecord::Base
belongs_to :project_manager
has_many :milestones
has_and_belongs_to_many :categories
end
p = Project.find(1)
pp = Project.find(:all)
</code>
And of course the Ruby code is much prettier to me, and I would much rather work with it on a day to day basis. Such is the beauty of DSL’s I suppose.