This year is the 5th/6th year he has been working with Rails. What hasn’t changed is worth looking at. Things are moving fast at a micro level, but not at a macro level. Stop fretting about whether you are
up to date with the latest features. His 5 year old code might have some old idioms, but generally is still working and doing the same thing.
Mortal wounds that are supposed to have killed Rails
Not Enterprise Ready “You may have noticed that pretty much everyone on the Ruby camp are insultants with many of them being book authors attempting tp capitalize on hype” – James McGovern. Lesson: You can’t win over over everyone in the world with better logical arguments.
Find the One Thing to make Rails work Sails, Biscuit Grails Monorail – all claimed to have found “The Formula” to make Rails work. Later proven to be a wothless exercise. Lesson: Most worthwhile things in the world can’t be boiled down to one thing.
Waves of Pushback “7 reasons I switched back to php after 2 years on Rails” – Derek Sivers. Communities erupted for 2 days. Lesson: Comments on Reddit don’t change peoples minds.
The Fail Whale – “Rails doesn’t scale”. Some memes are so increadibly powerful and it is useless to fight them. Rails actually has a poster-boy that is one of the most talked about sites of our time. We can take the bad with the good. People can be both proud of things and annoyed at them at the same time.
We’re still here
We have the same core principles we had 5 years ago. Take it easy. Chill out. Most of these things don’t matter as much as you think they do, and the importamnt pieces of them will be extracted and used.
The Philosophy of Rails 3
Lock up all the unicorns: Rails 3 is not going to be a complete rewrite and is not going to solve evertbody’s problems. Not everyone is going to get the wonderful feature (unicorn) they want.
No holy cows: No “that is the way it has to be”. That was a mistake the Rails team made in that past and what caused Merb to come into existence. Concrete example: alias_method_chain. Nothing is holy in Rails and if you have an idea that is going to break every Rails app in the world, if it is good enough, it is on the table.
Have it your way: (a la Burger King). How many questions do you get asked when you order a burger. Mot people just want to eat; They just want to get their applications done. On the hand if you really hate pickle, you get to make that choice.
Rails 3 Progress
Faster. Route by subdomains, user agents, more. Route to other Rack machinery.
resource :projects, :controller => :project do resource :attachments resources :participants do put :update_all, :on => :collection end resouces :companies do resources :people resource :avatoar end end
Note no block variables. Uses instance_eval to make a cleaner DSL. There goes a holy cow (not using instance_eval in Rails DSLs). Still questioning if this is a good idea. Enjoys the asthetics of this.
(Refresher: Allows someone to inject JS code into your public pages, then steal cookies and do other bad things). Old:
New: By default everything will be escaped in views.
(ed: Yahoo! – Security on by default!)
No more inline onclicks. Adopt HTML5 approach to having custom attributes.
<a href="/comments/1" data-remote="true" data-method="delete">Destroy</a> <a href="/comments/1" data-confirm="true" - form_for(@comment, :remote => true) do
Under the covers:
Action ORM – a shim layer on top of all the ORMs.
Generators – make generators smarter about whether they are using RSpec etc.
The Great Refactoring
Things you probably won’t notice. Cleaing up a lot of old code. Abstract Controller + Action Dispatch. Active Relation underpins Active Record. Cherry picking from Active Support. Speedy callbacks.
The real secret to high productivity
The humorous bit. What were the elements/principles that made him so productive back in the old days working on BaseCamp. One thing: Renegotiate requirements. Don’t treat requirements as stone tablets. Suggest a better way. “Sure, whatever” – Stakeholders everywhere.
About the Author