<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/if-not-notebooks-then-what-look-to-literate-programming/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2018/09/notebooks-literate-programming.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>Author and research engineer <a rel="nofollow" href="http://joelgrus.com/" target="_blank">Joel Grus</a> kicked off an important <a rel="nofollow" href="https://twitter.com/joelgrus/status/1033035196428378113" target="_blank">conversation </a>about Jupyter Notebooks in his <a rel="nofollow" href="https://docs.google.com/presentation/d/1n2RlMdmv1p25Xy5thJUhkKGvjtV-dkAIsUXP-AL4ffI/edit#slide=id.g362da58057_0_1" target="_blank">recent presentation at JupyterCon</a>: </p>
<p><a rel="nofollow" href="https://docs.google.com/presentation/d/1n2RlMdmv1p25Xy5thJUhkKGvjtV-dkAIsUXP-AL4ffI/edit#slide=id.g362da58057_0_1" target="_blank"><img border="0" alt="Joel grus title slide" title="Joel grus title slide" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b022ad3b0836c200b-800wi"></a></p>
<p>There's no video yet available of Joel's talk, but you can guess the theme of that opening slide, and walking through the slides conveys the message well, I think. <a rel="nofollow" href="https://yihui.name/" target="_blank">Yuhui Xie</a>, author and creator of the <a rel="nofollow" href="https://rmarkdown.rstudio.com/" target="_blank">rmarkdown package</a>, provides a <a rel="nofollow" href="https://yihui.name/en/2018/09/notebook-war/" target="_blank">detailed summary and response to Joel's talk</a>, where he lists Joel's main critiques of Notebooks: </p>
<ol>
<li>Hidden state and out-of-order execution</li>
<li>Notebooks are difficult for beginners</li>
<li>Notebooks encourage bad habits</li>
<li>Notebooks discourage modularity and testing</li>
<li>Jupyter’s autocomplete, linting, and way of looking up the help are awkward</li>
<li>Notebooks encourage bad processes</li>
<li>Notebooks hinder reproducible + extensible science</li>
<li>Notebooks make it hard to copy and paste into Slack/Github issues</li>
<li>Errors will always halt execution</li>
<li>Notebooks make it easy to teach poorly</li>
<li>Notebooks make it hard to teach well </li>
</ol>
<p><a rel="nofollow" href="https://bookdown.org/yihui/rmarkdown/#" target="_blank"><img alt="R Markdown book" title="R Markdown book" src="http://a1.typepad.com/6a0105360ba1c6970c022ad3b086d1200b-200wi"></a>Yihui suggests that many of these shortcomings of Notebooks could be addressed through literate programming systems, where the document you edit is plain-text (and so easy to edit, manage, and track), and computations are strictly processed from the beginning of the document to the end. I use the RMarkdown system myself, and find it a delightful way of combining code, output and graphics in a single document, which can in turn be rendered in a <a rel="nofollow" href="https://bookdown.org/yihui/rmarkdown/output-formats.html" target="_blank">variety of formats</a> including HTML, PDF, Word and even <a rel="nofollow" href="https://bookdown.org/yihui/rmarkdown/powerpoint-presentation.html" target="_blank">PowerPoint</a>.</p>
<p>Yihui expands on these themes in greater detail in his excellent book (with JJ Allaire and Garrett Grolemund), <a rel="nofollow" href="https://www.crcpress.com/R-Markdown-The-Definitive-Guide/Xie-Allaire-Grolemund/p/book/9781138359338" target="_blank"><em>R Markdown: The Definitive Guide</em></a>, published by CRC Press. Incidentally, the book itself is a fine example of literate programming; you can find the <a rel="nofollow" href="https://github.com/rstudio/rmarkdown-book" target="_blank">R Markdown source here</a>, and you can read the book <a rel="nofollow" href="https://bookdown.org/yihui/rmarkdown/" target="_blank">in its entirety here</a>. As Joel mentions in his talk, an automatically-generated document of that length and complexity simply wouldn't be possible with Notebooks.</p>
<p>All that being said, RMarkdown is (for now) a strictly R-based system. Are there equivalent literate programming systems for Python? That's a genuine question — I don't know the Python ecosystem well enough to answer — but if you have suggestions please leave them in the comments.</p>
<p>Yihui Xie: <a rel="nofollow" href="https://yihui.name/en/2018/09/notebook-war/" target="_blank">The First Notebook War</a></p>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2018/09/notebooks-literate-programming.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/aGAdCsXklug" height="1"></a></div>