SlideShare a Scribd company logo
1 of 26
Download to read offline
Type-Safe Evolution of 

Web Services
João Campinhos, João Costa Seco, Jácome Cunha

NOVA LINCS, Universidade NOVA de Lisboa, Portugal
j.campinhos@campus.fct.unl.pt, joao.seco@fct.unl.pt,
jacome@fct.unl.pt
Second International Workshop on Variability and Complexity in Software Design
VACE @ ICSE 2017
27 May, 2017 - Buenos Aires, Argentina
Problem
• Mobile/Web apps based on micro or web services have
had significant growth (smartphones explosion)
• Client and server are loosely coupled
• Using such kind of interfaces provides almost no
guarantees to the (client) developer in terms of evolution
• Changes to service interfaces can be introduced at any
moment, causing the clients to fail
• All of us now this evolution happens all the time
2
An Example of a Web Service for Users - v1.0
server implementation – version 1.0
user() => { name: “John Doe” }
client implementation – version 1.0
user().name.trim()
3
Server Evolution
server implementation – version 2.0
user() => { name:{ first: “John”,
last: “Doe” }}
client implementation – version 1.0
user().name.trim()
4
Clients Need to Go Along…
server implementation – version 2.0
user() => { name:{ first: “John”,
last: "Doe" }}
client implementation – version 2.0
user().name.first + “ “ + user().name.last
5
Several Issues
• It is probably not feasible to update all clients
to the latest version at the same time
• It is probably not possible to keep all service
interfaces and maintain them all
• If the client moves from version A to version B,
then all the code needs to move (not
incremental)
6
How can we help server and client
developers cope with evolution?
?
7
Towards a Solution
•Coexistence Principle
•Compatibility Principle
•Safety Principle
•Modularity Principle
8
Coexistence Principle
• Coexistence Principle: to make all the existing
versions available as a complete application, as a
unique code base
• Making use of annotations in the client requests and
in the server code to identify which version(s) to use
to attend a request
• Both versions 1.0 and 2.0 of the server should coexist
at the same time and should be usable by a client,
both at the same time
9
Coexistence Principle
{
(version = ’1.0’) => {
var currentuser = {name: “John Doe”};
function user() : {name: string}
{
return currentuser;
}
}
(version = ’2.0’) => {
var currentuser = {name: {first:”John”, last: ”Doe”}};
function user() : {name: {first: string, last: string}}
{

return currentuser;
}
}
} 10
Reuse
•The coexistence of versions only makes sense if
it is possible to reuse code across versions
•We introduce a language construct that allows
the annotation of an expression e with a
version v where it should be evaluated



