際際滷

際際滷Share a Scribd company logo
Heroku waza 2013
Lessons Learned
Pete Hudgins
Twitter: @phudgins
Github: phudgins
Waza?
Art, Technique
I attended
Keynote - Michael Lopp
Unfactoring - Aaron Patterson
Dismantling the Monorail - Jack Lawson
Design Minded Development - Austin Bales
Instrumenting Twelve-Factor Apps - Joseph Ruscio
Caring for your Baby Ecosystem - Jacob Kaplan-Moss
Ruby 2.0 - Yukihiro 'Matz' Matsumoto
Everything is a Remix - Kirby Ferguson
Ruby 2.0
Yukihiro 'Matz'
Matsumoto
@yukihiro_matz
 Creator of Ruby
 Hired by Heroku as Chief
Architect, Ruby
Why Ruby?
"I hope to see Ruby help every programmer in the world to
be productive, and to enjoy programming, and to be happy."
Pete Heroku Waza 2013 Ruby 2.0
Ruby 2.0
Happiest release ever"
Why Ruby 2.0?
 1.8.7 will die SOON
 100% Compatible with Rails 4.0
 Available on Heroku NOW
 Cool new features
Ruby 2.0 Features
 Keyword Arguments
 Symbol array literals
 UTF-8 by default
 Scoped Monkey-Patching
Keyword Arguments
 Use for named, optional arguments
 No specific order
 Descriptive
 Easy to remember
Keyword Arguments
Ruby 1.9:
def self.find_by_division_id(employer_id, opts={})
opts.symbolize_keys!
params = opts.reject { |k,v| v.blank? }
. . .
end
Keyword Arguments
What if we want:
 An arbitrary number of opts?
 To have nil as a valid value?
 Descriptive Exceptions?
Keyword Arguments
Ruby 1.9:
def log(*msgs)
opt = msgs.last.is_a?(Hash) ? msgs.pop : {}
level = opt.key?(:level) ? opt.delete(:level) : "ERROR"
time = opt.key?(:time) ? opt.delete(:time) : Time.now
raise "unknown key: #{opt.keys.first}" if !opt.empty?
msgs.map do |msg|
puts "#{ time.ctime } [#{ level }] #{ msg }"
end
end
Keyword Arguments
Keyword Arguments
Ruby 2.0:
def log(msg, level: "ERROR", time: Time.now)
puts "#{ time.ctime } [#{ level }] #{ msg }"
end
Symbol Array
Literals
Need a quick array of symbols?
%i(foo bar) # => [:foo, :bar]
Scoped monkey
patching
Monkey Patching?
monkey patching
 Ruby 1.9 uses Open Class
 Add methods to existing classes
 Replace methods in existing classes
 Example: ActiveSupport
monkey patching
What could possibly go wrong?
monkey patching
class String
def to_slug(id)
self.truncate(30, separator: ' ', omission: '').
parameterize + "-#{id}"
end
end
monkey patching
class String
def to_slug(id)
"#{id}-" + self.truncate(30,
separator: ' ',
omission: '').
parameterize
end
end
monkey patching
Global modification is BAD
Scoped monkey
patching
Use Refinements!
Scoped monkey
patching
module GemName
refine String
def to_slug(id)
. . .
end
end
end
Ruby 2.0
Questions?

More Related Content

What's hot (7)

PPTX
Intro to Clojure lightningtalk
Nola Stowe
PPTX
C# - Raise the bar with functional & immutable constructs (Dutch)
Rick Beerendonk
PDF
Docker and Fluentd
N Masahiro
PDF
Cloud native akka and kubernetes holy grail to elasticity
Fabio Tiriticco
PDF
Cloud Native Akka & Kubernetes: the holy grail to elasticity?
J On The Beach
PPTX
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Adler Hsieh
PDF
Taking Spinnaker for a spin @ London DevOps Meetup 36
aleonhardt
Intro to Clojure lightningtalk
Nola Stowe
C# - Raise the bar with functional & immutable constructs (Dutch)
Rick Beerendonk
Docker and Fluentd
N Masahiro
Cloud native akka and kubernetes holy grail to elasticity
Fabio Tiriticco
Cloud Native Akka & Kubernetes: the holy grail to elasticity?
J On The Beach
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Adler Hsieh
Taking Spinnaker for a spin @ London DevOps Meetup 36
aleonhardt

Similar to Pete Heroku Waza 2013 Ruby 2.0 (20)

