SlideShare a Scribd company logo
Release Responsibly 
(backwards compatibility) 
Emily Stolfo 
Ruby Engineer at 
@EmStolfo
The lifetime of our 
Gemfile.
source :rubygems 
! 
# Generic 
gem “rake” 
if RUBY_VERSION < “1.9.3” 
gem “activesupport”, “~>3.0” 
else 
gem “activesupport” 
end 
! 
# Deploy 
gem “redcarpet”, “2.2.0” 
! 
# Testing 
gem “mocha”, “0.13.0”, :require => ”mocha/setup” 
gem “shoulda”, “3.3.2” 
gem “shoulda-matchers”, “~>1.0” 
gem “test-unit”, “2.5.0” 
! 
# JRuby 
platforms :jruby do 
gem “jruby-jars”, “1.7.13” 
end
Innovation 
and 
Stability 
are in conflict in the 
Ruby community.
a gem version breaks backwards compatibility… 
“Not part of the official API” 
“My bad, sorry” 
yank the gem, release a new one
Release Responsibly 
(backwards compatibility)
“What’s the deal with the 
Ruby driver? 
! 
Do newer versions of the 
driver support all older 
versions of the server?”
“Not quite…”
Your code will be 
backwards 
compatible if you 
stick to 3 things.
SIMPLE API 
CLEAR COMMUNICATION 
SEMANTIC VERSIONING
SIMPLE API
Configurability 
and 
Stability 
are at odds.
www.gov.uk
Some ways to 
safely make API 
changes.
DO 
• Add arguments with default values, so 
old method calls still work. 
• Add methods. 
• Add subclasses. 
! 
DON’T 
• Add arguments without default values. 
• Rename methods or classes. 
• Remove arguments from method 
signatures.
Modularize 
(hide all the gory details)
def add_user(username, password=nil, read_only=false, opts={}) 
begin 
user_info = command(:usersInfo => username) 
# MongoDB >= 2.5.3 requires the use of commands to manage users. 
# "Command not found" error didn't return an error code (59) 
# before MongoDB 2.4.7 so we assume that a nil error code means 
# the usersInfo command doesn't exist and we should fall back to 
# the legacy add user code. 
rescue OperationFailure => ex 
raise ex unless COMMAND_NOT_FOUND_CODES.include?(ex.error_code) 
return legacy_add_user(username, password, read_only, opts) 
end 
! 
if user_info.key?('users') && !user_info['users'].empty? 
create_or_update_user(:updateUser, username, password, 
read_only, opts) 
else 
create_or_update_user(:createUser, username, password, 
read_only, opts) 
end 
end 
Ex: Gory details
Have a 
Compatibility 
module.
Use 
Polymorphism 
instead of 
conditionals.
Backport 
only when 
necessary.
Ex: OrderedHash 
module BSON 
class OrderedHash < Hash 
! 
def ==(other) 
begin 
case other 
when BSON::OrderedHash 
keys == other.keys && 
values == other.values 
else 
super 
end 
rescue 
false 
end 
end 
... 
end 
end
CLEAR 
COMMUNICATION
Compatible with what? 
! 
1. Your older API 
2. Older system(s) you 
integrate with
Define the 
scope 
of what you support.
Ex: Ruby driver
Test everything you 
say you support.
Release responsibly (Maintaining Backwards Compatibility)
Changelog 
is important.
keepachangelog.com
User trust 
should be a 
priority.
“Not part of the official API” 
“My bad, sorry” 
yank the gem, release a new one
Ex: Gem released 
breaking 1.8.7 support 
Q: Maybe you can change the gemspec 
to official say you don’t support 1.8.7? 
A: We don’t use the gemspec because 
we only support alive Ruby versions.
Have a 
deprecation 
strategy.
www.mongodb.com/ 
support-policy
Ex: strict mode 
# lib/mongo/db.rb 
... 
! 
# @deprecated Support for strict will be 
removed in version 2.0 of the driver. 
def strict=(value) 
warn "Support for strict mode has been “ + 
“deprecated and will be removed “ + 
“in version 2.0 of the driver." 
@strict = value 
end
Anticipate 
deprecations 
when designing.
Ex: Insert operation 
# lib/mongo/operation/write/insert.rb 
... 
! 
def execute(context) 
if context.write_command_enabled? 
op = Command::Insert.new(spec) 
Response.new(op.execute(context)) 
else 
context.with_connection do |connection| 
Response.new(connection.dispatch([ message, 
gle ])) 
end 
end 
end
Ex: Insert operation 
# lib/mongo/operation/write/insert.rb 
... 
! 
def execute(context) 
op = Command::Insert.new(spec) 
Response.new(op.execute(context)) 
end
SEMANTIC 
VERSIONING
Why don’t people 
follow SemVer?
SemVer is a 
double-edged 
sword. 
! 
- a Bundler maintainer
Gemfiles 
could be cleaner.
source :rubygems 
! 
# Generic 
gem “rake” 
if RUBY_VERSION < “1.9.3” 
gem “activesupport”, “~>3.0” 
else 
gem “activesupport” 
end 
! 
# Deploy 
gem “redcarpet”, “2.2.0” 
! 
# Testing 
gem “mocha”, “0.13.0”, :require => ”mocha/setup” 
gem “shoulda”, “3.3.2” 
gem “shoulda-matchers”, “~>1.0” 
gem “test-unit”, “2.5.0” 
! 
# JRuby 
platforms :jruby do 
gem “jruby-jars”, “1.7.13” 
end
It’s a culture/ 
community thing.
end

