9 ms·
Notebooks Are McDonalds of Code
- alan-hn 2y agoI've never been a fan of notebooks, it always felt like a strange way to run my code. What's the real advantage over creating scripts? If I want my code to run somewhere I would need to notebook architecture or just turn it into a normal script anyhow
- eldenring 2y agoof course, running a script from start to finish is better when it's fast, but if your code is slow to run, each cell acts like an in memory cache of your previous work.
- Tarq0n 2y agoThere's so many other ways to achieve the same effect though. I would argue that serializing the result of some expensive computation explicitly is even just better, as it can have a meaningful name and metadata.
- rcxdude 2y agoJust serialising and deserialising the results can be expensive though: it's quite for jupyter notebooks to have >64GB of data loaded. Even with high-end SSDs that's a fairly significant overhead.
- YurgenJurgensen 2y agoNotebooks have at least one advantage, but it's one that shouldn't really be an advantage: In a world where every big organisation rushed to adopt all the latest cloud buzzwords, we now have an awful lot of half-baked fontends for AWS and Azure that will certainly be mandated by company policy. Actually getting a computer that can access all the data you want and run in a way you want through EU law, US law, EULAs, company security policy, cloud billing policy et cetera et cetera is a nightmare. But for some reason, no matter what nonsensical environment you're being forced to operate in, there's always a Jupyter web interface with access to exactly what you need that none of the auditors, accountants or systems administrators seem to care about. It may not be good, but it works, and won't be bricked by some inexplicable change to IAM roles or VPS settings applied by some automated policy tool you didn't even know exists.
- hot_gril 2y agoSame reason spreadsheets are so powerful.
- pquki4 2y agoFor a script, you run it from start to end. For a notebook/repl environment, you can create any number of intermediate steps, rerun the previous step with minor modifications and check if the results are better, rinse and repeat. For jupyter notebook specifically, you can visualize data and add markdown inline which are very useful. You won't understand it unless you are already familiar with the workflow.
- alan-hn 2y agoSometimes I need to run my code in small pieces for testing and evaluation, I do this with multiple smaller scripts. Data can be saved to files and this accomplishes nearly the same thing as a notebook without needing to have the notebook environment
- rcxdude 2y agoSure, if you don't mind the overhead (both development and processing time) of loading/saving state to disk (about 10-30 minutes for a lot of my data). In notebooks you don't have to think about it since it's just the objects in memory (and indeed they don't make it easy to think about it, which is a reasonable criticism, but I don't currently know of a framework or system which gives you the advatages of both).
- alan-hn 2y agoWhenever I work with large datasets I use a small subset of the overall data to do testing while I build the pipeline, this avoids long run times and allows for quick iteration while I get things set up to run against the full dataset
- giraffe_lady 2y agoI've seen them used really effectively for debugging and incident response & documentation in elixir and erlang. You can connect to a running node in a controlled way, repl around the live environment, and dump potentially interesting things out to the notebook as you build your understanding of what's going on. I wasn't too active in ops stuff at that job, but as a dev it was so awesome for them to hand me off a notebook that was basically an in-progress investigation, including the entire path of exploration they took to narrow it down and dead ends along the way. You can't ask for a better bugfix ticket. Now I guess a lot of that depends BEAM particulars, and doesn't apply to jupyter or whatever. But it's at least an illustration that notebooks can uncover novel workflows for certain tasks.
- toxik 2y agoI disagree with the idea that notebooks and McDonalds are somehow inherently and fundamentally bad. They fit a certain niche, and you should use them accordingly.
- jhbadger 2y agoI think people may be misusing notebooks. They aren't there to develop software but serve as virtual versions of scientific notebooks (hence the name). They are there to conduct experiments (changing parameters and the like in your code) and to record and plot the results. You don't have to develop the software itself in the notebook.
- alan-hn 2y agoI can change parameters in a script. What's the advantage?
- packetlost 2y agoImmediate(ish) visualization and a whole lot of tooling to make presentation palatable for some datasets/types
- Cacti 2y agoIt’s a REPL, for starters.
- lelandbatey 2y agoREPL stands for Read–eval–print loop https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93prin... A REPL, by its name, is a very narrow version of the broader paradigm of interactive computer programming environments. But Notebooks are not REPLs, unless you use REPL to mean "interactive programming environment" and not REPL. Notebooks are much broader than a REPL! In a notebook, you can go back and edit and run individual lines of the notebook without re-running the whole notebook from the start and without re-computing everything that depends on what you just edited. Behavior like this makes it super hard to track the actual state, and super easy to lose track of how things are how they are. That's pretty terrible! The parent article links this great talk that goes into more detail than the parent post and is much easier to understand: https://www.youtube.com/watch?v=7jiPeIFXb6U https://www.youtube.com/watch?v=7jiPeIFXb6U
- tommykins 2y ago[flagged]
- hotdogscout 2y agoIt's what I have, some people are poor. Obsessing over silly details like these can be deceptively tempting procrastination.
- packetlost 2y agoSome 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.
- hot_gril 2y agoIdk how you'd use one for non-throwaway code. Not like a webserver can run a routine in a notebook.
- WalterSear 2y agohttps://nbdev.fast.ai/ https://nbdev.fast.ai/
- hot_gril 2y agoOh, that looks like a disaster. Edit: I can't judge without trying, but that's my initial thought.
- WalterSear 2y agoI have masses of admiration and respect for Jeremy Howard and tried using this to build a bunch of fastapi endpoints. I still have masses of admiration and respect for him, but no longer so much when it comes to software engineering - due to this, among other things. It seems like a great idea, but is clunky, hard to refactor and to integrate with other things, in my practice. Wrapping production code in jupyter cruft doesn't work for me. Or, any code, really, that doesn't stay very small and stand alone.
- packetlost 2y agoI've seen "production workflows" be wrapped up in jupyter notebooks. Manually triggered of course.
- giraffe_lady 2y agoIn 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.
- vineyardlabs 2y agoI'm an embedded person, so clueless on this stuff. Are notebooks really used in prod? Outside of applications where notebooks are specifically useful to the goal of the system, ie. documentation,blog posts,textbooks with interactive/data driven elements? How would this even work? Can an ipynb file be mechanized in the same way a py file can?
- slowking2 2y agoJupyter notebooks can be executed roughly like scripts by papermill. You can also save a .py version of the notebook without outputs using jupytext. We use these packages together where I work to basically auto-generate the start of notebooks for exploratory work after certain batch jobs. For dashboards only used by a small number of users, we’ve found voila occasionally useful. Voila turns notebooks into dashboards or web apps basically. You generally shouldn’t put code you want to reuse in notebooks, but we haven’t found this to be much of a problem. And >3/4 of the people who’ve worked on our team don’t have software engineering backgrounds. If you set clear expectations, you can avoid the really bad tar pits even if most of your co-workers are (non-software) engineers or scientists 0-3 years out of college.
- analog31 2y agoI think the issue actually goes beyond notebooks. It's just that notebooks are the method du jour for creating hacked-together code. But regardless of the tool chosen, hacked-together code does eventually leak into production. Mine has. It's harder to breach that barrier in embedded, because someone has to approve of getting the hardware made. In most organizations, there's a kind of no mans land between hacked code, and professionally written software. That's because the real SWE's are always overbooked, and for good reasons -- business and career wise -- should be working on the biggest projects. This leaves software needs that are urgent for somebody but not urgent enough to rise to the top of the priority list for the software team. The somebody could be an internal or external customer.
- fifilura 2y ago"and career wise -- should be working on the biggest project" That explains a lot. I have seen a lot of SWE that believe they are working on bigger project but they are not. Probably 90% of them. These are the guys that will produce a lot of useless abstractions without producing any real value. I guess they aspire to work with kafka/k8s at Google but ended up at the local shop. And nothing wrong with the local shop. This is probably the place where you actually have the possibility to produce real value.
- localfirst 2y agoI like notebooks because they let me see the result of immediately and i can trace my steps having said that when i see Jupyter notebook I close the tab and do not continue theres just a sense of dread that I can't explain...perhaps its PTSD from data structure/algorithm comp sci courses that i never completed.
- lucw 2y agoThe 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.
- p4bl0 2y agoIndeed. I have to admit it took me some times to understand this was not about a specific small-ish form factor of laptops (e.g. Chromebooks like)…
- kwstas 2y agoAgreed, even something like "coding" notebooks if brandname usage is a concern would help. It took more time than I'd like to admit to understand that they weren't talking about physical notebooks...
- xanathar 2y agoEspecially given that 'notebook' is also a synonym of 'laptop' and I was like, wtf, I don't have a mainframe to be less lazy.
- blitzar 2y agoI dont want to nitpick here but a 'notebook' is a small book with blank or ruled pages for writing notes in. All the greats carried one and I too carry one.
- mrweasel 2y agoI still have no idea. I assumed it was a paper notebook, but then Excel is brought in, so now I think it's an Excel feature. In either case I have no idea what their are on about.
- hypercube33 2y agoMy first assumption was something like interactive notebooks like Polyglot or something but reading this I really have no idea either
- manojlds 2y agoNotebooks are spreadsheets of code
- YurgenJurgensen 2y agoNo, I assure you, even in 2024, there are definitely fields where spreadsheets are still the spreadsheets of code.
- hot_gril 2y agoCode = spreadsheets in many places.
- adeelk93 2y agoI like this analogy a lot. They both give you a very intuitive feel for the data and calculations being applied.
- pquki4 2y agoIf there are complaints about code quality in a jupyter notebook, chances are that someone is doing it wrong -- either the author is using it for demonstration purpose, for production or near production environment, or the person looking at others' notebooks is taking them too seriously. Most code in jupyter notebook is bad, but that's fine, because nobody should waste time doing that unless they must reproduce the results or they are sharing the notebook with others. Notable example of high quality notebook: https://youtu.be/zduSFxRajkE https://youtu.be/zduSFxRajkE
- deleted 2y ago[deleted]
- snorkel 2y agoA notebook is a REPL with an inline wiki. Of course it is not intended for running production code, it’s just an R&D environment to document, share, and test ideas
- waldrews 2y agoNotebooks are a diluted form of the Lisp/Smalltalk REPL-based development experience, with some features from the reactive-spreadsheet world. Especially for those of us in the business of producing numbers, 'real code' with a fixed set of tests isn't a better way but a necessary evil, a black box that we can't really trust. Building a calculation piece by piece, in a notebook, trying out variations along the way? That's how you get a feel for the calculation, connect with it at a spiritual level.
- skydhash 2y agoI wonder why CL and Smalltalk haven’t beat Python. Is is the languages or just unawareness? The workflow just make more sense there with better updates propagation and state saving.
- waldrews 2y agoThe Clojure/JVM statistics/scientific computing/now tensor math packages just never got as good as Python, and in Smalltalk they were a non-starter. R is an awkward language, but it's repl-first, has a lot of Lisp's metaprogramming (done in very ad-hoc ways), and Smalltalk's serializable image model -- so a lot of exploratory/experimental statistical methods research happens there, and then gradually makes its way to Python when it needs to be stabilized for production. F# based .Net would've made a fine math-centric environment, but it's a language with a high initial barrier, and though .Net community has been making a decent effort at porting over a lot of NumPy/SciPy, it's not fully caught up after many years. We have Julia now, it's jitted, multicore/GPU friendly, and has interesting REPL innovations, and yes, serializable state (though, ugh, ligatures). But every time I reach for it, it's like, oh no, yet another thing I want to call is in the Python ecosystem. Especially all the modern deep learning/tensor stuff, where the assumption is Python's speed and the GIL don't matter because you're just gluing together GPU calls.
- neonsunset 2y agoIn their defense, F# has https://diffsharp.github.io https://diffsharp.github.io and .NET has https://ilgpu.net https://ilgpu.net In terms of NumPy port, for more involved implementations you might be better off using built-in numeric primitives together with upcoming Tensor<T>(kind of like ndarray on steroids) and TensorPrimitives (BLAS).
- hot_gril 2y agoDid I miss somewhere in the article where the author says what the chosen alternative is to notebooks? "I'm also constantly exploring other options and having fun" makes it sound like there isn't one.
- alan-hn 2y agoWriting a normal script
- makmanalp 2y ago> If people are given a chance to be lazy, they will be (I will be for sure). Quickly hacking some stuff without properly testing? Sure! Linting? Pfff, living on the edge, you'll throw the colab away in an hour anyways To save everyone time, I think the fundamental disagreement comes down to this. A vast chunk of the audience of notebooks is people whose brain has not been drilled on the daily about best practices and maintainable code and often don't get judged on that criteria or affected by the consequences of this. If you believe that these people are irredeemable as engineers, or more charitably that the incentives driving this cannot be fixed, then you probably believe in taking away good tools from these people because they'll misuse it, and then you'll agree with these articles. If you don't, then you won't. > I am using code autoreload and write code in modules >> Nice! I've done this for a while as well. This is a good use-case. However, this approach does not address some of the issues, e.g. data analysis scripts should be checked by another team member. How come? When you write your code in a module, it gets committed and PR'd and linted and tested and reviewed just like any other code, which is the whole point of this approach. Which I think is the most reasonable and mature one. The notebook then is mostly reserved for a very thin interaction layer optimized for play, on top of your vast iceberg of reviewed & tested & maintainable code. Including lots of prewritten convenience routines for plotting and munging to minimize business logic in the notebooks further, and not have paragraphs of matplotlib crud in hidden cells. You construct what's almost like a shell + DSL that's optimized for the domain and datasets you care about, and you can focus on investigating. If there's more significant code, it soon goes in a module again, without interrupting your ongoing flow and thought process.
- jofer 2y agoNotebooks 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 exploratory data analysis, especially in python. The main issue is that they absolutely kill interactivity. Straight up CLI based ipython is far more interactive, and often better for exploratory data analysis. In a lot of ways, pretty much any other interface is better than code blocks that aren't independent but can be run independently. Part of it is the interface (i.e. non-linear state, code blocks, etc), which is great for teaching, but bad for exploration. However, i.m.o. even more of it is the fact that it's browser based. E.g. folks often think it's best to use matplotlib in a notebook. However, using a notebook means you get very little interactivity out of a highly interactive library and remarkably poor performance out of something that's actually _very_ interactive and quite performant on standard Tk/Qt/etc backends. If you ditch browser based stuff, you're usually far better off. This part is mostly just me griping, but I don't understand why we've stepped back 20 years in basic usability, interactivity, and performance by making everything use a web browser (and then making that not even remotely cross platform).
- __mharrison__ 2y agoNot 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.
- jofer 2y agoSo 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.
- Xx_crazy420_xX 2y agoNotebooks are not IDE, so cannot be compared to ones. You can run notebook in vscode, and keep the best code practices. Experiment with code, incrementally move code chunks to external modules. Another great feature is ability to eaisly switch kernel to remote one without leaving IDE. Downside is that it can be really annoying to manipulate the code.
- skybrian 2y agoOne of those complaints is due to an unfortunate implementation choice. Out-of-date cells happen because Jupyter works like a buggy makefile that doesn't reliably rebuild dependencies, forcing you to run "make clean" when anything weird happens. There are better build systems. Observable notebooks will automatically rerun cells that changed, like a spreadsheet. It works nicely for calculations that aren't too heavy, but it might not be what you want for a heavy batch job. Their newer tool, Observable Framework, works more like a regular build system. You can still have it automatically build when you save a file in your editor. A second complaint, that it's browser based, is basically an editor preference. You can open Jupyter notebooks in VS Code if you prefer.
- bluenose69 2y agoThis is a great article. For me, a lot relates to scale. I use notebooks occasionally for the university classes I teach. I like how I can write equations and text to explain ideas, and present interactive graphs to illustrate the ideas. But it's quite a lot of work to set things up, and there can be a problem when components of the work take a long time. In my research work, it is common for a calculation or a graph to take hours to days. Doing work like that in a notebook is just a non-starter. I use scripts (in various languages) along with Makefiles that "know" if I've changed my code or my data, and only rebuilds a result file or a graph when require. Almost always, I separate code that does analysis from code that creates graphical displays. And of course the text (of a paper, course notes, etc.) is written to incorporate these numerical and graphical results. The whole point is to subdivide complex tasks into smaller tasks that can be executed in an organized way. I don't see the sense in using one tool (notebooks, say) for simple tasks and other tools (scripts, a strong editor, tmux, unix, etc.) for complex tasks. So, apart from the toy tools that I make for some teaching tasks, I stick to simple unix-style tools for the tricky stuff. It's important to have many tools in the toolbox. Notebooks can be useful for some things, but I wouldn't want to frame a wall using an awl.
- stakhanov 2y agoWholly agree and can't for the life of me figure out why you're being downvoted, other than people disagreeing with the tenor of your opinion.
- bitwize 2y agoNotebooks are used for crunching data, for scientific, mathematical, or engineering purposes, and showing your work (revealing to your colleagues exactly how the data was crunched). If you're deploying them to production you get what you f'n deserve. That said, when I'm writing code, if I want it to be good quality code then I might use org-mode and its literate programming facilities to type up my thoughts, interlineating code as necessary. This is more useful on greenfield and personal stuff, but there is a high probability that I too have undiagnosed ADHD and the use of org-mode helps to organize and clarify my thoughts before I commit them to code. It is a hallmark of the programmer personality to jump into coding without thinking things through beforehand -- or really, sometimes, at all. The management consultant Tim Bryce wrote about a programming class he took in the 70s: "When given an assignment, the other two members of my team started coding immediately, then keyed up the source code (Yes, we were using punchcards back then), and kept compiling and debugging until they finally got a clean compile. While this was going on, I pulled out my trusty old template, worked out the logic, wrote the code, keyed it up and usually got a clean compile on my first shot. Inevitably, I beat my teammates everytime." The use of org-mode and LP helps with these organization and planning issues... well, at least it does for me.
- mvanveen 2y ago>Same with notebooks, you can write NASA-production-grade software in a notebook, but most likely you won't. One of my family members literally maintains a software platform for test bedding production NASA spacecraft at JPL and it is all on top of Jupyter notebooks. People are literally on course to build AGI and there’s a good chance that large portions of that work will be done within Jupyter notebooks. To suggest real work doesn’t get done in notebooks is simply asinine. As I have embedded further into data science and machine learning teams within my career I have come to learn that a lot of the things software engineers care about around maintainability, reusability etc. are often completely antithetical to data science productivity. In many cases practitioners would consider some of the listed cons of notebooks as features rather than bugs. There is obviously a time and a place for pulling out those practices in such settings but blindly applying software engineering standards to this kind of work is both all too common and often rather counter productive. If notebook style dev doesn’t jive with you personally I get that, and god speed. I’ve worked on CV/ML teams with a lot of CS degree grads and they don’t always want Jupyter notebooks. However, I’ve noticed a tendency for folks to extrapolate that to blanket statements about notebooks in general. As someone who has inherited and had to clean up many jumbled/bad notebooks I’m empathetic but I would challenge folks to lean into considering more about the circumstances the previous notebook author was working in and what kinds of productivity outcomes they were responsible and prioritizing rather than casting judgement on said author or their tools of choice.
- semi-extrinsic 2y ago> People are literally on course to build AGI Citation needed.
- mvanveen 2y agoI will bet you that said citation (the important one you’re holding out for) will have an accompanying Jupyter notebook when it’s ready
- int_19h 2y agoI think we need to clearly distinguish two things here, though. A lot of software engineering ritual is dedicated to shipping software - that is the part that tends to be of very remote relevance in research and scientific contexts. But there are also more fundamental principles and techniques that concern writing code, which apply regardless of the reason why you're doing that, and are beneficial in any context - in a sense that, if you follow them, you will spend less time overall writing code (and thus more time doing whatever it is you're trying to achieve with that code). However, the problem is that those things are not trivial and have to be learned before they can be applied. And that is where the value becomes questionable - the time spent learning all that could instead be spent on learning other things. But if you already have a software engineering background, you do benefit from doing things "right" to some extent.
- rufus_foreman 2y ago>> You can come to McDonalds and order a salad, but you won't. But I often did.
- esafak 2y agoIn the context of machine learning, notebooks are a crutch people lean on when the production environment lacks the right abstractions--isn't convenient enough. Notebooks fall under the "prototype smell" in Google's Hidden Technical Debt in Machine Learning Systems (2015). I agree that notebooks are best reserved for exposition.
- StableAlkyne 2y agoI don't think I've met a single data scientist or ML person who used Python and didn't use notebooks. What are the "right abstractions" that everyone seems to miss?
- esafak 2y agoI use them too, but for data science rather than machine learning. The right abstractions include handling authenticating to the ML services, experiment tracking, hyper-parameter optimization, distributed compute, access to PII data, etc. If you're dealing with nonsensitive data that fits on a laptop you might not need these.
- __mharrison__ 2y agoWith a few constraints and best practices, notebooks tend to be delightful to use. I've taught many teams to be successful with them over the years. Certainly you can shoot yourself in the foot with notebooks, but you can also footgun with many other tools.
- kelseyfrog 2y agoIt's absolutely hilarious that the author opens with an image of Socrates. Socrates, as you recall, famously argued that writing was a detriment to thinking. The parallel that notebooks are a sign of lazy thought does not go unnoticed.
- RamblingCTO 2y agoThat's his profile pic on all platforms, afaik
- deleted 2y ago[deleted]
- JoeyBananas 2y agoThat is really not a valid parallel at all because code notebooks are only one particular form of coding. Being against coding in a code notebook is more like saying "yellow highlighter on sticky notes is a bad medium for serious writing"
- kelseyfrog 2y agoThis is a good opportunity to respond with the strongest plausible interpretation of what someone says.
- spit2wind 2y agoI try to avoid Jupyter related things. Every time I encounter them, it seems worse. Point in case, an open issue from 2017 requesting "copy/paste" be (re)added to the right-click context menu, still open. https://github.com/jupyterlab/jupyterlab/issues/3224 https://github.com/jupyterlab/jupyterlab/issues/3224
- skeledrew 2y agoRecently, since coming across FastAI and nbdev[0], I've been moving increasingly to a more notebook-centric flow. So far it's been better particularly for the exploration aspect where I've primarily used ptpython in the past (and this isn't anywhere ML-related). I think the idea behind nbdev is pretty neat, but it pushes some practices that I'm not a fan of at all. I want to get to the point where I have a mostly complete IDE experience in the notebook so I don't have to keep switching back and forth. I have a ways to go. [0] https://nbdev.fast.ai/ https://nbdev.fast.ai/
- darepublic 2y agoI remember Jeremy from fast ai was an advocate for notebook centric flows. But I have to respectfully disagree that he is a good authority on maintainable / scalable coding practices like this. And though I may be wrong, I feel like the fast ai lib itself is a not too useful wrapper around pytorch and people would be better served just learning pytorch itself. I say this as someone who watched a year of the fast ai videos, and got really excited about ai because of the fast ai course, which I am still grateful for. But this is my current take.
- skeledrew 2y agoI'd say the fastai library itself[0] is a pretty good example of how maintainable/scalable practices can come to life in notebook flows. There's something to be said IMO for an active project with 25.8k stars, 238 contributers, 2.7k commits, and 199 open vs 1.5k closed issues. [0] https://github.com/fastai/fastai/ https://github.com/fastai/fastai/
- deleted 2y ago[deleted]
- corvus-cornix 2y agoI only use notebooks when I need to analyze a csv and a python repl session would be cumbersome. For this limited use case I think they're fine.
- AlexanderTheGr8 2y agoThe article and comments debating best practices in notebooks remind me of the time I hosted a website from a jupyter notebook. Technically, I was using gradio to create a localhost webpage and then piping it through cloudflare. The website would only work when the notebook was running on the cmd line of EC2. Hey if it works, it works! Notebooks allowed me to do a 2 week project in 2 hours. Like most things, notebooks have their pros and cons. One of the biggest adv is very rapid experimentation. Even a regular script takes a while for python interpreter to run and that time (even if only a few seconds) adds up in lack of creativity ("Bret Victor - Inventing on Principle" [1]). And if your script is loading a big database, then notebook is a no-brainer. One of the biggest disadv of notebook is mis-ordering. You are allowed to declare a variable in cell 3 and then go and use it in cell 2. Even worse, you can declare a variable in cell 3 and then delete cell 3 and still be able to use that variable. That I believe is the biggest dis-adv of notebooks. It adds way too many subtle errors. One way to bypass this is to write everything in functions - no global vars. I am willing to accept the issue of mis-ordering in order to get rapid experimentation. It's subjective whether you think the pros outweight the cons. I definitely think they do. [1] : https://www.youtube.com/watch?v=PUv66718DII&t=4s https://www.youtube.com/watch?v=PUv66718DII&t=4s
- nottorp 2y ago> Notebooks allowed me to do a 2 week project in 2 hours. So... your alternative framework was too enterprisey for your purposes?
- abdullahkhalids 2y agoThe online book I am writing is just a set of jupyter notebooks (with lots of code) that get converted to html and uploaded.
- casualscience 2y ago> Notebooks are often used as a playground to easily have access to an accelerator. In this case, the execution environment is often set up differently and with different dependencies. In this case, you make your code work in a colab, smile widely and run your experiment after on a cluster or whatever. You start crying in twenty minutes after your code crashes due to lack of dependency or versioning or anything else similar. This is actually one of the best things about jupyter is that you can just tunnel into the computer and use the exact same env... this article is WACK
- mangecoeur 2y agoThis is a very narrow minded take. Notebooks are used mostly by scientists who are just using code as a research tool. Being able to explore to learn is incredibly useful. Using them in production is a perfect bridge between different disciplines. And if you get distracted because “your browser has tabs” that’s really not the notebooks fault.
- DeathArrow 2y agoWhen I've read just the the title I thought the article was about laptops.
- fumeux_fume 2y agoThe title tells you everything you need to know about how condescending and pointless most of the article is.
- dahart 2y agoIt’s disappointing to have someone’s misguided hot take get lots of attention. There’s nothing inherently wrong with Notebooks, just like there’s nothing inherently wrong with a command line REPL. They are tools. Sure, neither is a great choice for coding a million-line application, and yet the REPL is the better choice for one-liners, and the notebook is the better choice for a few plots or developing a 10-line algorithm. I’d rather read something thoughtful about when and how and why to migrate from a notebook to something better. Making that easier, without judgement, is going to do a whole lot more good than attempting to shame people with a bad analogy will do. Anyway, McDonalds has scaled larger than any other food chain in the world, so the title is accidentally paying a huge compliment to Notebooks.
- eimrine 2y agoI have an understanding that the notebook is something other than laptop, but I can not find neither the definition of the word nor any synonyms in the article.
- deleted 2y ago[deleted]
- kkfx 2y agoHum... I do not use Jupyter and co BUT I have my configs and various personal stuff in org-mode/org-bable witch is a kind of notebook and my desktop boot to Emacs, who not retain state but it's still a live environment and it's flexibility and user-programmability with ease are it's strongest points. So well... Writing in org-mode makes me waste a bit of time but produce much clearer designs because I do not design in code but in natural language and if the narrative is suboptimal is immediately clear, also it proper document the code non with comments but with complete human language. The downside it's that's very time consuming and I do loose some coding helpers that can't work much in babel blocks instead of full source files. So well, for me such interaction is the most powerful UI we have, the best human-computer interface so far, the default go-to solution for any day-to-day work. A project could be an independent entity but still the day-to-day work born and evolve like that, so I'm not agreeing much, notebooks are not quick&dirty stuff but a tool to reason and reasoning often take much more time than directly write code, if you are disciplined. On contrary might disperse you if you are in "silicon valley mode". This is probably than main point not of the tool, but of the human using it: how many are constantly in Silicon Valley mode vs in Donald Knuth mode?
- pdav 2y agoL
- itsoktocry 2y ago>You can come to McDonalds and order a salad, but you won't. I don't go to McDonald's if I want a salad.
- fardinahsan146 2y agoSeriously, is this even a real problem? I'm not even a programmer, I'm a data scientist 1 year out of college, and I still know that notebooks should never ever be deployed to production! The right way to view notebooks is as.. notebooks. Text and visualizations that can run online code. They are for presenting! You would need a tremendous amount of incompetence and a lack of any code reviews or tech leadership at all to end up deploying a notebook to production.
- mpalmer 2y agoI get that the gentle snark is the point, but I feel like a tiny shift in perspective would universally improve "take" posts like this. Add a "why I might be wrong" section, or "why this might not apply to you". Just show me that you've thought from more than one side of the issue and I'll be more receptive to your side.
- silent_cal 2y agoA notebook is just an IDE for writing scripts. There's software you can use (like Databricks and Azure Data Factory) to orchestrate them. But obviously if you are building an application they can't be the only IDE you use. A lot of the confusion in this article comes from trying to use them in a way that they're not designed to be used.
- darepublic 2y agoAs a web developer who now is increasingly coding in python.. I sympathize with this but frankly google colab is way more accessible to me than other options. Jupyter notebook is good because it provides a quick feedback loop. Google colab is needed by a beginner like me because they have taken care of all the pytorch / cuda set up. The tutorials I access online use it so it's not easy to find a different way. All the quick and easy tutorials only demonstrate using google colab (or some other similar alternative). I messed around with paperspace for a while, but I could not get detectron2 working in it so I went back to google colab. And my ML projects, that I have ambitions to become production apps, are still toys so for now the quick and dirty notebook will have to do. But yes, I prefer to be in my element in a traditional IDE, pushing to git, tabbing between files. I certainly have > 10 years of experience doing that, but not really for ML projects if that makes sense.
- constantcrying 2y agoI 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.
- deleted 2y ago[deleted]
- cliff_badger 2y agoHoly 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.