SlideShare a Scribd company logo
1 of 30
Backwards Compatibility
The Science and the Art
Agenda
Where does backwards compatibility matter,
and why?
Ways a ReST service can evolve.
Strategies for evolving a service in a backwards
compatible fashion.
Database backwards compatibility.
Best practices.
So you want to deploy a new version
The new version has a different API than the
old one.
Typically, web service
Also: java library
Also: schema design
Just upgrade the clients?
May not be able to upgrade all clients at the
same time.
Creates tightly coupled releases.
Cannot do partial rollbacks.
Not possible for zero-downtime deploys.
Versioning?
/myService/v1 → /myService/v2
Backwards Compatibility
A change to a service is backwards compatible
if old clients can continue to call the new
service without problems.
Wire Compatibility
Data format not changed in ways that cause
parsing errors when old clients make calls.
Semantic Compatibility
When old clients make calls, stuff still works
right.
This is the one you want!
Compatibility and deploys
A backwards compatible service change can be
rolled out without problems.
Zero downtime!
Rolling back other services does not force
rolling back your service.
Compatibility and deploys
After (and only after) a service has rolled, can
clients upgrade.
Or perhaps just change a config flag
If the service needs to roll back, all clients must
roll back first.
Ways a ReST service can evolve
Changes to the API
For web services, this includes URIs, representations (i.e.
JSON), and HTTP methods
Changes to behavior
Most evolutions involve both kinds of change
Evolution Strategies
Additional field in request
Additional field in response
New values in existing request fields
Changing field types
Additional field in request
Make it optional (at least at first), with a
default value matching old behavior
@RequestMapping(value=”/petstore/pets”, method=GET)
public getPets() {
return petService.getAllPets();
}
@RequestMapping(value=”/petstore/pets”, method=GET)
public getPets(
@RequestParam(value=“species”, required=false)
Species species) {
return species == null
? petService.getAllPets()
: petService.getAllPets(species);
}
Additional field in request
Can also provide a default value:
@RequestMapping(value=”/petstore/pets”, method=GET)
public getPets(
@RequestParam(“species”) species)
@RequestMapping(value=”/petstore/pets”, method=GET)
public getPets(
@RequestParam(“species”) Species species,
@RequestParam(
value=”mustBeAdoptable”, defaultValue=”false”)
boolean adoptable)
Additional field in response
Most serialization libraries (including Jackson)
can ignore unmapped fields.
New clients can use the field value, while old
ones ignore it.
Ensure that the new field does not change
semantics of old fields!
New values in a request field
Pretty straightforward, provided that the
meaning of pre-existing values does not change.
Example – add a new value to an enum.
public enum Species {
DOG,
FERRET,
CAT
}
Narrowing set of allowed request values
Example – No longer allowing searches for
Ferrets.
Rarely happens
When it does, all clients must upgrade first
before the service can safely rely on the
narrowed set of values
Changing type
Of request field:
Make sure the old type can be parsed into the new type –
e.g. Integer to Double
Of response field:
Make sure new type can be parsed as old value – e.g.
Double to Integer
Alternative: add new field with new type, have
the old field “forward”
Changing type – forwarding field
{“age”: 12}
{
“age”: 12,
“ageAsDouble”: 12.3
}
New behavior
Changing business logic
Should be OK - this is why we do services in the first place!
Performing additional actions (or less actions)
If this breaks contract, then a new resource may be required
New failure modes
This is very similar to new values in response fields
Database backwards compatibility
Adding columns, tables, etc is OK...ish
They won't always get used!
Backwards population may be needed
Beware the generic update endpoint!
Removing: First update clients
If you know what they are!
Triggers and views can help here.
Safely adding a column (say, “foo”)
Problem: old client calls GET, followed by PUT.
Drops foo on the floor
Solution: BEFORE UPDATE trigger
IF :new.foo IS NULL THEN :new.foo = :old.foo
For inserts, a default value is simpler than a trigger.
Best Practices
Plan ahead for versioning changes
Keep your API as narrow as possible.
Document and test compatibility requirements.
Automated client tests.
Keep clients as up to date as possible.
Plan ahead for versioning changes
Always consider versioning issues when making
any changes to existing resources.
Do this up front, not as an afterthought.
Put care into initial API design.
Keep DTOs as simple as possible.
It is very hard to see which fields clients are using.
Keep your API as narrow as possible
You can't break what you never provided.
Splunk can show what is called, but not how
the results are used.
Narrow APIs often are also better tailored.
Avoid generic “update” endpoints if possible
Fields are part of the API – only include what
you need!
Document and test compatibility requirements
Make it clear which client versions are
expected to be able to talk to which service
versions.
Verifying these requirements should be part of
any service change.
Automated tests
Write automated tests which exercise the
service as a given version of a client would.
Tests for version n should be written before
starting version n+1, and ideally before rolling
version n to production.
Run old tests against new service version to
test backwards compatibility.
Copy and paste can be acceptable here.
Keep clients as up to date as possible
Once all clients have upgraded, any deprecated
fields, resources, etc. can be removed from the
service.
Maintaining backwards compatibility is
expensive, and gets more so with multiple
versions.
Cooperation is required.
What if you need to break backwards compatability?
1)Don't!
2)See #1
3)Talk with your colleagues – find a solution.
4)There is always a way, and it usually isn't that
hard.
THANK YOU.

