Nick Sieger: RailsConf 2007 Opening Keynote: David Heinemeier Hansson tag:blog.nicksieger.com,2005:Typo Typo 2010-11-22T18:17:29+00:00 Bernd urn:uuid:27a8249e-4cac-4c53-ab38-d43ecaa6b36b 2007-05-21T08:20:22+00:00 2010-11-22T18:17:29+00:00 Comment on RailsConf 2007 Opening Keynote: David Heinemeier Hansson by Bernd <p>Ha, I haven&#8217;t even learned 1,2&#46;3 and yet curious to see 2&#46;0 :&#45;)</p> Akhil Bansal urn:uuid:49b01920-31ba-4921-8311-c47ed550e0fa 2007-05-20T04:39:03+00:00 2010-11-22T18:17:29+00:00 Comment on RailsConf 2007 Opening Keynote: David Heinemeier Hansson by Akhil Bansal <p>Hey, Lots of new things to come in Rails2&#46;0, Thanks for sharing&#46;</p> Logan Koester urn:uuid:cec5ca3f-7629-4bb9-89bf-2512d53e36e6 2007-05-19T07:33:02+00:00 2010-11-22T18:17:30+00:00 Comment on RailsConf 2007 Opening Keynote: David Heinemeier Hansson by Logan Koester <p>Indeed, thank you&#46;</p> D. Taylor Singletary urn:uuid:c909cdab-454b-4ce2-a41a-b2b962087d8e 2007-05-18T18:00:33+00:00 2010-11-22T18:17:30+00:00 Comment on RailsConf 2007 Opening Keynote: David Heinemeier Hansson by D. Taylor Singletary <p>Thanks for summarizing this for those of us who couldn&#8217;t make it to the keynote&#46;</p> Nick Sieger urn:uuid:35f07fbf-9a1b-4848-9e0a-848ba7029697 2007-05-18T17:10:39+00:00 2010-11-22T18:17:31+00:00 RailsConf 2007 Opening Keynote: David Heinemeier Hansson <h1>Rails 2&#46;0</h1> <h2>Where we&#8217;ve been</h2> <p>David is surprised and proud of the community that we already have, and wants us to be comfortable with where we are, and not always looking toward the future&#46; We have:</p> <ul> <li>Million gem downloads</li> <li>Hundreds of plugins</li> <li>10k users on the rubyonrails&#45;talk mailing list</li> <li>Ruby job descriptions (asking for 3 years RoR experience, longer than David)</li> <li><a href="http://www.amazon.com/s/002-0555878-2213644?ie=UTF8&amp;tag=mozilla-20&amp;index=blended&amp;link%5Fcode=qs&amp;field-keywords=ruby%20on%20rails&amp;sourceid=Mozilla-search">Books, books, books</a> (and not just English books, but non&#45;English titles as well), surpassing VBA, Perl, and Python in book sales</li> <li>IDEs from NetBeans, Borland, Aptana, etc&#46;</li> </ul> <p>Rails 2&#46;0 is not going to be the &#8220;Unicorn&#8221;&#46; It&#8217;s not going to be a total rewrite, it actually has a release schedule, it will not break backwards&#45;compatibility&#46; Instead, it will build upon what we already have, and continue the philosophy of building on what is useful and needed&#46; In fact, 95% of what&#8217;s in 2&#46;0 already works today, in the edge&#46; Example, a simple controller that handles three formats of input/output, with a person resource for accessing the data from a remote server&#46;</p> <div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">class </span><span class="class">PeopleController</span> <span class="punct">&lt;</span> <span class="constant">ApplicationController</span> <span class="punct">...</span> <span class="keyword">def </span><span class="method">create</span> <span class="attribute">@person</span> <span class="punct">=</span> <span class="constant">Person</span><span class="punct">.</span><span class="ident">create</span><span class="punct">(...)</span> <span class="ident">respond_to</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">format</span><span class="punct">|</span> <span class="ident">format</span><span class="punct">.</span><span class="ident">html</span> <span class="punct">{</span> <span class="ident">redirect_to</span> <span class="ident">person_url</span><span class="punct">(</span><span class="attribute">@person</span><span class="punct">)</span> <span class="punct">}</span> <span class="ident">format</span><span class="punct">.</span><span class="ident">xml</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:status</span> <span class="punct">=&gt;</span> <span class="symbol">:created</span><span class="punct">,</span> <span class="symbol">:location</span> <span class="punct">=&gt;</span> <span class="ident">person_url</span><span class="punct">(</span><span class="attribute">@person</span><span class="punct">),</span> <span class="punct">...</span> <span class="punct">}</span> <span class="ident">format</span><span class="punct">.</span><span class="ident">js</span> <span class="punct">{</span> <span class="ident">render</span> <span class="symbol">:update</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">js</span><span class="punct">|</span> <span class="punct">...</span> <span class="keyword">end</span> <span class="punct">}</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="keyword">end</span> <span class="keyword">class </span><span class="class">Person</span> <span class="punct">&lt;</span> <span class="constant">ActiveResource</span><span class="punct">::</span><span class="constant">Base</span> <span class="constant">self</span><span class="punct">.</span><span class="ident">site</span> <span class="punct">=</span> <span class="punct">&quot;</span><span class="string">http://example.com/</span><span class="punct">&quot;</span> <span class="keyword">end</span></code></pre></div> <p>David then goes into a live demo of the new scaffold resource, which by appearance is identical to the old scaffolding, except it comes pre&#45;baked with a REST&#45;ful XML interface&#46; He then adds support for a text format with a couple of lines of code, jumps into IRB, defines an active resource, and proceeds to change the data remotely&#46;</p> <p>If you want to add search to your controller, you can do it in a DRY way, and all the format/view work you&#8217;ve done will benefit:</p> <div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">class </span><span class="class">PeopleController</span> <span class="punct">&lt;</span> <span class="constant">ApplicationController</span> <span class="keyword">def </span><span class="method">index</span> <span class="keyword">if</span> <span class="ident">params</span><span class="punct">[</span><span class="symbol">:name</span><span class="punct">]</span> <span class="attribute">@people</span> <span class="punct">=</span> <span class="constant">Person</span><span class="punct">.</span><span class="ident">find</span> <span class="symbol">:all</span><span class="punct">,</span> <span class="symbol">:conditions</span> <span class="punct">=&gt;</span> <span class="punct">[&quot;</span><span class="string">name like ?</span><span class="punct">&quot;,</span> <span class="punct">&quot;</span><span class="string"><span class="expr">#{params[:name]}</span>%</span><span class="punct">&quot;]</span> <span class="keyword">else</span> <span class="attribute">@people</span> <span class="punct">=</span> <span class="constant">Person</span><span class="punct">.</span><span class="ident">find</span> <span class="symbol">:all</span> <span class="keyword">end</span> <span class="punct">...</span> <span class="keyword">end</span> <span class="keyword">end</span></code></pre></div> <p>David points out that 37signals, Shopify, Fluxiom, et&#46; al&#46; are real sites, with non&#45;trivial domains that are still well executed in Rails, so it&#8217;s not just about simple scaffolding demos&#46;</p> <p>In Rails 2&#46;0, ActiveResource will be bundled with Rails, and ActionWebService will not&#46;</p> <h2>Friends of Rails</h2> <ul> <li>AJAX!</li> <li>REST!</li> <li>Atom? &#45;&#45; Atom should be more native to Rails</li> <li>Openid? &#45;&#45; Openid is not necessarily something that needs to be used by all, but still a strong ally&#46;</li> </ul> <h2>9 other things I like about Rails 2</h2> <ul> <li>Breakpoints are back &#45;&#45; no longer depends on <code>Binding.of_caller</code>; instead Rails depends and builds upon <a href="http://rubyforge.org/projects/ruby-debug/"><code>ruby-debug</code></a> by Kent Sibilev&#46;</li> <li>HTTP Performance &#45;&#45; streamlining &#46;js and &#46;css, even though it feels better to break up Javascript and CSS into many little pieces, and gzip them</li> </ul> <div class="typocode"><pre><code class="typocode_ruby "><span class="punct">&lt;%=</span><span class="string"> javascript_include_tag :all, :cache </span><span class="punct">=&gt;</span> <span class="constant">true</span> <span class="punct">%&gt;</span><span class="string"> &lt;%= stylesheet_link_tag :all, :cache =</span><span class="punct">&gt;</span> <span class="constant">true</span> <span class="punct">%&gt;</span><span class="string"></span></code></pre></div> <p>We can also fake out the browser and configure multiple asset hosts (4) you can maximize browser connections</p> <div class="typocode"><pre><code class="typocode_ruby "><span class="ident">config</span><span class="punct">.</span><span class="ident">action_controller</span><span class="punct">.</span><span class="ident">asset_host</span> <span class="punct">=</span> <span class="punct">'</span><span class="string">assets%d.highrisehq.com</span><span class="punct">'</span></code></pre></div> <ul> <li>Query cache</li> </ul> <div class="typocode"><pre><code class="typocode_ruby "><span class="constant">ActiveRecord</span><span class="punct">::</span><span class="constant">Base</span><span class="punct">.</span><span class="ident">cache</span> <span class="keyword">do</span> <span class="comment"># actions here are cached</span> <span class="keyword">end</span></code></pre></div> <ul> <li>Rendering and MIME types &#45;&#45; bake the MIME convention into the template, and separate from the rendering mechanism people/index&#46;html&#46;erb people/index&#46;xml&#46;builder people/index&#46;rss&#46;erb people/index&#46;atom&#46;builder</li> <li>config/initializers replacing config/environment&#46; Initializers are &#46;rb files in the config/initializers directory of your app that are automatically loaded during initialization time&#46;</li> <li>Sexy migrations</li> </ul> <div class="typocode"><pre><code class="typocode_ruby "><span class="ident">create_table</span> <span class="symbol">:people</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">t</span><span class="punct">|</span> <span class="ident">t</span><span class="punct">.</span><span class="ident">integer</span> <span class="symbol">:account_id</span> <span class="ident">t</span><span class="punct">.</span><span class="ident">string</span> <span class="symbol">:first_name</span><span class="punct">,</span> <span class="symbol">:last_name</span><span class="punct">,</span> <span class="symbol">:null</span> <span class="punct">=&gt;</span> <span class="constant">false</span> <span class="ident">t</span><span class="punct">.</span><span class="ident">text</span> <span class="symbol">:description</span> <span class="ident">t</span><span class="punct">.</span><span class="ident">timestamps</span> <span class="keyword">end</span></code></pre></div> <ul> <li>HTTP authentication (<code>authenticate_or_request_with_http_basic</code>, <code>authenticate_with_http_basic</code>)</li> <li>The MIT assumption &#45;&#45; the licensing question &#45;&#45; make it easier to understand</li> <li>Spring cleaning &#45;&#45; getting rid of the cruft &#45;&#45; stay tuned!</li> </ul>