More Related Content

DOC
php drupal mysql MAMP
Jing Cheng
 
PDF
Gerenciando múltiplas versões do PostgreSQL com pgvm
Dickson S. Guedes
 
DOC
Kumpulan script jahil
UNP PGRI KEDIRI
 
PDF
RSpec. Part 3
Vladimir Dementyev
 
PDF
Node.jsやってみた
Yoshihiko Uchida
 
PDF
Javascript #2.2 : jQuery
Jean Michel
 
PDF
Intro to the Express Web Framework
jasonsich
 
PDF
CasperJS and PhantomJS for Automated Testing
X-Team
 
php drupal mysql MAMP
Jing Cheng
 
Gerenciando múltiplas versões do PostgreSQL com pgvm
Dickson S. Guedes
 
Kumpulan script jahil
UNP PGRI KEDIRI
 
RSpec. Part 3
Vladimir Dementyev
 
Node.jsやってみた
Yoshihiko Uchida
 
Javascript #2.2 : jQuery
Jean Michel
 
Intro to the Express Web Framework
jasonsich
 
CasperJS and PhantomJS for Automated Testing
X-Team
 

What's hot (16)

PDF
Overview: How to Measure your WebApp
Chang W. Doh
 
ODP
Choosing JavaScript Libraries - Refresh-Detroit.org
Chris Lee
 
PDF
Superfast Automated Web Testing with CasperJS & PhantomJS
Hervé Vũ Roussel
 
PDF
Site Testing with CasperJS
Joseph Scott
 
PPTX
Laravel mix
Cloud Wu
 
PDF
Chef
Mike Bailey
 
PDF
Ansible を完全にマスターする
Keisuke Kamada
 
PDF
livedoor blogのsorryサーバの話 #study2study
SATOSHI TAGOMORI
 
PDF
Testing MeteorJS using CasperJS
Stephan Hochhaus
 
PDF
Zookeper
AlexeyStepanov21
 
TXT
Places
dulcealvarez25
 
PDF
Como programar melhor jogando game boy
Gabriel Rodrigues Couto
 
KEY
JRuby最新事情@札幌
Naoto Takai
 
PDF
Unit Testing with Jest
Maayan Glikser
 
