SlideShare a Scribd company logo
1 of 115
Download to read offline
How not to rewrite
your library
Tips on stable APIs
by Loren Segal / @lsegal
I’ve worked on libraries,
all shapesand sizes.
I’ve worked on libraries,
all shapesand sizes.
and with
^
I’ve worked on libraries,
all shapesand sizes.
and with
^
I’ve worked on libraries,
all shapesand sizes.
and with
^
I’ve worked on libraries,
all shapesand sizes.
and with
^
cost benefit.
YMMV.
let’s go!
we’re getting older!
(and that’s a good thing)
what does it mean
to be a grownup?
responsibility.
there is a lot of Ruby
out there.
much more to break.
idealism ⟼ pragmatism
Backwards
Compatibility
Matters
to whom?
Dependency GraphLibrary Maintainer
parser
ast
easy mode.
library maintainers
have a distorted view
of dependency management.
Library Maintainer
“It’s just one
breaking change!”
reality is…
Dependency GraphApplication Maintainer
Dependency GraphApplication Maintainer
parser gem
reality is…
“It’s just one
breaking change!”
“It’s just one
breaking change!”
“It’s just one
breaking change!”
“It’s just one
breaking change!”
“It’s just one
breaking change!”
“It’s just one
breaking change!”
Application Maintainer
breaking changes hurt.
I’m Application Maintainer.
what can I do?
hold
library maintainers
accountable.
open issues.
even for major
version bumps.
I’m a Library Maintainer
avoidance > mitigation
change
but mitigation will do.
C H A N G E
MITIGATION
STRATEGIES
Compatibility
Adapters
Strategy #1
Adapter Pros:
- Minimal change for user.
- Write once, minimal
maintenance.
RedcarpetCompat
Only 74 lines.
Rarely changes.
“but it’s a maintenance burden!”
“but it’s a maintenance burden!”
Gem::SourceIndex
RubyGems 1.3 API.
Literally 0 changes.
Ethical Deprecation
Strategy #2
this is super important…
Deprecate ≠ Delete!
NOT EQUAL
dislike, don’t delete.
TOLERANCE!
We must live
in harmony with
our deprecated
brothers and sisters!
Good Deprecation Example
Java 1.3:
Thread.stop()
Java 1.3: Thread.stop()
Java 1.8: Still there.
Java 1.8: Thread.stop()
Deprecation Tips
1.
always have a
good technical
reason to deprecate.
2.
always have a
replacement API.
be like: Thread.stop()
be like: Thread.stop()
Good Reason
be like: strcpy()
be like: strcpy()
Alternative API
don’t be like: fs.exists()
don’t be like: fs.exists()
don’t be like: fs.exists()
Not technical.
don’t be like: fs.exists()
Not technical.
No reason provided.
No replacement provided.
3.
you don’t have to
maintain deprecated
code.
4.
you don’t have to
delete
deprecated code.
even in major version
updates.
Semantic Versioning
Strategy #3?
v{MAJOR}.{MINOR}.{PATCH}
MAJOR = breaking change
MINOR = non-breaking change
PATCH = no APIs should change
v{MAJOR}.{MINOR}.{PATCH}
v1.0.0
v3.5.3
etc.
SemVer is a great tool!
you can use SemVer.
you should use
SemVer!
just don’t use SemVer
as an excuse to break users.
just don’t use SemVer
as an excuse to break users.
that’s not cool.
major version bumps
are still last resorts.
only use SemVer to
communicate
breaking changes.
(the rare times they happen)
recall:
avoidance > mitigation
C H A N G E
AVOIDANCE
STRATEGIES
avoid breaking changes.
avoid breaking changes.
easy right?
Tips to Avoid Changing
Your API
1.
up-front design work
always yields a more
stable API.*
1.
up-front design work
always yields a more
stable API.*
* in my experience.
- domain model
- class diagram
- ER diagram
make a:
YARD, circa Feb. 2007
https://raw.githubusercontent.com/lsegal/yard/
v0.1a/doc/domain_model.jpg
8 years later,
that entire architecture
still exists.
YARD,
circa 2015
2.
README Driven
Development
sketch out your API
in README form.
start from user
experience,
work backwards.
start from user
experience,
work backwards.
less formal. equally helpful.
less formal. equally helpful.
for small libraries.
3.
Everything as a
Contract
Think of each API
decision as a contract
you cannot break.
Ask:
“Will I be comfortable
with this API being
public in 5 years?”
If not, don’t make it public.
“But 5 years is a long time!”
no.
Things That Were
Designed More Than
5 Years Ago and
Still Work Today
cron (last change in 1999)
Linux Kernel.
(GNU/BSD) make.
10+ year old Makefiles
still work.
not bad.
(note: he probably didn’t vendor gcc/make/
X11 in his repository)
will you be able
to say this about your
non-trivial Ruby
program
in 20 years?
how about 10?
how about 5?
Lessons
1.
design for the future.
2.
think about your users.
users > code.
3.
own your mistakes.
“Way too many projects seem to
think that the code is more
important than the user, and they
break things left and right, and they
don’t apologize for it, because they
feel that they are ‘fixing’ the code
and doing the right thing.”
“Way too many projects seem to
think that the code is more
important than the user, and they
break things left and right, and they
don’t apologize for it, because they
feel that they are ‘fixing’ the code
and doing the right thing.”
- Linus Torvalds, creator of the Linux Kernel
@lsegal