(version = ‘v’) => e
11
12
(version = ’1.0’) => {
var currentuser = {name: “John Doe”};
function user() : {name: string}
{
return (version ‘2.0’) => { name: user().first + “ “ + user().last };
}
}
(version = ’2.0’) => {
var currentuser = {name: {first:”John”, last: ”Doe”}};
function user() : {name: {first: string, last: string}}
{

return currentuser;
}
}
Small Change to v2.0
…
(version = ’2.0’) => {
var currentuser = {name: {first:”John”, last: ”Doe”}};
function user() : {name: {first: string, last: string}}
{

return currentuser;
}
}
(version = ’2.1’) => {
function user(): {name:{first: string, last: string}, age:int}
{
return (version = ’2.0’) => {user(), age: 42};
}
} 13
14
• In this case, the type of the response in
version 2.1 is a subtype of the response
in version 2.0
• In many cases, it is still possible for
clients to interact with the new version
• This makes it possible for version 2.1 to
be used whenever version 2.0 is
requested
Compatibility Principle
• Compatibility Principle: a system should serve its
clients with (type) compatible versions at all times
• Our solution is to use a relation on versions that
embeds the notion of compatibility between
versions
• We introduce version patterns which define the
base version for searching the correct
implementation
15
16
…
(version = ’2.0’) => {
var currentuser = {name: {first:”John”, last: ”Doe”}};
function user() : {name: {first: string, last: string}}
{

return currentuser;
}
}
(version = ’2.1’) => {
function user(): {name:{first: string, last: string}, age:int}
{
return (version = ’2.0’) => {user(), age: 42};
return (version = ’2.*’) => {user(), age: 42};
}
}
An Example of a Relation
17
1.0
2.0
2.1
1.0-A
user():{name:string}
user():{name:{first: string,
last: string}}
user():{name:{first: string,
last: string},
age:int}
strictfree
subtyping
Compatibility Modes
•Strict: all the changes from one version to
another preserve the types of all declared
identifiers (functions and variables)
•Subtyping: all changes from one version to
another follow the subtype relation
•Free: does not constraint the changes on the
type signatures, as to allow the developer to
arbitrarily change the source code
18
An Example of a Relation
19
1.0
2.0
2.1
1.0-A
user():{name:string}
user():{name:{first: string,
last: string}}
user():{name:{first: string,
last: string},
age:int}
strictfree
subtyping
Back to the Client Code - Subtyping Mode
second client implementation – version 2.0
(version = ’2.*’) => { user().name.first }
• Client code maybe still be in version 2.0, but if
it requests the most updated version of the
service, version 2.1 will be served
20
Type Checker and Dispatching System
• The static type checker considers all versions
and the compatibility modes between them to
typecheck the code base
• The runtime dispatching system also takes into
consideration the relation between the
different version to serve the appropriate one
21
Safety Principle
•A third (and more general) principle becomes
essential to reach a sound solution
•Safety Principle: all possible entry points of
the system should be type safe, in all versions,
and considering all possible version
redirections given by the version compatibility
relation
22
Modularity Principle
•Modularity Principle: the static verification of
code and the dynamic dispatching of requests
and execution should be decoupled from the
actual definition of what a version is and how
versions relate
•This implies the relation is defined by the
server developer to relate any versions using
any compatibility mode
23
Open-Source Prototype Implementation
24
Annotated
JavaScript
Code
Syntactic
Analysis
Version
Type
Checker
Flow Transpiler
JavaScript
Code
Router
Request
(version,
mode)
Function
Relation
AST
http://github.com/niverso
Babel Ours
Flow Syntax
Type Checker
Conclusions & Future Work
•We introduced a new programming model to develop and
evolve software with multiple versions at the same time
•It copes with evolution using version compatibility modes
•Our approach is flexible as it is parametric on any version
control system developers may use
•The type system we developed can typecheck programs
with several versions at the same time
•The dispatching function dynamically decides what is the
best version of a particular component for each request
25
Conclusions & Future Work
•As a proof of concept we have implemented our
programming model as a prototype using the Flow
typechecker and JavaScript
•As future work, we want to formally certify the soundness
of the approach
•Also, experimental work must be performed with larger
case-studies
•We would also like to develop an IDE with this
programming model built-in
26

More Related Content

Similar to Type-Safe Evolution of 
Web Services

Foundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose ApplicationsFoundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose ApplicationsChing-Hwa Yu
 
Wading through treacle? Escape the integration syrup with contract tests
Wading through treacle? Escape the integration syrup with contract testsWading through treacle? Escape the integration syrup with contract tests
Wading through treacle? Escape the integration syrup with contract testsStefan Smith
 
CI/CD Pipeline with Docker
CI/CD Pipeline with DockerCI/CD Pipeline with Docker
CI/CD Pipeline with Dockerkushalsingh007
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Osconvijayrvr
 
Decomposing the Monolith (Riga Dev Days 2019)
Decomposing the Monolith (Riga Dev Days 2019)Decomposing the Monolith (Riga Dev Days 2019)
Decomposing the Monolith (Riga Dev Days 2019)Dennis Doomen
 
.NET Innovations and Improvements
.NET Innovations and Improvements.NET Innovations and Improvements
.NET Innovations and ImprovementsJeff Chu
 
Mantis Code Deployment Process
Mantis Code Deployment ProcessMantis Code Deployment Process
Mantis Code Deployment ProcessJen Wei Lee
 
Building a CI/CD Pipeline for PHP apps
Building a CI/CD Pipeline for PHP appsBuilding a CI/CD Pipeline for PHP apps
Building a CI/CD Pipeline for PHP appsJuan Manuel Torres
 
Loadrunner interview questions and answers
Loadrunner interview questions and answersLoadrunner interview questions and answers
Loadrunner interview questions and answersGaruda Trainings
 
16 implementation techniques
16 implementation techniques16 implementation techniques
16 implementation techniquesMajong DevJfu
 
Altitude NY 2018: 132 websites, 1 service: Your local news runs on Fastly
Altitude NY 2018: 132 websites, 1 service: Your local news runs on FastlyAltitude NY 2018: 132 websites, 1 service: Your local news runs on Fastly
Altitude NY 2018: 132 websites, 1 service: Your local news runs on FastlyFastly
 
