Carmen M. Reinhart, Kenneth S. Rogoff (2010). "Growth in a Time of Debt". American Economic Review 100 (2): 573–78.
“George Osborne’s favourite ‘godfathers of austerity’ economists admit to making error in research” — the Mirror
“The Rogoff-Reinhart data scandal reminds us economists aren’t gods” — The Guardian
“The Excel Depression” — Paul Krugman
The art of programming is the art of organising complexity [...] — Edsger W. Dijkstra (1930–2002)
Controlling complexity is the essence of computer programming. — Brian Kernighan (1942–)
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. — C. A. R. Hoare (1934–)
Complex | Modular | Abstract |
---|---|---|
Decompose the system into separate, weakly-coupled parts, with well-defined interfaces between them. |
“Abstraction principle: Each significant piece of functionality in a program should be implemented in just one place in the source code. Where similar functions are carried out by distinct pieces of code, it is generally beneficial to combine them into one by abstracting out the varying parts.” — Benjamin C. Pierce, Types and Programming Languages |
Worksheets are often used to separate concerns
Columns are often used to group elements of a repeated calculation
But: it's hard to define the "interfaces"
=IFERROR(INDEX(INDIRECT($C10 & ".Outputs[" & this.Year & "]"),
MATCH(G$5, INDIRECT($C10 & ".Outputs[Vector]"), 0)), 0)
Operations are repeated
Large formulae are repeated
=IFERROR(INDEX(INDIRECT($C10 & ".Outputs[" & this.Year & "]"),
MATCH(G$5, INDIRECT($C10 & ".Outputs[Vector]"), 0)), 0)
No structured data, higher-order functions, ...
Spreadsheets are incremental
Spreadsheets are immediate
... and, perhaps, because abstraction is not easy
Observe that spreadsheets are already a lot like a simplistic programming language
Write this language explicitly, so that spreadsheets are written as programs
Generalise the language to include more powerful features
|
Very simple term graph: only values and built-in functions. No user-defined types, no lambda abstractions, no first-class functions, no iteration or recursion.
Topological sort: | Then write out each step: |
|
Poor choice of surface syntax for users: too many definitions. But perhaps useful as a target language which can then be used to generate any particular spreadsheet (Excel, Numbers, ...)
cell | Full language, supporting abstraction and modularity. Ideally, a superset of nocell. |
nocell | A language with the same expressive power as a spreadsheet (and no more) but a more convenient surface syntax. |
grid | An intermediate representation of a spreadsheet, from which a number of backends could produce specific formats. |
(No probabilistic elements yet.)
Perhaps a conventional function syntax?
times(0.20, minus(21000, 11000))
But spreadsheet modellers tend to think in terms of a "data-flow" model: Here's some data; here's the operation; here's the result; here's an operation on that ...
cf. the R package ‘magrittr’, which allows one to write, eg,
data %>% filter() %>% summarise()
=> Can we retain this style of interactive / incremental programming?
Why not just write the spreadsheet as if you were writing a spreadsheet?
Postfix | Spreadsheet-y |
---|---|
|
|
|
|
Does cell “compile” to nocell?
Or is it a “nocell-constructing” language?
“Spreadsheets as values”
It would be ideal if, every time the user hits ‘return’, the spreadsheet-so-far is generated, and that spreadsheet is the same as the one obtained by compiling/running the program so far.
cell | nocell | grid | |
---|---|---|---|
Semantics | Functional, first-class functions, rich set of data types, user-defined data types, | Purely functional, primitive types only (numeric, string, boolean, perhaps vector), built-in functions only, names. | Like nocell, but every expression assigned to a cell. Names changed to named ranges. |
Surface syntax | ? |
|
|
Other | Structures annotated with information to inform layout. | Cells annotated with information to determine cell style. |
Use an existing language for stochastic simulation and inference, restricting class of models to those expressible in nocell
Add stochastic data with a few new VBA functions (eg, =NORMAL(0,1)
)
Output of PPL modelled as Monte Carlo runs on separate worksheet, with named ranges, eg, =MEDIAN(param1)
Must make at least some tasks easier, eg,
Formatting tables (always a pain), "LaTeX for spreadsheets";
Make probabilistic calculations possible.
Must extend the "natural" language of spreadsheets
Must allow incremental transition from concrete to abstract
Must be interactive
User-centred functions (SPJ)
Gencel (templates for Excel)
ModelSheet Authoring (specific kinds of models)
Tabular
Improv
Scenarios (FW)
Maximisation
Dynamic simulation
Agent-based simulation
Equilibrium-finding
“Full” Bayesian inference