top | item 27159159

(no title)

saym | 4 years ago

Can you talk a little more about worksheets? I'm not familiar with scala worsheets at all.

Follow-up: How do you transition to productionizing your code after iterating in them?

discuss

order

jules|4 years ago

Worksheets are a simple concept: you write lines of code in them, and the IDE runs the code automatically as you type, and displays the return value of each line. If you're familiar with the concept of Jupyter notebooks, it's a bit like that.

I tend to not view it as a replacement for an ordinary code file, but as a replacement for a REPL session. It has several advantages:

* Keeping track of your previous commands in a file is much more convenient than keeping track of it in your input history of the REPL.

* You can keep re-editing previous lines easily, and you can see the output of all lines.

* There is no hidden state (unlike a REPL). Everything is run from scratch every time.

* It's easier to define helper functions than in a REPL.

* It's easier to turn a worksheet into a unit test than it is to turn a REPL session into a unit test.

That said, it's also possible to start writing a module in a worksheet, and then turn it into an ordinary code file later.

Worksheets aren't perfect yet; I can think of many improvements, but they're already very useful to me. I think the end game will be to merge the concept of worksheet, unit test, debugger, printf debugging, and ordinary code file into one system, like Sean McDirmid's usable live programming research work (which in my opinion remains one of the most underrated research projects).

https://www.youtube.com/watch?v=01Xyoh-G6DE