Moving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesMoving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesHussein Salman
 
video conference (peer to peer)
video conference (peer to peer)video conference (peer to peer)
video conference (peer to peer)mohamed amr
 
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...University of Antwerp
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)Kevin Sutter
 
The Importance of Testnets in Developing InitVerse dApps.pdf
The Importance of Testnets in Developing InitVerse dApps.pdfThe Importance of Testnets in Developing InitVerse dApps.pdf
The Importance of Testnets in Developing InitVerse dApps.pdfInitVerse Blockchain
 

Similar to Type-Safe Evolution of 
Web Services (20)

Foundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose ApplicationsFoundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose Applications
 
Wading through treacle? Escape the integration syrup with contract tests
Wading through treacle? Escape the integration syrup with contract testsWading through treacle? Escape the integration syrup with contract tests
Wading through treacle? Escape the integration syrup with contract tests
 
CI/CD Pipeline with Docker
CI/CD Pipeline with DockerCI/CD Pipeline with Docker
CI/CD Pipeline with Docker
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
Decomposing the Monolith (Riga Dev Days 2019)
Decomposing the Monolith (Riga Dev Days 2019)Decomposing the Monolith (Riga Dev Days 2019)
Decomposing the Monolith (Riga Dev Days 2019)
 
.NET Innovations and Improvements
.NET Innovations and Improvements.NET Innovations and Improvements
.NET Innovations and Improvements
 
Mantis Code Deployment Process
Mantis Code Deployment ProcessMantis Code Deployment Process
Mantis Code Deployment Process
 
Micro service architecture
Micro service architectureMicro service architecture
Micro service architecture
 
DevOps.pptx
DevOps.pptxDevOps.pptx
DevOps.pptx
 
Building a CI/CD Pipeline for PHP apps
Building a CI/CD Pipeline for PHP appsBuilding a CI/CD Pipeline for PHP apps
Building a CI/CD Pipeline for PHP apps
 
Loadrunner interview questions and answers
Loadrunner interview questions and answersLoadrunner interview questions and answers
Loadrunner interview questions and answers
 
16 implementation techniques
16 implementation techniques16 implementation techniques
16 implementation techniques
 
Altitude NY 2018: 132 websites, 1 service: Your local news runs on Fastly
Altitude NY 2018: 132 websites, 1 service: Your local news runs on FastlyAltitude NY 2018: 132 websites, 1 service: Your local news runs on Fastly
Altitude NY 2018: 132 websites, 1 service: Your local news runs on Fastly
 
Onine exam 1
Onine exam 1Onine exam 1
Onine exam 1
 
Moving Applications into Azure Kubernetes
Moving Applications into Azure KubernetesMoving Applications into Azure Kubernetes
Moving Applications into Azure Kubernetes
 
Revealing C# 5
Revealing C# 5Revealing C# 5
Revealing C# 5
 