PDF
What's new in Ruby 2.0
Kartik Sahoo
PPTX
Day 1 - Intro to Ruby
Barry Jones
PDF
RubyMiniGuide-v1.0_0
tutorialsruby
PDF
RubyMiniGuide-v1.0_0
tutorialsruby
KEY
Ruby on Rails Training - Module 1
Mark Menard
PDF
Workin On The Rails Road
RubyOnRails_dude
PDF
Introduction to Ruby & Modern Programming
Christos Sotirelis
PPT
Workin ontherailsroad
Jim Jones
PPT
WorkinOnTheRailsRoad
webuploader
PPTX
Why Ruby?
IT Weekend
PDF
Get your ass to 1.9
Nic Benders
PPTX
Code for Startup MVP (Ruby on Rails) Session 2
Henry S
PDF
Let's Learn Ruby - Basic
Eddie Kao
PDF
The story of language development
Hiroshi SHIBATA
PDF
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Michael Kimathi
PDF
Web Development With Ruby - From Simple To Complex
Brian Hogan
ODP
Ruby
Aizat Faiz
PDF
Ruby Intro {spection}
Christian KAKESA
PDF
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...
forbahchonev
KEY
Ruby
Kerry Buckley
What's new in Ruby 2.0
Kartik Sahoo
Day 1 - Intro to Ruby
Barry Jones
RubyMiniGuide-v1.0_0
tutorialsruby
RubyMiniGuide-v1.0_0
tutorialsruby
Ruby on Rails Training - Module 1
Mark Menard
Workin On The Rails Road
RubyOnRails_dude
Introduction to Ruby & Modern Programming
Christos Sotirelis
Workin ontherailsroad
Jim Jones
WorkinOnTheRailsRoad
webuploader
Why Ruby?
IT Weekend
Get your ass to 1.9
Nic Benders
Code for Startup MVP (Ruby on Rails) Session 2
Henry S
Let's Learn Ruby - Basic
Eddie Kao
The story of language development
Hiroshi SHIBATA
Ruby 4.0 To Infinity and Beyond at Ruby Conference Kenya 2017 by Bozhidar Batsov
Michael Kimathi
Web Development With Ruby - From Simple To Complex
Brian Hogan
Ruby
Aizat Faiz
Ruby Intro {spection}
Christian KAKESA
Ruby Best Practices Increase Your Productivity Write Better Code 1st Edition ...
forbahchonev
Ad

Recently uploaded (20)

PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
PDF
The Growing Value and Application of FME & GenAI
Safe Software
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) 際際滷s
Ravi Tamada
PDF
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
PDF
Unlocking FME Flows Potential: Architecture Design for Modern Enterprises
Safe Software
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
PDF
Kubernetes - Architecture & Components.pdf
geethak285
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
PPTX
Simplifica la seguridad en la nube y la detecci坦n de amenazas con FortiCNAPP
Cristian Garcia G.
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
The Growing Value and Application of FME & GenAI
Safe Software
Why aren't you using FME Flow's CPU Time?
Safe Software
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) 際際滷s
Ravi Tamada
2025_06_18 - OpenMetadata Community Meeting.pdf
OpenMetadata
The Future of Product Management in AI ERA.pdf
Alyona Owens
UserCon Belgium: Honey, VMware increased my bill
stijn40
Unlocking FME Flows Potential: Architecture Design for Modern Enterprises
Safe Software
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
Kubernetes - Architecture & Components.pdf
geethak285
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
Python Conference Singapore - 19 Jun 2025
ninefyi
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
Simplifica la seguridad en la nube y la detecci坦n de amenazas con FortiCNAPP
Cristian Garcia G.
Ad

Pete Heroku Waza 2013 Ruby 2.0

Editor's Notes

  • #3: Japanese word for Art and Technique. As developers and engineers, we should think about our art and our craft.
  • #5: Focus on Talk Ruby 2.0
  • #6: Created Ruby on February 24, 1993
  • #7: Why did Matz create Ruby? Other languages work ok Matz wanted something that was '...more powerful than Perl, and more object-oriented than Python Primarily:
  • #8: Primarily: For me, the purpose of life is, at least partly, to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy.
  • #9: Ruby 2.0 was released on its 20 th birthday. Matz considered the release schedule as Anniversary Driven Development or ADD
  • #10: Why move to Ruby 2.0? Rails 4.0 prefers Ruby 2.0
  • #13: We can do keyword arguments in 1.9, with an opts hash.
  • #15: We clearly have an issue here..
  • #17: We can do keyword arguments in 2.0
  • #20: ActiveSupport example: 20.years.ago
  • #22: One developer adds to_slug to String class
  • #23: Another developer adds to_slug to String class
  • #26: If you call to_slug without using the module, an error is thrown.