More Related Content

What's hot

Express lane video 4 autoresp
Express lane video 4   autorespExpress lane video 4   autoresp
Express lane video 4 autorespChuck Milliken
 
Pratical eff monad at Scaladays Chicago
Pratical eff monad at Scaladays ChicagoPratical eff monad at Scaladays Chicago
Pratical eff monad at Scaladays ChicagoEric Torreborre
 
Pratical eff-scalaitaly-2017
Pratical eff-scalaitaly-2017Pratical eff-scalaitaly-2017
Pratical eff-scalaitaly-2017Eric Torreborre
 
Pretenders talk at PyconUK 2012
Pretenders talk at PyconUK 2012Pretenders talk at PyconUK 2012
Pretenders talk at PyconUK 2012txels
 
CDC Tests - Integration Tests cant be made simpler than this!
CDC Tests - Integration Tests cant be made simpler than this!CDC Tests - Integration Tests cant be made simpler than this!
CDC Tests - Integration Tests cant be made simpler than this!Ramya Authappan
 
Managing Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with RelaxManaging Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with RelaxSalesforce Developers
 
Handling Failures with Messaging
Handling Failures with MessagingHandling Failures with Messaging
Handling Failures with MessagingElton Stoneman
 
Ruby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraRuby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraAndolasoft Inc
 
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIOJumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIOJosh Cypher
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSumitkumar Shingavi
 
EAIESB Java CAPS Migration Program
EAIESB Java CAPS Migration ProgramEAIESB Java CAPS Migration Program
EAIESB Java CAPS Migration ProgramVijay Reddy
 
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...Gáspár Nagy
 
"Asynchronous" Integration Tests for Microservices - RootConf 2017
"Asynchronous" Integration Tests for Microservices - RootConf 2017"Asynchronous" Integration Tests for Microservices - RootConf 2017
"Asynchronous" Integration Tests for Microservices - RootConf 2017Ramya Authappan
 
Consumer Driven Contracts - A Deep Dive
Consumer Driven Contracts - A Deep DiveConsumer Driven Contracts - A Deep Dive
Consumer Driven Contracts - A Deep DiveRamya Authappan
 
Developing a Culture of Quality Code (Midwest PHP 2020)
Developing a Culture of Quality Code (Midwest PHP 2020)Developing a Culture of Quality Code (Midwest PHP 2020)
Developing a Culture of Quality Code (Midwest PHP 2020)Scott Keck-Warren
 

What's hot (20)

Wax on, wax off
Wax on, wax offWax on, wax off
Wax on, wax off
 
Defensive Apex Programming
Defensive Apex ProgrammingDefensive Apex Programming
Defensive Apex Programming
 
Express lane video 4 autoresp
Express lane video 4   autorespExpress lane video 4   autoresp
Express lane video 4 autoresp
 
Pratical eff monad at Scaladays Chicago
Pratical eff monad at Scaladays ChicagoPratical eff monad at Scaladays Chicago
Pratical eff monad at Scaladays Chicago
 
Pratical eff-scalaitaly-2017
Pratical eff-scalaitaly-2017Pratical eff-scalaitaly-2017
Pratical eff-scalaitaly-2017
 
Pratical eff
Pratical effPratical eff
Pratical eff
 
Pretenders talk at PyconUK 2012
Pretenders talk at PyconUK 2012Pretenders talk at PyconUK 2012
Pretenders talk at PyconUK 2012
 
