Your SlideShare is downloading. ×
0
Ruby and DCIYou’re doing it wrong   Simon Courtois - @happynoff
DCI ?Data (domain model)ContextInteraction (roles)
Example                          d::Base           < A ctiveRecorclass User                                      e}")  def...
Example                      cor   d::Base           < ActiveReclass Userend                                  module Twitt...
Performance ?http://tonyarcieri.com/dci-in-ruby-is-completely-broken                                             Tony Arci...
Performance ?Benchmark.ips do |bm|  bm.report("without dci") { ExampleClass.new.foo }  bm.report("with dci") do    obj = E...
Ruby’s cacheRuby VMs cache methods « These caches remain valid so long as we don’t see new types and the class hierarchy d...
Alternative                      cor   d::Base           < ActiveReclass User                                             ...
Questions ?Simon Courtois - @happynoff
Thanks !Simon Courtois - @happynoff
Upcoming SlideShare
Loading in...5
×

Ruby and DCI

974

Published on

Slides de mon talk à Paris.rb le 07/01/13.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
974
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Ruby and DCI"

  1. 1. Ruby and DCIYou’re doing it wrong Simon Courtois - @happynoff
  2. 2. DCI ?Data (domain model)ContextInteraction (roles)
  3. 3. Example d::Base < A ctiveRecorclass User e}") def tweet _name My nam e is #{nam .se nd_tweet(" TwitterLib endenduser = User.find(42)user.tweet_name
  4. 4. Example cor d::Base < ActiveReclass Userend module TwitterUser def tweet_name TwitterLib.send_tweet("M y name is #{name}") end enduser = User.find(42)user.extend(TwitterUser)user.tweet_name
  5. 5. Performance ?http://tonyarcieri.com/dci-in-ruby-is-completely-broken Tony Arcieri @bascule
  6. 6. Performance ?Benchmark.ips do |bm| bm.report("without dci") { ExampleClass.new.foo } bm.report("with dci") do obj = ExampleClass.new obj.extend(ExampleMixin) obj.foo endend Local - Ok Global - What ?!
  7. 7. Ruby’s cacheRuby VMs cache methods « These caches remain valid so long as we don’t see new types and the class hierarchy doesn’t change. » Tony Arceria
  8. 8. Alternative cor d::Base < ActiveReclass User Evan Lightend class TwitterUser < Simp leDelegator def tweet_name TwitterLib.send_tweet("M y name is #{name}") end enduser = User.find(42)tw_user = TwitterUser.new(user)tw_user.tweet_name
  9. 9. Questions ?Simon Courtois - @happynoff
  10. 10. Thanks !Simon Courtois - @happynoff
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×