@lsegal

gnuu.org!
thank you.

More Related Content

Similar to How NOT to rewrite your library: tips on stable APIs

Publishing Technology Today
Publishing Technology TodayPublishing Technology Today
Publishing Technology TodayApex CoVantage
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design PrinciplesSamuel Breed
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonifiedChristian Heilmann
 
Immutable Data and TypeScript in an Ember.js Application
Immutable Data and TypeScript in an Ember.js ApplicationImmutable Data and TypeScript in an Ember.js Application
Immutable Data and TypeScript in an Ember.js ApplicationBill Heaton
 
Ruby codebases in an entropic universe
Ruby codebases in an entropic universeRuby codebases in an entropic universe
Ruby codebases in an entropic universeNiranjan Paranjape
 
Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016Łukasz Koniecki
 
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017   ember.js - escape the javascript fatigueNode.js meetup 17.05.2017   ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigueTobias Braner
 
10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo SpecsAtlassian
 
From a web application to a distributed system
From a web application to a distributed systemFrom a web application to a distributed system
From a web application to a distributed systemGianluca Padovani
 
Choosing a JVM Web Framework
Choosing a JVM Web FrameworkChoosing a JVM Web Framework
Choosing a JVM Web FrameworkMatt Raible
 
PyCon PL 2014 executable api
PyCon PL 2014   executable apiPyCon PL 2014   executable api
PyCon PL 2014 executable apiWojtek Erbetowski
 
How we took our server side application to the cloud and liked what we got
How we took our server side application to the cloud and liked what we gotHow we took our server side application to the cloud and liked what we got
How we took our server side application to the cloud and liked what we gotBaruch Sadogursky
 
Building resuable and customizable Vue components
Building resuable and customizable Vue componentsBuilding resuable and customizable Vue components
Building resuable and customizable Vue componentsFilip Rakowski
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in ComponentsFITC
 
Java script framework-roller-coaster
Java script framework-roller-coasterJava script framework-roller-coaster
Java script framework-roller-coasterRyan McColeman
 
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015NoSQLmatters
 

Similar to How NOT to rewrite your library: tips on stable APIs (20)

Publishing Technology Today
Publishing Technology TodayPublishing Technology Today
Publishing Technology Today
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonified
 
Immutable Data and TypeScript in an Ember.js Application
Immutable Data and TypeScript in an Ember.js ApplicationImmutable Data and TypeScript in an Ember.js Application
Immutable Data and TypeScript in an Ember.js Application
 
Ruby codebases in an entropic universe
Ruby codebases in an entropic universeRuby codebases in an entropic universe
Ruby codebases in an entropic universe
 
Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016Effective programming in Java - Kronospan Job Fair 2016
Effective programming in Java - Kronospan Job Fair 2016
 
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017   ember.js - escape the javascript fatigueNode.js meetup 17.05.2017   ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
 
10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs10 Tips for Configuring Your Builds with Bamboo Specs
10 Tips for Configuring Your Builds with Bamboo Specs
 
From a web application to a distributed system
From a web application to a distributed systemFrom a web application to a distributed system
From a web application to a distributed system
 
Linux Users are People, Too!
Linux Users are People, Too!Linux Users are People, Too!
Linux Users are People, Too!
 
Choosing a JVM Web Framework
Choosing a JVM Web FrameworkChoosing a JVM Web Framework
Choosing a JVM Web Framework
 
Ruby On Rails Introduction
Ruby On Rails IntroductionRuby On Rails Introduction
Ruby On Rails Introduction
 
PyCon PL 2014 executable api
PyCon PL 2014   executable apiPyCon PL 2014   executable api
PyCon PL 2014 executable api
 
How we took our server side application to the cloud and liked what we got
How we took our server side application to the cloud and liked what we gotHow we took our server side application to the cloud and liked what we got
How we took our server side application to the cloud and liked what we got
 
Raptor 2
Raptor 2Raptor 2
Raptor 2
 
API presentation
API presentationAPI presentation
API presentation
 
Building resuable and customizable Vue components
Building resuable and customizable Vue componentsBuilding resuable and customizable Vue components
Building resuable and customizable Vue components
 
Thinking in Components
Thinking in ComponentsThinking in Components
Thinking in Components
 
Java script framework-roller-coaster
Java script framework-roller-coasterJava script framework-roller-coaster
Java script framework-roller-coaster
 
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
Adrian Colyer - Keynote: NoSQL matters - NoSQL matters Dublin 2015
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

How NOT to rewrite your library: tips on stable APIs