CDC Tests - Integration Tests cant be made simpler than this!
CDC Tests - Integration Tests cant be made simpler than this!CDC Tests - Integration Tests cant be made simpler than this!
CDC Tests - Integration Tests cant be made simpler than this!
 
Managing Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with RelaxManaging Your Batch and Scheduled Apex Processes with Relax
Managing Your Batch and Scheduled Apex Processes with Relax
 
Handling Failures with Messaging
Handling Failures with MessagingHandling Failures with Messaging
Handling Failures with Messaging
 
Ruby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraRuby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybara
 
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIOJumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
Jumpstarting Testing In Your Organization with Selenium, Cucumber, & WebdriverIO
 
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler FramworksSalesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
Salesforce Meetup 18 April 2015 - Apex Trigger & Scheduler Framworks
 
EAIESB Java CAPS Migration Program
EAIESB Java CAPS Migration ProgramEAIESB Java CAPS Migration Program
EAIESB Java CAPS Migration Program
 
Salesforce asynchronous apex
Salesforce asynchronous apexSalesforce asynchronous apex
Salesforce asynchronous apex
 
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
 
"Asynchronous" Integration Tests for Microservices - RootConf 2017
"Asynchronous" Integration Tests for Microservices - RootConf 2017"Asynchronous" Integration Tests for Microservices - RootConf 2017
"Asynchronous" Integration Tests for Microservices - RootConf 2017
 
Consumer Driven Contracts - A Deep Dive
Consumer Driven Contracts - A Deep DiveConsumer Driven Contracts - A Deep Dive
Consumer Driven Contracts - A Deep Dive
 
The Apex Ten Commandments
The Apex Ten CommandmentsThe Apex Ten Commandments
The Apex Ten Commandments
 
Developing a Culture of Quality Code (Midwest PHP 2020)
Developing a Culture of Quality Code (Midwest PHP 2020)Developing a Culture of Quality Code (Midwest PHP 2020)
Developing a Culture of Quality Code (Midwest PHP 2020)
 

Viewers also liked

Spec By Example or How to teach people talk to each other
Spec By Example or How to teach people talk to each otherSpec By Example or How to teach people talk to each other
Spec By Example or How to teach people talk to each otherAndrey Rebrov
 
Chemistry-Ions(1)_150818_01
Chemistry-Ions(1)_150818_01Chemistry-Ions(1)_150818_01
Chemistry-Ions(1)_150818_01Art Traynor
 
State Of The Art - Part 3 Technical Spec
State Of The Art - Part 3 Technical SpecState Of The Art - Part 3 Technical Spec
State Of The Art - Part 3 Technical SpecPascal Cottereau
 
Space Research, Pollution's types, Endangered Species. PPT
Space Research, Pollution's types, Endangered Species. PPTSpace Research, Pollution's types, Endangered Species. PPT
Space Research, Pollution's types, Endangered Species. PPTJeyasuriya Suriya
 
Species! Example presentation
Species! Example presentationSpecies! Example presentation
Species! Example presentationBetsy Rivera
 
Erlang Practice
Erlang PracticeErlang Practice
Erlang Practicelitaocheng
 
USB Type-C R1.1 Introduction
USB Type-C R1.1 IntroductionUSB Type-C R1.1 Introduction
USB Type-C R1.1 IntroductionTing Ou
 
Sustaining Wild Species
Sustaining Wild SpeciesSustaining Wild Species
Sustaining Wild Speciestcooper66
 
An Introduction to BGP Flow Spec
An Introduction to BGP Flow SpecAn Introduction to BGP Flow Spec
An Introduction to BGP Flow SpecShortestPathFirst
 
Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...
Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...
Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...jvendetti
 
Chemical reaction engineering
Chemical reaction engineeringChemical reaction engineering
Chemical reaction engineering1langshen
 
Speciation and Evolution
Speciation and EvolutionSpeciation and Evolution
Speciation and EvolutionPaulVMcDowell
 
Apiculture: introduction, species types and different methods of rearing of bees
Apiculture: introduction, species types and different methods of rearing of beesApiculture: introduction, species types and different methods of rearing of bees
Apiculture: introduction, species types and different methods of rearing of beesTehreem Sarwar
 
Wildlife ppt.sar
Wildlife ppt.sarWildlife ppt.sar
Wildlife ppt.sarsar Sari
 

Viewers also liked (18)

Spec By Example or How to teach people talk to each other
Spec By Example or How to teach people talk to each otherSpec By Example or How to teach people talk to each other
Spec By Example or How to teach people talk to each other
 