video conference (peer to peer)
video conference (peer to peer)video conference (peer to peer)
video conference (peer to peer)
 
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...Keynote VST2020 (Workshop on  Validation, Analysis and Evolution of Software ...
Keynote VST2020 (Workshop on Validation, Analysis and Evolution of Software ...
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)InterConnect 2016 Java EE 7 Overview (PEJ-5296)
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
 
The Importance of Testnets in Developing InitVerse dApps.pdf
The Importance of Testnets in Developing InitVerse dApps.pdfThe Importance of Testnets in Developing InitVerse dApps.pdf
The Importance of Testnets in Developing InitVerse dApps.pdf
 

More from Jácome Cunha

Spreadsheet Engineering
Spreadsheet EngineeringSpreadsheet Engineering
Spreadsheet EngineeringJácome Cunha
 
Model-driven Spreadsheets
Model-driven SpreadsheetsModel-driven Spreadsheets
Model-driven SpreadsheetsJácome Cunha
 
Model-Driven Spreadsheet Development
Model-Driven Spreadsheet DevelopmentModel-Driven Spreadsheet Development
Model-Driven Spreadsheet DevelopmentJácome Cunha
 
Energy Efficiency Across 
Programming Languages
Energy Efficiency Across 
Programming LanguagesEnergy Efficiency Across 
Programming Languages
Energy Efficiency Across 
Programming LanguagesJácome Cunha
 
Explaining Spreadsheets with Spreadsheets
Explaining Spreadsheets with SpreadsheetsExplaining Spreadsheets with Spreadsheets
Explaining Spreadsheets with SpreadsheetsJácome Cunha
 
Automatically Inferring ClassSheet Models from Spreadsheets
Automatically Inferring ClassSheet Models from SpreadsheetsAutomatically Inferring ClassSheet Models from Spreadsheets
Automatically Inferring ClassSheet Models from SpreadsheetsJácome Cunha
 
On Understanding Data Scientists
On Understanding  Data ScientistsOn Understanding  Data Scientists
On Understanding Data ScientistsJácome Cunha
 
Systematic Spreadsheet Construction Processes @ VL/HCC 2017
Systematic Spreadsheet Construction Processes @ VL/HCC 2017Systematic Spreadsheet Construction Processes @ VL/HCC 2017
Systematic Spreadsheet Construction Processes @ VL/HCC 2017Jácome Cunha
 
jStanley: Placing a Green Thumb on Java Collections
jStanley: Placing a Green Thumb on  Java CollectionsjStanley: Placing a Green Thumb on  Java Collections
jStanley: Placing a Green Thumb on Java CollectionsJácome Cunha
 
MDSheet – Model-Driven Spreadsheets
MDSheet – Model-Driven SpreadsheetsMDSheet – Model-Driven Spreadsheets
MDSheet – Model-Driven SpreadsheetsJácome Cunha
 
Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14
Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14
Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14Jácome Cunha
 
Summer School DSL 2013 - SpreadSheet Engineering
Summer School DSL 2013 - SpreadSheet EngineeringSummer School DSL 2013 - SpreadSheet Engineering
Summer School DSL 2013 - SpreadSheet EngineeringJácome Cunha
 
Talk at the Joint SSaaPP/FATBIT 2012 Workshop
Talk at the Joint SSaaPP/FATBIT 2012 WorkshopTalk at the Joint SSaaPP/FATBIT 2012 Workshop
Talk at the Joint SSaaPP/FATBIT 2012 WorkshopJácome Cunha
 

More from Jácome Cunha (20)

Spreadsheet Engineering
Spreadsheet EngineeringSpreadsheet Engineering
Spreadsheet Engineering
 
Model-driven Spreadsheets
Model-driven SpreadsheetsModel-driven Spreadsheets
Model-driven Spreadsheets
 
Model-Driven Spreadsheet Development
Model-Driven Spreadsheet DevelopmentModel-Driven Spreadsheet Development
Model-Driven Spreadsheet Development
 
Energy Efficiency Across 
Programming Languages
Energy Efficiency Across 
Programming LanguagesEnergy Efficiency Across 
Programming Languages
Energy Efficiency Across 
Programming Languages
 
LMCC - 30 Anos
LMCC - 30 AnosLMCC - 30 Anos
LMCC - 30 Anos
 
Explaining Spreadsheets with Spreadsheets
Explaining Spreadsheets with SpreadsheetsExplaining Spreadsheets with Spreadsheets
Explaining Spreadsheets with Spreadsheets
 
Automatically Inferring ClassSheet Models from Spreadsheets
Automatically Inferring ClassSheet Models from SpreadsheetsAutomatically Inferring ClassSheet Models from Spreadsheets
Automatically Inferring ClassSheet Models from Spreadsheets
 
On Understanding Data Scientists
On Understanding  Data ScientistsOn Understanding  Data Scientists
On Understanding Data Scientists
 
Systematic Spreadsheet Construction Processes @ VL/HCC 2017
Systematic Spreadsheet Construction Processes @ VL/HCC 2017Systematic Spreadsheet Construction Processes @ VL/HCC 2017
Systematic Spreadsheet Construction Processes @ VL/HCC 2017
 
jStanley: Placing a Green Thumb on Java Collections
jStanley: Placing a Green Thumb on  Java CollectionsjStanley: Placing a Green Thumb on  Java Collections
jStanley: Placing a Green Thumb on Java Collections
 
MDSheet – Model-Driven Spreadsheets
MDSheet – Model-Driven SpreadsheetsMDSheet – Model-Driven Spreadsheets
MDSheet – Model-Driven Spreadsheets
 
Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14
Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14
Spreadsheet Engineering @ OSU - EECS Colloquium - 02/24/14
 
Summer School DSL 2013 - SpreadSheet Engineering
Summer School DSL 2013 - SpreadSheet EngineeringSummer School DSL 2013 - SpreadSheet Engineering
Summer School DSL 2013 - SpreadSheet Engineering
 
Talk at VL/HCC '12
Talk at VL/HCC '12Talk at VL/HCC '12
Talk at VL/HCC '12
 
Talk at QUATIC '12
Talk at QUATIC '12Talk at QUATIC '12
Talk at QUATIC '12
 
Talk at the Joint SSaaPP/FATBIT 2012 Workshop
Talk at the Joint SSaaPP/FATBIT 2012 WorkshopTalk at the Joint SSaaPP/FATBIT 2012 Workshop
Talk at the Joint SSaaPP/FATBIT 2012 Workshop
 
Talk
TalkTalk
Talk
 
Talk at IS-EUD '11
Talk at IS-EUD '11Talk at IS-EUD '11
Talk at IS-EUD '11
 
Talk at EUSPRIG '11
Talk at EUSPRIG '11Talk at EUSPRIG '11
Talk at EUSPRIG '11
 
Talk at VL/HCC '11
Talk at VL/HCC '11Talk at VL/HCC '11
Talk at VL/HCC '11
 

Recently uploaded

DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSSLeenakshiTyagi
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Sérgio Sacani
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...ssifa0344
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencySheetal Arora
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsSumit Kumar yadav
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINsankalpkumarsahoo174
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfrohankumarsinghrore1
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)PraveenaKalaiselvan1
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)Areesha Ahmad
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Lokesh Kothari
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfSumit Kumar yadav
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...anilsa9823
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000Sapana Sha
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...Sérgio Sacani
 

