redirect_to :future #思维驱动 » Blog Archive » REST是什么?

REST是什么?

其实昨天想写的叫“REST迷思”,不过今天看到这篇文章,我也”REST是什么?”

昨天整个下午我都在想REST到底是什么?我为什么要用它?应该用在什么地方?在骑车出门的时候还不停的在想,也没想很明白,本来还想发篇博客问问,没想到今天就有了。总的来说我还是比较同意dongbin的那篇文章的。

真正开始了解REST就是前一段时间,其实也不能说了解,就是看了一些介绍和视频。我也犯了老毛病,学到新东西就拼命的想往现在的项目上靠,美其名曰”学用,学用,学以致用”。

首先就碰到问题了。
1.比如:图书网站,有很多的书本,而书本属于某个用户。现在要开发图书列表和用户的图书列表。其实就是
/books/list
/users/leo/books or /users/leo/book_list or /users/leo/books/list
原来的想都不想两个action,处理book.find
当然了如果一个action可以优雅的解决问题那我还是趋向于一个action实现的,DRY嘛。(只是if else太不优雅了)
怎么用到REST呢?按模型来说,是这样的.
map.resources :users do |users|
users.resources :books
end
事实上这个是实现不了/books/list的。那就不用nested resources了,还是Controller加个action(哦,我可不喜欢/books;list_by_user这样的URL),还是增加一个controller?

那么那么,主要问题是什么呢(Ok,我个人的问题)?原来我的实现是直接从业务(需求,用户接口)映射到实现上来的,使用REST思考的时候呢?从model来考虑的? 至顶向下还是至底向上呢这是个问题。
用Rest是为很酷而又方便的url mapping吗?为了方便的列出model的关系吗?

2.一本书有很多章节.那么我的章节列表应该放在:
/books/1/sections (sections.index)
/books/1 (books.show)
里面呢? 如果按照Web Service的做法或是把REST当做Model的HTTP方式的接口(把book看做Resource)的话那么应该是在sections.index里面。而按照习惯我可能更喜欢/book/1里面显示sections list(至少,至少少一次点击。)。
Rest是Model的http接口吗?

3.“REST的主要优势在我看来其实在于它是一种对于服务器的更加有效的抽象方式。”(引用1)
按照这么说的话,个人认为REST并不适合于仅仅使用GET/POST的WEB应用的开发。在form里面加一个method的hidden变量然后把网址变成book;edit这样有意义吗?为了漂亮的mapping?只要你会写routes什么样的mapping写不出来?为了根据不同的format请求返回不同的结果?不用rest你也可以responds_to不同的format。

从WS的角度来说REST用HTTP的请求方式来映射function-name,只是为了方便理解?

到此以我对REST的理解来说我已经想不下去了,一团麻了。

REST到底是什么,适合我吗? 突然间我想到了04年刚刚接触敏捷是写的“你敏捷得起来吗?”,那么REST适合你吗?

上面的文字有太多的问号,正如我现在对于REST的问号。不过我觉的似乎从我现在的理解来说REST不适合于实用至上的我现在进行的这些项目。

引用1:http://blog.csdn.net/mozilla/archive/2007/06/07/1643095.aspx

看完啦?再看看我们最近的10条记录对您是否有用呢?

要不,再找找其它内容:




或者给我们留下些意见、建议,这将给我们莫大的鼓励,促使我们做得更好。