Chemistry-Ions(1)_150818_01
Chemistry-Ions(1)_150818_01Chemistry-Ions(1)_150818_01
Chemistry-Ions(1)_150818_01
 
State Of The Art - Part 3 Technical Spec
State Of The Art - Part 3 Technical SpecState Of The Art - Part 3 Technical Spec
State Of The Art - Part 3 Technical Spec
 
Space Research, Pollution's types, Endangered Species. PPT
Space Research, Pollution's types, Endangered Species. PPTSpace Research, Pollution's types, Endangered Species. PPT
Space Research, Pollution's types, Endangered Species. PPT
 
Species! Example presentation
Species! Example presentationSpecies! Example presentation
Species! Example presentation
 
Erlang Practice
Erlang PracticeErlang Practice
Erlang Practice
 
Ecological succession (1)
Ecological succession (1)Ecological succession (1)
Ecological succession (1)
 
USB Type-C R1.1 Introduction
USB Type-C R1.1 IntroductionUSB Type-C R1.1 Introduction
USB Type-C R1.1 Introduction
 
Sustaining Wild Species
Sustaining Wild SpeciesSustaining Wild Species
Sustaining Wild Species
 
Species Interaction
Species InteractionSpecies Interaction
Species Interaction
 
An Introduction to BGP Flow Spec
An Introduction to BGP Flow SpecAn Introduction to BGP Flow Spec
An Introduction to BGP Flow Spec
 
Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...
Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...
Bio413 07 sympatric_speciation_species concepts_allopatric_speciation_winter2...
 
Chemical reaction engineering
Chemical reaction engineeringChemical reaction engineering
Chemical reaction engineering
 
Speciation and Evolution
Speciation and EvolutionSpeciation and Evolution
Speciation and Evolution
 
Apiculture: introduction, species types and different methods of rearing of bees
Apiculture: introduction, species types and different methods of rearing of beesApiculture: introduction, species types and different methods of rearing of bees
Apiculture: introduction, species types and different methods of rearing of bees
 
Types of the speech
Types of the speechTypes of the speech
Types of the speech
 
Wildlife ppt.sar
Wildlife ppt.sarWildlife ppt.sar
Wildlife ppt.sar
 
PPT OF BIODIVERSITY
PPT OF BIODIVERSITYPPT OF BIODIVERSITY
PPT OF BIODIVERSITY
 

Similar to THE SCIENCE AND ART OF BACKWARDS COMPATIBILITY

How to deal with REST API Evolution
How to deal with REST API EvolutionHow to deal with REST API Evolution
How to deal with REST API EvolutionMiredot
 
Recipes for API Ninjas
Recipes for API NinjasRecipes for API Ninjas
Recipes for API NinjasNordic APIs
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfAparna Sharma
 
Bank_Automated_API_Testing
Bank_Automated_API_TestingBank_Automated_API_Testing
Bank_Automated_API_TestingAndy Saunders
 
REST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxREST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxJason452803
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile appsMugunth Kumar
 
Business Applications Integration In The Cloud
Business Applications Integration In The CloudBusiness Applications Integration In The Cloud
Business Applications Integration In The CloudAnna Brzezińska
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfAparna Sharma
 
Writing Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using FitnesseWriting Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using FitnesseFacundo Farias
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJordan Open Source Association
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationKnoldus Inc.
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Knoldus Inc.
 
Developing Profitable APIs - John Fraser - Platform A
Developing Profitable APIs - John Fraser - Platform ADeveloping Profitable APIs - John Fraser - Platform A
Developing Profitable APIs - John Fraser - Platform Aauexpo Conference
 
Migrate existing application to asp.net core
Migrate existing application to asp.net coreMigrate existing application to asp.net core
Migrate existing application to asp.net coreI-Verve Inc
 
Architecture for the cloud deployment case study future
Architecture for the cloud deployment case study futureArchitecture for the cloud deployment case study future
Architecture for the cloud deployment case study futureLen Bass
 

Similar to THE SCIENCE AND ART OF BACKWARDS COMPATIBILITY (20)

How to deal with REST API Evolution
How to deal with REST API EvolutionHow to deal with REST API Evolution
How to deal with REST API Evolution
 
Rest assured
Rest assuredRest assured
Rest assured
 
Recipes for API Ninjas
Recipes for API NinjasRecipes for API Ninjas
Recipes for API Ninjas
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdf
 