Recently uploaded (20)

DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
 
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
TEST BANK For Radiologic Science for Technologists, 12th Edition by Stewart C...
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Botany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questionsBotany krishna series 2nd semester Only Mcq type questions
Botany krishna series 2nd semester Only Mcq type questions
 
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATINChromatin Structure | EUCHROMATIN | HETEROCHROMATIN
Chromatin Structure | EUCHROMATIN | HETEROCHROMATIN
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 
Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)Recombinant DNA technology (Immunological screening)
Recombinant DNA technology (Immunological screening)
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
Labelling Requirements and Label Claims for Dietary Supplements and Recommend...
 
GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdf
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
PossibleEoarcheanRecordsoftheGeomagneticFieldPreservedintheIsuaSupracrustalBe...
 

Type-Safe Evolution of 
Web Services

  • 1. Type-Safe Evolution of 
 Web Services João Campinhos, João Costa Seco, Jácome Cunha
 NOVA LINCS, Universidade NOVA de Lisboa, Portugal j.campinhos@campus.fct.unl.pt, joao.seco@fct.unl.pt, jacome@fct.unl.pt Second International Workshop on Variability and Complexity in Software Design VACE @ ICSE 2017 27 May, 2017 - Buenos Aires, Argentina
  • 2. Problem • Mobile/Web apps based on micro or web services have had significant growth (smartphones explosion) • Client and server are loosely coupled • Using such kind of interfaces provides almost no guarantees to the (client) developer in terms of evolution • Changes to service interfaces can be introduced at any moment, causing the clients to fail • All of us now this evolution happens all the time 2
  • 3. An Example of a Web Service for Users - v1.0 server implementation – version 1.0 user() => { name: “John Doe” } client implementation – version 1.0 user().name.trim() 3
  • 4. Server Evolution server implementation – version 2.0 user() => { name:{ first: “John”, last: “Doe” }} client implementation – version 1.0 user().name.trim() 4
  • 5. Clients Need to Go Along… server implementation – version 2.0 user() => { name:{ first: “John”, last: "Doe" }} client implementation – version 2.0 user().name.first + “ “ + user().name.last 5
  • 6. Several Issues • It is probably not feasible to update all clients to the latest version at the same time • It is probably not possible to keep all service interfaces and maintain them all • If the client moves from version A to version B, then all the code needs to move (not incremental) 6
  • 7. How can we help server and client developers cope with evolution? ? 7
  • 8. Towards a Solution •Coexistence Principle •Compatibility Principle •Safety Principle •Modularity Principle 8
  • 9. Coexistence Principle • Coexistence Principle: to make all the existing versions available as a complete application, as a unique code base • Making use of annotations in the client requests and in the server code to identify which version(s) to use to attend a request • Both versions 1.0 and 2.0 of the server should coexist at the same time and should be usable by a client, both at the same time 9
  • 10. Coexistence Principle { (version = ’1.0’) => { var currentuser = {name: “John Doe”}; function user() : {name: string} { return currentuser; } } (version = ’2.0’) => { var currentuser = {name: {first:”John”, last: ”Doe”}}; function user() : {name: {first: string, last: string}} {
 return currentuser; } } } 10
  • 11. Reuse •The coexistence of versions only makes sense if it is possible to reuse code across versions •We introduce a language construct that allows the annotation of an expression e with a version v where it should be evaluated
 
 (version = ‘v’) => e 11
  • 12. 12 (version = ’1.0’) => { var currentuser = {name: “John Doe”}; function user() : {name: string} { return (version ‘2.0’) => { name: user().first + “ “ + user().last }; } } (version = ’2.0’) => { var currentuser = {name: {first:”John”, last: ”Doe”}}; function user() : {name: {first: string, last: string}} {
 return currentuser; } }
  • 13. Small Change to v2.0 … (version = ’2.0’) => { var currentuser = {name: {first:”John”, last: ”Doe”}}; function user() : {name: {first: string, last: string}} {
 return currentuser; } } (version = ’2.1’) => { function user(): {name:{first: string, last: string}, age:int} { return (version = ’2.0’) => {user(), age: 42}; } } 13
  • 14. 14 • In this case, the type of the response in version 2.1 is a subtype of the response in version 2.0 • In many cases, it is still possible for clients to interact with the new version • This makes it possible for version 2.1 to be used whenever version 2.0 is requested
  • 15. Compatibility Principle • Compatibility Principle: a system should serve its clients with (type) compatible versions at all times • Our solution is to use a relation on versions that embeds the notion of compatibility between versions • We introduce version patterns which define the base version for searching the correct implementation 15
  • 16. 16 … (version = ’2.0’) => { var currentuser = {name: {first:”John”, last: ”Doe”}}; function user() : {name: {first: string, last: string}} {
 return currentuser; } } (version = ’2.1’) => { function user(): {name:{first: string, last: string}, age:int} { return (version = ’2.0’) => {user(), age: 42}; return (version = ’2.*’) => {user(), age: 42}; } }
  • 17. An Example of a Relation 17 1.0 2.0 2.1 1.0-A user():{name:string} user():{name:{first: string, last: string}} user():{name:{first: string, last: string}, age:int} strictfree subtyping
  • 18. Compatibility Modes •Strict: all the changes from one version to another preserve the types of all declared identifiers (functions and variables) •Subtyping: all changes from one version to another follow the subtype relation •Free: does not constraint the changes on the type signatures, as to allow the developer to arbitrarily change the source code 18
  • 19. An Example of a Relation 19 1.0 2.0 2.1 1.0-A user():{name:string} user():{name:{first: string, last: string}} user():{name:{first: string, last: string}, age:int} strictfree subtyping
  • 20. Back to the Client Code - Subtyping Mode second client implementation – version 2.0 (version = ’2.*’) => { user().name.first } • Client code maybe still be in version 2.0, but if it requests the most updated version of the service, version 2.1 will be served 20
  • 21. Type Checker and Dispatching System • The static type checker considers all versions and the compatibility modes between them to typecheck the code base • The runtime dispatching system also takes into consideration the relation between the different version to serve the appropriate one 21
  • 22. Safety Principle •A third (and more general) principle becomes essential to reach a sound solution •Safety Principle: all possible entry points of the system should be type safe, in all versions, and considering all possible version redirections given by the version compatibility relation 22
  • 23. Modularity Principle •Modularity Principle: the static verification of code and the dynamic dispatching of requests and execution should be decoupled from the actual definition of what a version is and how versions relate •This implies the relation is defined by the server developer to relate any versions using any compatibility mode 23
  • 24. Open-Source Prototype Implementation 24 Annotated JavaScript Code Syntactic Analysis Version Type Checker Flow Transpiler JavaScript Code Router Request (version, mode) Function Relation AST http://github.com/niverso Babel Ours Flow Syntax Type Checker
  • 25. Conclusions & Future Work •We introduced a new programming model to develop and evolve software with multiple versions at the same time •It copes with evolution using version compatibility modes •Our approach is flexible as it is parametric on any version control system developers may use •The type system we developed can typecheck programs with several versions at the same time •The dispatching function dynamically decides what is the best version of a particular component for each request 25
  • 26. Conclusions & Future Work •As a proof of concept we have implemented our programming model as a prototype using the Flow typechecker and JavaScript •As future work, we want to formally certify the soundness of the approach •Also, experimental work must be performed with larger case-studies •We would also like to develop an IDE with this programming model built-in 26