Live data from Hacker News

Notebooks Are McDonalds of Code

yobibyte.github.io

131–140 of 153 posts

Re: Notebooks Are McDonalds of Code

#131
I have no idea what he is talking about. I use notebooks because I want to have an interactive and visual way to explore data/algorithms/phenomena. How/Why would you use a notebook "in production"? Why would you care about performance?

The article really makes me think either I or the author have a terrible misunderstanding about what notebooks are or how to use them.

Re: Notebooks Are McDonalds of Code

#132
post #41

Notebooks are primarily a _teaching_ tool, not code or an experimentation interface. I know that's not how they're used, but it's really bizarre to me that people use them for exploratory data analysis. They're great for teaching and for _documenting_ the results of exploration, but fairly bad for any type of interactive data exploration, let alone actually writing code. Frankly, notebooks are pretty terrible for exp…

The issue with CLI is it's crap for editing the code. It's rare that your data analysis will just be one-liners, it'll be some mess of steps and you want to go edit one in the middle (but not re-run the whole script). That's the first thing that the notebooks give you that you don't tend to get elsewhere. The second thing is the presentation of the plots: it's really handy to have multiple interactive plots laid out…

> It's rare that your data analysis will just be one-liners, it'll be some mess of steps and you want to go edit one in the middle (but not re-run the whole script.

And that's why I use elpy to execute codeblocks marked by comments in IPython. VSCode supports this workflow out of the box (but you don't get the matplotlib windows out of the box ;)) - although it is very, very liberal in using screenspace...

> One big thing that any replacement will need is the easy ability for the code to actually be running on a remote machine

VSCode remote (proprietary sadly). Also tramp + SSH-X-forwarding likely beats whatever ergonomics jupyterlab offers.

Re: Notebooks Are McDonalds of Code

#134
Holy hell why didn't he say "Jupyter Notebooks Are..."

I sat there reading through this thing, staring at my, spiral bound, paper notebook being utterly confused at what in the hell he was talking about.

I took a random comment, here, saying it for me to realize what was going on.

Re: Notebooks Are McDonalds of Code

#135
post #41

Notebooks are primarily a _teaching_ tool, not code or an experimentation interface. I know that's not how they're used, but it's really bizarre to me that people use them for exploratory data analysis. They're great for teaching and for _documenting_ the results of exploration, but fairly bad for any type of interactive data exploration, let alone actually writing code. Frankly, notebooks are pretty terrible for exp…

Not sure if this is sarcastic or not... I've taught and worked with some of the biggest companies in the world. They were using Jupyter and sound EDA to great effect.

So have I (not FAANG, though). I've been working in scientific python for over 20 years and long before notebooks came to the python world. (Yes, pre-numpy) And I've seen notebooks abused far more than used well. The same general thing was heavily abused in Matlab/etc too. It's not only Jupyter and it's not new.

It's not that they're not a good tool, it's that they're the wrong tool for a lot of what they're used for. They're an excellent teaching and documentation tool. However, they're remarkably bad for actually doing any type of analysis or exploration. They're a great way of presenting your analysis after you complete it, but they're bad for actually doing that analysis. Write analysis code and data exploration code using the same tools you would for production code. There's nothing wrong with an edit + run + explore loop. Do that with a standard REPL like ipython + your preferred editor.

But there's a lot wrong with trying to use a notebook to write and execute code, as it: 1) encourages writing code that won't actually run later (dependent on non-linear code execution and unsaved changes made to earlier cells), and 2) is a poor environment for writing code compared to more full featured editors or IDEs, and 3) discourages interactivity and data exploration due to being browser-based (poor performance compared to running directly limits interactivity during data exploration).

Your data analysis work needs to actually run independently later. Notebooks rarely do unless they're re-made from scratch. At that point, you're better off working in a more full-featured environment for the exploration phase and then using the notebook as later documentation / communication.

Re: Notebooks Are McDonalds of Code

#136
post #41

Notebooks are primarily a _teaching_ tool, not code or an experimentation interface. I know that's not how they're used, but it's really bizarre to me that people use them for exploratory data analysis. They're great for teaching and for _documenting_ the results of exploration, but fairly bad for any type of interactive data exploration, let alone actually writing code. Frankly, notebooks are pretty terrible for exp…

The issue with CLI is it's crap for editing the code. It's rare that your data analysis will just be one-liners, it'll be some mess of steps and you want to go edit one in the middle (but not re-run the whole script). That's the first thing that the notebooks give you that you don't tend to get elsewhere. The second thing is the presentation of the plots: it's really handy to have multiple interactive plots laid out…

You're not editing code in the CLI. You're editing code in your preferred editor/IDE. ipython + %edit works wonders. That's one of the main reasons to avoid notebooks and stick with CLI-based or similar tools.

Jumping into the middle of a script and editing is often a bit dangerous. You usually wind up with something that can't be reproduced, as it depends on modifying state in a way that wasn't recorded. You do often need some sort of caching during exploration, for sure (it's not really feasible to wait an hour every time you want to tweak a visualization), but it's often better to break pipelines up a bit and do disk I/O rather than leaning on cells in a notebook.

I do agree on the remote client part, though. Browser-based interactivity often is a good solution for a dev instance + a local thin client. It's slower than native for a local solution, though.

Re: Notebooks Are McDonalds of Code

#137

Earlier quoted context omitted.

In general anything written by nonprofessional programmers in pursuit of some other goal is terrible code by professional programmer standards. On the other hand, it accomplishes a goal other than getting a programmer paid. So in one important sense is objectively better than probably 80% of the code I've seen people paid to write, no matter how nicely it was constructed.

This is the crux of a lot of the anti-notebook rhetoric. I spend a good deal of time covertly teaching software engineering best practices to folks who claim they don't want to be "software engineers", yet they are in front of Jupyter most days.

I don't, but this is the conclusion my team came to very early on as well. It has honestly worked wonders.

Re: Notebooks Are McDonalds of Code

#138

Some of the worst code I've seen in my life lives in Jupyter notebooks. But that's fine, it's meant to be throwaway code. The problem is a lot of places/people do not use it as such .

Idk how you'd use one for non-throwaway code. Not like a webserver can run a routine in a notebook.

I've seen "production workflows" be wrapped up in jupyter notebooks. Manually triggered of course.

Re: Notebooks Are McDonalds of Code

#139
post #13

The article should start with more context, what is a notebook ? I know what it is, but the author is particularly bad at introducing his article.

My first assumption was something like interactive notebooks like Polyglot or something but reading this I really have no idea either

Re: Notebooks Are McDonalds of Code

#140
post #135

Earlier quoted context omitted.

Not sure if this is sarcastic or not... I've taught and worked with some of the biggest companies in the world. They were using Jupyter and sound EDA to great effect.

So have I (not FAANG, though). I've been working in scientific python for over 20 years and long before notebooks came to the python world. (Yes, pre-numpy) And I've seen notebooks abused far more than used well. The same general thing was heavily abused in Matlab/etc too. It's not only Jupyter and it's not new. It's not that they're not a good tool, it's that they're the wrong tool for a lot of what they're used for…

Your experience differs from mine... Shrug
Post reply on HN