Notebook

I’ve adapted the music generation experiments from the other day to Google Colab here. Not that I expect anyone to go look at it anytime soon — let alone run it — at least not from a discreet link tucked away in this hillbilly offramp from the information superhighway. But some future iteration may (eventually) become useful in some (as yet unclear) way to some (possibly imaginary) students.

Colab is both a blessing and a curse in these matters. On the one hand, Google dispense compute resources profligately to anyone who wants them (albeit with no guarantees and somewhat unpredictable constraints); on the other hand, it’s all delivered via the medium of Jupyter fucking Notebook.

I don’t want to get into a tedious round of that thing you like is bad, actually, but I’m very much not a fan of Jupyter. I do appreciate that its web based UI can be handily draped over an online and/or virtual backend to alleviate (or at least delegate) some of the dependency hell that besets complex software these days. Setting up a functioning work environment for data science and deep learning can be a toothgrinding business — a huge chunk of student queries and TA workload for COMP0088 last year arose from that — so it’s not really surprising that people will flock to anything that eases the burden a bit. But that doesn’t mean said web based UI isn’t also a problem in its own right.

Jupyter represents the lonesome death of software engineering. It actively militates against modularisation and scoping. Why bother to define a function when you can select a cell and run it again? It’s like Edsger Dijkstra and Niklaus Wirth died for nothing*.

Unless you really strive not to, you’ll wind up dumping everything into a global namespace that can be acted on — created, changed, deleted — unpredictably, out of order; and worse, that can persist unacknowledged between runs. When you load up a notebook there might be any amount of unknowable state lurking in it to bite you in the arse.

Python and Markdown are sometimes abstruse, but fundamentally they are made up of readable text. Notebooks are binary files full of crap. They contain nice textual code, but they are so much more than that — and by the same token, so much less. They suck for version control and configuration management. They suck for automation. They suck for reusability — and, most of the time, for plain usability.

Basically — I guess my position on this is not exactly a secret by this point — they suck.

It’s only fair to note that the notebook concept didn’t originate with Jupyter. I first encountered it in Stephen Wolfram’s amazing yet also awful Mathematica, and it may well predate that. The same decomposition into functionally unordered code cells interspersed with rich text documentation went on to infect Matlab and R too. But similar fundamental objections apply wherever it rears its ugly head. Jupyter strikes me as the worst iteration yet, but that may just be because it’s the one I used today.

Anyway, you pays your money and you takes your choice. Jupyter is the face of Colab, so everyone uses it. Even — apparently, occasionally, for my sins — me.

* Yes, yes, Wirth is still alive and Dijkstra wasn’t exactly killed in hand-to-hand combat with a GOTO statement, but you know what I mean.

Leave a Reply

Your email address will not be published. Required fields are marked *