Hermans Treats Excel as Functional Code, Demands Engineering Tools

Pure Functional Programming in Excel • Felienne Hermans • GOTO 2016 — GOTO Conferences

GOTO Conferences

Because companies rely on Excel's functional engine to bypass slow IT departments, critical spreadsheet models require traditional software engineering practices such as automated refactoring and regression testing.

AI-assisted summary of Pure Functional Programming in Excel • Felienne Hermans • GOTO 2016 — original source. Check the original for full context.

Source published:

Key ideas

  • Spreadsheets operate as Turing-complete, pure functional programs without side effects, providing instantaneous live programming feedback across millions of corporate business models. (0:11)
  • Empirical corporate spreadsheet analysis reveals an average model lifecycle of 5 years with 12 distinct users, yet only one in three models includes any documentation. (0:11)
  • Around 8% of real-world spreadsheets naturally contain informal assertions disguised as error-flagging formulas, paving the way for dedicated testing suites like Expector. (33:47)
  • Spreadsheet formulas exhibit classic software engineering code smells such as long methods, feature envy across worksheets, and duplicate expressions that impair calculation caching. (22:50)

Detailed notes

## Background Published on YouTube by GOTO Conferences on August 9, 2016, this presentation features Assistant Professor Felienne Hermans speaking at GOTO Amsterdam 2016. According to the video description, the talk examines Excel as the world's most widely used programming language, illustrating how spreadsheets naturally execute functional programming concepts such as sorting, dynamic programming, and lambdas.

## TL;DR Felienne Hermans makes the case that spreadsheets are legitimate software code, noting that Excel pioneered pure functional, side-effect-free programming and live recalculation long before modern paradigms caught on. Demonstrating array formulas, monad-like error lifting, and a dynamic programming maze solver in native cells, she shows that spreadsheets solve the same complex computational problems as general-purpose languages. Because corporate workbooks suffer from the exact same maintenance issues as legacy codebases—including code smells and architectural coupling—she advocates applying classical software engineering to the medium. To bridge this gap, Hermans showcases tools developed at TU Delft: Bumblebee for automated formula refactoring and Expector for detecting existing assertions and mapping visual test coverage.

## Atmosphere & style The presentation is energetic, witty, and unapologetically contrarian, carried by Hermans's vibrant stage presence and crusading enthusiasm to defend spreadsheet users against developer elitism. She balances academic rigor with self-deprecating jokes, teasing the audience about testing skepticism, tossing t-shirts for correct answers, and illustrating high-level functional concepts with playful examples of money-filled mazes. The talk feels lively and vindicating, turning what many programmers dismiss as boring office software into a dynamic, visually screaming playground of computer science.

## Bulletin - [00:11](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=11s) Spreadsheets operate as Turing-complete, pure functional programs without side effects, providing instantaneous live programming feedback across millions of corporate business models. - [00:11](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=11s) Empirical corporate spreadsheet analysis reveals an average model lifecycle of 5 years with 12 distinct users, yet only one in three models includes any documentation. - [33:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2027s) Around 8% of real-world spreadsheets naturally contain informal assertions disguised as error-flagging formulas, paving the way for dedicated testing suites like Expector. - [22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) Spreadsheet formulas exhibit classic software engineering code smells such as long methods, feature envy across worksheets, and duplicate expressions that impair calculation caching.

## Key takeaways - [00:11](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=11s) Spreadsheets are genuine software code that implement standard domain calculations, investment advice, and complex business logic typically assigned to general-purpose programming languages. - [00:11](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=11s) Business units frequently favor end-user spreadsheet development over traditional IT vendor engagements due to lower costs, faster turnaround, and immediate adaptability. - [04:20](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=260s) Excel formulas constitute a pure functional programming environment where evaluations produce outputs without side effects or mutating external cell states. - [04:20](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=260s) Spreadsheets pioneered live programming decades before modern IDEs, recalculating downstream dependency graphs instantly upon each cell edit without explicit compilation. - [06:56](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=416s) Named ranges and implicit row intersections enable developers to write clear, uniform functional expressions without hardcoded relative cell coordinates. - [11:08](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=668s) Array formulas wrap list mapping, filtering, and reduction pipelines into single-cell evaluations without requiring cluttering helper columns. - [12:01](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=721s) Excel's automatic error propagation across arithmetic operators treats errors as algebraic data types similar to a Maybe or Either monad. - [13:54](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=834s) Dynamic programming models can be natively structured in Excel grids by tabling intermediate subproblem states to solve complex optimization problems like cash mazes. - [17:26](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1046s) Formula-driven directional vector fields provide intuitive visual backtracking and route optimization directly inside the spreadsheet grid. - [21:07](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1267s) Spreadsheet development mirrors historical software engineering crises, lacking standard IDE tooling to prevent architectural decay, bad smells, and orphaned code. - [22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) Formula-level code smells include excessive nesting, unreadable parameter dispersion, and duplicate subexpressions that bypass Excel's cell-result calculation cache. - [26:02](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1562s) Cross-sheet Feature Envy and cyclic worksheet dependencies cause expensive cognitive context switching and brittle inter-file architectures. - [31:38](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1898s) The BumbleBee plugin introduces automated formula refactoring with domain-specific rewrite rules, interactive previews, and programming-by-example synthesis. - [33:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2027s) Non-technical spreadsheet authors naturally author ad-hoc conditional tests (e.g., verifying sums equal 100%), which can be extracted into formalized test suites. - [36:12](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2172s) The Expector plugin automatically detects existing assertions, generates visual dependency test coverage, and guides authors to test complex, high-risk calculation hubs. - [41:53](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2513s) Critical enterprise sectors like banking and insurance rely fundamentally on complex Excel models, making rigorous spreadsheet software engineering tooling vital.

## Detailed walkthrough ### [00:11](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=11s) The Gospel: Spreadsheets Are Code

Felienne Hermans, Assistant Professor at Delft University of Technology, opens her presentation by challenging common developer perceptions of spreadsheets. Most software developers dismiss spreadsheets as merely "data," but Hermans insists that spreadsheets are genuine software code. In fact, she calls this belief the defining mission of her career: “Spreadsheets are code. This is the gospel of my life.” She jokingly tells the audience that if they want to leave, fall asleep, or answer emails right then, they can, because that single assertion is the core takeaway of the entire presentation.

To justify why spreadsheets are code, Hermans outlines three fundamental arguments:

1. **Spreadsheets Solve the Same Problems as General-Purpose Languages:** Hermans displays an example of an investment calculation where an end user supplies numbers and receives investment advice. This logic could easily be implemented in C, Objective-C for an iPad app, Java, or an Excel workbook. The business problem itself has nothing uniquely "spreadsheet-like" about it; it is standard business software logic. 2. **End-User Software Development Beats Traditional IT:** During her PhD research, Hermans worked alongside Dutch banks and investment institutions and asked business stakeholders why they built critical systems in Excel instead of commissioning proper corporate software from internal or external IT vendors. She candidly reveals the answer: “You know why? Because we are bad at making software. Seriously.” When business units hand over prototype spreadsheets to IT, vendors promise delivery in six months for €1,000,000. In reality, delivery drags out to nine months, costs €3,000,000, and delivers only half the requested features. Consequently, business users see themselves as faster, more effective developers than professional programmers because they can produce working prototypes on demand. 3. **Turing Completeness:** To definitively shut down claims that spreadsheets are not a real programming language, Hermans built a fully functional Turing machine using only native Excel formulas. In her implementation, each row represents an iteration step of the machine's tape, while conditional formatting highlights and tracks the machine's head moving across cells. This setup creates a clear visualization where the tape's entire execution history remains inspectable across rows rather than being overwritten in place. The project went viral, hitting the front pages of Hacker News and Reddit and crashing her personal blog for half a day.

```mermaid flowchart TD accTitle: Spreadsheets as Code Argument accDescr: Three reasons why spreadsheets qualify as genuine software code.

subgraph CoreArg["Core Proposition"] C["Spreadsheets Are Code"] end

subgraph Evidence["Supporting Arguments"] E1["Solves standard domain problems\n(finance, calculations, advice)"] E2["Empowers end users over\nslow, costly IT development"] E3["Turing complete\n(Turing machine in pure formulas)"] E4["Suffers classic software engineering woes\n(no docs, long lifespan, multi-user)"] end

E1 --> C E2 --> C E3 --> C E4 --> C ```

- An average corporate spreadsheet is used by 12 distinct individuals over a lifespan of 5 years. - Only one in three spreadsheets includes any form of user manual or documentation. - These maintenance and lifecycle issues closely mirror the exact software crisis that classical software engineering experienced 20 to 30 years prior, when software engineering degrees and standardized toolchains did not yet exist.

[04:20](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=260s) Why Excel Is the Next Language to Learn

Hermans argues that developers should not merely tolerate spreadsheets; they should actively learn Excel as their next language. She puts it bluntly: “Resistance is futile.” Spreadsheets inherently possess three characteristics that modern software movements revere:

- **True Live Programming:** Computer scientist Bret Victor popularized "live programming" by demonstrating an environment where editing source code on the right side of a split view instantly updates a rendered visual tree on the left without any manual compile phase. Hermans notes that the software industry has had this exact workflow since VisiCalc: the moment an end user edits a formula cell, every dependent computation across the workbook recalculates instantly without an explicit compilation step. - **Pure Functional Programming:** While the programming world treats functional programming as a recent resurgence, Excel has been pure functional programming from day one. A native Excel formula is inherently free of side effects; it accepts cell inputs, evaluates a calculation, and outputs a value into its host cell. It cannot mutate values in other cells or cause external side effects. - **Unrivaled Adoption:** Spreadsheets are ubiquitous across every facet of modern society, from a local neighbor organizing soccer club finances to certified accountants calculating tax returns. Developers are often the only demographic blind to this reality.

Emphasizing the sheer scale of the tool, Hermans observes: “I really like to say that spreadsheets are the most successful programming language in the history of mankind. It's such a good programming language that people don't even know they're programming.” By contrast, nobody ever accidentally writes Java; people inadvertently program in Excel every single day.

[06:56](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=416s) Functional Mapping and Named Ranges

Referring to Robert C. Martin's ("Uncle Bob") definition that functional programming is simply programming without assignment statements, Hermans demonstrates how basic mathematical pipelines map onto a spreadsheet. She begins with an example squaring a list of integers:

1. **Relative Cell Mapping:** Entering a formula such as `=A2 * A2` and dragging the fill handle (or double-clicking the corner) down the column automatically adjusts relative row references. This is functionally equivalent to a higher-order `map` operation applied across an input list. 2. **Eliminating Fragile Cell Addresses:** Professional developers often dislike the visual clutter of varying relative row references (such as `A2`, `A3`, `A7`). Hermans resolves this by selecting the input values and defining a named range called `input`. 3. **Implicit Intersection:** When a user enters `=input * input` beside the named column, Excel performs implicit intersection: the formula automatically resolves `input` to the specific cell value sharing that exact row. This makes the formula uniform across all cells in the column, mirroring clean source code without hard-coded row coordinates.

[08:44](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=524s) Conditional Sums and Array Formulas

Hermans then raises the stakes: calculating the sum of all squares that exceed 30.

A traditional spreadsheet approach splits the pipeline into multiple explicit intermediate columns: 1. Compute the squared values. 2. Add a boolean comparison column checking if the squared value is greater than 30 (evaluating to `TRUE` or `FALSE`). 3. Aggregate the values using `=SUMIF(...)`, which filters the range based on the boolean condition and sums the matching squares.

While this approach works, it wastes substantial grid real estate and requires extra helper columns for booleans and squares. To make the calculation compact and treat arrays as first-class citizens, Hermans demonstrates Excel array formulas.

Excel can treat boolean evaluations numerically (interpreting `FALSE` as `0` and `TRUE` as `1`), meaning values can be filtered through direct pairwise multiplication. Rather than relying on implicit row intersection via standard Enter, pressing `Ctrl` + `Shift` + `Enter` signals to Excel that the formula must be evaluated as an array formula, wrapping it in curly braces (`{...}`).

By applying an array formula to `=input * input`, the entire input range is multiplied by itself pairwise in memory. When placed into a single cell, it returns the first calculated element of the resulting array; if copied across a five-row span, it displays the first five elements of the resulting computed vector without needing intermediate helper cells.

[11:08](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=668s) Array Formulas and In-Cell Reduction

Hermans shows how an array formula produces a virtual second array without requiring helper cells across the spreadsheet. Instead of allocating columns of intermediate data, an author can reduce that entire array right inside a single expression. By wrapping the operation in a `SUM`, one can multiply an entire range pointwise with itself and sum the results simultaneously. Hermans adds a condition directly inside the calculation—multiplying the input array by whether each value exceeds thirty—effectively combining mapping, filtering, and reduction into one compact formula: “so in just one formula we don't need all the extra cells just in one formula I'm multiplying the range pointwise with itself and I'm summing everything”.

This concise pipeline means an analyst can delete clutter and spare worksheets entirely. The spreadsheet engine evaluates the vectors internally, demonstrating how array formulas replicate higher-order functional patterns without sacrificing processing efficiency.

[12:01](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=721s) Error Values, Lifted Operators, and the Accidental Monad

Turning to how spreadsheets handle edge cases, Hermans highlights that Excel's intuitive error system hides sophisticated type behavior under the hood. To illustrate, she populates an input column with random integers between zero and three and then attempts to divide by that range, humorously labeling the resulting calculation column the "danger zone" because zeros inevitably trigger division-by-zero errors. When `#DIV/0!` appears, Hermans asks the audience to consider the underlying data type of that column, prompting functional programmers in the room to recognize it as a `Maybe Int`.

```mermaid flowchart LR accTitle: Lifted Addition over Maybe Int accDescr: Visualizing how Excel automatically lifts arithmetic addition across integers and error values. subgraph S1["Inputs"] A["Integer (e.g. 5)"] B["Error (#DIV/0!)"] end subgraph S2["Lifted Operator (+)"] C["+ (Lifted)"] end subgraph S3["Outputs"] D["Integer Result"] E["Error (#DIV/0!)"] end A --> C --> D B --> C --> E ```

Rather than crashing or halting execution, downstream calculations seamlessly propagate these errors. An adjacent formula adding a constant to that column operates without an explicit null or exception check; the plus operator is automatically lifted to accept either an integer or an error value. Hermans points out the irony that hundreds of millions of people practice advanced functional patterns every single day without realizing it: “this is a 700 million Excel users they just use monads without any problems they don't even think about it because if we have another column that uses this maybe int as an input it just works”.

- Dividing by a column seeded with random values from `0` to `3` introduces sporadic `#DIV/0!` errors into the range. - Downstream arithmetic formulas treat cells not as bare `Int`, but as an algebraic data type equivalent to `Maybe Int` (or `Either Error Int`). - Excel automatically lifts built-in operators like `+` to work polymorphically across valid integers and error values.

[13:54](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=834s) Dynamic Programming in a Money-Filled Maze

Moving beyond basic array operations, Hermans tackles a classic algorithmic challenge: navigating a grid-based maze loaded with cash to collect the maximum possible reward. As she jokes, “I'm a poor academic so I need to get my money from programming examples that are set in a maze”. While one could write a recursive search that works backward from the destination by taking the maximum payoff of the two preceding steps, naive recursion re-evaluates the same overlapping paths repeatedly, making it computationally expensive.

```mermaid flowchart TD accTitle: Dynamic Programming Matrix Computation accDescr: How cell values in the Max sheet depend on the maximum of adjacent subproblems plus current cell cash. subgraph Grid["Max Worksheet Cell Evaluation"] Up["Cell Above (Subproblem Max)"] Left["Cell to Left (Subproblem Max)"] MaxOp{"MAX(Up, Left)"} Curr["Current Maze Value"] Result["Current Cell Max Value"]

Up --> MaxOp Left --> MaxOp MaxOp --> Result Curr --> Result end ```

