TYPES 2018 - Braga, 18 June typing the evolution of ...
Transcript of TYPES 2018 - Braga, 18 June typing the evolution of ...
![Page 1: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/1.jpg)
typing the evolution of variational software
Luís Carvalho João Costa Seco Jácome Cunha
TYPES 2018 - Braga, 18 June
![Page 2: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/2.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
context
time
v0desktop
v1mobile
![Page 3: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/3.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
context
time
v0desktop
v1mobile
software of Theseus: as the software evolves and its parts are replaced and upgraded, and new parts are introduced, is it still the same software?
https://en.wikipedia.org/wiki/Ship_of_Theseus
![Page 4: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/4.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
context software extensions● bug fixes● backwards compatibility● architectural changes
○ adding new classes, types, traits, etc.
![Page 5: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/5.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
context time/product orientation● multiple targets● different licensing levels● service-based architectures● multiple live versions of service
endpoints supporting older client devices
![Page 6: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/6.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
motivation problems
● related versions share a significant amount of code
● no true guaranties about soundness of code sharing and evolution
● ad-hoc co-existence of versions and transitions between versions
![Page 7: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/7.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
motivation problems
● each commit represents an evolution step ● each branch represents a different version ● each merge establishes a sound co-existence and
transition between two versions
![Page 8: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/8.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
motivation problems
~ git + branching + merging within the core language
![Page 9: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/9.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach principles● software development tools based on lightweight type-based verification● types ensure evolution, like git, but sound with branching & merging● we extend FeatherweightJava (Igarashi et al.) with
○ native support for versions in the codebase■ base versions■ single versions
○ support for lenses that specify how the state transition between one version and another is performed
○ type system that ensures evolution is sound
![Page 10: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/10.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach example
class Post extends Object { Boolean priv, draft; Post(Boolean priv, Boolean draft) { this.priv = priv; this.draft = draft; } Post active() { return new Post(false, false); } Boolean isPrivate() { return this.priv; }}
v1
![Page 11: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/11.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach example
class Post extends Object { Boolean priv, draft; Post(Boolean priv, Boolean draft) { this.priv = priv; this.draft = draft; } Post active() { return new Post(false, false); } Boolean isPrivate() { return this.priv; }}
v1
change the variable representing the status to a String instead of two Booleans.
what do we need to refactor?
![Page 12: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/12.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach example
class Post extends Object { Boolean priv, draft; Post(Boolean priv, Boolean draft) { this.priv = priv; this.draft = draft; } Post active() { return new Post(false, false); } Boolean isPrivate() { return this.priv; }}
class Post extends Object { String st; Post(String st) { this.st = st; } Post active() { return new Post("active"); } Boolean isPrivate() { return this.st.equals("private"); } String status() { return this.st; }}
v1 v2
change the variable representing the status to a String instead of two Booleans.
refactoring
![Page 13: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/13.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampledo we need to refactor everything?
class Post extends Object { Boolean priv, draft; Post(Boolean priv, Boolean draft) { this.priv = priv; this.draft = draft; } Post active() { return new Post(false, false); } Boolean isPrivate() { return this.priv; }}
class Post extends Object { String st; Post(String st) { this.st = st; } Post active() { return new Post("active"); } Boolean isPrivate() { return this.st.equals("private"); } String status() { return this.st; }}
v1 v2
refactoring
![Page 14: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/14.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampledo we need to refactor everything?what about defining how the state transitions from v1 to v2, and then take advantage of the existing implementation?
class Post extends Object { Boolean priv, draft; Post(Boolean priv, Boolean draft) { this.priv = priv; this.draft = draft; } Post active() { return new Post(false, false); } Boolean isPrivate() { return this.priv; }}
class Post extends Object { String st; Post(String st) { this.st = st; } Post active() { return new Post("active"); } Boolean isPrivate() { return this.st.equals("private"); } String status() { return this.st; }}
v1 v2
refactoring
![Page 15: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/15.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleversion 1class Post extends Object { Boolean priv@1, draft@1; Post@1(Boolean priv, Boolean draft) {
this.priv = priv;this.draft = draft;
} Post active@1() {
return new Post(false, false); } Boolean isPrivate@1() {
return this.priv; }}
declare version 1
tag fields, constructor, and methods as belonging to v1
![Page 16: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/16.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleadd declaration for version 2
add needed fields, constructor, and methods for v2 - but keep the existing ones from v1!
version 1version 2 extends 1class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {
return new Post(false, false); } Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
String st@2;
![Page 17: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/17.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleadd lenses to the constructors describing how state transitions from one version to the other
no need to re-implement the methods from v1
version 1version 2 extends 1class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {
return new Post(false, false); } Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
this@1(st.equals("private"),st.equals("draft"));
String st@2;
![Page 18: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/18.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplethe entire codebase is versioned and so, at each point in time, the developer only sees a slice of the codebase corresponding to the version they are developing
version 1version 2 extends 1class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {
return new Post(false, false); } Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
this@1(st.equals("private"),st.equals("draft"));
String st@2;
![Page 19: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/19.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleversion 1class Post extends Object { Boolean priv, draft; Post(Boolean priv, Boolean draft) {
this.priv = priv;this.draft = draft;
} Post active() {
return new Post(false, false); } Boolean isPrivate() {
return this.priv; }}
this@2(priv?"private":(draft?"draft":"active"));
the entire codebase is versioned and so, at each point in time, the developer only sees a slice of the codebase corresponding to the version they are developing
![Page 20: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/20.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleversion 2 extends 1class Post extends Object { String st; Post(String st) {
this.st = st;
} String status() {
return this.st; }}
this@1(st.equals("private"),st.equals("draft"));
the entire codebase is versioned and so, at each point in time, the developer only sees a slice of the codebase corresponding to the version they are developing
![Page 21: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/21.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleversion 1version 2 extends 1class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {
return new Post(false, false); } Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
this@1(st.equals("private"),st.equals("draft"));
String st@2;
at any time, the developer may look at a different version and examine the code for that version (~ git checkout)
![Page 22: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/22.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach exampleany expression runs in a given context, provided by the version in which it is to be executed
version 1version 2 extends 1class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {
return new Post(false, false); } Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
this@1(st.equals("private"),st.equals("draft"));
String st@2;
![Page 23: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/23.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 24: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/24.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 25: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/25.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 26: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/26.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 27: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/27.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
@2(new Post("active").status())
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 28: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/28.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
@2(new Post("active").status())
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 29: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/29.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
@2(new Post("active").status())
@2("active")
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 30: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/30.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
@2(new Post("active").status())
@2("active")
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 31: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/31.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
technical approach examplederivation
@2(new Post("draft").active().status())
@2(@1(new Post(false, false)).status())
@2(new Post("active").status())
@2("active")
"active"
class Post extends Object { Boolean priv@1, draft@1;
Post@1(Boolean priv, Boolean draft) {this.priv = priv;this.draft = draft;
}
Post active@1() {return new Post(false, false);
} Boolean isPrivate@1() {
return this.priv; }
}
Post@2(String st) {this.st = st;
}
String status@2() {return this.st;
}
this@2(priv?"private":(draft?"draft":"active"));
String st@2;
this@1(st.equals("private"),st.equals("draft"));
![Page 32: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/32.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax
![Page 33: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/33.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax: versions and classes
![Page 34: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/34.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax: versions and classes
![Page 35: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/35.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax: versions and classes
![Page 36: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/36.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax: versions and classes
![Page 37: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/37.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax: versions and classes
![Page 38: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/38.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language syntax: versions and classes
![Page 39: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/39.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types
extension of the FWJ typing rules by enriching the context with version v
![Page 40: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/40.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types: version
if e has type C in version v', then @v'(e) has type C in version v
![Page 41: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/41.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types: constructor
![Page 42: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/42.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types: constructor
lenses must be well-typed within the constructor of the source version
![Page 43: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/43.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types
extension of the FWJ typing rules by enriching the context with version v
![Page 44: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/44.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types
base version lookup:
v1
v2
v3
v4
version hierarchy for class Cgreen means there is a constructor for that version
base1 (C) = 1
base2 (C) = 1
base3 (C) = 3
base4 (C) = 4
![Page 45: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/45.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types
fields lookup:
v1
v2
v3
v4
version hierarchy for class Cgreen means there is a constructor for that version
base1 (C) = 1
base2 (C) = 1
base3 (C) = 3
base4 (C) = 4
![Page 46: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/46.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language types
v1
v2
v3
v4
method type lookup:
version hierarchy for class Cgreen means there is a constructor for that version
![Page 47: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/47.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language semantics
extension of the FWJ semantics by enriching the context with version v
![Page 48: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/48.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language semantics: version upgrade
![Page 49: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/49.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language semantics: method call
method body lookup:
![Page 50: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/50.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language semantics: method call
method body lookup:
![Page 51: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/51.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language semantics: method call
method body lookup:
![Page 52: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/52.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
language semantics: method call
method body lookup:
![Page 53: TYPES 2018 - Braga, 18 June typing the evolution of ...](https://reader033.fdocuments.us/reader033/viewer/2022051319/627b00600c70d264821f9918/html5/thumbnails/53.jpg)
Typing the Evolution of Variational SoftwareLuís Carvalho, João Costa Seco & Jácome CunhaTYPES 2018 - Braga, 18 June
conclusions● type- & language-based approach to code evolution and software product
lines management● extend a core language (Featherweight Java) with a typing discipline that
ensures the sound evolution of state and code○ analyse the codebase as a whole○ keep all versions well-typed○ ensure that version/state transformations are checked○ detect illegal version context crossings○ standard subject reduction results
● execute all versions simultaneously with seamless transitions● slice versions/variants from the whole codebase