Bank_Automated_API_Testing
Bank_Automated_API_TestingBank_Automated_API_Testing
Bank_Automated_API_Testing
 
REST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptxREST API 20.2 - Appworks Gateway Integration.pptx
REST API 20.2 - Appworks Gateway Integration.pptx
 
Designing your API Server for mobile apps
Designing your API Server for mobile appsDesigning your API Server for mobile apps
Designing your API Server for mobile apps
 
Business Applications Integration In The Cloud
Business Applications Integration In The CloudBusiness Applications Integration In The Cloud
Business Applications Integration In The Cloud
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdf
 
Writing Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using FitnesseWriting Acceptance Tests Using Fitnesse
Writing Acceptance Tests Using Fitnesse
 
Grails Services
Grails ServicesGrails Services
Grails Services
 
JOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best PracticesJOSA TechTalks - RESTful API Concepts and Best Practices
JOSA TechTalks - RESTful API Concepts and Best Practices
 
ATAGTR2017 Test the REST
ATAGTR2017 Test the REST ATAGTR2017 Test the REST
ATAGTR2017 Test the REST
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL Presentation
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)
 
Developing Profitable APIs - John Fraser - Platform A
Developing Profitable APIs - John Fraser - Platform ADeveloping Profitable APIs - John Fraser - Platform A
Developing Profitable APIs - John Fraser - Platform A
 
Migrate existing application to asp.net core
Migrate existing application to asp.net coreMigrate existing application to asp.net core
Migrate existing application to asp.net core
 
Architecture for the cloud deployment case study future
Architecture for the cloud deployment case study futureArchitecture for the cloud deployment case study future
Architecture for the cloud deployment case study future
 

More from Informatics Summit

PSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEER
PSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEERPSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEER
PSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEERInformatics Summit
 
BUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESS
BUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESSBUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESS
BUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESSInformatics Summit
 
READING THE HUMAN GENOME IS HARD WORK!
READING THE HUMAN GENOME IS HARD WORK!READING THE HUMAN GENOME IS HARD WORK!
READING THE HUMAN GENOME IS HARD WORK!Informatics Summit
 
GENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASS
GENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASSGENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASS
GENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASSInformatics Summit
 
Informatics Summit Oct, 30 2015
Informatics Summit Oct, 30 2015Informatics Summit Oct, 30 2015
Informatics Summit Oct, 30 2015Informatics Summit
 

More from Informatics Summit (6)

PSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEER
PSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEERPSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEER
PSYCHOLOGY, MOTIVATION AND THE SOFTWARE ENGINEER
 
LOGGING FOR FUN, AND PROFIT
LOGGING FOR FUN, AND PROFITLOGGING FOR FUN, AND PROFIT
LOGGING FOR FUN, AND PROFIT
 
BUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESS
BUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESSBUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESS
BUSINESS INTELLIGENCE — HOW DATA DRIVES BUSINESS
 
READING THE HUMAN GENOME IS HARD WORK!
READING THE HUMAN GENOME IS HARD WORK!READING THE HUMAN GENOME IS HARD WORK!
READING THE HUMAN GENOME IS HARD WORK!
 
GENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASS
GENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASSGENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASS
GENETIC VARIANTS: SIMPLE ENOUGH FOR MY DAUGHTER’S 4TH GRADE CLASS
 
Informatics Summit Oct, 30 2015
Informatics Summit Oct, 30 2015Informatics Summit Oct, 30 2015
Informatics Summit Oct, 30 2015
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 

