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

Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsAArockiyaNisha
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...jana861314
 
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
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfSumit Kumar yadav
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTSérgio Sacani
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptxRajatChauhan518211
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 sciencefloriejanemacaya1
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoSérgio Sacani
 
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
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhousejana861314
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 

Recently uploaded (20)

9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Natural Polymer Based Nanomaterials
Natural Polymer Based NanomaterialsNatural Polymer Based Nanomaterials
Natural Polymer Based Nanomaterials
 
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
Traditional Agroforestry System in India- Shifting Cultivation, Taungya, Home...
 
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...
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdf
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOST
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
Boyles law module in the grade 10 science
Boyles law module in the grade 10 scienceBoyles law module in the grade 10 science
Boyles law module in the grade 10 science
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
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
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
Orientation, design and principles of polyhouse
Orientation, design and principles of polyhouseOrientation, design and principles of polyhouse
Orientation, design and principles of polyhouse
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 

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