PPT
Basic Knowledge on MySql Replication
Tasawr Interactive
 
PDF
SenchaLabs Connect & Express
Tim Caswell
 
Overview: How to Measure your WebApp
Chang W. Doh
 
Choosing JavaScript Libraries - Refresh-Detroit.org
Chris Lee
 
Superfast Automated Web Testing with CasperJS & PhantomJS
Hervé Vũ Roussel
 
Site Testing with CasperJS
Joseph Scott
 
Laravel mix
Cloud Wu
 
Ansible を完全にマスターする
Keisuke Kamada
 
livedoor blogのsorryサーバの話 #study2study
SATOSHI TAGOMORI
 
Testing MeteorJS using CasperJS
Stephan Hochhaus
 
Como programar melhor jogando game boy
Gabriel Rodrigues Couto
 
JRuby最新事情@札幌
Naoto Takai
 
Unit Testing with Jest
Maayan Glikser
 
Basic Knowledge on MySql Replication
Tasawr Interactive
 
SenchaLabs Connect & Express
Tim Caswell
 
Ad

Viewers also liked (20)

PPTX
Technical Debt
Aaron Tushabe
 
PDF
Product Marketing Content & Collateral Matrix
David Castro
 
PDF
Technical Debt - Why should you care? (Agiles Buenos Aires 2011)
CI&T
 
KEY
Identifying Managing & Eliminating Technical Debt
AgileDad
 
ODP
Pay off Technical Debt by Good Code
Tung Nguyen
 
PDF
Going to R12? The Upgrading vs Reimplementing Decision
eprentise
 
PPTX
What's New in The ASAM Criteria
Ted Moore
 
KEY
Technical Debt
Rob Myers
 
PPTX
Technical stories v1.2
Jim Brisson
 
PPTX
Technical Debt for the Non Technical
Maria Matarelli
 
PDF
Towards a Technical Debt Management Framework based on Cost-Benefit Analysis
M Firdaus Harun
 
PDF
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
PDF
Benefits of Upgrading to SharePoint 2013
Aciron Consulting
 
PDF
Managing Software Debt Workshop at Intel
Chris Sterling
 
PPTX
Siebel Upgrade Best Practices &amp; Processes V2
Dr.Dinesh Chandrasekar PhD(hc)
 
KEY
Technical Debt and Requirements
Neil Ernst
 
PPT
Understand release engineering
gaoliang641
 
PPTX
Managing Technical Debt
construx_software
 
PDF
The SQALE method: Meaningful insights into your Technical Debt
Jean-Louis LETOUZEY
 
PDF
Managing technical debt
Fadi Stephan
 
Technical Debt
Aaron Tushabe
 
Product Marketing Content & Collateral Matrix
David Castro
 
Technical Debt - Why should you care? (Agiles Buenos Aires 2011)
CI&T
 
Identifying Managing & Eliminating Technical Debt
AgileDad
 
Pay off Technical Debt by Good Code
Tung Nguyen
 
Going to R12? The Upgrading vs Reimplementing Decision
eprentise
 
What's New in The ASAM Criteria
Ted Moore
 
Technical Debt
Rob Myers
 
Technical stories v1.2
Jim Brisson
 
Technical Debt for the Non Technical
Maria Matarelli
 
Towards a Technical Debt Management Framework based on Cost-Benefit Analysis
M Firdaus Harun
 
Drupal upgrades and migrations. BAD Camp 2013 version
David Lanier
 
Benefits of Upgrading to SharePoint 2013
Aciron Consulting
 
Managing Software Debt Workshop at Intel
Chris Sterling
 
Siebel Upgrade Best Practices &amp; Processes V2
Dr.Dinesh Chandrasekar PhD(hc)
 
Technical Debt and Requirements
Neil Ernst
 
Understand release engineering
gaoliang641
 
Managing Technical Debt
construx_software
 
