Talking About Fluent Interface

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites & 1 Group

    Talking About Fluent Interface - Presentation Transcript

    1. 2008‐11‐19(Wed); AppleStore, Sapporo Ruby Sapporo Night vol.8 Talking about “Fluent interface” snoozer.05@ruby‐sapporo.org Ruby /Ruby SHIMADA Koji; Nihon Ruby-no-kai; RubySapporo http://www.flickr.com/photos/mio-spr/2042538806
    2. ✓ ✓ ✓ ✓ ✓
    3. RubyConf 2008 http://rubyconf.org/
    4. Neal Ford, Advanced DSL in Ruby http://www.nealford.com/downloads/conferences/canonical/Neal_Ford- Advanced_DSLs_in_Ruby-slides.pdf
    5. Neal Ford, Advanced DSL in Ruby http://www.nealford.com/downloads/conferences/canonical/Neal_Ford- Advanced_DSLs_in_Ruby-slides.pdf
    6. Neal Ford, Advanced DSL in Ruby http://www.nealford.com/downloads/conferences/canonical/Neal_Ford- Advanced_DSLs_in_Ruby-slides.pdf
    7. ?
    8. ✓ ✓
    9. http://www.flickr.com/photos/quanle/251201209/
    10. http://www.flickr.com/photos/jw3000/12703492
    11. Martinfowler’s Biki http://capsctrl.que.jp/kdmsnr/wiki/bliki/?FluentInterface
    12. Expect.Once.On(mockLogger) .Method(“LogError”) .With(Has.Substring(USER_NAME) & Has.Substring(“access defined”)); mainframe.expects(once()) .method(“buy”).with(eq(QUANTITY)) .will(returnValue(TICKET));
    13. ✓ ✓ ✓
    14. ?
    15. http://www.flickr.com/photos/srijith/1867095482
    16. ✓ ✓
    17. ✓ ✓
    18. http://www.flickr.com/photos/mdd/175282811
    19. ✓ ✓
    20. ✓ ✓
    21. http://www.flickr.com/photos/ozyman/443545349
    22. ✓ ✓
    23. ✓ ✓
    24. ✓ ✓ ✓
    25. http://www.flickr.com/photos/fuckr/91530309
    26. Martinfowler’s Biki http://capsctrl.que.jp/kdmsnr/wiki/bliki/?FluentInterface
    27. Evolving an EDSL in Java http://www.mockobjects.com/files/ evolving_an_edsl.ooplsa2006.pdf
    28. ✓ ✓ ✓ http://www.flickr.com/photos/17258892@N05/2588347668
    29. http://www.flickr.com/photos/good_day/117131491/
    30. ✓ ✓ ✓
    31. A B C b a c
    32. tmp1 = data.grep(/foo/) tmp2 = tmp1.uniq tmp3 = tmp2.sort tmp4 = tmp3.join(“¥n”) tmp4.display data.grep(/foo/).uniq.sort.join(“¥n”).display
    33. http://www.flickr.com/photos/jacky83/2311687241
    34. ✓ ✓ ✓ ✓
    35. Transcript clear. Transcript nextPutAll: ‘SHIMADA Koji’. Transcript cr. Transcript flush. Transcript clear; nextPutAll: ‘SHIMADA Koji’; cr; flush
    36. A b a c
    37. ✓ ✓ ✓
    38. expectation.setCount(once()); expectation.setMethod(“buy”); expectation.setArgument(eq(QUANTITY)); expectation.setResult(TICKET); expectation.setCount(once()) .setMethod(“buy”) .setArgument(eq(QUANTITY)); .setResult(TICKET);
    39. http://www.flickr.com/photos/mio-spr/428995450
    40. ✓ ✓ ✓
    41. expectation.setCount(once()) .setMethod(“buy”) .setArgument(eq(QUANTITY)); .setResult(TICKET); mainframe.expects(once()) .method(“buy”).with(eq(QUANTITY)) .will(returnValue(TICKET));
    42. data.grep(/foo/).uniq.sort.join(“¥n”).display (1..10).map{|i| i*i}.select{|i| i % 2 == 0}
    43. data.grep(/foo/).uniq.sort.join(“¥n”).display (1..10).map{|i| i*i}.select{|i| i % 2 == 0} mainframe.expects(once()) .method(“buy”).with(eq(QUANTITY)) .will(returnValue(TICKET));
    44. ✓ ✓ ✓ http://www.flickr.com/photos/17258892@N05/2588347668
    45. ✓ ✓ ✓
    46. rate = Discount.new rate.cash = 0.05 rate.membership = 0.02 rate.price = 0.01 product.apply_discount(rate)
    47. product.apply( Discount.for. cash(0.05). membership(0.02). price(0.01) )
    48. class Discount ... def Discount.for Discount.new end def cash(discount) @for_cash = discount self end end
    49. class Discount ... def Discount.for Discount.new end def cash(discount) @for_cash = discount self end end
    50. class Discount ... def Discount.for Discount.new end def cash(discount) @for_cash = discount self end end
    51. class Product ... def apply(discount) @discount = discount end ... end
    52. product.apply( Discount.for. cash(0.05). membership(0.02). price(0.01) )
    53. ✓ ✓ ✓ ✓
    54. http://www.flickr.com/photos/srijith/1867095482
    55. ...a programmer’s job is too communicate with other programmers, not just a machine. Programming, then, is a human task done by humans for humans. Oh, and writing good code at the same time.
    56. http://www.flickr.com/photos/suvcougar/
    57. http://ja.wikipedia.org/wiki/%E5%8B%95%E7%B7%9A ✓ ✓ ✓
    58. http://www.flickr.com/photos/storm-crypt/2280100565
    59. ✓ ✓ ✓ ✓
    60. http://www.flickr.com/photos/nibaq/1735007
    61. ✓ ✓ ✓ ✓ ✓ ✓
    62. ✓ ✓ ✓ ✓ ✓ ✓
    63. http://www.flickr.com/photos/pedrosz/2287112249
    64. 2008‐11‐19(Wed); AppleStore, Sapporo Ruby Sapporo Night vol.8 Talking about “Fluent interface” snoozer.05@ruby‐sapporo.org Ruby /Ruby SHIMADA Koji; Nihon Ruby-no-kai; RubySapporo http://www.flickr.com/photos/mio-spr/2042538806

    + snoozer05snoozer05, 7 months ago

    custom

    638 views, 2 favs, 3 embeds more stats

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 638
      • 516 on SlideShare
      • 122 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 16
    Most viewed embeds
    • 53 views on http://blog.stco.info
    • 36 views on http://ruby-sapporo.org
    • 33 views on http://implementationpatterns.g.hatena.ne.jp

    more

    All embeds
    • 53 views on http://blog.stco.info
    • 36 views on http://ruby-sapporo.org
    • 33 views on http://implementationpatterns.g.hatena.ne.jp

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel

    Categories

    Groups / Events