Your SlideShare is downloading. ×
0
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Ruby and DCI
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Ruby and DCI

967

Published on

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

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
967
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Ruby and DCIYou’re doing it wrong Simon Courtois - @happynoff
  • 2. DCI ?Data (domain model)ContextInteraction (roles)
  • 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. 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. Performance ?http://tonyarcieri.com/dci-in-ruby-is-completely-broken Tony Arcieri @bascule
  • 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. 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. 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. Questions ?Simon Courtois - @happynoff
  • 10. Thanks !Simon Courtois - @happynoff

×