Recently uploaded (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 

THE SCIENCE AND ART OF BACKWARDS COMPATIBILITY

  • 2. Agenda Where does backwards compatibility matter, and why? Ways a ReST service can evolve. Strategies for evolving a service in a backwards compatible fashion. Database backwards compatibility. Best practices.
  • 3. So you want to deploy a new version The new version has a different API than the old one. Typically, web service Also: java library Also: schema design
  • 4. Just upgrade the clients? May not be able to upgrade all clients at the same time. Creates tightly coupled releases. Cannot do partial rollbacks. Not possible for zero-downtime deploys.
  • 6. Backwards Compatibility A change to a service is backwards compatible if old clients can continue to call the new service without problems.
  • 7. Wire Compatibility Data format not changed in ways that cause parsing errors when old clients make calls.
  • 8. Semantic Compatibility When old clients make calls, stuff still works right. This is the one you want!
  • 9. Compatibility and deploys A backwards compatible service change can be rolled out without problems. Zero downtime! Rolling back other services does not force rolling back your service.
  • 10. Compatibility and deploys After (and only after) a service has rolled, can clients upgrade. Or perhaps just change a config flag If the service needs to roll back, all clients must roll back first.
  • 11. Ways a ReST service can evolve Changes to the API For web services, this includes URIs, representations (i.e. JSON), and HTTP methods Changes to behavior Most evolutions involve both kinds of change
  • 12. Evolution Strategies Additional field in request Additional field in response New values in existing request fields Changing field types
  • 13. Additional field in request Make it optional (at least at first), with a default value matching old behavior @RequestMapping(value=”/petstore/pets”, method=GET) public getPets() { return petService.getAllPets(); } @RequestMapping(value=”/petstore/pets”, method=GET) public getPets( @RequestParam(value=“species”, required=false) Species species) { return species == null ? petService.getAllPets() : petService.getAllPets(species); }
  • 14. Additional field in request Can also provide a default value: @RequestMapping(value=”/petstore/pets”, method=GET) public getPets( @RequestParam(“species”) species) @RequestMapping(value=”/petstore/pets”, method=GET) public getPets( @RequestParam(“species”) Species species, @RequestParam( value=”mustBeAdoptable”, defaultValue=”false”) boolean adoptable)
  • 15. Additional field in response Most serialization libraries (including Jackson) can ignore unmapped fields. New clients can use the field value, while old ones ignore it. Ensure that the new field does not change semantics of old fields!
  • 16. New values in a request field Pretty straightforward, provided that the meaning of pre-existing values does not change. Example – add a new value to an enum. public enum Species { DOG, FERRET, CAT }
  • 17. Narrowing set of allowed request values Example – No longer allowing searches for Ferrets. Rarely happens When it does, all clients must upgrade first before the service can safely rely on the narrowed set of values
  • 18. Changing type Of request field: Make sure the old type can be parsed into the new type – e.g. Integer to Double Of response field: Make sure new type can be parsed as old value – e.g. Double to Integer Alternative: add new field with new type, have the old field “forward”
  • 19. Changing type – forwarding field {“age”: 12} { “age”: 12, “ageAsDouble”: 12.3 }
  • 20. New behavior Changing business logic Should be OK - this is why we do services in the first place! Performing additional actions (or less actions) If this breaks contract, then a new resource may be required New failure modes This is very similar to new values in response fields
  • 21. Database backwards compatibility Adding columns, tables, etc is OK...ish They won't always get used! Backwards population may be needed Beware the generic update endpoint! Removing: First update clients If you know what they are! Triggers and views can help here.
  • 22. Safely adding a column (say, “foo”) Problem: old client calls GET, followed by PUT. Drops foo on the floor Solution: BEFORE UPDATE trigger IF :new.foo IS NULL THEN :new.foo = :old.foo For inserts, a default value is simpler than a trigger.
  • 23. Best Practices Plan ahead for versioning changes Keep your API as narrow as possible. Document and test compatibility requirements. Automated client tests. Keep clients as up to date as possible.
  • 24. Plan ahead for versioning changes Always consider versioning issues when making any changes to existing resources. Do this up front, not as an afterthought. Put care into initial API design. Keep DTOs as simple as possible. It is very hard to see which fields clients are using.
  • 25. Keep your API as narrow as possible You can't break what you never provided. Splunk can show what is called, but not how the results are used. Narrow APIs often are also better tailored. Avoid generic “update” endpoints if possible Fields are part of the API – only include what you need!
  • 26. Document and test compatibility requirements Make it clear which client versions are expected to be able to talk to which service versions. Verifying these requirements should be part of any service change.
  • 27. Automated tests Write automated tests which exercise the service as a given version of a client would. Tests for version n should be written before starting version n+1, and ideally before rolling version n to production. Run old tests against new service version to test backwards compatibility. Copy and paste can be acceptable here.
  • 28. Keep clients as up to date as possible Once all clients have upgraded, any deprecated fields, resources, etc. can be removed from the service. Maintaining backwards compatibility is expensive, and gets more so with multiple versions. Cooperation is required.
  • 29. What if you need to break backwards compatability? 1)Don't! 2)See #1 3)Talk with your colleagues – find a solution. 4)There is always a way, and it usually isn't that hard.