Talk

11
Type-safe Evolution of Spreadsheets acome Cunha Joost Visser Tiago Alves Jo˜ ao Saraiva Universidade do Minho, Portugal, {jacome,jas}@di.uminho.pt Software Improvement Group, The Netherlands, {j.visser,t.alves}@sig.eu to be presented at FASE (ETAPS) 2011 17 – 21 January acome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 1 / 11

description

 

Transcript of Talk

Page 1: Talk

Type-safe Evolution of Spreadsheets

Jacome Cunha Joost Visser Tiago Alves Joao Saraiva

Universidade do Minho, Portugal, {jacome,jas}@di.uminho.ptSoftware Improvement Group, The Netherlands, {j.visser,t.alves}@sig.eu

to be presented at FASE (ETAPS) 2011

17 – 21 January

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 1 / 11

Page 2: Talk

Motivation

Spreadsheets are notoriously error-prone;

Many errors are introduced when changing data;

But many others when changing the structure;

Models capturing the interdependencies between data can help(inferable);

Co-evolution of models and instances.

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 2 / 11

Page 3: Talk

An Example

Budget for travel, hotel and local transportation expenses.

At the beginning of each year, it needs to be modified toaccommodate the next year;

Several steps are necessary:add three new rows, labels, update formulas, etc.

Very prone to errors.

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 3 / 11

Page 4: Talk

An Example - Changing the Model

For expenses before and after tax, additional columns need to beinserted in the block of each year.

The user needs to change all the year in the spreadsheet.

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 4 / 11

Page 5: Talk

ClassSheets: Specifying Spreadsheets

Erwig et al. have introduced ClassSheets to specify spreadsheets;

ClassSheets allow to express business object structures within aspreadsheet using concepts from the OO paradigm;

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 5 / 11

Page 6: Talk

Modeling our Example

Class to represent a year;

Class to represent budget line;

Class to represent the relationship between them.

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 6 / 11

Page 7: Talk

Spreadsheet Models in Haskell

We have created a representation for spreadsheet models based onClassSheets;

Reused the 2LT framework: when specifying a model transformation,we get for free functions to migrate data back and forward.

A

to&&

6 A′

from

ff

A, A′ data type and transformed data typeto witness function of type A→ A′

(injective and entire relation)from witness function of type A′ → A

(surjective, possibly partial)from ◦ to = idAWe can compose refinements

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 7 / 11

Page 8: Talk

Spreadsheet Models in Haskell - References

References pose a particular challenge;

We implemented them as a pair of selection functions: one selects thecell which is the reference and another select the referenced cell.

s

A

to&&

target ..

source00

T +3 A′

from

ff

source′nn

target′ppt

source Projection over type Aidentifying the reference

target Projection over type Aidentifying the referenced cell

source ′ = source ◦ fromtarget ′ = target ◦ from

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 8 / 11

Page 9: Talk

Evolution Rules

Combinators:

Pull up all the references: all references must be at the top level;Apply after and friends: applies another rules after something;

Semantic:

Insert column: insert a new column;Make it expandable: allows some part to be added more columns/rows;Split: moves a column and substitutes it by references to the newposition;

Layout:

Change orientation: from vertical to horizontal and vice versa;Normalize blocks: some results are not well formated;Shift: shift vertically, horizontally, up or down.

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 9 / 11

Page 10: Talk

Make It Expandable

It is possible to make a block expandable:

(label : clas)

id×head--

6 (label : (clas)↓)

id×tolistll

Its implementation is as follows:

expandBlock :: String → RuleexpandBlock str (label : clas) | compLabel label str = do

let rep = Rep {to = id × tolist, from = id × head }return (View rep (label : (clas)↓))

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 10 / 11

Page 11: Talk

Conclusions

We have created a safe representation of spreadsheet models (andinstances);

We shown rules for coupled evolution of models and instances;

We want to make this available for spreadsheet users;

We are working on an extension for OpenOffice;

Jacome Cunha (UMinho-SIG) Type-safe Evolution of Spreadsheets 11 / 11