To solve this efficiently, Hermans introduces dynamic programming by tabling subproblem solutions on a dedicated worksheet called `Max`. Because movement is constrained to rightward and downward steps, cells along the top and left borders have only a single arrival path. For every other interior cell, the formula simply takes the maximum of the two adjacent predecessor cells on the `Max` sheet and adds the monetary value present at the current maze square: “this is a very famous problem in computer science with the solution in C or even in Haskell it really looks very easy in a spreadsheet this is the only formula you need for the entire maze and you have your answer”.

[17:26](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1046s) Vector Fields and Visual Backtracking

Knowing the maximum potential earnings is only half the battle; an optimal algorithm must also yield the exact route to take. Rather than manually retracing the scores or writing an external solver, Hermans crafts formulas that output arrow-like characters to build a directional vector field pointing toward whichever neighbor provided the optimal payoff. Border cells point unidirectionally up or left, while interior cells evaluate which neighbor holds the maximum value and point toward it.

Because a dense grid of arrows requires excessive mental overhead, Hermans refines the logic so that only cells belonging to the winning trajectory render an arrow, leaving non-path cells as empty strings. By inspecting whether a cell is actively pointed to from the bottom or from the right, the worksheet automatically illuminates the single optimal path across the board:

```text Formula Logic: =IF(OR(Below = "^", Right = "<"), Direction_To_Max, "") ```

Hermans emphasizes that this interactive feedback loop highlights the core strength of live programming. In typical text-based languages, inspecting intermediate stages requires print statements, debuggers, or pencil and paper. In a spreadsheet, the computation and the visual state are permanently unified: “the data is right there it's screaming at you you're like use me give me some formulas and I will tell you what I'm up to and that makes spreadsheet programming really very very easy and intuitive”. She passionately urges the audience to defend the medium's legitimacy: “if everyone say anyone close to you says it's just a spreadsheet hit them on the head with something really tell them it's untrue spreadsheets are real programming and it's super cool”.

[21:07](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1267s) Bringing Software Engineering to Spreadsheet Code

Hermans transitions from spreadsheet demonstrations to the broader academic research she leads at Delft University of Technology, arguing that if spreadsheets are genuinely code, they deserve the discipline of software engineering. She draws a historical parallel to traditional programming twenty-five to thirty years earlier, when end-user programming was the norm and developers routinely rolled out bespoke compilers without formal maintenance practices. Over time, industry recognized the crisis of orphaned legacy systems and engineered modern development environments equipped with testing frameworks, debuggers, and code-metric analysis tools.

These modern IDE capabilities do not merely assist in typing out syntax; they structure disciplined engineering behavior: “those features are not helping me to build codes to write codes they're helping me to write responsible code to be a good developer”. In contrast, mainstream spreadsheet tools like Excel historically focused on presentation and rapid calculation while omitting the foundational scaffolding needed to safeguard, test, and analyze mission-critical business logic.

[22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) Code Smells in Spreadsheet Formulas

Excel offers virtually no tool support or IDE-like assistance to guide developers toward good spreadsheet design. Users are free to write unreadable formulas like `A2 * A3` or give cells descriptive, maintainable names; either way, the interface remains completely agnostic and offers zero feedback or encouragement to structure things better. Because spreadsheets share core characteristics with traditional source code, ideas from software engineering can be brought directly to spreadsheets. During her PhD dissertation, Felienne Hermans explored adapting traditional code smells to spreadsheet formulas:

- **Long Formula (analogous to Long Method):** Length is evaluated by cognitive complexity rather than sheer character count. A formula that combines multiple operations—such as adding, multiplying, and dividing all in one go—exhibits this smell. “If a lot is going on in a formula, it's just as smelly and for the same reason as a long method is smelly,” Hermans argues. - **Many Parameters:** In traditional code, a method littered with knobs and parameters becomes brittle and unmaintainable. In Excel, a formula referencing half a dozen disparate cells scattered across a sheet causes identical readability headaches. - **Conditional Complexity:** Excel permits deeply nested `IF` statements. Early versions had an arbitrary limit of seven nesting levels, but that restriction was removed, allowing nesting depths of up to 64. When spreadsheet creators nest six to eight conditions, tracing and debugging becomes painful. - **Clones (Duplicate Code):** Just as duplicated logic hurts software maintainability when changes must be made in multiple places, subformulas repeated within the same cell or across cells cause problems. Beyond maintainability, spreadsheet clones damage execution speed. Hermans explains that Excel's internal caching model caches computed cell results, but does not cache intermediate subformulas. In a formula containing an identical expression like `EXP(0 - G36 * C36)` twice, the execution engine evaluates the exact same mathematical operation from scratch both times. Extracting duplicate expressions into separate intermediate cells cuts recalculation time in half.

[26:02](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1562s) Worksheet-Level Architectures and Dependency Smells

```mermaid flowchart TD accTitle: Spreadsheet Architectural Smells accDescr: Three architectural patterns found in spreadsheet dependency graphs

subgraph Normal["Clean Model Flow"] direction LR I["Inputs"] --> C["Calculations"] --> R["Reports"] end

subgraph Cyclical["Tight Coupling Smell"] direction LR S1["Sheet 1"] <-->|"Bidirectional References"| S2["Sheet 2"] end

subgraph Fragile["External Folder Smell"] direction LR F1["File A.xlsx"] --> M["Master Model"] F2["File B.xlsx"] --> M end ```

Smells are not restricted to individual formulas; they also manifest at the architectural level across entire workbooks. Hermans built a dependency visualization tool that renders worksheets as blocks and inter-sheet formulas as directed arrows (e.g., an arrow connecting an `Inputs` tab to a `Calculation` tab containing `=Inputs!A1 * 12`). Visualizing real-world corporate workbooks exposed messy architectures:

- **Evolving Prototypes Left in Production:** One workbook showed quarters Q2, Q3, and Q4 cleanly structured across their monthly sheets, while Q1 (January, February, March) had a totally different dependency topology. When asked, the author confessed that Q1 had been a scratchpad prototype. Although they rebuilt the model cleanly starting in Q2, the model rolled into the next calendar year without anyone ever migrating Q1 to the new pattern. - **Cyclic Coupling (Feature Envy at Scale):** Visualizations between paired sheets revealed bidirectional arrows, where formulas on Sheet 1 pulled from Sheet 2, and formulas on Sheet 2 reached directly back into Sheet 1 across corresponding rows, indicating an unorganized data model crying out for consolidation. - **The "Wobbly" External Network:** One organization used a master model connected to external worksheets located across various disparate files. The business process consisted of colleagues emailing individual spreadsheets back and forth, saving them into a shared network folder, and opening the master workbook to pull the numbers. Hermans describes this system as “very wobbly to to say the least.”

[28:28](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1708s) Feature Envy and the Infotron Spin-off

At the architectural level, Hermans draws a direct parallel to object-oriented class smells. Presenting two coupled classes to the audience, she asked what smell they exhibited; when an audience member called out "bad naming," she laughed, agreed it was true, and admitted she had been too lazy to rewrite the slides, before awarding a t-shirt to an attendee who correctly identified the problem as **Feature Envy**. In object-oriented programming, Feature Envy describes a method that constantly reaches into another class's fields rather than working on its own data.

In spreadsheets, Feature Envy occurs when a formula placed on one sheet consists almost entirely of references pointing to another worksheet. Hermans illustrates this with a formula on an `Income Statement` worksheet pulling building and depreciation metrics from a `Required Funds` sheet:

$$\text{Formula on Income Statement} = \frac{\text{Required Funds}!B9}{\text{Required Funds}!C9} + \dots$$

``` =Required Funds!B9 / Required Funds!C9 + Required Funds!B10 / Required Funds!C10... ```

Tracing this logic forces a user to jump back and forth between sheets to map cell coordinates to their actual labels. “We know from cognitive science that context switches are very expensive,” Hermans points out; “if you have to switch views all the time, that's super annoying.” Relocating the formula directly onto the `Required Funds` worksheet offers immediate ergonomic benefits: 1. Excel automatically highlights all local cell dependents with colored overlay boxes, making the formula visual and readable. 2. The sheet prefixes (`Required Funds!`) vanish entirely, shortening the formula and making the underlying mathematical pattern obvious.

An audience member noted that you could also refactor out common terms, such as factoring out a `/ 12` division. Hermans noted that this research led to the launch of **Infotron**, a university spin-off tool where corporate users upload workbooks to automatically detect code smells, including formulas that should be migrated to adjacent sheets.

[31:38](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1898s) Automated Refactoring with Bumblebee

Identifying smells naturally demands a systematic way to repair them. Hermans and her team developed a spreadsheet refactoring plug-in named **Bumblebee**, bringing modern IDE refactoring capabilities directly into Excel:

- **Formula Transformations:** Bumblebee detects opportunities to streamline formulas, such as replacing a manual `=SUM(range) / COUNT(range)` with `=AVERAGE(range)`. While many users know the `AVERAGE` function, other transformations provide larger benefits, such as converting nested formulas into a `=SUMIF()`—a function many spreadsheet users either do not know or do not know how to construct properly. - **Interactive Previews:** Just like a code refactoring tool in an IDE, Bumblebee shows a before-and-after preview so users can inspect the transformed formula before applying it to the worksheet. - **Domain-Specific Transformation Language:** Bumblebee includes a mini-language allowing users to write custom rewrite rules, defining how pattern matches map to target syntax:

``` SUM(range) / COUNT(range) => AVERAGE(range) ```

Looking ahead, Hermans wants to test whether corporate power users—those capable of writing array formulas or writing VBA—can author their own custom Bumblebee refactorings. She also highlights ongoing research into **programming by example**, where the tool watches a user manually update several formulas, deduces the underlying refactoring pattern on the fly, and offers to automate the transformation across the rest of the spreadsheet.

[33:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2027s) Refactoring Needs Testing: Discovering In-Sheet Assertions

Felienne Hermans notes that the BumbleBee refactoring tool can detect repetitive transformations across a spreadsheet and automate them, inviting attendees to try it or pass it to business users via `felienne.com/bumblebee`. Pausing as an audience member takes a photo of the slide, she segues naturally into the next logical software engineering concept: testing. As she puts it:

> “You're not going to refactor your spreadsheet without the security of some tests.”

When someone in the audience makes a skeptical noise, Hermans jokes about them not believing in testing, but admits that her own initial assumptions were flawed. She had suffered from “typical Ivory Tower thinking,” worrying about how to ever convince spreadsheet users or their management to test when it is already notoriously hard to persuade professional software developers and their bosses to write tests.

```mermaid flowchart TD accTitle: Evolution of Spreadsheet Testing accDescr: Flowchart contrasting initial academic assumptions with empirical reality found in spreadsheets.

subgraph Assumption["Ivory Tower Assumption"] A["Developers struggle to test"] --> B["Spreadsheet users won't test"] end

subgraph Reality["Empirical Finding"] C["Lack of formal framework"] --> D["Users write assertion formulas: IF(sum=100%, 100, 'ERROR')"] D --> E["Found in 8% of analyzed spreadsheets"] end

Assumption -.->|"Debunked by data"| Reality ```

However, examining empirical spreadsheet data revealed the opposite: end users were already testing instinctively. Lacking dedicated testing frameworks, users repurposed standard formulas as assertions. A classic pattern Hermans identified checked whether a set of percentage values summed to 1: ```excel =IF(SUM(A1:A5)=1, 100, "ERROR") ``` This formula encapsulates business domain knowledge: the items must add up to 100%, and if they don't, it displays an error. Analyzing an open dataset, Hermans found that roughly 8% of real-world spreadsheets already contained these ad-hoc test formulas. People were even returning graphical indicators like smiley faces or sad faces depending on formula results. Because users already had these rudimentary checks in place, Hermans realized researchers did not need to invent testing behaviors from scratch—they just needed to harness what users were already doing.

- BumbleBee is available for free download at `felienne.com/bumblebee`. - Approximately 8% of spreadsheets analyzed in the open corpus contained explicit test/assertion formulas. - Common assertion outputs in formula results included `"OK"`, `"ERROR"`, `"YES"`, `"NO"`, and even smiley or sad face emoticons.

---

[36:12](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2172s) Expector: Test Extraction, Coverage Visualization, and Guided Assertions

To turn these informal practices into structured engineering workflows, Hermans and her team developed a plugin named Expector. The tool scans spreadsheets using heuristic pattern matching on formula logic and known keywords (such as `"error"`, `"yes"`, or smiling/frowning faces) to automatically discover existing test-like formulas. Expector then translates those formulas into human-readable, “natural-ish language” summaries (for instance, showing that a group of cells is expected to sum to 100%) so users can inspect them and add them to an official test suite with a single click.

```mermaid flowchart LR accTitle: Expector Testing Workflow accDescr: Workflow showing automated test discovery, coverage analysis, and targeted test generation in Expector.

subgraph Discovery["1. Discovery"] A["Scan Spreadsheet"] --> B["Detect Heuristics & Keywords"] B --> C["Parse into Natural Language Assertions"] end

subgraph Suite["2. Suite & Coverage"] C --> D["Add to Test Suite"] D --> E["Mark Dependents Yellow (Coverage)"] end

subgraph Growth["3. Guided Extension"] E --> F["Suggest 1 Target Formula"] F --> G["Add Bounds, Types, or Custom Formulas"] G --> H["Celebrate Increased Coverage%"] end ```

Expector also brings the concept of test coverage to spreadsheet grids. When users ask the tool to show what is covered, Expector highlights the assertion formulas and marks all of their precedent dependencies in yellow. While Hermans acknowledges this is not formal statement or branch coverage—and is not completely foolproof against indirect errors—it provides non-technical users with an immediate, visual intuition of which data paths are safeguarded.

To help users expand their suites without being overwhelmed, Expector offers targeted, bite-sized recommendations when someone has just a spare five minutes before a meeting:

1. **Complex formulas**: Intricate calculations that carry high cognitive load and risk. 2. **High-value formulas**: Cells calculating critical business metrics, large monetary amounts, or order volumes. 3. **High-precedent formulas**: Core calculation hubs referenced by many downstream dependent cells.

Users can attach assertions defining expected types (e.g., number), set upper and lower numerical bounds, or write arbitrary validation formulas in newer versions of the tool. Whenever a user adds a test, Expector encourages them with explicit positive reinforcement—congratulating them for boosting coverage from 6% to 8%—and maintains a dashboard of passing and failing tests. Expector is distributed free for research purposes at `felienne.com/expector`.

---

[39:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2390s) The 30-Second Summary: Spreadsheets Are Real Code

Hermans wraps up the main presentation by offering a rapid, one-minute synthesis for anyone who arrived late or felt drowsy at the end of the conference day. She emphasizes the foundational thesis of her talk:

> “Spreadsheets are code: it's the most important message, remember and tell all your friends and tweet about it and put it on a t-shirt.”

Her core argument rests on three undeniable parallels between spreadsheets and traditional software: - **Domain equivalence**: Spreadsheets are deployed to solve the exact same classes of complex business logic as traditional programs. - **Computational equivalence**: Formula languages are Turing complete and support sophisticated functional programming concepts, from live evaluation to dynamic programming algorithms (such as solving mazes). - **Engineering problems**: Spreadsheets suffer from identical software engineering ailments—code smells, maintainability bottlenecks, lack of regression tests, and refactoring risks.

Far from being an inferior toy, Hermans argues that Excel embodies the very qualities contemporary language designers strive to achieve in 2016: it is purely functional, reactive, interactive/live, and accessible enough to be used by hundreds of millions of everyday workers worldwide. Because spreadsheets represent genuine source code, applying software engineering techniques—such as the commercial code smell detector *PerfectXL*, the *BumbleBee* refactoring tool, and the *Expector* testing suite—is essential. She directs attendees to `felienne.com`, her Delft research team at `przylab.org`, and invites further discussion during the evening conference party or the Q&A.

---