The SQALE method: Meaningful insights into your Technical Debt
Jean-Louis LETOUZEY
 
Managing technical debt
Fadi Stephan
 
Ad

Similar to Release responsibly (Maintaining Backwards Compatibility) (20)

PPTX
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
PPTX
Day 1 - Intro to Ruby
Barry Jones
 
PDF
Web Development using Ruby on Rails
Avi Kedar
 
PDF
RubyGems 3 & 4
Hiroshi SHIBATA
 
PDF
Migrating Legacy Rails Apps to Rails 3
Clinton Dreisbach
 
PPTX
Rails Engine | Modular application
mirrec
 
PDF
RubyGems 3 & 4
Hiroshi SHIBATA
 
PDF
The Future of Dependency Management for Ruby
Hiroshi SHIBATA
 
PDF
Building Mobile Friendly APIs in Rails
Jim Jeffers
 
PDF
Introduction to Rails - presented by Arman Ortega
arman o
 
KEY
Crafting Beautiful CLI Applications in Ruby
Nikhil Mungel
 
PPT
Rails Rookies Bootcamp - Blogger
Nathanial McConnell
 
PDF
Lightweight APIs in mRuby (Михаил Бортник)
Fwdays
 
PDF
Basic Rails Training
Arthit Hongchintakul
 
PDF
Gems on Ruby
Hiroshi SHIBATA
 
PDF
The Future of library dependency management of Ruby
Hiroshi SHIBATA
 
KEY
Why ruby and rails
Reuven Lerner
 
KEY
Ruby on Rails Training - Module 1
Mark Menard
 
PDF
The Future of Bundled Bundler
Hiroshi SHIBATA
 
PDF
Ruby projects of interest for DevOps
Ricardo Sanchez
 
Exploring Ruby on Rails and PostgreSQL
Barry Jones
 
Day 1 - Intro to Ruby
Barry Jones
 
Web Development using Ruby on Rails
Avi Kedar
 
RubyGems 3 & 4
Hiroshi SHIBATA
 
Migrating Legacy Rails Apps to Rails 3
Clinton Dreisbach
 
Rails Engine | Modular application
mirrec
 
RubyGems 3 & 4
Hiroshi SHIBATA
 
The Future of Dependency Management for Ruby
Hiroshi SHIBATA
 
Building Mobile Friendly APIs in Rails
Jim Jeffers
 
Introduction to Rails - presented by Arman Ortega
arman o
 
Crafting Beautiful CLI Applications in Ruby
Nikhil Mungel
 
Rails Rookies Bootcamp - Blogger
Nathanial McConnell
 
Lightweight APIs in mRuby (Михаил Бортник)
Fwdays
 
Basic Rails Training
Arthit Hongchintakul
 
Gems on Ruby
Hiroshi SHIBATA
 
The Future of library dependency management of Ruby
Hiroshi SHIBATA
 
Why ruby and rails
Reuven Lerner
 
Ruby on Rails Training - Module 1
Mark Menard
 
The Future of Bundled Bundler
Hiroshi SHIBATA
 
Ruby projects of interest for DevOps
Ricardo Sanchez
 

Recently uploaded (20)

PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 