82 Responses to “REST是什么?”

  1. wedding dresses Says:

    http://www.shopforlover.com

  2. cialis Says:

    Hello!
    cialis ,

  3. skin care lines Says:

    The maker boasts cosmetic features are moreover lifted by Extra Firming Product while
    smoothing wrinkles and determining curves.

    my web page … skin care lines

  4. Jerri Says:

    Let us know at the checkout if you happen to would
    prefer a different chain.

    My web blog Danon Jewellery (Jerri)

  5. Linnea Says:

    Trendy and minimalist kinds of ornaments could be made utilizing materials corresponding to clay, foils, tinsel, wire, and mesh.

    Here is my site :: Danon Jewellery, Linnea,

  6. Maureen Says:

    Some quartz, peridot, amethyst, to call a few, are among the many most fragile
    stones and would require very light wear, care and storage.

    Look at my page … Danon Jewellery Online - Maureen -

  7. Jasmine Says:

    doesn’t ship exterior the USA and its territories.

    My web blog - Danon Jewellery UK (Jasmine)

  8. 6% off Hotelopia :: Discount Code for March 2016 :: Tested Daily Says:

    […] […]

  9. £5 off • Tesco Groceries Voucher Codes & Discount Codes Says:

    […] […]

  10. Free Delivery - Discount Codes Art | Verified March, 2016 Says:

    […] […]

  11. Bernadine Says:

    Additionally the selection of the ladies marriage ceremony ring
    is usually made to match with the engagement ring, and should have to be formed to fit.

    Take a look at my web page: Danon Jewellery Stockist (Bernadine)

  12. Sherlyn Says:

    I write on helping folks with personal improvement or inter-private expertise.

    Check out my website - Danon Jewellery Sale (Sherlyn)

  13. Margarito Says:

    It truly is that trouble-free.

    Also visit my weblog :: Danon Jewellery Stockist (Margarito)

  14. Danon Jewellery Says:

    We provide a variety of Mezuzahs , Tallitot , Jewish Jewelry and extra.

    my blog: Danon Jewellery

  15. Edwina Says:

    After that we get on the boat and headed to Nu’ulopa Island.

    My web page :: Danon Jewellery UK (Edwina)

  16. Catalina Says:

    Many people solely like gold or silver, not each. Look at the recipients
    wardrobe choices and current jewelry to search out what jewelry kind they would be most
    certainly to enjoy and actually put on.

    Here is my homepage; Danon Jewellery Sale (Catalina)

  17. Read this about Designer Jewellery Says:

    It might embody other protecting symbols including eyes, fish (an historical Jewish image) and the Star of David.

    Here is my blog post: Read this about Designer Jewellery

  18. Designer Jewellery web site Says:

    Jewellery should display exemplary craftsmanship and be properly-made.

    My webpage; Designer Jewellery web site

  19. Terrie Says:

    The everyday fashion of a bit of Danon jewelry can be summed up in only one phrase;
    whimsical.

    my page; Danon Jewellery Online (Terrie)

  20. Danon Jewellery Online Says:

    Each piece of Danon jewellery is a tiny work of art, handcrafted in pewter and glazed with silver or bronze.

    my weblog :: Danon Jewellery Online

  21. Josephine Says:

    A fragile chain can wreck a helpful piece by breaking as a minimum opportune second.
    Get a jeweler’s recommendation to pick out a series that strikes a very good steadiness between attractiveness and sturdiness.

    Check out my web blog; Danon Jewellery UK; Josephine,

  22. best anti aging creams reviews uk Says:

    You’ll find a whole variety of objects designed to deliver life back
    to the skin.

    Also visit my page … best anti aging creams reviews uk

  23. Fashion Jewellery site Says:

    Put on a stable colour or the “little black dress” to highlight fascinating pieces.

    My site: Fashion Jewellery site

  24. Nell Says:

    If you want to increase your familiarity only keep visiting this web site and be updated with the most recent news update posted here.

    Also visit my blog post - fat burning foods
    (Nell)

  25. food preparation Says:

    You actually make it seem so easy with your presentation but I find this topic to be really something that I think
    I would never understand. It seems too complicated and very
    broad for me. I’m looking forward for your next post,
    I will try to get the hang of it!

    Feel free to surf to my web page food preparation

  26. postcard mailing Says:

    Touche. Solid arguments. Keep up the good work.

    Also visit my blog postcard mailing

  27. Valorie Says:

    I think what you posted was very logical. However, consider this,
    what if you added a little content? I mean, I don’t wish
    to tell you how to run your blog, however suppose you added a title to maybe grab people’s attention? I mean redirect_to :
    future #思维驱动 » Blog Archive »
    REST是什么? is a little boring. You could glance at Yahoo’s home page and note how they create news headlines to grab people interested.

    You might add a video or a related pic or two to grab people
    interested about what you’ve got to say. Just my
    opinion, it would bring your posts a little livelier.

    Feel free to visit my web-site - heavier fish steaks (Valorie)

  28. Jacquie Says:

    Way cool! Some extremely valid points! I appreciate you writing this
    article and also the rest of the site is extremely good.

    My web-site :: myrtle beach vacation (Jacquie)

  29. Ashton Says:

    WOW just what I was searching for. Came here by searching for north myrtle beach hotels

    Stop by my web page; weight successfully, Ashton,

  30. Cornelius Says:

    Pretty nice post. I just stumbled upon your weblog and wanted to say that I’ve truly enjoyed browsing your blog posts.
    After all I will be subscribing to your rss feed and I hope
    you write again very soon!

    my page :: direct marketing (Cornelius)

  31. Fat Burning foods Says:

    Everything is very open with a very clear
    clarification of the challenges. It was truly
    informative. Your website is extremely helpful. Many thanks for sharing!

    my web-site Fat Burning foods

  32. Dani Says:

    Hello! Would you mind if I share your blog with my twitter
    group? There’s a lot of people that I think would really appreciate your content.
    Please let me know. Many thanks

    my web page uric acid foods (Dani)

  33. Chloe Says:

    Excellent goods from you, man. I’ve understand your stuff previous to and you are just extremely great.
    I really like what you’ve acquired here, certainly like
    what you’re stating and the way in which you say it.

    You make it entertaining and you still care for to keep it wise.
    I can’t wait to read much more from you. This is really a terrific web
    site.

    Also visit my blog … personal wine promo (Chloe)

  34. Felisha Says:

    I got this site from my friend who shared with me regarding this website and at the moment this time I am
    visiting this web site and reading very informative posts at this time.

    Here is my web-site :: postcard articles (Felisha)

  35. Anne Says:

    Have you ever considered creating an ebook or guest authoring
    on other blogs? I have a blog based on the same subjects you discuss and
    would really like to have you share some stories/information. I know my visitors would enjoy your work.
    If you’re even remotely interested, feel free to send me an e mail.

    My web site; postcard tips; Anne,

  36. Jimmy Says:

    Good answer back in return of this difficulty with firm arguments and describing the whole thing concerning
    that.

    Here is my weblog - heavier fish (Jimmy)

  37. Humberto Says:

    Hello Dear, are you really visiting this site daily, if so afterward you will absolutely obtain nice know-how.

    Feel free to visit my web page :: lose weight successfully (Humberto)

  38. Rachelle Says:

    You really make it seem so easy with your presentation but I find this matter to be actually something which
    I think I would never understand. It seems too complicated and extremely broad for me.
    I’m looking forward for your next post, I’ll try to
    get the hang of it!

    my web blog expensive wine - Rachelle -

  39. food critic Says:

    Does your site have a contact page? I’m having problems locating it but, I’d like to send you an e-mail.

    I’ve got some ideas for your blog you might be interested in hearing.
    Either way, great site and I look forward to seeing it grow over time.

    my page: food critic

  40. Backpack Beachchair Says:

    I seriously love your site.. Pleasant colors & theme.

    Did you develop this website yourself? Please reply back as I’m looking
    to create my own website and would love to find out where you got this from or exactly what the theme is called.
    Thank you!

    Also visit my weblog :: Backpack Beachchair

  41. Florian Says:

    Wonderful work! That is the kind of information that are meant to be shared around the
    internet. Disgrace on the search engines for not positioning this put up upper!
    Come on over and talk over with my site . Thank you =)

    Feel free to visit my web blog; metamucil weight loss, Florian,

  42. Andy Says:

    Have you ever thought about adding a little bit more
    than just your articles? I mean, what you say is important and all.
    However just imagine if you added some great visuals or video clips to give your posts more, “pop”!
    Your content is excellent but with images and clips, this website could certainly
    be one of the best in its niche. Superb blog!

    my webpage … expensive wines (Andy)

  43. Jolene Says:

    It’s nearly impossible to find knowledgeable people on this topic, but
    you sound like you know what you’re talking about!
    Thanks

    Here is my page myrtle beach condominium, Jolene,

  44. beaches europe Says:

    Thanks a lot for sharing this with all of us you actually understand what you’re talking about!
    Bookmarked. Please additionally discuss with my site =). We may have a hyperlink exchange agreement among us

    Feel free to visit my web blog … beaches europe

  45. Richard Says:

    What’s up, I check your blogs like every week. Your humoristic
    style is awesome, keep up the good work!

    Look into my web page backpack beachchair (Richard)

  46. Barbara Says:

    Mouse studies show that external application of coffee may cause cells harmed by light
    in the sun to home-destruct.” While in The Newspaper of
    Investigative Dermatology, scientists noted in 2009 they are closer to being able to exploit this finding as a probable cure
    for nonmelanoma skin cancers.

    Here is my web site best anti aging skin creams reviews - Barbara
    -

  47. Mahalia Says:

    I’m really enjoying the theme/design of your website.
    Do you ever run into any internet browser compatibility problems?
    A number of my blog readers have complained about my site not operating correctly in Explorer
    but looks great in Safari. Do you have any suggestions to help fix
    this problem?

    Also visit my blog :: heavier fish steaks (Mahalia)

  48. postcard designs Says:

    Write more, thats all I have to say. Literally, it seems as though you relied on the video to make
    your point. You clearly know what youre talking about,
    why waste your intelligence on just posting videos to your weblog when you could
    be giving us something informative to read?

    Also visit my webpage :: postcard designs

  49. Geraldo Says:

    My brother recommended I may like this website. He was once totally right.
    This submit truly made my day. You can not consider
    simply how so much time I had spent for this info! Thanks!

    Feel free to visit my web blog … postcard mailing (Geraldo)

  50. Dianna Says:

    Hello it’s me, I am also visiting this website on a regular basis,
    this website is actually pleasant and the visitors are genuinely sharing pleasant thoughts.

    Here is my web blog direct marketing articles [Dianna]

  51. Coy Says:

    This article is genuinely a good one it helps new net viewers, who are wishing in favor of blogging.

    my web-site myrtle beach sc [Coy]

  52. Tresa Says:

    I read this piece of writing fully about the difference of newest
    and previous technologies, it’s remarkable article.

    My homepage healthy foods (Tresa)

  53. love horoscope Says:

    Hello there! Do you use Twitter? I’d like to follow you if
    that would be okay. I’m undoubtedly enjoying your blog and look forward
    to new updates.

  54. Ward Says:

    Wow! After all I got a weblog from where I can actually obtain useful data concerning my study and knowledge.

    Look into my homepage :: heavier fish (Ward)

  55. Tuyet Says:

    I was recommended this website by my cousin. I am not sure whether this post is written by him as no one
    else know such detailed about my difficulty. You are amazing!

    Thanks!

    Here is my web blog :: north myrtle beach (Tuyet)

  56. fast food Says:

    Thanks for your marvelous posting! I really enjoyed reading it, you
    may be a great author. I will be sure to bookmark your blog and definitely will come back in the foreseeable future.
    I want to encourage continue your great posts, have a nice afternoon!

    My blog post - fast food

  57. Ulysses Says:

    Hey very interesting blog!

    My homepage beach condominium (Ulysses)

  58. Louisa Says:

    Hi I am so excited I found your web site, I really found you by error,
    while I was looking on Askjeeve for something else, Nonetheless I am here now and would just like to say kudos for a incredible post and a all round interesting blog (I also
    love the theme/design), I don’t have time to look over it
    all at the moment but I have saved it and also included your RSS feeds,
    so when I have time I will be back to read more, Please do keep up the awesome work.

    Also visit my webpage - marketing business.mlm network market (Louisa)

  59. Jeanette Says:

    I am genuinely happy to read this weblog posts which consists
    of lots of helpful facts, thanks for providing such statistics.

    Here is my web site: weight loss (Jeanette)

  60. Marisol Says:

    always i used to read smaller content which also clear their motive,
    and that is also happening with this article which I am reading at this
    place.

    Here is my web site … wine promo - Marisol -

  61. Randolph Says:

    It’s impressive that you are getting ideas from this post as well as from our discussion made at this place.

    my weblog :: cheap myrtle beach golf packages (Randolph)

  62. Marty Says:

    Hello there, just became alert to your blog through Google, and found that it’s truly informative.
    I am gonna watch out for brussels. I will be grateful if you continue this in future.
    Many people will be benefited from your writing. Cheers!

    My homepage … steaming foods (Marty)

  63. Fae Says:

    After I originally left a comment I seem to have
    clicked the -Notify me when new comments are added- checkbox and
    from now on every time a comment is added I receive four emails with the same comment.

    Is there a means you are able to remove me from that service?
    Thanks!

    Here is my web site; find personal wine - Fae,

  64. expensive wines Says:

    Terrific article! This is the kind of info that should be shared across the net.
    Shame on Google for no longer positioning this put up higher!
    Come on over and seek advice from my website . Thanks =)

    Also visit my webpage … expensive wines

  65. Adriene Says:

    Hello! Do you know if they make any plugins to safeguard
    against hackers? I’m kinda paranoid about losing everything I’ve worked hard
    on. Any suggestions?

    Have a look at my website … myrtle beach hotels (Adriene)

  66. pan fish Says:

    Unquestionably believe that which you said. Your
    favorite reason appeared to be on the net the easiest thing to be aware of.
    I say to you, I definitely get irked while people consider worries that they just do not know about.
    You managed to hit the nail upon the top as well as defined
    out the whole thing without having side effect , people could take a signal.
    Will likely be back to get more. Thanks

    Also visit my blog … pan fish

  67. myrtle beach golf vacation Says:

    What’s Happening i’m new to this, I stumbled upon this I have found It absolutely useful and it has helped
    me out loads. I’m hoping to contribute & aid other users like its aided me.

    Great job.

    Also visit my site: myrtle beach golf vacation

  68. Audrey Says:

    It is the best time to make some plans for the future and it is time to be happy.
    I have read this post and if I could I want to suggest you few interesting things or suggestions.
    Maybe you could write next articles referring to this article.
    I wish to read even more things about it!

    Here is my web page; lose weight successfully (Audrey)

  69. Angelita Says:

    Hello! This is kind of off topic but I need some help from an established blog.
    Is it difficult to set up your own blog? I’m not very techincal
    but I can figure things out pretty fast. I’m thinking about setting
    up my own but I’m not sure where to start. Do you have any points or suggestions?
    Cheers

    Review my web site pair wine (Angelita)

  70. Rodrick Says:

    It’s nearly impossible to find educated people in this particular subject, but you
    seem like you know what you’re talking about!
    Thanks

    Also visit my web-site - myrtle hotels; Rodrick,

  71. personalized fitness Says:

    When I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox and from now
    on each time a comment is added I recieve 4 emails
    with the same comment. There has to be an easy
    method you are able to remove me from that service?
    Thanks a lot!

    My blog - personalized fitness

  72. jjdongshin.com Says:

    Howdy! I could have sworn I’ve visited your blog before but after going through many of
    the articles I realized it’s new to me. Regardless, I’m definitely happy
    I discovered it and I’ll be book-marking it and checking back frequently!

    Also visit my website subliminal (jjdongshin.com)

  73. Florida Says:

    I love your blog.. very nice colors & theme. Did you make this website yourself or
    did you hire someone to do it for you? Plz answer back as I’m looking to construct
    my own blog and would like to know where u got this from.
    many thanks

    Visit my page food preparation [Florida]

  74. Erika Says:

    Recently, Avon has launched several prosperous skin treatment collections for skin.

    My blog post; professional organic skin care lines for estheticians (Erika)