DHH Keynote - A Peek at Rails 2.0
Starting with a story about textmate. He liked the mac, but hated all the editors, so he got involved with textmate and helped it come out. Same thing with Ruby he liked it, but didn’t like the web stuff and that is what led him to do rails.
What we have:
- Plugins. Hundreds of them. Original implementation was just 5 lines. Rails coders aren’t just users, they are participants and plugins is one of the best examples of that.
- ~10K people on rubyonrails-talk big community. For the most part helps new people out. IRC channel also is useful.
- Commercial opportunities. Funny job advertisement asking for 3 years of Rails Experience which is a year longer than the framework has existed.
- Number of books both in English and in other languages (6 japanese, french, german, portugese, etc.) Example of the breadth of community.
- Tooling - a lot of really cool stuff coming out: netbeans, aptana, jetbrains, codegear, etc.
Rails 2.0
Not going to change everything. It is relatively humble. Not going to talk about a single bomb dripping idea because there is so much to catch up on.
Last year talked about a world of resources. The experiment worked. RESTful development is getting more popular and those who tried it love it.
Rails 2.0 will focus on RESTful principles.
Example of a create method responding to three different formats: html, xml, and javascript. The ActiveResource stuff really is beautiful, I’ve thoroughly enjoyed playing with it.
95% of what he shows today, works today.
Routing - Adding namespaces to routing. Idea that single resources can be represented in multiple ways.
One of his original concerns about REST was that it turned routes.rb into a form of configuration files ’It’s not that I don’t like config files it’s that I don’t like config files that make me configure things I don’t care about it”
Demoing creating a new address book web app free. Rails 2 scaffold is the resource scaffold. Default UI is exactly the same as the old scaffolding, but it is different under the hood. Default now has complete xml restful implementation for free. Demo showing adding csv representation. Format representations can be added without changing anyting other than the controller code. He forgot a render directive in the code and it blew up. Laughs as he tried :render => :string and finally :render => :text to get it to work.
Opens up irb and demoing the power of ActiveResource. Pretty much the same interface as ActiveRecord, but going out over the network to get the info.
What if my app isn’t just CRUD? What if I want to do search? Showing adding search to the REST index operation. Pretty cool. After adding search to the controller you get it for the other formats for free.
Who uses it? Public Highrise API 22 of 24 controllers on highrise work. they have an action with 6 formats., shopify marketplace has an internal restful api, fluxiom, etc.
What about Active Web Service? No longer bundled with Rails 2.0. Rails is not Switzerland, it has an opinion whether it be on how you should structure your DB and how you should wire up applications over the web and it isn’t SOAP. you can still use Active Web Service.
Friends:
- Ajax!
- REST!
- Atom? Getting as fundamental as HMTL to support. Trying to figure out a way to make it native to rails.
- OpenID? Hugely interested in it. There is a plugin. It isn’t quite to the point where support is a must.
9 Other Things I Lkie About Rails 2:
- Breakpoints are back (applause) Fixed the bug that breakpoints depended on in Ruby 1.8.5. New debugging library integrated into rails 2. Just write debugger where you want to inspect and it dumps you into irb when it hits that. full access to all your models. You can introspect the call stack, go up, down, backtrace, etc. That is freaking cool.
- HTTP Performance - For a long time he didn’t think it matttered.
Bandwidth is plentiful, it won’t matter. Wrong. It does. If you
factor out jyour js and css you have a huge amount of files. bad for
performance, good for understanding and structure. Needs to be that
way in development, not in deployment.
<%javascript_include_tag :all, :cache => :true %>
wraps all in a single gzipped call. Awesome. Thought that the big performance problem were action responses. Twitter taught that it was http performance. Two connection HTTP connections per host is a huge pain. One line to add 4 subdomains to structure for all images etc. I had to try to handcode this in ASP.Net at lockheed and it was a massive pain. This is awesome. - Query Caching - improved query cachiig based on checking if the SQL is the same. completely transparent.
- action.mimetype.renderer - index.html.erb instead of index.rhtml decoupling response type and format.
- environment.rb clean up. split up environment.rb into multiple files to be cleaner.
- Sexy Migrations - declare type frst (t.integer) instead of name first (t.first_name) This reduces duplication.
- HTTP Authentication - He used to poo poo it for html apps because it sucks for gui apps. But it is awesome for computer apps. Works great for APIs. Showing example using different types of authentications
- The MIT assumption - plugin generator now defaults to MIT license. if you want something else, fine, but you have to change it. He loves the MIT license, so do I.
- Spring cleaning - dropping a lot of things that were deprecated. Moving some things out of the core and into plugins.
That’s it. Good talk. Time to figure out what sessions I’m going to go to. The slides will be up after the conference is over.
More Articles on Software & Product Development
- Agile With a Lowercase “a”
- ”Agile“ is an adjective. It is not a noun. It isn’t something you do, it is something you are.
- How Do You End Up With A Great Product A Year From Now?
- Nail the next two weeks. 26 times in a row.
- Build it Twice
- Resist the urge to abstract until you've learned what is general to a class of problems and what is specific to each problem.