Release responsibly (Maintaining Backwards Compatibility)

  • 1. Release Responsibly (backwards compatibility) Emily Stolfo Ruby Engineer at @EmStolfo
  • 2. The lifetime of our Gemfile.
  • 3. source :rubygems ! # Generic gem “rake” if RUBY_VERSION < “1.9.3” gem “activesupport”, “~>3.0” else gem “activesupport” end ! # Deploy gem “redcarpet”, “2.2.0” ! # Testing gem “mocha”, “0.13.0”, :require => ”mocha/setup” gem “shoulda”, “3.3.2” gem “shoulda-matchers”, “~>1.0” gem “test-unit”, “2.5.0” ! # JRuby platforms :jruby do gem “jruby-jars”, “1.7.13” end
  • 4. Innovation and Stability are in conflict in the Ruby community.
  • 5. a gem version breaks backwards compatibility… “Not part of the official API” “My bad, sorry” yank the gem, release a new one
  • 7. “What’s the deal with the Ruby driver? ! Do newer versions of the driver support all older versions of the server?”
  • 9. Your code will be backwards compatible if you stick to 3 things.
  • 10. SIMPLE API CLEAR COMMUNICATION SEMANTIC VERSIONING
  • 14. Some ways to safely make API changes.
  • 15. DO • Add arguments with default values, so old method calls still work. • Add methods. • Add subclasses. ! DON’T • Add arguments without default values. • Rename methods or classes. • Remove arguments from method signatures.
  • 16. Modularize (hide all the gory details)
  • 17. def add_user(username, password=nil, read_only=false, opts={}) begin user_info = command(:usersInfo => username) # MongoDB >= 2.5.3 requires the use of commands to manage users. # "Command not found" error didn't return an error code (59) # before MongoDB 2.4.7 so we assume that a nil error code means # the usersInfo command doesn't exist and we should fall back to # the legacy add user code. rescue OperationFailure => ex raise ex unless COMMAND_NOT_FOUND_CODES.include?(ex.error_code) return legacy_add_user(username, password, read_only, opts) end ! if user_info.key?('users') && !user_info['users'].empty? create_or_update_user(:updateUser, username, password, read_only, opts) else create_or_update_user(:createUser, username, password, read_only, opts) end end Ex: Gory details
  • 19. Use Polymorphism instead of conditionals.
  • 20. Backport only when necessary.
  • 21. Ex: OrderedHash module BSON class OrderedHash < Hash ! def ==(other) begin case other when BSON::OrderedHash keys == other.keys && values == other.values else super end rescue false end end ... end end
  • 23. Compatible with what? ! 1. Your older API 2. Older system(s) you integrate with
  • 24. Define the scope of what you support.
  • 26. Test everything you say you support.
  • 30. User trust should be a priority.
  • 31. “Not part of the official API” “My bad, sorry” yank the gem, release a new one
  • 32. Ex: Gem released breaking 1.8.7 support Q: Maybe you can change the gemspec to official say you don’t support 1.8.7? A: We don’t use the gemspec because we only support alive Ruby versions.
  • 33. Have a deprecation strategy.
  • 35. Ex: strict mode # lib/mongo/db.rb ... ! # @deprecated Support for strict will be removed in version 2.0 of the driver. def strict=(value) warn "Support for strict mode has been “ + “deprecated and will be removed “ + “in version 2.0 of the driver." @strict = value end
  • 37. Ex: Insert operation # lib/mongo/operation/write/insert.rb ... ! def execute(context) if context.write_command_enabled? op = Command::Insert.new(spec) Response.new(op.execute(context)) else context.with_connection do |connection| Response.new(connection.dispatch([ message, gle ])) end end end
  • 38. Ex: Insert operation # lib/mongo/operation/write/insert.rb ... ! def execute(context) op = Command::Insert.new(spec) Response.new(op.execute(context)) end
  • 40. Why don’t people follow SemVer?
  • 41. SemVer is a double-edged sword. ! - a Bundler maintainer
  • 42. Gemfiles could be cleaner.
  • 43. source :rubygems ! # Generic gem “rake” if RUBY_VERSION < “1.9.3” gem “activesupport”, “~>3.0” else gem “activesupport” end ! # Deploy gem “redcarpet”, “2.2.0” ! # Testing gem “mocha”, “0.13.0”, :require => ”mocha/setup” gem “shoulda”, “3.3.2” gem “shoulda-matchers”, “~>1.0” gem “test-unit”, “2.5.0” ! # JRuby platforms :jruby do gem “jruby-jars”, “1.7.13” end
  • 44. It’s a culture/ community thing.
  • 45. end