这么重要的演讲,居然连个transcript都找不到,实在很郁闷,所以打算先记下来。

资源:
http://blog.scribestudio.com/articles/2006/07/09/david-heinemeier-hansson-railsconf-2006-keynote-address
http://www.loudthinking.com/lt-files/worldofresources.pdf

TRANSCRIPT of
RailsConf 2006 Keynote Address
by David Heinemeier Hansson

Contents
01. Discovering Resources on Rails
02. Problem with CRUD?(DHH learns to stop worrying and love the CRUD)
03. Get, Post and Clean URLs(Don't Do Busy Work)
04. Accounts, Controllers and CRUD(Evaluating the richness of the domain)
05. CRUD is Not a Goal but an Inspiration(Not one paradigm captures all the world all the time)
06. Controllers, Design Patterns & MIME(Have one controller for many MIMEs)
07. Doing By Hand Leads to Good Design(IDE is not necessary)
08. Get, Find, Post Redux(Active record and assigning IDs)

02. Problem with CRUD?(DHH learns to stop worrying and love the CRUD)

The problem with CRUD is (that) it's got kind of a bad name, actually. (audience laughing) Not only it has a bad name, it has a bad reputation.

Oh, by the way, this talk is not in Japanese also because I can't write Japanese, but  because I was just there to (days ago) and gave this talk. And since there's(?) this wonderful ultimate universe thing, nobody from the west really had any idea of the talk going on, thereas I thought I just reuse it. So ... thanks for letting me do that, Japanese guys!

Well, what they told you about CRUD? Well, first of all they told you it was simplistic, so just doing CRUD is simply not enough:

[showing PPT page 3]

It's too simple. You can't just have these four operations and expect to do anything interesting. And the world is way more complex than what these four simple contexts or constructs can put together, it's simply too simplistic. And because it's too simplistic, it's unfufilling work. You're not really doing enough if you just doing CRUD. CRUD is not a satisfactory way of working, it's simply not enough to keep our great intellects occupied. And I really meant that it's unworthy. You shouldn't spend too much time on this CRUD stuff -- it's simply too basic, it's just an assumption, it's just there.

Really, if you are doing it, you should be somewhat ashamed. (audience laughing) Really, don't spend your time on this CRUD stuff -- you have much bigger and better things to do with your mind.

[showing PPT page 4 & 5]

Well, they were wrong. And this talk is in large part about how I learned to stop worrying and love the CRUD. (audience laughing)

[showing PPT page 6]

CRUD, of course, is represented in our world mainly in these kinds of operations. So, at the object level, we have find, creat, update and destroy -- those are the verbs we use when we manipulate Active records and other types of object-oriented things.

Well, in the database world, it's pretty much the same thing. We have SELECT, INSERT, UPDATE, and DELETE. But the thing that really got ME started thinking more about CRUD recently is not those basic constructs -- they've been around for a long time enough. And that is really what makes CRUD to seem as just this simplistic thing -- it's just there, not really worth talking about.

[showing PPT page 7]

Recently we've had somewhat(?) a renaissance -- a renaissance for HTTP. HTTP adds another layer on top of this CRUD stuff through the verbs GET, POST, PUT, and DELETE. Well, most of us, most of the time, are just thinking about HTTP and thinking about the web as GET and POST -- we're not really thinking about HTTP as a protocol that exhibits the four range of CRUD-ness.

(And) I'm certainly guilty of that, for the longest time my conception of HTTP was that it was just this GET-and-POST thing. That led me to have URLs like this:

[showing PPT page 8]

So this was how a CRUD application was exposed to the rest of the world. When you wanted to creat something, you would POST to this special URL for creating a new person(see PPT page 8); when you wanted to get something, you have to show verb(?) or word(?) inside that URL; when you wanted to update or destroy these, you're just to POST operations, or even worse sometimes, GET operations, on various URLs.

Well, just from looking at this picture now, I get a little bit of woozy(?). The fact is that all the stuff we're doing in Rails is largely about not repeating ourselves.

If you look at these verbs, POST, GET, and the URLs -- they're pretty much repeating themselves. Look at the number two (see PPT page 8 line 2), (so) we're getting the person number 1. Well, we're kind of presenting that term already in the URL -- the same 'show'(possible meaning: GET already meant "we're getting the person number 1", while 'show' is just repeating that term). But something's not quite right here. It's not quite right because we're not using the CRUD features of HTTP. When we are, we can get something that's nice and clean and beautiful, and it looks like this:

[showing PPT page 9]

The URL now becomes a way of identifying the thing we're working with, and the verbs become operations on that. Before, we mixed the two, so we both had identification, and we had what we were doing with that thing. Well, this(see PPT page 9) is obviously a lot nicer, but there's, of course, a reason why we haven't exposed this and used this very much. And how that part of HTTP in general has kind of got forgotten along the way? That's of course because it's a pain in the ass to use, and it's a pain in the ass to use because HTML and the rest of the web world wasn't really geared up for this beauty that was already present in HTTP.

Well, since what it is we're doing is, well, a framework, which is all about removing those (bad) things and exposing the beauty of beyond-the-line concepts, why wouldn't we tackle these problem too? The answer, of course, is exactly what I'll be talking about today -- how we've tackled this process of turning these URLs(see PPT page 8) into this(see PPT page 9):

And this is initially got to be a conquest in its own mind for some people. just to getting these URLs in itself held some great promise, some magical thing would happen once you got these clean URLs.

Well, not really. I guess it's not the clean URLs we're after, but I'll get to that in a moment. Now, in Rails, the way we get this started, and the way we'll get it started from the next major release (Rails) 1.2, is that in your r...ts(?) file, you can start talking about these things, you can start talking about the resources. So, if you want to expose this beautiful set of URLs to a given resource, which is often just a given model, you'll do something like this:

[showing PPT page 10]

In the r...ts(?) file you'll say

map.resources :person

Person is now available as that beautiful URL. Routing will start to happen automatically depending on the verb, instead of just depending on the URL. And you'll get something like this:

[showing PPT page 11]

You'll get, from the same example, that we can have a PeopleController as the four CRUD operations, create, show, update, and destroy. And we can direct people to them from the same URL. So the first one POST to people will lead to a create action, the second one will use the same URL as we'll use in update and destroy. But when GET operation is called, we're doing 'show'; when the PUT operation is called, we're doing 'update'; when the DELETE operation is called, we're doing 'destroy'.

This old(?) method should be somewhat familiar now because this is a convention. This is exactly what we've been doing in Rails all along. We've been making things, configurable(?) things, just disappear by inventing conventions, by inventing our own world where these rules just magically apply.

Now, how do we get to this? One thing is that, it's actually possible to do PUT and DELETE verbs against controllers, but as I've talked about just a minute ago, that's not very helpful from HTML because HTML doesn't expose these things natively. We fix that. (audience laughing)

[showing PPT page 12]

So, the first one(see PPT page 12) is doing a POST against 'people'. Well, that's pretty similar to what we've been doing all along. So that doesn't need any special introductions -- that's just a form as a textfield, and we'll do the normal things to forms in Rails too, which is POST. So far, so good.

[showing PPT page 13]

The 'show()' is, of course, just a normal GET, not very interesting -- we're linking to something, and we're given that URL and the GET automatically will happen.

Now the interesting parts are update() and destroy().

[showing PPT page 14]

For update(), we need a new way of describing that this form is not the regular POST -- it's actually a PUT, it's an UPDATE. This is how it should have been in HTML -- you should just have been able to destinate(?) on your form that the operation you're using was a PUT. Unfortunately, that's not quite the case. So, we have to fake it, and we're faking it in Rails by picking(?) backing(?) on POST. So, by making this construct, you'll actually make a form that will include a hidden field called underscored method that include the real method -- the one we're actually talking about. And when we then submit that, Rails will believe that what we're doing is actually PUT.

[TO BE CONTINUED]

Rails之父DHH在RailsConf2006上的Keynote Address TRANSCRIPT Part 2 of 8相关推荐

  1. Rails之父DHH在RailsConf2006上的Keynote Address TRANSCRIPT Part 1 of 8

    这么重要的演讲,居然连个transcript都找不到,实在很郁闷,所以打算先记下来. 资源: http://blog.scribestudio.com/articles/2006/07/09/davi ...

  2. Rails之父DHH在RailsConf2006上的Keynote Address TRANSCRIPT Part 3 of 8

    这么重要的演讲,居然连个transcript都找不到,实在很郁闷,所以打算先记下来. 资源: http://blog.scribestudio.com/articles/2006/07/09/davi ...

  3. “人工智能之父”艾伦·图灵登上英国50英镑新钞

    图源:BBC 来源:海外网 海外网7月15日电英国广播公司(BBC)报道,"计算机科学和人工智能之父"艾伦·图灵登上英国50英镑新钞. 此前有媒体报道称,英格兰银行计划于2020年 ...

  4. iPad版keynote导出html,完美把ppt导入到ipad上的keynote软件中(图文详细教程)

    The new ipad是一款非常出色的平板电脑,配备的Retina屏显示效果细腻,而且携带轻便,我经常用ipad向客户展示一些设计作品,今次为某IT企业设计整套企业品牌形象,其中重要一项就是ppt模 ...

  5. layer 父弹出框上弹出子弹框窗体大小问题

    在父弹框上继续弹出子弹框,因为是iframe,子弹框窗体只能显示在父弹框的窗体区域内. 如果子弹框的窗体大小超过了父弹框,则子弹框的界面无法显示全. 有没有办法解决这个问题? 让子弹窗不被限制在父弹框 ...

  6. 在父域的基础上,添加子域

    父域--Window server 2016 子域--window server 2016 父域(提前创建好的)-- 子域的创建 打开服务器管理器,添加角色和功能向导 安装域服务 首先要确保两台虚拟机 ...

  7. 【历史上的今天】1 月 10 日:算法分析之父出生;史上最失败的世纪并购;含冤 50 年的计算机先驱

    整理 | 王启隆 透过「历史上的今天」,从过去看未来,从现在亦可以改变未来. 今天是 2022 年 1 月 10 日,在 1863 年的今天,世界上第一条地铁--伦敦地铁正式通车.伦敦地铁起源于大都会 ...

  8. 历史上的今天:支付宝推出条码支付;分时系统之父诞生;世界上第一支电视广告...

    整理 | 王启隆 透过「历史上的今天」,从过去看未来,从现在亦可以改变未来. 今天是 2022 年 7 月 1 日,在 1646 年的今天,戈特弗里德·威廉·冯·莱布尼茨(Gottfried Wilh ...

  9. Python 之父卸任 BDFL | 历史上的今天

    整理 | 王启隆 透过「历史上的今天」,从过去看未来,从现在亦可以改变未来. 今天是 2023 年 7 月 12 日,在 1854 年的今天,伊士曼柯达公司的创始人.胶卷的发明者乔治·伊斯曼(Geor ...

最新文章

  1. 使用Javascript创建XML文件
  2. 关于MPLS和SD-WAN的4大误解—Vecloud微云
  3. RabbitMQ 交换器、持久化
  4. 阿里云 ECS服务器 开放 8080 端口 -- 图解
  5. 易生信Linux培训
  6. android组件不能加适配器,Android 针对继承BaseAdapter的自定义适配器应注意的几个地方...
  7. ADB工具安装及常用命令
  8. Unicode 字符编码表
  9. VB编程操作AutoCAD线型
  10. 解决求平均值出现加和导致的溢出问题
  11. 今日头条的企业服务产品线
  12. 举例Halcon,简述数字图像处理之Blob分析和纹理分析texture_laws
  13. ES改变主分片数量,动态拆分primary shard
  14. 第二章,人脸识别与管理系统界面开发(WinForm界面增强,OpenCV-Python智能识别)
  15. 2019公共课的【考研平均分】和难度系数公布!
  16. 深入理解vue中的slot与slot-scope (简单易懂)
  17. 水肥一体化智能灌溉系统
  18. 力扣1884. 鸡蛋掉落-两枚鸡蛋
  19. Matlab title, xlabel, legend 中文变成方框的解决方案
  20. Java后端架构师的成长之路(二)——Java设计模式(1)

热门文章

  1. linux命令link,readlink命令
  2. 七、GitHub下载慢,解决GitHub下载慢的问题,用此方法下载速度直接原地起飞
  3. MPLS 虚拟私有网 CSC Option C(BGP分发标签)
  4. 使用mpaas的iOS客户端如何一包支持任意环境切换(理论篇)
  5. 《教育管理案例研究》
  6. Unity DOTS【000】 入门介绍:环境配置
  7. 逝者:GIS之父Roger Tomlinson
  8. springMvc整合undertow容器
  9. 感恩父亲:前半生你为我遮风避雨,后半生我为你倾其所有
  10. JAVA习题大全之java期末考试复习预测题一