[41:53](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2513s) Q&A: Enterprise Adoption, User Thresholds, and Microsoft Research

During the closing questions, an audience member asks about the actual reach of these tools and whether average office workers really interact with spreadsheets at the level of complexity Hermans showcased. Hermans clarifies that while plenty of people only make basic tables, critical industries rely entirely on heavy spreadsheet programming:

> “There are people that just use it for simple lists, but there are companies and organizations that really depend on Excel for their core business—so insurance companies, banks that really make models that the company depends on.”

Another participant asks how to determine the threshold where users should adopt dedicated developer tooling instead of treating Excel like a scratchpad. Hermans compares this dilemma to standard software development: deciding when an Excel user needs refactoring and testing plugins is fundamentally the same open question as deciding when a programmer should migrate from Notepad++ to a full-featured IDE. It ultimately hinges on the criticality of the model and what the organization is trying to achieve.

Finally, Hermans mentions that in two weeks she will be heading to Microsoft for a three-month research visit to work directly on improving Excel. She notes with a laugh that she is not certain whether they will grant her full access to proprietary telemetry data, but points out that Microsoft had been one of the original sponsors of her PhD research, confirming that the Excel engineering team is well aware of her research in spreadsheet software engineering.

## Notable quotes > [04:20](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=260s) I really like to say that spreadsheets are the most successful programming language in the history of mankind. It's such a good programming language that people don't even know they're programming. — Felienne Hermans

> [00:11](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=11s) Spreadsheets are code. This is the gospel of my life. — Felienne Hermans

> [22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) If a lot is going on in a formula, it's just as smelly and for the same reason as a long method is smelly — Felienne Hermans

> [33:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2027s) You're not going to refactor your spreadsheet without the security of some tests. — Felienne Hermans

## Mentioned Felienne Hermans, Delft University of Technology, GOTO Conferences, Microsoft, Excel, Bret Victor, VisiCalc, Robert C. Martin, Haskell, Infotron, Bumblebee, Expector, PerfectXL

## Video description This presentation was recorded at GOTO Amsterdam 2016 http://gotoams.nl

Felienne Hermans - Assistant Professor at Delft University of Technology @felienne

ABSTRACT This talk is about the world's most popular programming language...Java? Python? COBOL? No... Excel!

Excel somehow hits the sweet spot between being powerful enough to run entire domains like finance and insurance, but also easy enough to attract a huge audience. Why is that?

In this talk we'll explore some of the mechanisms that make spreadsheets so powerful, while implementing a few interesting mathematical problems in spreadsheets.

While doing that, you might learn some (functional) programming concepts too, as we'll talk about sorting, dynamic programming and lambdas. [...]

Download slides and read the full abstract here: http://gotocon.com/amsterdam-2016/presentation/Pure%20Functional%20Programming%20in%20Excel

RECOMMENDED BOOKS Felienne Hermans • The Programmer's Brain • https://amzn.to/3mENbN0 Daniel Kahneman • Thinking, Fast and Slow • https://amzn.to/2XmJEtf

https://bsky.app/profile/gotocon.com https://twitter.com/GOTOcon https://www.linkedin.com/company/goto- https://www.instagram.com/goto_con https://www.facebook.com/GOTOConferences #Excel #FunctionalProgramming #ExcelProgramming #FP #Programming #ProgrammingExcel #SpreadsheetProgramming #FelienneHermans

CHANNEL MEMBERSHIP BONUS Join this channel to get early access to videos & other perks: https://www.youtube.com/channel/UCs_tLP3AiwYKwdUHpltJPuA/join

Looking for a unique learning experience? Attend the next GOTO conference near you! Get your ticket at https://gotopia.tech Sign up for updates and specials at https://gotopia.tech/newsletter

SUBSCRIBE TO OUR CHANNEL - new videos posted almost daily. https://www.youtube.com/user/GotoConferences/?sub_confirmation=1

