Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
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

1,271 views

Published on

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

Published in: Technology
  • Be the first to comment

  • Be the first to like this

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

×