Your SlideShare is downloading. ×
0
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
Design patterns in Ruby
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

Design patterns in Ruby

731

Published on

Slides from my July, 2012 talk to the Ottawa Ruby Tuesday meet up. http://ottawaruby.ca/

Slides from my July, 2012 talk to the Ottawa Ruby Tuesday meet up. http://ottawaruby.ca/

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

No Downloads
Views
Total Views
731
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
22
Comments
0
Likes
1
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. Design Patterns in Ruby @russolsen 1Wednesday, July 25, 12
  • 2. 2Wednesday, July 25, 12
  • 3. 3Wednesday, July 25, 12
  • 4. Th ird & Me! 4Wednesday, July 25, 12
  • 5. (magma) edward.og 5Wednesday, July 25, 12
  • 6. FORTRAN Pascal BASIC C C++ Python Java Ruby Clojure 6Wednesday, July 25, 12
  • 7. Design Patterns: 3 Things in 1 7Wednesday, July 25, 12
  • 8. Philosophy of Good Design 8Wednesday, July 25, 12
  • 9. Common Problems Common Solutions 9Wednesday, July 25, 12
  • 10. Some Common Solutions 10Wednesday, July 25, 12
  • 11. More @#$& Documents! 11Wednesday, July 25, 12
  • 12. Templates & Strategies 12Wednesday, July 25, 12
  • 13. Document def render render_title(@title) render_author(@author) ... end PlainDocument HtmlDocument def render_title(t) def render_title(t) end end def render_author(a) def render_author(a) end end Template Method 13Wednesday, July 25, 12
  • 14. PlainRender def render(doc) puts doc.title Document puts “By #{doc.author}” ... end def render @renderer.render(self) end HtmlRenderer def render(doc) ... end Strategy 14Wednesday, July 25, 12
  • 15. Separate Out Change 15Wednesday, July 25, 12
  • 16. Think Interface NOT Implementation 16Wednesday, July 25, 12
  • 17. Composition NOT Inheritance 17Wednesday, July 25, 12
  • 18. Delegate! 18Wednesday, July 25, 12
  • 19. Five In Five! 19Wednesday, July 25, 12
  • 20. Client “Stand In” “Real Object” Do something with @real Do real stuff Stand In Meta Pattern 20Wednesday, July 25, 12
  • 21. What If You Need Control? 21Wednesday, July 25, 12
  • 22. Proxy! 22Wednesday, July 25, 12
  • 23. Client ProxyDoc Document def render def render(doc) if allowed? puts doc.title @doc.render puts “By #{doc.author}” end ... end end Proxy 23Wednesday, July 25, 12
  • 24. What If You Need More? 24Wednesday, July 25, 12
  • 25. Decorate! 25Wednesday, July 25, 12
  • 26. Client Decorator Document def to_japanese translate(@doc.paragraphs) end def render @doc.render end Decorator 26Wednesday, July 25, 12
  • 27. What If You Need Less? 27Wednesday, July 25, 12
  • 28. Facade! 28Wednesday, July 25, 12
  • 29. Client EnterpriseDoc Facade 10,000 Complex methods def render @ent_doc.complex_stuff() end Facade 29Wednesday, July 25, 12
  • 30. What If You Need Different? 30Wednesday, July 25, 12
  • 31. Adapt! 31Wednesday, July 25, 12
  • 32. Client Adapter Document def print def render @doc.render ... end end Adapter 32Wednesday, July 25, 12
  • 33. What If You Need Little Bits? 33Wednesday, July 25, 12
  • 34. Compose! 34Wednesday, July 25, 12
  • 35. Document Client Document CompositeDoc def render @subdocs.each do |s| s.render end end Document Composite 35Wednesday, July 25, 12
  • 36. Design Patterns are nothing but decent pre-loaded solutions to common problems. 36Wednesday, July 25, 12
  • 37. They are worth your time because of they are solutions, but also because they are decent. 37Wednesday, July 25, 12
  • 38. russ@russolsen.com @russolsen thinkrelevance.com 38Wednesday, July 25, 12

×