[Source](https://www.youtube.com/watch?v=0yKf8TrLUOw)

中文简报

Hermans将Excel视为函数式代码,呼吁引入工程化工具 由于企业依靠Excel的函数式引擎来绕过响应缓慢的IT部门,关键的电子表格模型亟需自动化重构和回归测试等传统软件工程实践。 Felienne Hermans论证了电子表格是正统的软件代码,并指出早在现代编程范式流行之前,Excel就开创了纯函数式、无副作用编程和实时重算。她通过原生单元格演示了数组公式、类似Monad的错误提升以及动态规划迷宫求解器,表明电子表格能解决与通用语言相同的复杂计算问题。由于企业工作簿也面临着与遗留代码库完全相同的维护问题——包括代码异味和架构耦合——她主张将经典软件工程方法应用于这一介质。为弥合这一鸿沟,Hermans展示了代尔夫特理工大学开发的相关工具:用于公式自动化重构的Bumblebee,以及用于检测现有断言并映射可视化测试覆盖率的Expector。 电子表格作为图灵完备、无副作用的纯函数式程序运行,为数以百万计的企业业务模型提供即时的实时编程反馈。 (0:11) 对企业电子表格的实证分析显示,一个模型的平均生命周期为5年,涉及12位不同用户,但每三个模型中仅有一个包含任何文档。 (0:11) 现实世界中约8%的电子表格天然包含伪装成错误标记公式的非正式断言,这为Expector等专用测试套件的应用铺平了道路。 (33:47) 电子表格公式表现出典型的软件工程代码异味,例如过长方法、跨工作表的依恋情结,以及破坏计算缓存的重复表达式。 (22:50)

Reading summary

Felienne Hermans argues that spreadsheets constitute genuine, functional programming code rather than mere data containers, requiring the same software engineering discipline—including code-smell detection, automated refactoring, and regression testing—applied to traditional software. Functional Programming Foundations in the Grid (4:20) Hermans contends that spreadsheets embody pure functional programming because native formulas evaluate without side effects and cannot mutate values in other cells. Concepts championed by modern software paradigms, such as reactive 'live programming' where interface states update immediately upon source edits, have been standard in spreadsheets since VisiCalc. Through named ranges and array formulas evaluated via Ctrl + Shift + Enter, spreadsheets can execute higher-order mapping, filtering, and in-cell reductions without allocating intermediate helper columns. Excel also manages edge cases using algebraic data types and lifted operators. When formulas encounter divisions by zero, the sheet outputs #DIV/0!, effectively treating cell outputs as a Maybe Int or Either Error Int. Downstream formulas seamlessly accept these inputs without throwing fatal runtime exceptions or requiring manual null-checks, allowing hundreds of millions of users to employ monadic error propagation without formal computer science training. Solving Dynamic Programming Models Visually (13:54) To demonstrate that spreadsheet formulas can handle advanced computer science challenges, Hermans models a dynamic programming solution for navigating a cash-filled maze. Rather than deploying computationally expensive naive recursion, an auxiliary worksheet tables subproblem results by adding each cell's reward to the maximum of its immediate predecessor cells. Hermans demonstrates that this entire optimization algorithm can be executed using a single uniform formula across the grid. To trace the winning route, Hermans constructs formula-driven directional vector fields that point toward the neighbor yielding the highest payoff, masking non-optimal cells as empty text. Unlike traditional programming environments that require external debuggers, print statements, or scratchpads, the spreadsheet permanently couples data computation with visual rendering, providing real-time feedback on intermediate algorithmic states. Adapting Code Smells to Workbook Architecture (22:50) Hermans observes that corporate workbooks endure traditional software maintenance crises: an average business spreadsheet lasts five years, is maintained by 12 distinct users, and lacks documentation in two out of three cases. To improve maintainability, she adapts classical code smells to spreadsheet formulas, targeting cognitive complexity, excessive parameters, deeply nested IF statements (up to Excel's 64-level limit), and duplicated subexpressions. Because Excel caches calculated cell values but re-evaluates duplicate subformulas from scratch, extracting repeated expressions into separate cells significantly improves calculation speed. At the system level, dependency visualizations reveal architectural anti-patterns across worksheets. These include cyclic coupling, where pairs of sheets contain reciprocal cross-references; orphaned prototype models left in production; and 'feature envy,' where a formula resides on one sheet but exclusively references values on another. Relocating these formulas resolves unnecessary context switching and allows Excel's native color-coded cell bounding to improve readability. Tooling for Formula Refactoring and Verification (31:38) To remediate structural smells, Hermans and her research team created Bumblebee, an automated refactoring plugin that previews and applies formula transformations, such as replacing manual SUM/COUNT divisions with AVERAGE or consolidating complex conditional expressions into SUMIF. Bumblebee also includes a domain-specific transformation language enabling advanced users to define custom rewrite rules. Addressing testability, Hermans notes that empirical analysis of open spreadsheet corpuses revealed that 8% of workbooks already contained ad-hoc assertion formulas (such as checking whether percentages sum to 100% or returning 'ERROR'). Her team developed Expector to discover these informal checks using heuristic pattern matching, convert them into formal natural-language test suites, visualize formula dependency coverage in yellow, and prompt users to define validation bounds on critical, high-precedent calculation hubs. While many individuals use spreadsheets only for basic lists, Hermans stresses that banks and insurance providers operate mission-critical business models within Excel. Determining when users should adopt structured engineering tools remains an open challenge analogous to deciding when a developer should transition from a basic text editor to an IDE.

精炼阅读摘要

代尔夫特理工大学助理教授 Felienne Hermans 提出,电子表格本质上是纯函数式代码,具备图灵完备性与即时交互反馈,现代软件工程应当为其提供代码坏味检测、自动化重构与测试等专业工程规范支持。 电子表格本质是软件代码 (0:11) 传统开发者常将电子表格简单视作“数据”,但 Hermans 认为电子表格是真正的软件工程代码。在业务领域中,投资计算等关键业务逻辑用 C、Java 或 Excel 工作簿实现并无本质区别。商业机构在面对外包 IT 高昂成本与周期延误时,更倾向依赖业务人员直接构建电子表格模型。为了从计算理论上证明其地位,Hermans 仅使用 Excel 原生公式构建了能够完整追踪纸带历史的图灵机。 实际应用中,企业级电子表格往往呈现经典软件工程的演进特征。数据表明,平均一份企业级电子表格会被 12 位不同人员在长达 5 年的生命周期中持续维护使用,而其中仅有三分之一配备任何形式的用户手册或文档。这种生命周期状态高度再现了二三十年前软件工程尚未规范化时所面临的系统维护危机。 Excel的纯函数式编程底色 (4:20) Hermans 强调现代开发者应当主动学习 Excel。Excel 具备三大被现代开发高度推崇的特性:第一是无需显式编译、修改即时重新计算依赖的即时编程(Live Programming);第二是纯函数式特性,原生单元格公式接收输入并输出至宿主单元格,天然不存在副作用与跨单元格状态篡改;第三是无可比拟的用户基数,全球有数以亿计的用户在不自知的情况下编写函数式逻辑。 在高级运算场景中,Excel 能映射经典函数式范式。利用命名区域与隐式交集(Implicit Intersection),公式可以摆脱易错的硬编码行坐标;数组公式结合条件布尔值(0 与 1),能在单个公式内部同时完成映射(Map)、过滤(Filter)与聚合归约(Reduce),避免冗余辅助列。此外,当单元格出现除以零错误(#DIV/0!)时,加法等运算符能够多态向下传递,表现出类似 Maybe Int 单子(Monad)代数数据类型的自动提升(Lifting)机制;动态规划算法亦可直接在网格中以单元格依赖形式高效求解。 公式与架构维度的代码坏味 (22:50) 由于主流表格软件缺乏引导良好设计的集成开发环境(IDE)机制,电子表格极易积累技术债务。Hermans 将传统面向对象与结构化软件的“代码坏味”迁移至电子表格领域。在公式层面,包含多重嵌套运算的过长公式、引用分散的过多参数、深度嵌套达数十层的条件分支,以及重复执行但未被缓存优化的子公式克隆,都会严重损害可读性与运算性能。 在工作表架构层面,依赖分析工具揭示了多种不良拓扑。部分模型由于原型直接转为生产用,出现首季度与其他季度依赖关系严重脱节的现象;工作表之间双向相互引用的紧耦合破坏了数据流向;而公式过度跨表引用数据则对应典型的“依恋情结(Feature Envy)”。频繁跨表切换不仅增加认知负荷,也使公式失去了本地单元格高亮提示的优势。针对这些问题,其团队衍生研发了企业代码坏味检测工具 Infotron 与重构插件 Bumblebee,支持通过模式匹配重写简化公式。 表格内置断言与测试覆盖工程化 (33:47) 在缺乏自动化保障的前提下实施重构存在系统性风险。Hermans 针对开源数据集的实证分析表明,大约 8% 的实际业务表格已经包含用户自发设计的验证公式,例如使用 IF 语句核对百分比求和是否为 1,并输出错误文本或表情符号。终端用户虽然缺少测试框架,但已自发通过常规函数构建断言逻辑。 为将这种非正规测试习惯制度化,其团队开发了 Expector 插件。该工具通过启发式规则和关键词扫描自动抽取现存断言并解析为自然语言陈述,一键加入测试套件;同时,它将断言所依赖的先验单元格高亮显示,为非技术人员提供直观的可视化覆盖率反馈。针对时间有限的业务场景,系统还会依据公式复杂性、核心财务金额或引用中心度,为未测试的高风险单元格生成针对性的断言补充建议。 Hermans 总结指出,电子表格在业务重要性与计算本质上都是货真价实的程序代码,银行业与保险业的核心业务严重依附于庞大的模型资产。如何界定业务表格何时必须从随意记录转向引入重构与测试等专业 IDE 工具,仍是实践中类似文本编辑器向专业开发环境过渡的开放问题。

Detailed notes — zh

## Background 本内容由 GOTO Conferences 于 2016 年 8 月 9 日发布在 YouTube 平台上,记录了代尔夫特理工大学助理教授 Felienne Hermans 在 GOTO Amsterdam 2016 大会上的演讲。根据页面介绍,该演讲聚焦于世界上最流行的编程语言——Excel,探讨其兼具强大计算能力与极低使用门槛的深层机制,并通过排序、动态规划和 Lambda 等编程概念证明电子表格的纯函数式编程本质。 ## TL;DR Felienne Hermans 在演讲中提出了“电子表格即代码”的核心论点,论证了 Excel 公式不仅图灵完备,而且天然具备实时计算(Live Programming)与纯函数式(Pure Functional)等前沿语言特性。她通过数组公式、Monad 错误处理以及用网格实现动态规划算法,展示了 Excel 在处理复杂计算时的优雅与强大。随后,她将传统软件工程的理论体系引入电子表格领域,系统性剖析了公式与工作表层面的“代码坏味道”,并展示了团队开发的重构工具 Bumblebee 和测试管理工具 Expector,呼吁软件工程界正视并填补电子表格在工程化保障工具上的巨大空白。 ## Atmosphere & style 整个演讲充满学术洞察与极具感染力的幽默感,Felienne Hermans 风格犀利、节奏轻快,善于用自嘲与即兴互动调动现场开发者的情绪。她既以严密的计算机科学逻辑粉碎了对电子表格的傲慢与偏见,又以生动的现场演示和可视化案例引发台下阵阵会心的笑声与惊叹。整场分享从最初颠覆认知的理念宣讲,层层推进到硬核算法演示与前沿工具落地,听众仿佛经历了一场重新认识日常工具的启蒙之旅,既痛快淋漓又发人深省。 ## Bulletin - [00:06](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=6s) 代尔夫特理工大学研究指出,电子表格不仅图灵完备且支撑着金融与保险等关键业务,其本质就是代码,且正面临着与早期软件工程高度一致的维护危机。 - [04:19](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=259s) Excel 天然具备实时编程(Live Programming)与纯函数式(Pure Functional)特征,其公式无副作用,底层错误处理机制在形式上等同于函数式编程中的 Maybe Monad。 - [22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) 研究团队将传统软件工程概念引入电子表格,不仅定义了公式过长与依恋情结等“坏味道”,还开发了自动化重构插件 Bumblebee 与测试管理工具 Expector。 - [35:09](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2109s) 公开数据集分析显示,约 8% 的电子表格已自发内嵌类似断言的测试公式,表明业务终端用户具备极强的自测试意识,亟需专业工程化工具的规范引导。 ## Key takeaways - [00:06](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=6s) 电子表格本质是代码而非单纯数据:它们不仅解决与传统系统相同的复杂业务问题,其公式系统更是图灵完备的。 - [01:30](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=90s) 终端用户更倾向于使用 Excel 自建系统,主要因为 IT 部门交付周期漫长、成本超标且难以即时响应原型需求。 - [02:36](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=156s) 电子表格承受着严重的软件工程危机:平均生命周期达 5 年且历经多达 12 人修改,但仅有三分之一附带文档说明。 - [04:19](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=259s) Excel 是最成功的实时纯函数式编程环境:数据修改即可触发瞬时重新计算,且单元格公式严格杜绝外部状态修改的副作用。 - [06:56](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=416s) 通过命名区域与隐式相交,Excel 能够消灭底层的散乱坐标引用,实现类似高阶函数 Map 的整洁抽象。 - [08:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=527s) 数组公式(Ctrl+Shift+Enter)将数据区域提升为一等公民,支持单表达式内完成过滤与归约(Map-Filter-Reduce)计算。 - [11:08](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=668s) Excel 自动短路并传递除以零等错误值的方式,在数学与函数式编程层面上天然实现了 Maybe Monad 运算及操作符提升。 - [13:54](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=834s) 利用网格作为天然的状态备忘录,Excel 仅需单条自底向上的状态转移公式即可高效实现动态规划与路径逆向追踪。 - [21:06](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1266s) 现代专业 IDE 具备完善的度量与防错基础设施,而支撑庞大经济体核心逻辑的 Excel 却长期缺乏相应的软件工程保障工具。 - [22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) 电子表格在公式层面普遍存在过长公式、过多参数、64层嵌套条件及重复子公式等传统代码坏味道。 - [26:01](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1561s) 跨工作表引用容易诱发类似面向对象中的依恋情结(Feature Envy)与双向循环依赖,导致认知成本与系统脆弱性急剧攀升。 - [31:12](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1872s) 重构插件 Bumblebee 支持公式优化规则匹配、实时效果预览,以及基于示例编程(PBE)的批量模式重构。 - [35:09](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2109s) 测试工具 Expector 通过启发式规则从业务表格中识别并提取自发编写的断言公式(占比约 8%),将其转化为结构化测试套件。 - [37:18](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2238s) Expector 提供依赖高亮的覆盖率可视化,并从高复杂度、大数值与高引用前驱三个维度向业务人员精准推荐待测单元格。 - [41:53](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2513s) 尽管大量用户仅将 Excel 用作轻量级清单,但在金融与保险等支柱行业,其工程化深度和复杂度完全值得专业 IDE 级别的工具支持。 ## Detailed walkthrough ### [00:06](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=6s) 电子表格是代码,而非单纯的数据 代尔夫特理工大学(Delft University of Technology)助理教授 Felienne Hermans 在 GOTO Amsterdam 2016 大会开场时向在场开发者发问:为什么一个开发者大会要谈论电子表格?她指出,电子表格长期以来被严重误解,“许多人认为电子表格是数据,但电子表格不是数据,电子表格是代码。”这是她一直以来四处布道的核心信条:“This is the gospel of my life: spreadsheets are code.” ```mermaid flowchart TD accTitle: 电子表格即代码的三大支柱 accDescr: 展现 Felienne Hermans 论证电子表格为何是代码的三个核心原因 Root["电子表格是代码(Spreadsheets are Code)"] subgraph Reasons["三大论据"] R1["解决相同规模的问题<br/>(投资建议、计算业务逻辑)"] R2["计算模型图灵完备<br/>(纯公式实现图灵机)"] R3["承受典型的软件工程痛点<br/>(缺乏文档、多维护者、长生命周期)"] end Root --> R1 Root --> R2 Root --> R3 ``` 她阐述了认定“电子表格即代码”的第一个原因:它们解决的正是传统软件所解决的业务问题。以现场展示的投资计算模型为例,用户输入基础数值,系统计算并输出投资建议。这类系统完全可以用 C、用于 iPad 应用的 Objective-C、Java 或电子表格实现,问题本身并无任何专属于电子表格的特殊性。 - 许多人错误地把 Excel 当作静态数据存储,忽视了其底层的计算与逻辑表达能力。 - 业务计算逻辑在本质上与任何主流编程语言编写的系统没有区别。 --- ### [01:30](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=90s) 为什么业务人员偏爱 Excel 而弃用 IT 部门? 在攻读博士学位期间,Felienne Hermans 深入荷兰的多家银行和投资机构进行调研,询问业务人员为何选择自己用电子表格搭建复杂系统,而不向企业内部或外部的 IT 供应商提需求。得到的回答十分现实:因为专业软件开发的交付表现往往令人失望。 业务人员常常拿着做好的原型表格去找 IT 部门,希望转写为正式系统。IT 供应商通常承诺“6 个月、100 万欧元搞定”;然而最终结果往往延期到 9 个月、耗费 300 万欧元,功能却只实现了一半。因此在业务用户眼中,他们觉得自己比软件工程师更擅长编程。正如 Felienne Hermans 所总结的: > “And end users perceive themselves as better programmers than us, and I mean they're not entirely wrong in that because they can quickly build prototypes that do what they want.” 这种快速构建可用原型、即时响应需求的能力,让终端用户更倾向于留在电子表格的世界里。 --- ### [02:36](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=156s) Excel 公式是图灵完备的:在单元格中实现图灵机 为了彻底粉碎“电子表格不是真正的编程语言”这一刻板印象,Felienne Hermans 甚至使用纯 Excel 公式构建了一台图灵机,以此证明电子表格公式具备图灵完备性(Turing Completeness)。 在这套实现中,表格的每一行代表纸带的一次状态迭代,通过条件格式(Conditional Formatting)直观呈现读写头在纸带上的移动轨迹。相比物理磁带上只能看到当前指针位置,这种表格呈现方式将完整的历史记录逐行保留下来,提供了一种极为清晰的图灵机可视化形态。该项目在 Hacker News 和 Reddit 上引发病毒式传播,涌入的流量一度导致她的个人博客宕机半天。 第三个将电子表格视作源代码的核心依据,是它们正承受着软件工程中最典型的痛点: - 仅有三分之一(1/3)的电子表格附带说明文档或手册。 - 一个平均生命周期为 5 年的电子表格,期间会被多达 12 位不同的人员修改和使用。 - 这种缺乏规范、缺乏工具支持、人人都随手编写系统的现状,与二三十年前软件工程刚起步时的混沌局面如出一辙。 活动形式、逻辑复杂度以及面临的工程问题完全一致,无可辩驳地证明了电子表格就是代码。 --- ### [04:19](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=259s) 实时编程与纯函数式:Excel 是你下一个该学的语言 Felienne Hermans 进而主张:Excel 不仅是一门语言,更是开发者下一个应该学习的编程语言。 首先,电子表格体现了极具现代感的“实时编程”(Live Programming)。知名交互设计师 Bret Victor 曾提出实时编程理念,并在演示中展示了右侧调整代码(如数值或颜色参数)、左侧图形树即时响应而无需手动编译的场景。Felienne Hermans 指出,这一被前沿探索奉为圭臬的特性,早在 1979 年 VisiCalc 诞生时就已经是电子表格的标准配置:用户修改单元格数值或公式,所有下游结果瞬时重新计算,完全无需编译等待。 ```mermaid flowchart LR accTitle: Excel 公式的数据流纯函数特性 accDescr: 展现单元格公式仅接收输入并计算输出,杜绝任何外部状态修改的纯函数机制 subgraph Inputs["输入单元格"] A1["Cell A1: 5"] A2["Cell A2: 10"] end subgraph PureFunc["Excel 单元格公式"] Formula["= A1 + A2<br/>(无副作用运算)"] end subgraph Output["输出单元格"] Target["Cell A3: 15"] end Inputs --> PureFunc PureFunc --> Output Formula -.->|"绝对禁止修改外部状态"| Forbidden["其他单元格 / 全局状态"] style Forbidden stroke-dasharray: 5 5,stroke:#f66,fill:#fee ``` 其次,当今软件界函数式编程(Functional Programming)正在强势复兴,而 Excel 本质上就是纯函数式编程(Pure Functional Programming)。在原生 Excel 公式中,计算天然具备无副作用(Side-effect free)的特征:一个公式只能引用其他单元格的输入并计算出一个值,它绝不可能篡改其他单元格的数据或修改系统全局状态。 最后,电子表格拥有极其庞大的受众群体。无论是邻居统计足球队开销,还是会计师核算税务,所有人都在使用电子表格,唯独专业软件开发者对此视而不见。Felienne Hermans 感慨道: > “I really like to say that spreadsheets are the most successful programming language in the history of mankind. It's such a good programming language that people don't even know they're programming.” 她调侃道,没人会“不小心写了 Java”,但全球每天都有成千上万的人在毫无察觉的情况下用电子表格完成复杂的程序设计。 --- ### [06:56](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=416s) 摆脱赋值语句:命名区域与高阶函数 Map 思想 软件工程学者 Uncle Bob(Robert C. Martin)曾提出,函数式编程本质上就是“没有赋值语句的编程”(programming without assignment statements)。Felienne Hermans 在 Excel 中演示了这一思想的实际落地。 以最常见的对一组整数求平方为例: 1. **基础写法与 Map 隐喻**:在相邻列输入公式将数值与自身相乘,随后向下拖拽或双击填充句柄,公式会自动对齐引用。这在本质上就是对输入集合应用一个函数,等同于函数式编程中的 `map` 映射操作。 2. **消灭底层单元格地址**:针对开发者嫌弃“公式中充斥着 A2、A3 这种丑陋坐标”的心理,她给首列数据定义了一个命名区域(Named Range),命名为 `input`。 3. **隐式相交(Implicit Intersection)**:直接在计算列编写公式 `= input * input`。此时 Excel 会自动计算当前行与命名区域 `input` 的交集,使得整列每一行都展示完全统一的公式结构,如同整洁的函数定义,彻底摆脱了零散单元格地址的拼凑。 --- ### [08:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=527s) 数组公式:将范围作为一等公民进行计算 在平方计算的基础上,Felienne Hermans 进一步提出进阶需求:计算所有大于 30 的平方数之和。 常规做法通常是多列协同:先用布尔表达式判断哪些平方值大于 30,再通过 `SUMIF` 函数依据布尔条件进行汇总求和。但这种方式占用了大量的网格空间(Real Estate),产生了许多辅助列。 为了更高效优雅地解决该问题,她展示了直接利用数组计算的方式。在底层逻辑中,布尔值会被转换为数字 0 或 1,因此可以直接与数据区域相乘。然而,如果直接输入命名区域相乘,Excel 默认仍然只会触发针对当前行的隐式相交逻辑。此时必须借助快捷键: - 按下 **`Ctrl + Shift + Enter`**,Excel 会将普通公式转化为**数组公式**(Array Formula),并在公式外围自动加上大括号 `{...}`。 - 这意味着整个 `input` 数组与另一个 `input` 数组进行了成对元素相乘(pairwise multiplication),计算结果本身也是一个数组。 - 此时,数组(范围)在 Excel 中成为了真正意义上的“一等公民”(First Class Citizens),无需展开铺满辅助列即可一次性完成批处理运算。通过演示前 5 个元素的展示,她直观呈现了底层数组计算的存在与威力。 ### [11:08](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=668s) 数组公式的归约计算与 Excel 中的 Monad 错误处理机制 Felienne Hermans 演示了如何将数组公式(Array Formula)与归约(Reduce)思想结合。通过单条公式,用户可以直接对一个数据区域执行逐项自乘并求和(例如 `SUM(range * range)`),甚至可以在同一个公式中嵌入过滤逻辑(例如乘以判断条件 `> 30`)。这种做法完全省去了创建中间辅助单元格的繁琐步骤,将所有运算折叠进一个表达式中,兼具表现力与计算效率。 随后,Hermans 将话题引向 Excel 的错误处理机制。她在表格中用随机生成的数字(0 到 3)填充数据列,接着创建了一个执行除法运算的列,并风趣地将其命名为“危险区域(danger zone)”。当除数为 0 时,Excel 立即抛出除以零的错误值。她向在场的程序员提问:如果原始数据是整数类型(Integer),那么该错误结果列的数据类型到底是什么? ```mermaid flowchart LR accTitle: Excel 中的 Maybe Monad 计算流程 accDescr: 展示常规整数与 Maybe 类型的计算,以及加法运算在遇到错误值时的直接提升与短路机制。 subgraph Inputs ["输入区域"] A["整数输入 (Integer)"] B["随机数 0~3 (Divisor)"] end subgraph MaybeType ["Maybe 运算层"] A --> C["除法: A / B"] B --> C C --> D["结果: Maybe Int<br/>(整数 或 #DIV/0!)"] end subgraph LiftedOp ["后续计算 (提升运算)"] D --> E["加法: Maybe Int + X"] E --> F["结果: 自动传递错误值<br/>或正常输出整数"] end ``` Hermans 揭示了一个令人惊讶的事实:这个结构在函数式编程中正是 Monad(更具体地说是 `Maybe Int`)。全世界数以亿计的 Excel 用户每天都在自然地使用 Monad,却浑然不知背后的理论门道。当另一个计算列引用这个包含错误值的单元格时,加法操作符会被自动“提升”(lifted)——它不仅能处理纯粹的整数,还能无缝处理包含错误值或有效数值的联合类型: > “This is a 700 million Excel users, they just use monad without any problems, they don't even think about it because if we have another column that uses this maybe Int as an input, it just works.” —— Felienne Hermans - 单公式归约:利用数组运算与布尔乘法过滤,可在单格内完成“Map-Filter-Reduce”全流程,免除额外存储开销。 - 隐式 Monad:Excel 遇到错误(如 `#DIV/0!`)时不会导致程序直接崩溃,而是返回错误标记,并将后续运算作为 `Maybe` 类型进行优雅短路与传递。 - 操作符提升:普通的加减乘除运算符自动适配错误与正常值双重状态,降低了异常处理的心智负担。 --- ### [13:54](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=834s) 迷宫寻宝问题与动态规划求解 为了展现更“硬核”的编程场景,Hermans 引入了一个经典计算机科学问题:在一个填满金币的网格迷宫中寻找收益最大化的路径。她调侃自己作为一名“贫穷的学者”,必须靠迷宫代码里的金币来发家致富。若采用朴素的递归回溯算法,从终点反推每一步的可能来源(仅能来自上方或左方),系统在每一个分支都会重复遍历子路径,计算开销极其昂贵。 针对这一问题,Hermans 现场演示了如何用“动态规划”(Dynamic Programming)在 Excel 中实现最优解。动态规划的核心在于保存中间子问题的计算状态,避免重复劳动。她在工作簿中新建了一个名为 `Max` 的工作表,用于记录到达迷宫中每一个格子的累计最大金币值: ```mermaid flowchart TD accTitle: 迷宫动态规划子问题状态转移 accDescr: 演示从当前格子的上方与左方状态取最大值,并叠加当前格子自身权值的转移过程。 subgraph Decisions ["前置状态 (子问题)"] Top["上方格子的累计最大值<br/>Max(r-1, c)"] Left["左方格子的累计最大值<br/>Max(r, c-1)"] end subgraph Transition ["当前单元格公式"] PickMax["MAX(Top, Left)"] CurrentVal["当前格子金币值<br/>Maze(r, c)"] Calc["PickMax + CurrentVal"] end Top --> PickMax Left --> PickMax PickMax --> Calc CurrentVal --> Calc ``` 在边界处,因为只能单向移动(仅能向右或向下),计算路径是唯一的;而对于其余所有内部单元格,只需编写一个通用的状态转移公式:取上方单元格与左方单元格的最大值,再加上当前格子本身的数值。通过拖拽复制这一行公式填满整个迷宫,所有子问题迎刃而解。对比 C 语言甚至高中编程教学中的冗长实现,Excel 仅用一张网格公式便优雅解决了这一复杂算法。 - 复杂度痛点:暴力递归在每一步都重复遍历所有分支,效率极低;而动态规划通过制表(Tabulation)保存了子状态。 - 网格即缓存:Excel 单元格天然充当了动态规划的状态备忘录(Memoization / Table),直观展现了自底向上的推导过程。 - 公式极简化:整张动态规划表仅需复用单条公式 `=MAX(上方, 左方) + 当前单元格`,即可算出全局最优解。 --- ### [17:25](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1045s) 逆向路径重构与流式编程的直观优势 求出最大金币数后,Hermans 并不满足于仅仅得到一个孤立的数字,更关键的是要直观找出通往财富的具体移动路径。她戏称“懒得自己心算复盘”,决定让 Excel 自动标记出路径轨迹。她首先尝试在单元格内根据相邻格子的最大值来源打印方向箭头(向上或向左),将整个迷宫转变为类似“向量场”的流向图。 虽然全网格的箭头已经能指出方向,但视觉上依然不够清爽。Hermans 进一步迭代公式,加入了判断逻辑:只有当一个单元格被后续路径(即它的正下方或正右方)指向上时,它才属于有效路径并打印箭头;否则输出空字符串 `""`。经过两层条件判断的完善,整张表格瞬间隐去了多余干扰,只留下一条由箭头串联、清晰直观的财富路线。 在这个过程中,Hermans 强调了 Excel 作为“交互式编程环境”无与伦比的优越性。数据与公式实时并存,每修改一次条件,屏幕上立刻呈现直观反馈;而传统代码从文本文件读取数据时,开发者往往需要靠终端里密密麻麻的 `print` 打印语句、断点调试器甚至草稿纸来艰难维持与数据的联系: > “The data is right there, it's screaming at you, you're like 'use me, give me some formulas and I will tell you what I'm up to', and that makes spreadsheet programming really very, very easy and intuitive.” —— Felienne Hermans - 向量场可视化:通过对比上方与左方的最大权值,生成指示来源的局部最优方向标记。 - 条件反向过滤:利用嵌套 `IF` 逻辑,只渲染被后续节点引用的有效路径格,实现极简的可视化轨迹追踪。 - 实时编程反馈:公式的计算结果随时可见,数据“触手可及”,免去了传统软件工程中频繁编译、控制台打印或断点调试的心智负担。 --- ### [21:06](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1266s) 电子表格即代码:软件工程支持的迫切需求 在成功演示例题后,Hermans 掷地有声地得出结论:“电子表格就是代码”。她半开玩笑地告诫台下的工程师,如果身边有人轻蔑地说“这不过是个电子表格”,一定要予以反驳,因为电子表格是货真价实的程序开发,而且极其强大。这也正是她在代尔夫特理工大学(Delft University of Technology)开展学术研究的核心立足点。 > “Spreadsheets are real programming, and it's super cool.” —— Felienne Hermans Hermans 回顾了计算机软件的发展历程:二三十年前,许多业务人员都是自己写代码甚至写编译器的“终端用户程序员”;多年过去后,当遗留系统仍在运转时,原作者早已离职,甚至连当时的编译工具都已遗失。面对这种软件危机,专业软件工程社区建立了一整套现代化 IDE 基础设施,提供调试工具、自动化测试、静态分析及代码度量指标等功能。 她犀利地指出,现代 IDE 中的这些高级功能并非单纯帮助开发者“码出代码”,而是帮助开发者“负责任地编写稳健的代码”,引导人成为一名优秀的开发者。然而反观拥有庞大用户群与复杂业务逻辑的 Excel,它至今在软件工程维度的辅助能力上依然十分匮乏,这正是工程界与学术界急需填补的巨大鸿沟。 - 行业认知偏差:严肃对待电子表格,纠正“Excel 不是真正编程”的偏见,正视其承载核心业务逻辑的事实。 - 遗留系统历史教训:未经规范管理的终端用户开发必然面临可维护性危机与人才流失断层。 - 工程工具失衡:传统 IDE 拥有成熟的测试、度量与分析生态,而支撑无数财务与商业命脉的 Excel 却极度缺乏规范的工程化保障机制。 ### [22:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1370s) 电子表格公式级别的“代码坏味道” 传统 IDE 通常会提供丰富的辅助功能来指导开发者编写高质量的代码,但 Excel 在这方面几乎是一片空白。它允许用户给单元格调整字体或颜色,却没有任何类似 IDE 的机制去提醒开发者:“也许你不应该把所有的变量都命名为 A5,或许应该在某些地方加上清晰的名称。”无论是直接写出像 `A2 * A3` 这样晦涩的单元格引用,还是使用良好的命名机制,Excel 的交互界面都不会给予任何正向或负向的反馈。 由于电子表格本质上高度类似于源代码,Felienne Hermans 在其博士论文中提出,可以借用软件工程领域的思想来帮助电子表格的制作者,其中一个核心切入点就是“代码坏味道”(Code Smells)。在公式层面上,很多传统的代码坏味道都能找到直接对应的映射: - **过长方法(Long Method)与过长公式(Long Formula)**:这里的长并非单纯指字符数量,而是指公式中包含的操作符和运算数量。如果一个公式里同时塞满了求和、乘法、除法等错综复杂的操作,它就和一个堆砌了大量职责的过长方法一样散发着坏味道。 - **过多参数(Many Parameters)**:如同拥有无数参数旋钮、难以维护的方法一样,一个引用了大量分散单元格(“那个、那个、还有那个”)的公式,在可读性上会变得极差。 - **条件复杂度(Conditional Complexity)**:在 Excel 中体现为嵌套 `IF` 语句。早期 Excel 曾有 7 层嵌套的硬性限制,但后来微软取消了这一限制,允许用户嵌套深达 64 层。在实际业务中,层层嵌套 6 到 8 层 `IF` 的情况屡见不鲜,导致后续的调试工作变成噩梦。 - **代码克隆(Code Clones / Duplicate Code)**:同一段逻辑在多处重复出现。例如公式中重复计算两遍的子公式 `EXP(0 - G36 * C36)`。这不仅损害可维护性,还会直接拖慢 Excel 的执行速度。因为 Excel 的缓存模型只针对完整的单元格计算结果,并不缓存公式内部的子表达式。在遇到重复子表达式时,计算引擎会重复进行昂贵的数学运算;如果能将该子公式提取到一个独立的单元格中,不仅能提升可读性,还能借助单元格级缓存获得明显的性能提升。 ```mermaid flowchart TD accTitle: Excel 代码坏味道映射 accDescr: 展示传统代码坏味道如何映射到 Excel 电子表格公式和架构中。 subgraph Traditional["软件工程代码坏味道"] M1["过长方法 (Long Method)"] M2["过多参数 (Many Parameters)"] M3["条件复杂度 (Conditional Complexity)"] M4["代码克隆 (Code Clones)"] end subgraph Spreadsheet["Excel 电子表格对应表现"] S1["过长公式 (堆叠大量算术与函数)"] S2["复杂引用 (引用数十个散乱单元格)"] S3["深度嵌套 IF (最高可达 64 层)"] S4["重复子公式 (降低速度且无内部缓存)"] end M1 --> S1 M2 --> S2 M3 --> S3 M4 --> S4 ``` --- ### [26:01](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1561s) 工作表依赖架构与跨工作表坏味道 坏味道不仅存在于微观的单一公式中,同样会蔓延到宏观的工作表(Worksheet)结构之间。Felienne Hermans 展示了一个用于可视化工作表之间依赖关系的工具:方块代表工作表,箭头代表跨表格的公式引用关系(如 Sheet2 中的公式引用了 `Input!A1 * 12`)。在分析实际生产中的电子表格时,依赖结构呈现出了各种奇特甚至混乱的形态: 在某一个案例中,模型包含了四个季度的数据。第 2、3、4 季度与其对应月份的计算链路整齐划一,但第 1 季度(含 1 月、2 月、3 月)的依赖拓扑却截然不同。研究团队向作者求证时,对方坦白道:“我刚开始做 Q1 时只是随手建了个原型,当时没想清楚自己要算什么;到了 Q2 我彻底推倒重来,理清了建模逻辑。但随着时间推移,一年过去又到了来年 1 月,我完全忘记了第一季度只是餐巾纸草稿级别的半成品,于是这两套完全不同的计算方式就这么一直在系统里并存着。”若没有可视化架构工具,维护者根本无法察觉这种结构缺陷。 此外,研究人员还观察到了双向循环依赖(Sheet1 与 Sheet2 之间存在互相引用的双向箭头,结构重复但高度耦合),以及高度脆弱的跨文件引用架构。例如某些模型的主工作表依赖大量外部表格文件(图中粉色区块),业务流程全靠人工邮件流转:业务员把收到的表格丢进特定文件夹,随后打开主表去硬读取所有外部文件,流程极其摇摇欲坠。 这表明电子表格不仅有公式级坏味道,还存在类似于面向对象编程中类级别坏味道的“跨工作表坏味道”(Inter-worksheet Smells)。 --- ### [28:30](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1710s) 依恋情结(Feature Envy)在电子表格中的具象化 为了类比跨工作表的架构坏味道,Felienne Hermans 向现场观众展示了一段面向对象代码并提问其存在的坏味道。现场有人喊出“命名不佳”,她幽默地承认确实有命名问题,但自己太懒没有改 PPT,台下随后有人准确答出了“依恋情结”(Feature Envy)。在该代码示例中,Class B 中的方法过度频繁地访问 Class A 中的字段 X 和 Y,它显然更渴望直接生活在 Class A 中。 这种坏味道在电子表格中极为常见:当一个工作表上的公式频繁引用另一个工作表上的单元格时,该公式往往放在被引用的工作表上才更合理。Felienne 列举了一个来自真实开源数据集的案例:在损益表(Income Statement)工作表上有一个极长且难以理解的公式: > “如果我的老板问我那个公式到底是干什么的,或者我必须去调试它,过程就会是这样:‘好的,Required Funds B9 是建筑物的数量,除以 Required Funds C9,那是建筑物的折旧……’以此类推。你必须不停地在这些单元格之间跳来跳去,才能真正看懂发生了什么。” 认知科学早已证明,频繁的上下文切换(Context Switches)在认知成本上极其昂贵。解决这一问题的重构手段非常直接:将该公式直接剪切并粘贴到 `Required Funds` 工作表中。这样重构带来了立竿见影的优势: 1. **缩短公式长度**:因为公式已经位于该表内,所有形如 `Required Funds!` 的跨表前缀都可以彻底剔除; 2. **逻辑一目了然**:剔除冗余前缀后,公式清晰地展现出“前三个指标相除加上后三个指标相除”的内在对称结构; 3. **视觉追踪辅助**:此时点击单元格,Excel 能够在本表内以彩色高亮直观标记所有被引用的依赖单元格,极大降低了心智负担。 现场还有观众指出可以进一步将除以 12 的操作提取公因式,Felienne 对此表示完全赞同。 --- ### [31:12](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1872s) 重构工具 Bumblebee 与自动化规则 为了将学术研究转化为实际生产力,团队创立了一家名为 Infotron 的衍生公司,开发了能自动检测电子表格坏味道的分析工具。用户只需上传表格,系统就会列出潜在缺陷,例如提示:“此处存在超过 10 处对目标工作表的跨表引用,建议将其移动到对应工作表”。 既然能够识别坏味道,接下来自然就是重构(Refactoring)。团队研发了一款名为 Bumblebee 的重构插件,其设计理念直接对标现代软件开发 IDE: - **智能重写建议**:当检测到类似 `SUM(...) / COUNT(...)` 的模式时,Bumblebee 会主动建议将其重构成内建的 `AVERAGE(...)` 函数。虽然高阶用户可能熟知平均值函数,但对缺乏系统训练的用户,或者面对诸如将 `SUM` 搭配逻辑判断改写为 `SUMIF` 这种较为冷门的进阶函数时,工具的提示能带来极大的便利。 - **实时效果预览**:与现代 IDE 的重构功能类似,用户在确认修改前可以看到公式重构后的对比预览,确认无误后一键应用。 - **可编程重构转换引擎**:Bumblebee 不仅自带一组内置重构规则,还提供了一套领域特定的小型语言,允许高级用户自行编写模式匹配转换规则。例如将对某区域的求和除以对同一区域的计数直接映射为该区域的平均值: $$\frac{\text{SUM}(Range)}{\text{COUNT}(Range)} \implies \text{AVERAGE}(Range)$$ Felienne 认为,既然企业中那些能够熟练编写数组公式(Array Formulas)甚至 VBA 脚本的“超级用户”(Power Users)拥有极强的逻辑能力,他们完全有潜力自己编写这些重构转换规则。此外,团队还在探索“基于示例的编程”(Programming by Example, PBE):系统在后台观察用户对几处公式的手动修改操作,自动归纳推导出通用的重构模式,进而询问用户是否需要将其批量应用到整个电子表格中。 ### [33:47](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2027s) 电子表格重构工具 Bumblebee 与测试的必要性 在讨论完电子表格中的代码异味后,Felienne Hermans 介绍了他们团队开发的重构工具 Bumblebee。当系统检测到用户在某个地方进行了公式重构或优化时,Bumblebee 会主动询问用户是否在做同一件事,并提供将这种转换一次性应用到整张工作表的功能。她提到该工具可以直接在她的个人网站下载,供企业业务人员和工程师尝试。然而,提到重构,现场听众自然而然地联想到了下一步的保障机制——测试。 “Yes, testing, you're not going to refactor your spreadsheet without the security of some tests,” Felienne Hermans 坚定地表示。面对台下某些观众对测试发出的轻笑与质疑,她打趣道:“Oh, you don't believe in testing? That's fair enough.” 按照原本的研究顺序,测试本该在重构之前就展开,但她坦言自己一开始陷入了典型的“象牙塔思维”(Ivory Tower thinking):在专业软件开发领域,说服程序员写测试、让管理层批准投入时间写测试就已经极其困难,怎么可能说服普通的电子表格用户去系统性地编写测试? - 重构工具 Bumblebee 允许用户将单处的公式变换自动批量应用至全表。 - 软件工程常规路径应当是“测试先行”再进行“安全重构”,但现实研究中往往反向探索。 - 讲者反思自身早期的学术偏见,一度认为业务人员不可能主动去写测试。 ### [35:09](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2109s) 业务人员的自制断言:Expector 工具的设计与原理 深入分析真实数据后,Felienne Hermans 发现之前的担忧完全是出于误解——业务人员不仅会测试,而且实际上非常擅长测试。研究团队在公开数据集里频繁观察到一类极具代表性的公式,例如:`=IF(SUM(A1:A5)=100%, 100, "Error")`。这种公式的本质就是一个断言(assertion),它清晰表达了领域知识——这五项加起来必须是 100%。在缺乏正式单元测试框架的情况下,业务人员只能使用他们唯一掌握的语言——公式,来给自己的模型写测试。在分析的数据集中,整整有 8% 的电子表格都内嵌了这种“测试公式”。 基于这一发现,团队构建了名为 Expector 的测试提取与管理工具。Expector 能够自动扫描工作表,利用启发式规则(heuristics)识别出那些看起来像测试的公式。这些启发式规则涵盖了常见的测试输出词汇,如“OK”、“Error”、“Yes”、“No”,甚至在真实表格中还检测到了根据测试结果输出笑脸(smiley)或哭脸(saddy face)的符号。一旦识别成功,Expector 会用通俗自然的类自然语言将公式逻辑呈现出来,用户只需打勾确认,就能将其直接收录进测试套件(Test Suite)并运行验证。 ```mermaid flowchart LR accTitle: Expector工作流程 accDescr: 展示Expector如何从电子表格中扫描提取测试公式、评估覆盖率并推荐新测试 subgraph S1["检测阶段"] A["电子表格公式"] --> B["启发式匹配 (OK/Error/笑脸)"] end subgraph S2["转换与执行"] B --> C["解析为自然语言断言"] C --> D["加入测试套件运行"] end subgraph S3["覆盖与推荐"] D --> E["黄色高亮显示依赖覆盖"] E --> F["推荐待测公式 (高复杂度/高价值/高引用)"] end ``` - 在公开数据集中,有 8% 的电子表格已经自发包含业务断言公式。 - 真实表格中的断言输出形式多种多样,包括显式文本(OK / Error)及表情符号(🙂 / 🙁)。 - Expector 将底层逻辑解析为易读的自然语言描述,便于业务人员理解与管理。 ### [37:18](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2238s) 测试覆盖率可视化与单点测试推荐机制 为了让业务人员对模型的安全性有直观认知,Expector 引入了测试覆盖率展示功能。只要点击查看覆盖范围,所有被测试公式直接或间接依赖的单元格都会被高亮显示为黄色。Felienne Hermans 解释称,这里并没有生搬专业软件工程中的分支覆盖(branch coverage)或语句覆盖(statement coverage)等高级指标,其核心目标是给用户建立直观的心智模型:一旦某处输入数值发生变化,测试套件能否感知并报警。 此外,为了降低编写测试的心理门槛,Expector 没有把一堆空白交给用户,而是设计了“推荐一个公式来测试”的引导功能——非常适合“离下一场开会还有 5 分钟,顺手加个测试”的碎片化场景。工具将潜在高风险单元格划分为三个维度供用户挑选: 1. 复杂度极高的公式(Complex formula); 2. 关联巨大数值/资产的公式(Big value,例如代表巨额资金或海量订单); 3. 被大量其他单元格引用的前驱公式(Many precedents)。 选中目标后,用户可以快速配置断言条件,如数据类型、数值上下限,或者在后续版本中直接编写自定义公式。每当测试增加,工具还会即时给予正向反馈:“太棒了!你的测试覆盖率从 6% 提升到了 8%!” - 覆盖范围可视化:通过黄色高亮标记依赖单元格,直观反映测试辐射面。 - 单点测试推荐的三大维度:高复杂度(Complex)、大数值(Big value)、多引用(Many precedents)。 - 激励机制:提供正向反馈与测试通过率统计,引导用户持续提升覆盖率。 ### [39:50](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2390s) 总结:电子表格就是代码 演讲尾声,Felienne Hermans 用极具感染力的语言在 30 秒内梳理了整场演讲的核心思想。她呼吁在座的所有开发者与研究者向外界传递这一理念:“Spreadsheets are code. It's the most important message, remember and tell all your friends and tweet about it and put it on a t-shirt.” 她从三个层面论证了为何必须将电子表格视为真正的代码: 1. **同等定位与能力**:电子表格用于解决极其严肃复杂的业务问题,在计算能力上是图灵完备的; 2. **同等困境**:它们与传统软件一样,饱受维护性差、异味丛生、难以测试等典型软件工程问题的困扰; 3. **先进的范式体现**:电子表格恰恰是 2016 年所有现代编程语言努力追逐的方向——它是即时交互的(Live)、纯函数式的(Functional),且坐拥数以亿计的真实用户。 既然电子表格是代码,软件工程领域的优秀工具与实践便大有可为。随后,她展示了相关的研究成果与落地工具链接:商用异味检测工具 PerfectXL、处于活跃研究阶段的重构工具 Bumblebee 和测试工具 Expector,以及她在代尔夫特理工大学(Delft University of Technology)领导的研究实验室团队网站。 - 核心论点:“Spreadsheets are code”——应作为开发者共识并广泛传播。 - 电子表格天然具备“交互式(Live)”与“函数式(Functional)”两大现代编程核心特质。 - 相关工具成果包括 PerfectXL(异味检测)、Bumblebee(重构工具)与 Expector(测试工具)。 ### [41:53](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=2513s) 现场问答:用户群体覆盖与微软访问计划 在 Q&A 环节,现场观众提出了一个关于目标受众的问题:普通用户与专业用户之间的断层很大,究竟有多少人会像讲者展示的那样深度使用 Excel? Felienne Hermans 回答道,虽然很多人确实只用 Excel 制作简单清单,但在金融、保险等关键行业,整家跨国机构的核心业务逻辑都完全构筑在极其复杂的 Excel 模型之上。要界定“严肃使用”(serious use)的精确临界点其实很难,这就好比问一名程序员“代码写到什么复杂度时,才值得从 Notepad++ 切换到功能完备的专业 IDE”一样,答案取决于具体的业务目标与工程代价。 最后,在谈及商业软件厂商的关注度时,Felienne 透露了即将展开的行程:两周后她将启程前往微软开展为期三个月的访问研究,深入探讨如何改进 Excel 自身的设计。她笑称微软本身也是她博士课题的资助方之一,因此产业界对电子表格工程化这一命题不仅知情,而且始终保持着高度关注。 - 电子表格用户分层显著,但金融与保险巨头对复杂模型的依赖使其具备极高的工程化价值。 - 从轻量编辑到使用专业开发工具的权衡,在电子表格与传统编程中呈现出高度一致的演进规律。 - 讲者透露近期将赴微软进行为期 3 个月的访问交流,从底层推动 Excel 工具的进化。 ## Notable quotes > [04:19](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=259s) I really like to say that spreadsheets are the most successful programming language in the history of mankind. It's such a good programming language that people don't even know they're programming. — Felienne Hermans > [17:25](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=1045s) The data is right there, it's screaming at you, you're like 'use me, give me some formulas and I will tell you what I'm up to', and that makes spreadsheet programming really very, very easy and intuitive. — Felienne Hermans > [01:30](https://www.youtube.com/watch?v=0yKf8TrLUOw&t=90s) And end users perceive themselves as better programmers than us, and I mean they're not entirely wrong in that because they can quickly build prototypes that do what they want. — Felienne Hermans ## Mentioned Felienne Hermans, GOTO Conferences, Delft University of Technology, Excel, Robert C. Martin, Bret Victor, VisiCalc, Hacker News, Reddit, Infotron, Bumblebee, Expector, PerfectXL, Microsoft, Java, Python, COBOL, Objective-C ## Video description This presentation was recorded at GOTO Amsterdam 2016 http://gotoams.nl Felienne Hermans - Assistant Professor at Delft University of Technology @felienne ABSTRACT This talk is about the world's most popular programming language...Java? Python? COBOL? No... Excel! Excel somehow hits the sweet spot between being powerful enough to run entire domains like finance and insurance, but also easy enough to attract a huge audience. Why is that? In this talk we'll explore some of the mechanisms that make spreadsheets so powerful, while implementing a few interesting mathematical problems in spreadsheets. While doing that, you might learn some (functional) programming concepts too, as we'll talk about sorting, dynamic programming and lambdas. [...] Download slides and read the full abstract here: http://gotocon.com/amsterdam-2016/presentation/Pure%20Functional%20Programming%20in%20Excel RECOMMENDED BOOKS Felienne Hermans • The Programmer's Brain • https://amzn.to/3mENbN0 Daniel Kahneman • Thinking, Fast and Slow • https://amzn.to/2XmJEtf https://bsky.app/profile/gotocon.com https://twitter.com/GOTOcon https://www.linkedin.com/company/goto- https://www.instagram.com/goto_con https://www.facebook.com/GOTOConferences #Excel #FunctionalProgramming #ExcelProgramming #FP #Programming #ProgrammingExcel #SpreadsheetProgramming #FelienneHermans CHANNEL MEMBERSHIP BONUS Join this channel to get early access to videos & other perks: https://www.youtube.com/channel/UCs_tLP3AiwYKwdUHpltJPuA/join Looking for a unique learning experience? Attend the next GOTO conference near you! Get your ticket at https://gotopia.tech Sign up for updates and specials at https://gotopia.tech/newsletter SUBSCRIBE TO OUR CHANNEL - new videos posted almost daily. https://www.youtube.com/user/GotoConferences/?sub_confirmation=1 [Source](https://www.youtube.com/watch?v=0yKf8TrLUOw)

Source quotes

[4:19] Felienne Hermans: I really like to say that spreadsheets are the most successful programming language in the history of mankind. It's such a good programming language that people don't even know they're programming. [17:25] Felienne Hermans: The data is right there, it's screaming at you, you're like 'use me, give me some formulas and I will tell you what I'm up to', and that makes spreadsheet programming really very, very easy and intuitive. [1:30] Felienne Hermans: And end users perceive themselves as better programmers than us, and I mean they're not entirely wrong in that because they can quickly build prototypes that do what they want.

Source quotes

[4:20] Felienne Hermans: I really like to say that spreadsheets are the most successful programming language in the history of mankind. It's such a good programming language that people don't even know they're programming. [0:11] Felienne Hermans: Spreadsheets are code. This is the gospel of my life. [22:50] Felienne Hermans: If a lot is going on in a formula, it's just as smelly and for the same reason as a long method is smelly [33:47] Felienne Hermans: You're not going to refactor your spreadsheet without the security of some tests.

Original transcript

[0:06] [Music] [0:10] [Applause] [0:11] hello everyone my name is Fen hermans [0:13] I'm assistant professor at Del [0:15] University of Technology I'm on Twitter [0:16] as well so if you want to rate me not [0:18] through the app but by sending a tweet [0:20] then uh feel free to do so so maybe [0:24] you're wondering at a developers [0:25] conference why we are talking about [0:27] spreadsheets so my view on this is is [0:30] spreadsheets are definitely mislabels [0:33] many people think of spreadsheets as [0:35] being data but spreadsheets are not data [0:39] spreadsheets are code this is the gospel [0:42] of my life spreadsheets are code I go to [0:44] all sorts of conferences to share the [0:46] happy word that spreadsheets our code so [0:48] if you want to leave now or fall asleep [0:50] or do some email that's fine because [0:52] this is already the most important [0:54] message of my talk right there [0:56] spreadsheets are CES so you might wonder [0:59] why well I have three reasons for this [1:02] the first reason that spreadsheets are [1:03] code is they're used for similar [1:06] problems as you see here this is an [1:08] investment calculation where you put in [1:10] some numbers and an investment advice [1:13] comes out you could make this in any [1:16] programming language I mean you could do [1:18] it in in C or in Objective C if you want [1:20] an iPad app or in Java or in a [1:23] spreadsheet it doesn't really matter [1:24] there's nothing special about this [1:26] problem that makes its spreadsheet [1:28] specific [1:30] of course you could wonder why do people [1:32] do this in a spreadsheet I have asked [1:35] people this so during my PhD [1:36] dissertation I've worked with several [1:38] Banks and investment companies in the [1:40] Netherlands and I asked them like why [1:42] are you building this why aren't you you [1:44] know asking your it provider for some [1:47] software you know why because we are bad [1:50] at making software seriously they have [1:53] tried this they've went to their it [1:55] provider either internally or externally [1:57] and they say look I've I've made this [1:59] sheet and it's sort of okay it's like a [2:01] prototype can you can you build me some [2:03] software for that and the IT provider [2:05] goes like yeah sure no problem that'll [2:06] be 6 months and a million euros and if [2:09] that were only true it wouldn't be that [2:11] bad but it's never six months and a [2:13] million euros it's nine months and it's [2:15] €3 million EUR and it has half the [2:17] features they want so end users perceive [2:21] themselves as better programmers than us [2:25] and and I mean they're not entirely [2:27] wrong in that because they can quickly [2:29] build prod types that do what they [2:31] want so I I go to Great length to make [2:36] my point to suchar Great length in fact [2:38] that I have built a touring machine in [2:40] Excel formulas to show that spreadsheet [2:43] formulas are touring complete so no more [2:46] saying please that spreadsheet are not a [2:49] real programming language because this [2:51] is a cheering machine every row by the [2:53] way is one iteration of the tape and [2:55] with conditional formatting I'm moving [2:57] the Hat over the tape so it's also I [2:59] think a nice visualization of a cheering [3:02] machine you can easily see what's going [3:04] on you see the history stored in the row [3:07] as well instead of just a head moving [3:09] over a real tape and many people and [3:12] enjoyed this a lot it sort of went viral [3:14] on the internet and it brought my [3:16] personal blog down for half a day [3:18] because it was on Hacker News and on [3:20] Reddit so the third reason that [3:22] spreadsheet should absolutely be treated [3:24] as pieces of source code is they suffer [3:27] from typical software engineering [3:29] problem s only one in three spreadsheets [3:32] has a manual an average spreadsheet is [3:35] used by 12 different people over a [3:38] lifespan of five years does that sound [3:41] familiar that is exactly the type of [3:43] problems that software is suffering from [3:47] and especially was suffering from let's [3:49] say 30 or 20 years ago in those days [3:53] everyone was an end user there were no [3:55] software engineering degrees yet there [3:57] were no tools everyone was just building [3:59] their own own stuff and then software [4:01] engineering software suffers from those [4:03] problems as well and spreadsheets still [4:05] do today so in summary the activities [4:09] the complexity and the problems [4:11] surrounding spreadsheets are the same as [4:14] software so spreadsheets are code [4:16] there's no denying it anymore but I'm [4:19] going to go further than that it's not [4:20] just a programming language Excel [4:23] actually is the next programming [4:25] language you should [4:27] learn why well resistance is futile why [4:32] first of all spreadsheets are live [4:34] programming who knows who made this does [4:37] anyone familiar with this [4:39] picture yeah who made it do you know oh [4:42] it's okay so it's made by a guy called [4:44] Brad Victor and what he proposes here is [4:46] the idea of live programming so on the [4:49] left side you have the instantiation of [4:52] the source code that you see on the [4:54] right so if you change something here a [4:56] number a color or an integer the tree [4:59] will change change immediately so [5:01] there's no compiling involved it it live [5:03] updates and he coins this term live [5:06] programming well that's awesome Brad [5:07] Victor but we had that since vyal I mean [5:10] a spreadsheet is live programming you [5:12] change your formula and automatically [5:14] everything updates there's no [5:16] compilation involved there [5:18] either so functional programming is sort [5:21] of like back from the from the almost [5:24] dead it's getting more and more [5:25] mainstream so you know what else is pure [5:28] functional program in Excel is pure [5:32] functional programming a formula in [5:35] Excel is by by definition side effect [5:38] free the only thing a formula can do is [5:41] take input from different formulas and [5:43] produce a value a formula cannot change [5:47] the results of another formula or [5:49] another cell so there are no side [5:51] effects isn't that [5:54] fantastic thirdly everyone knows [5:56] spreadsheets people everyone like your [5:58] neighbor is doing his is managing his [6:01] soccer team's finances in a spreadsheet [6:04] your accountant is probably doing your [6:06] taxes in a spreadsheet everyone knows [6:08] spreadsheets except us developers isn't [6:12] that sort of sad I I really like to say [6:15] that spreadsheets are the most [6:17] successful programming language in the [6:19] history of mankind it's such a good [6:22] programming language that people don't [6:24] even know they [6:25] programming isn't that fantastic I mean [6:28] imagine doing Java by accident that will [6:30] never happen when people are programming [6:33] in a spreadsheet without even knowing [6:35] they're programming how successful is [6:37] that so I'm going to assume now that you [6:41] are convinced that spreadsheets are Cod [6:42] and that you're also convinced that [6:44] spreadsheets are pretty cool so let me [6:45] show you some typical programming ideas [6:49] implemented in a spreadsheet to show you [6:51] how super awesome they are [6:56] let's so Uncle Bob says that function [6:59] programming is programming without [7:01] assignment statements so let's see how [7:03] that looks like in a spreadsheet we are [7:06] going to take a typical example we're [7:08] going to square some integers let's take [7:11] it easy I know it's it's late in the [7:15] day so I have a number of values here [7:18] and what I want is the square so that is [7:20] still pretty easy what I can do is I [7:22] just multiply the number with itself and [7:26] I can drag that down probably you know [7:28] this you can drag a formula down and [7:30] then it automatically updates the [7:32] location you can also double click there [7:34] and then it goes [7:35] automatically so what we have is a list [7:37] of inputs and we have a function [7:39] definition this is just defining a [7:42] function over an input it's like a map [7:45] we're mapping the function over all the [7:48] inputs but now you're going to say as [7:50] developers ah this isn't pretty because [7:52] all those formulas look slightly [7:54] different but I can fix that I can give [7:57] those that First Column a name I'm going [7:59] to call that [8:02] input and what I can do now is I can [8:05] refer to that name's range in this way [8:08] I'm dragging this input done and what [8:10] happens now is every value in this range [8:13] gets the value that's the intersection [8:16] of this row and the named [8:19] range so I can delete that and what I [8:22] can do now there instead of referring [8:23] directly to the formula I can say input [8:26] times input isn't that nice and now it [8:30] looks like a more proper programming [8:33] that's cool [8:34] huh it's the same everywhere so it's [8:37] really like a function and you can do [8:39] that without having the ugly spreadsheet [8:42] like A2 and [8:44] A3 so let's do something a little bit [8:47] more exciting because this is still [8:48] quite easy so what we want what we would [8:51] like to have is the sum of all squares [8:53] that are over [8:56] 30 so I can make a simple Boolean I'm [8:59] going to say which of those values is [9:01] bigger than 30 that's still you know [9:03] super easy and see we have square here [9:06] so again here everywhere we have a nice [9:08] consistent formula no a3s and a7s just a [9:12] nice [9:14] formula we can use a sum if now to sum [9:17] all of the values in the squares over 30 [9:21] that's sort of nice syntax sum if over [9:23] 30 if this is true then I'm summing the [9:26] Square value but it takes it takes lot [9:29] of real estate there's a lot of room I [9:31] need for all those extra squares and [9:34] extra booleans so what we want to do is [9:36] something a little bit more efficient [9:38] what I would like to do is I would like [9:39] to multiply those two ranges directly so [9:43] multiply the squares with the bullion [9:45] that internally is Rewritten to a zero [9:48] or one so you can multiply with it what [9:52] I could do is multiply input by [9:55] input but that's not it because what I [9:58] showed you earlier is if you have a [10:00] range if you refer to the range you get [10:03] the intersection of the row and that [10:05] range so that's not what you want but it [10:07] is close what we can do is use control [10:10] shift and then Excel makes this into an [10:13] array function and that means we can [10:16] calculate with ranges or or arrays as [10:19] first class citizens so if I just typ [10:23] the same formula and hit control shift [10:25] enter I get this and I got a different [10:28] value see without cures it's this and [10:30] with cures it's [10:32] this What's Happening Here is this [10:34] entire input range is multiplied by an [10:38] entire second input range and the result [10:41] of those two ranges because it's pawise [10:43] multiplication is another range so what [10:47] we're seeing here is the first item of [10:50] the result of this range multiplied by [10:52] itself and if I would give it a little [10:54] bit of space I would get the entire [10:57] array or I'm just going to show you I [10:59] think the first five elements so I'm [11:01] copying this formula now [11:04] here and now we get the first five [11:07] elements of that array so now you can [11:08] see that that array formula actually [11:10] results in a real second array of which [11:13] I'm showing a few values what I can do [11:15] then is I can reduce that array so I [11:18] have all the values now I could sum it [11:21] so I could do this the sum of [11:25] this range multiplied by itself so in [11:29] just one formula we don't need all the [11:31] extra cells just in one formula I'm [11:33] multiplying the range bewise with itself [11:35] and I'm swimming [11:37] everything and there I can also put in [11:39] the filter I can multiply input by input [11:43] and then multiply it by we or not that [11:45] is bigger than 30 and then I get the [11:47] same value here but I could delete all [11:51] those extra cells I don't need them [11:53] because everything is reduced so it's [11:54] pretty efficient if you know about all [11:57] these special functions like array [12:00] formulas so something else I want to [12:02] talk about is how error values work in [12:05] Excel probably you've never really [12:07] thought about it because they are so [12:08] intuitive and nice but there's something [12:11] interesting going on there so suppose [12:14] again you have a number of inputs and [12:17] I'm going to seat this with some random [12:19] data between zero and three so sometimes [12:22] we get zeros [12:24] there suppose I would want to divide by [12:28] that random data column and I'm going to [12:30] call that the danger zone because it's [12:32] really very dangerous because they could [12:35] be zero look at that danger dividing by [12:39] zero Excel warns us Excel gives an error [12:41] and say watch out this is an error so [12:45] think about this for a minute what is [12:48] the data type if we're saying this is an [12:51] integer what is the data type of that [12:57] range [13:00] who's a functional programmer [13:04] here yes look at this guys it's a Monet [13:08] in Excel it's a maybe [13:11] in this is a 700 million Exel users they [13:15] just use monad without any problems they [13:18] don't even think about it because if we [13:20] have another column that uses this maybe [13:23] in as an input it just works look we [13:27] have here a calculate some more column [13:30] that just takes the maybe in and works [13:33] with it without any problem so this plus [13:37] here is [13:38] lifted and just applied to the ins so we [13:42] go from a plus that works on integers [13:44] seamlessly to a plus that works on maybe [13:48] an integer or an a value isn't that [13:51] awesome I think it's pretty cool so [13:54] let's do some more real programming [13:56] because now you're saying yeah but a [13:58] little bit of filter in a little bit of [13:59] swimming that's that's not something [14:01] that I'm really going to use let's [14:04] tackle a bit more exciting problem so [14:07] what we have here is a maze and it's [14:10] filled with money so I want to have a [14:12] walk through this maze that gives me [14:15] most money I I'm a poor academic so I [14:18] need to get my money from programming [14:20] examples that are set in a [14:23] maze so what I could do of course what [14:26] would just work is I could Define a [14:28] cursive solution I'm going to start here [14:30] so this is the beginning of my maze but [14:34] it's easier to start at the end and work [14:36] our way back so what we can do is we can [14:38] say the value that what we can achieve [14:41] most what the most money is that we can [14:43] get from our maze there are two options [14:46] either I came from that way or I came [14:49] from that way that's that's the only two [14:51] options that could have happens if I [14:53] have reached the end of the maze so I'm [14:56] simply going to take the maximum of [15:00] those two so the maximum that I could [15:02] achieve here or the maximum that I could [15:06] achieve there the maximum of those two [15:08] paths through the maze so this this is a [15:10] solution that works however there is a [15:13] problem with this solution does anyone [15:14] know what our problem [15:19] is yeah so it's not very efficient yes [15:23] it's not very efficient it's not really [15:25] solved it is solved but it's not really [15:27] solved because for example this path [15:31] through the maze every recursive goal [15:34] you would try all the paths exra course [15:37] of coal so if you're here you try all [15:39] the pads and then you're you're again [15:41] you're here and you try all the pads so [15:43] it works but it's very expensive because [15:46] you keep exploring the entire maze so [15:50] what we could use here is a technique [15:52] called dynamic programming and what [15:54] dynamic programming does is it saves [15:58] half St states of the problem in order [16:01] to be more efficient you don't have to [16:03] calculate everything you calculate sub [16:06] problems uh you calculate the whole [16:08] problem from sub [16:09] problems so here is a ma our Maze and [16:12] we're going to have an extra work sheet [16:14] called Max and what we're saving there [16:17] is the maximum value at that square in [16:21] the Maze so those are easy this one and [16:26] that one there's only one way you could [16:29] reach that square the only way to get [16:31] there is like that because we're only [16:34] moving that way so those are easy but [16:37] the rest of the maze what I want to do [16:39] there is I want to look at what is the [16:42] best way I could have achieved this sub [16:45] problem so far so I'm taking the maximum [16:48] of those two steps before me [16:52] plus whatever is in this field of the [16:55] maze so either I came from that way or I [16:57] came from that way plus whatever was [16:59] already there now I have the same [17:01] formula for all those squares in the [17:04] Maze and I have my answer that's it [17:07] that's the whole solution and if you [17:09] compare that to this is a very famous [17:11] problem in computer science with the [17:13] solution in C or even in high school it [17:17] really looks very easy in a spreadsheet [17:19] this is the only formula you need for [17:22] the entire Maze and you have your [17:25] answer however it's a bit cumbersome [17:27] because now I have the value but what I [17:29] also of course would want to know is [17:31] what is the path through the mess how am [17:33] I supposed to walk in order to obtain [17:36] all that money and of course I could [17:38] find it out because every time I could [17:40] look what what is the best of those two [17:42] and then what is the best of those two [17:43] and I could retrace my steps but that's [17:46] too much work I I'd rather have Excel do [17:49] the thinking for me than I do it myself [17:52] so what I'm going to do is instead of [17:54] printing the values I'm going to print [17:56] the PAAD with arrow like symbols and [18:00] those Arrow like symbols are going to [18:01] indicate how I'm walking through the mze [18:05] so here it's relatively easy because [18:07] again if we're on the border of the maze [18:09] there's just one way we could [18:11] go up and in this case left those are [18:14] the only options we have because we're [18:16] only walking now we're walking back so [18:19] we're only walking [18:21] up then in this case if I want to detect [18:25] where I was coming from in my optimal [18:27] solution I can just say well I'm going [18:30] to point at the maximum if the maximum [18:33] is above me I'm going to print this and [18:36] if the maximum is next to me I'm going [18:39] to print [18:40] that and now we have sort of a a vector [18:43] field of our maze looks looks [18:46] interesting and I I could say it's [18:48] solved because I can just follow the [18:50] arrows now I could go like [18:52] this that way and then that way that's [18:57] that's how we're going but still still [18:58] it's too much thinking so let's just [19:00] tweak the formula a little bit so that [19:02] the solution looks somewhat nicer I'm [19:05] only going to print something if the [19:08] cell is being pointed at only if I'm [19:11] really in the path I'm Printing and [19:13] otherwise I just print an the anti [19:16] string because that will look very [19:18] pretty so there we go if the value below [19:23] me is this if I'm being pointed at from [19:26] the bottom then I'm printing something [19:29] and otherwise I'm printing the empty [19:31] string still sort of an easy formula and [19:34] it it looks nice but we're only going [19:36] one way now you see we're only going up [19:39] and the first B we have from here is now [19:41] stalled so we need one more thing [19:44] because now we're only pointed that from [19:45] below we also want to print if we're [19:47] pointed that from the side almost the [19:50] same we just add this we're just saying [19:53] if the value next to us is that Arrow [19:55] we're printing as well and otherwise [19:57] it's the empty string and then we get [19:59] this [20:01] Tada that's our fad our moneymaking pad [20:04] through the whole Maze and it's really a [20:08] very easy formula it's just if I'm being [20:11] pointed at I'm going to print the [20:14] maximum and otherwise I print the empti [20:17] string and the nice added value that you [20:19] see now the power of Life programming [20:22] and having the data and the formulas [20:24] together is that every step of the way [20:27] was very clear what was happening now [20:30] I'm printing values now I'm printing [20:32] strings you're very in touch with your [20:35] data whereas if you're doing this by [20:38] reading from a text file probably you're [20:41] using pen pen and paper to to check okay [20:44] what am I printing what am I doing [20:46] there's print statements everywhere or [20:48] you're using the debugger you have to [20:50] spend lots of effort to remain in touch [20:54] with your data whereas here the data is [20:56] is right there it's screaming at you [20:58] you're like use me give me some formulas [21:00] and I will tell you what I'm up to and [21:02] that makes spreadsheet programming [21:03] really very very easy and [21:06] intuitive so in summary spreadsheets are [21:09] code if everyone say anyone close to you [21:13] says it's just a spreadsheet hit them on [21:15] the head with something really tell them [21:18] it's untrue spreadsheets are real [21:21] programming and it's super [21:22] cool so of course this is sort of the [21:26] the the main idea behind all research [21:28] I'm doing at Del University of [21:30] Technology is if spreadsheets are code [21:34] then maybe they need some software [21:37] engineering maybe we as software [21:39] Engineers know how to support people [21:42] that are building spreadsheets because [21:44] in software I as I said in the beginning [21:46] of my talk 30 years ago 25 years ago [21:50] everyone was an end user programming [21:52] everyone was building their own compiler [21:54] and then 10 years later people were like [21:57] oh yeah I know that Pro program is still [21:58] running probably we've lost a compiler [22:01] and also the person that buildt it isn't [22:03] working here anymore I don't know either [22:06] so we saw those problems and we realize [22:09] as Community we need to improve we need [22:12] to build some tools to help people [22:14] maintain Legacy code so if you look at a [22:18] modern IDE well this screenshot isn't [22:20] all that modern anymore but if you look [22:22] at Aid you see it at all has all sorts [22:25] of features like debugging and testing [22:27] and [22:28] analyzing those features are not helping [22:31] me to build codes to write codes they're [22:34] helping me to write responsible code to [22:36] be a good developer I'm going to test my [22:39] code I'm going to analyze code metrics [22:41] from now now and then it's helping me to [22:44] be a good developer then if I look at [22:47] Excel yeah it has support for making [22:50] things a different font or a different [22:52] color it has no support for anything no [22:57] ID El L features helping spreadsheet [23:01] developers to build good spreadsheets so [23:04] whether they have the first version of [23:06] my of the first example I showed you [23:08] with A2 times A3 or they use nice names [23:12] for everything no one at least not the [23:16] interface is telling them ah maybe you [23:20] shouldn't you shouldn't call everything [23:22] A5 maybe you should give some names here [23:25] and there so because spreadsheets Areo [23:28] similar to source code is what I [23:29] observed maybe we can help spreadsheet [23:32] developers with some ideas from Source [23:35] from software engineering so one of the [23:37] things I build in my PC dissertation is [23:39] the idea of code smells for spreadsheet [23:43] formulas for example the long method [23:46] smell if you have a method that's very [23:48] long that does lots of things it easily [23:50] translate to Long formula if you have a [23:52] formula and then we're not really saying [23:55] long in terms of real length but we're [23:57] looking at the number of different [23:59] operations so in this formula we're [24:00] summing and multiplying and dividing if [24:03] a lot is going on in a formula it's just [24:06] as smelly and for the same reason as a [24:08] long method is [24:09] smelly another smell we know from source [24:12] code is the many parameter smells you [24:14] have a method and it has all these knobs [24:17] and buttons you can press that's not [24:19] very maintainable well and if you look [24:21] at the spreadsheet formula it's [24:23] referring to that and that and that and [24:25] that very very hard to read [24:29] conditional complexity is is a smell [24:32] it's it exactly translates to [24:34] spreadsheets we have an if so you can [24:37] Nest them and there used to be a limit I [24:39] think of seven layers of nesting but for [24:42] reasons known to me they have lifted [24:45] that band so you can now Nest up to I [24:47] don't know 64 depth or something like [24:50] that so this really really happens that [24:53] people Nest six seven eight ifs well if [24:56] you have to debug that it's just [24:57] horrible [24:58] something we also inspected is the use [25:00] or the occurrence of clones like we know [25:04] clones in source code can be bad because [25:06] if you have the same functionality in [25:08] multiple places if you have to make a [25:11] change it has to be changed everywhere [25:13] this happens in Excel as well for [25:14] example in this formula you have this [25:16] sub formula that occurs twice and this [25:19] is not just bad for maintainability but [25:22] actually also for execution speed of [25:24] excel because the way the Excel caching [25:26] model works is Exel caches Cell results [25:30] but it doesn't cach all sub formula so [25:32] the execution engine in this case would [25:34] be like oh you want to have the exponent [25:36] of 0 minus G36 * [25:39] c36 no problem [25:42] calculate and then it would be there and [25:44] then again it would think oh the [25:45] exponent of 0 minus G36 it would not [25:48] remember that has already been [25:50] calculated so if you would extract that [25:52] sub part into a cell you would also get [25:55] the added benefit of more speed because [25:57] it's only calculate [25:59] once so we found that those smells not [26:02] only occur at the formula level we have [26:06] a tool that visualizes dependencies [26:08] between worksheets as you can see here [26:11] so the blocks are worksheets and the [26:13] arrows connect worksheet so if there's a [26:15] formula here there would be a formula in [26:17] calculation 2 that would say input A1 * [26:21] 12 or something like that so [26:24] unfortunately not all visualizations [26:26] looked as structured as this one some [26:29] visualizations look like this still [26:31] okayish some visualizations look like [26:33] this which is particularly interesting [26:35] you can't read it but these are the [26:38] three quarters two three and four with [26:40] their corresponding months but this is [26:43] q1 with January February and March so it [26:47] somehow had a different structure than [26:49] all the other months and when we asked [26:50] the person that build this he said yeah [26:52] yeah you know I started like a prototype [26:54] in q1 and I didn't really know what I [26:56] wanted yet and then in Q2 of course I I [26:59] I started all a fresh and then I really [27:01] knew how to build my model but then of [27:04] course time went by and as it goes it [27:06] became January again I totally forgot [27:09] that that first quarter was like back of [27:11] a napkin I didn't know what I'm building [27:12] yet and the model stayed alive with [27:14] those two different calculations so how [27:17] would you know without a visualization [27:19] tool like this other visualizations look [27:22] like this also interesting so that's [27:24] touch for Sheet one and Sheet two you [27:26] can't really see but this is an arrow [27:28] going both ways so all the data went [27:31] from the one worksheet to the other and [27:33] what happened there was that all it the [27:35] sort of the worksheet had the same [27:37] structure and all these formulas were [27:39] connecting and all the formulas in the [27:41] other side were connecting of the same [27:43] worksheets so there was definitely an [27:45] opportunity there to restructure we saw [27:48] a visualization like this where the [27:50] pinkish blocks are external worksheets [27:53] so this spreadsheet is referring to [27:55] different worksheets in different files [27:58] so they they got this thing the mod [28:00] sheet where we got it from and the whole [28:03] process around it was people emailing [28:05] someone's spreadsheets they were put in [28:07] a special folder and then you open the [28:09] spreadsheet and it read all the other [28:12] spreadsheets yeah exactly you know it [28:14] was very wobbly to to say the least so [28:18] we concluded that those smells don't [28:20] really occur only at individual formula [28:23] level but you can also have inter [28:25] worksheet smells like you can also have [28:27] class [28:28] smells so who knows what smell these [28:31] classes are [28:36] exhibiting when I did this talk at [28:38] another conference someone yelled bad [28:40] naming which is true well that wasn't [28:43] what I was going for and I was too lazy [28:45] to change my [28:46] slides so it's not [28:56] that yes a t-shirt for you this is the [28:58] feature Envy smell because that method [29:01] here [29:02] XY it's it's it's envious it's jealous [29:05] of those wonderful Fields X and Y in [29:08] class A it would rather live in class A [29:12] where the fields are that it's so [29:14] interested in so this is a smell that [29:16] also easily transforms to spreadsheets [29:20] if you have a formula that refers to [29:22] cells on another worksheet then probably [29:24] it's better if it would go there this is [29:26] an example from an actual open data [29:29] spreadsheet set that we've analyzed so [29:31] you see formulas like this so we're on [29:33] the income statement worksheet and we [29:35] have this [29:36] formula so if you if the if my boss asks [29:39] me what does that formula actually [29:42] really do ra if I have to debug it it [29:45] would go like this okay required funds [29:49] B9 that is building amount of amount of [29:53] buildings divided by required funds C9 [29:57] that is depreciation of the buildings ET [30:01] CRA etra you have to go back and forth [30:04] between all those sales all the time to [30:07] really read what's going on and we know [30:08] from cognitive science that context [30:11] switches are very expensive if you have [30:13] to switch views all the time that's [30:15] super annoying so what you could do is [30:17] take that formula and put it on the [30:19] required funds worksheet just take it [30:21] and copy paste it there and the added [30:23] benefit is that if you click it now [30:25] Excel will color the dependence for you [30:28] which is nice I mean it's still sort of [30:31] a rainbow because these this is actually [30:33] three different colors green but at [30:36] least it's better because you can sort [30:38] of see what's going on and you don't [30:41] need the prefixes anymore either because [30:44] you're already on the required fronts [30:45] worksheet so you can drop them which [30:47] makes the formula a lot shorter and then [30:49] you start to see some structure oh there [30:52] these three things divided by each other [30:54] plus these three things divided by each [30:56] other so it's really a lot better like [30:59] it is in sour Cod to place the formula [31:02] where it [31:06] belongs oh you could factor out to [31:08] divide by 12 yeah that's true that's [31:11] definitely true too so we started a [31:13] spin-off company called infron and we [31:15] have a tool that does this smell [31:17] detection for you quick commercial break [31:19] where you can just upload your [31:20] spreadsheet and we tell you all the [31:22] smells that are in there so this would [31:24] be how it would look like for the [31:25] spreadsheet I just showed you [31:27] well look there are 10 there are more [31:29] than 10 references to that worksheet you [31:31] should move it to a different [31:34] sheet then of course if you say smells [31:38] you [31:41] say I have my hopes on you [31:45] really refactoring definitely if you [31:48] have smells then you should refactor [31:51] your source code which also goes for [31:53] spreadsheets so in addition to giving [31:56] the suggestions as we did in the [31:58] beginning in the slide I showed you we [32:00] also have a refactoring tool that helps [32:03] people refractor their spreadsheet so [32:05] this is how it looks like it's called [32:06] Bumblebee and the spreadsheet user can [32:09] ask for example for this formula it's a [32:11] simple example but it's a sum divided by [32:14] a account so you could also use [32:16] a average function yeah so maybe this [32:19] person isn't aware that that average [32:20] function exist probably in this case [32:22] they would be aware but there are for [32:24] example also refractor supports going [32:26] from a Su to a sum if and not everyone [32:29] knows what a sum if is or how it works [32:33] so you can ask bumblebee do you have [32:35] some interesting rewrites for me can I [32:37] improve this formula it says yeah sure [32:40] we have a sum and counts to average [32:42] refracturing for you like in modern [32:43] idees you get a preview as well this is [32:45] how the formula will look like if you [32:47] have refactored in and then you can [32:49] apply it and just applies the formula [32:52] for [32:53] you and those Transformations are [32:56] programmable so so bumblebe if you [32:57] downloaded it it comes with a set of [33:00] refracturing but you can also write your [33:02] own refracturing in a little language so [33:05] here for example is the sum and count to [33:08] average refracturing summing a range [33:10] divided by the count of the same range [33:12] results in the average of that range so [33:15] we haven't tried this yet with users if [33:17] you have spreadsheet users in your [33:18] company let me know at the end of this [33:20] talk but we envision that spreadsheet [33:23] users that are power users that they can [33:25] write array formulas maybe can write [33:27] some VB we think they could also be [33:31] capable of writing those Transformations [33:34] themselves and in in addition we also [33:36] want to explore the idea of programming [33:38] by example here a little bit where if we [33:40] observe a user is changing formulas a [33:43] few of them we could deduce a [33:45] refracturing pattern from it and say hey [33:47] you're you're doing the same thing maybe [33:49] we can apply it that transformation for [33:52] you in the entire [33:53] spreadsheet if you're interested to try [33:55] it or and want to encourage enourage [33:57] business users in your company to try it [33:59] you can download this from felina.com [34:01] bumbleby all the links will be also in [34:03] the final slide so you don't necessarily [34:05] need to make a picture now I'll wait for [34:09] you then if you say refactoring of [34:12] course you [34:15] say that's a good one but that's not [34:21] it yes testing you're not going to [34:24] refactor your spreadsheet without the [34:25] security of some [34:27] tests and this is actually [34:30] the oh you don't believe in testing [34:33] that's [34:36] a fair [34:39] enough okay so this is actually the the [34:42] chronological order in which I did the [34:44] work but it would have made sense also [34:47] to start with testing to do that at [34:49] least before refracturing however and [34:51] this was typical Ivory Tower thinking I [34:53] thought yes but how am I going to get [34:55] spreadsheets users to to test and [34:57] convince their management to test it's [34:59] already quite hard to get professional [35:01] developers to test and to give their [35:04] bosses you know to have them get [35:07] permission for testing but this was [35:09] really thinking the wrong way because [35:11] spreadsheet users are actually quite [35:13] good at testing we observed in in the [35:16] same open data set I talked about [35:18] earlier that these type of formulas are [35:21] actually quite common so what this [35:23] expresses is if the sum of those guys if [35:27] they're 100% together it outputs 100 but [35:30] if it's not it outputs error this is [35:34] like a test it's it's like an assertion [35:36] it expresses the knowledge that those [35:39] five things together should be 100% And [35:42] in the lack of a real testing framework [35:45] what do spreadsheet users use a for [35:48] formulas they have no other language and [35:50] formulas and we found that 8% of [35:53] spreadsheets that we analyzed had these [35:55] type of test formulas so they're not all [35:58] that in [35:59] common and then of course we thought [36:01] hauh we could exploit those test [36:03] formulas if people are already testing a [36:06] little bit we could use that to extract [36:09] a test Suite so we built another tool [36:12] called expor and you can ask expector to [36:14] to search for those type of test [36:17] formulas in your spreadsheet and then it [36:19] would say hey look at that I found a [36:22] formula that looks a little bit like a [36:24] test we use some euristic there so we [36:26] have a number of words that we know that [36:28] look like test outputs so okay error yes [36:32] no in in real life spreadsheets we even [36:34] found test formulas outputting in a [36:37] smiley or a saddy face depending on the [36:39] results of the test [36:42] definitely so we know what a test [36:44] formula is we say hey what we found here [36:46] is that the cell on that the formula in [36:49] that cell expresses that those guys [36:51] should be 100% And as you see we've done [36:54] some parsing here to represent the test [36:56] T formula in natural is language to make [37:00] it easier for people to see [37:03] it and then you can add those formulas [37:06] to the test sued you can have the little [37:08] tick mark save the test and then we say [37:09] Well it passed that test pass because [37:14] this is actually 100% and none of the [37:16] tests [37:18] failed and then what we also do is we [37:20] show users coverage of their test they [37:23] can say show me what's tested and [37:25] everything that's covered by it test [37:26] formula is marked yellow and this is [37:29] because this is a test formula that [37:31] depends on those cells we say they are [37:33] tested as well so we're not really [37:35] talking Branch coverage or statement [37:37] coverage here Advanced ways of coverage [37:39] we just want to give users a feel for [37:42] how well everything's tested so if you [37:44] have a test all the dependents are also [37:46] tested the idea is of course if you [37:48] would change one of the 20s then that [37:50] would show up this is not foolproof of [37:53] course because one could be there are [37:56] ways you could um you could have other [37:59] cells here that depend on it it's not [38:02] foolproof however it is helping a little [38:06] bit giving people an idea of what's [38:08] testing what we also do is we help [38:11] people then add more tests and instead [38:14] of just letting them free we thought it [38:16] might be easier to just give them one [38:19] formula to [38:20] test I have five minutes before I'm [38:23] going to to a meeting let me add one [38:25] test to my formula so that you can pick [38:28] in three categories a complex formula a [38:31] for formula with a big value that that [38:33] represents a lot of money or a lot of [38:35] orders or whatever or formula that has [38:37] many precedents so that that many cells [38:40] are referring to so you could say for [38:43] example if you ask for a complex formula [38:45] hey this formula here looks looks pretty [38:48] nifty that's probably something you want [38:50] to test if you just want to add one test [38:52] and then you can express some tests [38:54] buildin test so you could say it's a [38:57] number this is the upper uh limit the [38:59] lower limits and in a slightly newer [39:01] version of the tool we also have an [39:04] extra value there where users can write [39:06] a formula so whatever formula they want [39:09] because we found this is slightly uh too [39:11] restrictive just having types and upper [39:14] and lower bounds and we give people [39:17] compliments we say wonderful you have [39:19] increased your test coverage from 6% to [39:22] 8% we want to encourage people and show [39:24] them that higher coverage is is indeed [39:27] better so we have added the test and now [39:30] you see our test Suite is bigger because [39:32] now three tests have passed and still [39:34] none are failing this tool too is [39:37] available from my website felina.com [39:38] exor we're just at this point giving the [39:41] plugins away for free because it's [39:43] active research and so no guarantees if [39:45] it doesn't work you can send me an email [39:47] but probably there's nothing I can do [39:49] about [39:50] that this is everything I wanted to [39:52] share with you but before we go over to [39:54] questions I do think we have some time [39:56] for questions we have some time for [39:58] questions let me summarize my entire [40:01] talk for you in one minute so if you [40:03] came in late or it's the end of the day [40:05] and you're slightly sleepy this is your [40:06] second chance to get the dist of the [40:08] talk in like 30 seconds and otherwise of [40:11] course this is optimal preparation for [40:13] question asking spreadsheets are code [40:16] it's the most important message remember [40:18] and tell all your friends and tweet [40:19] about it and put it on a t-shirt why [40:22] because they're used for similar [40:24] problems they are just as power ful [40:26] namely to in complete and they suffer [40:29] from typical software engineering [40:31] problems even cooler they are what every [40:36] programming language in 2016 aims to be [40:39] live and functional and used by everyone [40:42] what what more is there to wish for I've [40:45] showed you a few examples of how to [40:47] implement real life [40:49] programming problems in an easy way in a [40:52] spreadsheet including a nice maze solved [40:55] with dynamic programming [40:57] so if spreadsheets are indeed code they [40:59] can use a little bit software [41:01] engineering magic and I've showed you [41:03] that in the form of a smell detection [41:06] tool a refracturing tool and a test tool [41:09] if you want to know more this is the [41:11] website perfect Excel of the smell [41:12] detection tool that is now commercially [41:15] available you can go to my website to [41:17] download the refactoring tool and the [41:19] testing tool because they're still [41:20] active ongoing research and we really [41:22] want people to try that and I have a [41:25] research group in Del as well where I [41:27] force grad students to also like this [41:29] and you can find out more about all the [41:31] sorts of research we do at our website [41:33] pry lab.org and if you want to connect [41:36] with me later I will be at the party [41:37] tonight you can send me a tweet if you [41:39] want to meet or an email or you can ask [41:42] a question now of [41:53] course yeah so one question is what is [41:55] the a reach of people what is the [41:57] audience not everyone would use Excel [41:59] like I do well some people use it in way [42:02] way more advanced ways and I do with my [42:04] little programming example so of course [42:07] there are people that just use it for [42:08] simple lists but there are companies and [42:10] organizations that really depend on [42:13] Excel for for their core business so [42:16] insurance companies banks that really [42:18] make models that the company depends on [42:21] so we do think there are lots of people [42:22] that could benefit from this type of [42:24] software many [42:28] yeah that's just Excel user so it's very [42:30] hard for us to know how many people you [42:32] know where where's the threshold of of [42:34] serious use at what point this is also I [42:37] mean a general question for developers [42:38] at what point is it worth it to go from [42:41] notepad plus plus to a full-fledged IDE [42:44] because you would have refracturing [42:45] support that's that's not a very easy [42:48] question to to answer and it could also [42:50] depend on your goal well I'm actually in [42:55] two weeks going to go for a research [42:56] visit I will work there for three months [42:58] to to improve EXL and to maybe also I'm [43:01] not sure if they will give me a if give [43:03] me a look at the data but yeah they [43:05] actually were one of the funders of my [43:06] PhD position so they are aware of [43:14] that