<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anatoly Scherbakov</title>
    <description>The latest articles on DEV Community by Anatoly Scherbakov (@anatolyscherbakov).</description>
    <link>https://dev.to/anatolyscherbakov</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F416881%2Fa48f593f-bcc8-44ff-87bf-e7b6df43ea41.jpeg</url>
      <title>DEV Community: Anatoly Scherbakov</title>
      <link>https://dev.to/anatolyscherbakov</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anatolyscherbakov"/>
    <language>en</language>
    <item>
      <title>documented: make docstrings in your exceptions work</title>
      <dc:creator>Anatoly Scherbakov</dc:creator>
      <pubDate>Fri, 06 Oct 2023 17:49:17 +0000</pubDate>
      <link>https://dev.to/anatolyscherbakov/documented-make-docstrings-in-your-exceptions-work-2kcf</link>
      <guid>https://dev.to/anatolyscherbakov/documented-make-docstrings-in-your-exceptions-work-2kcf</guid>
      <description>&lt;p&gt;During my time in writing Python code, I have gone through a certain evolution; one of the aspects of it is how I create and manage exceptions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 0
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I'm sorry Dave. I'm afraid I can't do that."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, to signify an error, we just use a standard built-in error class (such as &lt;code&gt;Exception&lt;/code&gt; or &lt;code&gt;ValueError&lt;/code&gt;). The exception message will be printed to the log and/or provided to the user.&lt;/p&gt;

&lt;p&gt;If we would like to catch the exception and to base our future behavior on the particular error that we had caught then we will be in trouble; likely we'll have to manually parse the exception message. That's dirty.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 1
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;pass&lt;/span&gt;

&lt;span class="c1"&gt;# …
&lt;/span&gt;
&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="n"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"I'm sorry Dave. I'm afraid I can't do that."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, I can catch &lt;code&gt;PodBayDoorsStillClosed&lt;/code&gt; in some other place of the application, and modify my behavior based on that. For instance, I can&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;retry&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is unlikely that HAL complies but at least the code will be arguably a bit more expressive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 2
&lt;/h2&gt;

&lt;p&gt;At some point, I realize that the text of HAL's message belongs to the class of the exception; there is no reason to keep them apart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__str__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"I'm sorry Dave. I'm afraid I can't do that."&lt;/span&gt;

&lt;span class="c1"&gt;# …
&lt;/span&gt;
&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="n"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is better, but… is it cool to write &lt;code&gt;__str__&lt;/code&gt; all the time, for each exception message, separately? — No, decidedly not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level ∞
&lt;/h2&gt;

&lt;p&gt;Some time ago I wrote a very small Python library by the name of &lt;a href="https://anatoly-scherbakov.github.io/documented/"&gt;&lt;code&gt;documented&lt;/code&gt;&lt;/a&gt;. Which makes it look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DocumentedError&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="s"&gt;"""
    I’m sorry, {self.user_name}.

    I’m afraid I can’t do that.
    """&lt;/span&gt;

    &lt;span class="n"&gt;user_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;

&lt;span class="c1"&gt;# …
&lt;/span&gt;
&lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="n"&gt;PodBayDoorsStillClosed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Dave'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That will print:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PodBayDoorsStillClosed: I’m sorry, Dave.

I’m afraid I can’t do that.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am now using it to format both internal and external exceptions for web and console applications. Flight condition nominal, so far. Perhaps this library will be useful for you too; you can easily grab it via&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;documented
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Github: &lt;a href="https://github.com/anatoly-scherbakov/documented"&gt;anatoly-scherbakov/documented&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Docs: &lt;a href="https://anatoly-scherbakov.github.io/documented/"&gt;https://anatoly-scherbakov.github.io/documented/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>exceptions</category>
      <category>opensource</category>
      <category>libraries</category>
    </item>
    <item>
      <title>Reflections on Literate Programming</title>
      <dc:creator>Anatoly Scherbakov</dc:creator>
      <pubDate>Fri, 31 Jul 2020 16:25:02 +0000</pubDate>
      <link>https://dev.to/anatolyscherbakov/reflections-on-literate-programming-2ll</link>
      <guid>https://dev.to/anatolyscherbakov/reflections-on-literate-programming-2ll</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Documenting and commenting your program is an activity many programmers despise. Documentation either is never written or gets abandoned and rots. Documentation becomes irrelevant and depressing.&lt;/p&gt;

&lt;p&gt;However, a program which is totally undocumented is hard to understand and maintain, up to the point of inability to support and use it. Which is a risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Literate Programming
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YnxyiG9C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/2jaw2w29gh2fr8351g7s.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YnxyiG9C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/2jaw2w29gh2fr8351g7s.jpg" alt="Donald Knuth, from Wikipedia" width="427" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Literate Programming (LP) as a term was coined by Donald E. Knuth in his article from 1984. Quote from &lt;a href="https://literateprogramming.com"&gt;https://literateprogramming.com&lt;/a&gt; goes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Rather than embedding documentation comments into code, a literate programmer embeds pieces of code into the essay (article, book) which tells the reader about what these pieces of code are doing, and why.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;Knuth has been using literate programming to write &lt;a href="https://en.wikipedia.org/wiki/TeX"&gt;TeX&lt;/a&gt; and &lt;a href="https://www-cs-faculty.stanford.edu/~knuth/lp.html"&gt;many other programs&lt;/a&gt; over the years. Here is one of them -- a port of an old &lt;em&gt;Adventure&lt;/em&gt; game to Knuth's literate programming tool called &lt;a href="http://www.literateprogramming.com/cweb_download.html"&gt;CWEB&lt;/a&gt;. Check out &lt;a href="http://www.literateprogramming.com/adventure.pdf"&gt;this PDF&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7p1CUVnT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/xfir4k1d4s2ob0tpj2o1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7p1CUVnT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/xfir4k1d4s2ob0tpj2o1.png" alt="A screenshot from CWEB generated PDF" width="688" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This document is one of the two outputs of the CWEB system -- this is a reader friendly, readable book (107 pages long) which fully describes the game, including its annotated source code.&lt;/p&gt;

&lt;p&gt;The other output would be the code itself in C language, ready for compilation.&lt;/p&gt;

&lt;p&gt;When writing the literate source, you can interleave and link the blocks of code and the blocks of text. Thus, the document can be written in a way that's the easiest for a human to read, but the code will be rearranged in the specific order which the compiler prefers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reasoning
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Av0PQDVTP4A"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In a talk named &lt;strong&gt;Literate Programming in the Large&lt;/strong&gt; Timothy Daly, long term developer of Axiom computer algebra system, urges us - fellow developers - to change the situation, suggesting that LP is the only (and best) way to build maintainable software systems. Why so?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Change of perspective.&lt;/strong&gt; From LP point of view, the essence of a computer program should be communicating its purpose and logic to a human reader. Only incidentally it so happens that this program also can be executed by a computer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;em&gt;Why&lt;/em&gt;.&lt;/strong&gt; The human reader wants to understand why the program is doing what it does. This ensures that the reader will be able to change the program with full understanding of the implications.&lt;/p&gt;

&lt;p&gt;This means the reader will be able to &lt;strong&gt;maintain the program&lt;/strong&gt; even if the original author is no longer available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adoption
&lt;/h2&gt;

&lt;p&gt;&lt;a href="http://www.literateprogramming.com/tools.html"&gt;Literate Programming - Tools&lt;/a&gt; page provides a few of the available tools which support the Literate Programming technique. But the overall adoption in the industry seems, at least to me, rather limited.&lt;/p&gt;

&lt;p&gt;Knuth himself states that, since the evolvement of the LP technique, he found himself more productive and the quality of his programs improved. Indeed, TeX is probably one of the best-quality pieces of software of all time. The question is though: can the positive impact of LP that Knuth observed apply to majority of programs and teams?&lt;/p&gt;

&lt;p&gt;We don't have statistical evidence to support or deny that; thus, I am going to list a few of very opinionated and subjective points on the matter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expressivity of programming language
&lt;/h2&gt;

&lt;p&gt;Daly is providing an example from the history of Axiom. He was once looking at a piece of its code and he did not understand why that piece was there.&lt;/p&gt;

&lt;p&gt;The code did obvious things with some bytes in memory, and Daly knew exactly what the code was doing (he was likely the author) - but he couldn't ascertain why it was doing that. That's why an essay-like description would have helped.&lt;/p&gt;

&lt;p&gt;But, I would say the code that controls logic of the application should not manipulate any bytes in memory &lt;em&gt;directly&lt;/em&gt;; it should be written in a much more abstract way. Like this, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;Warehouse&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;find_package&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;package_id&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;TeX was written originally in Pascal and then rewritten in C. Both are quite ascetic by modern standards - in terms of expressivity, available data structures, type systems, libraries, and possible syntax extensions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;lambda&lt;/code&gt; anonymous functions make the code more concise where previously you would have had to create a separate named function;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;map&lt;/code&gt; &lt;code&gt;filter&lt;/code&gt; &lt;code&gt;reduce&lt;/code&gt; and friends alleviate cycles;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Garbage collector or boundary checker permits to skip all the details of memory management;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type system helps to express concepts, not byte sequences, in code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of this reduces the need for a lot of extra explanation. In the example of Adventure game above, there would be no need to say&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="c1"&gt; /∗ basic input/output routines: fgets , printf ∗/&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;instead (this is pseudocode, I have no idea whether Rust has an &lt;code&gt;stdio&lt;/code&gt; crate):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nn"&gt;stdio&lt;/span&gt;&lt;span class="p"&gt;::{&lt;/span&gt;&lt;span class="n"&gt;fgets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Need for explanations alleviated. Code speaks for itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Power of Notation
&lt;/h2&gt;

&lt;p&gt;In the Middle Ages, European mathematicians had to communicate their ideas in natural language. Proofs were incredibly hard to understand and reason about when written in lengthy prose. Or, sometimes, in rhymes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When the cube and its things near&lt;br&gt;
Add to a new number, discrete&lt;br&gt;
Determine two new numbers different&lt;br&gt;
By that one; this feat&lt;br&gt;
Will be kept as a rule&lt;br&gt;
Their product always equal, the same&lt;br&gt;
To the cube of a third&lt;br&gt;
Of the number of things named.&lt;br&gt;
Then, generally speaking&lt;br&gt;
The remaining amount&lt;br&gt;
Of the cube roots subtracted&lt;br&gt;
Will be our desired count.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;(Source: &lt;a href="https://proofwiki.org/wiki/Tartaglia%27s_Poem"&gt;Tartaglia's Poem - ProofWiki&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;This is the description of the formula for roots of cubic equation by Niccolo Tartaglia.&lt;/p&gt;

&lt;p&gt;Invention of algrebraic notation was a great step forward which enabled us to reason about much more complex concepts - and still not blow our heads.&lt;/p&gt;

&lt;p&gt;Today, mathematics is using a lot of special symbolic languages to manage extremely complex and abstract concepts. They are expected to be concise, strict, unambiguous, and versatile.&lt;/p&gt;

&lt;p&gt;Computer programming language is actually even &lt;em&gt;stricter&lt;/em&gt; than the most abstract mathematical paper. &lt;a href="https://en.wikipedia.org/wiki/Vladimir_Arnold"&gt;Vladimir Arnold&lt;/a&gt;, a renowned mathematician, says in one of his lectures that Nikola Burbaki in their series of books on mathematics foundations aspire to be as strict as possible in the first books, but their grip kind of losens from one book to the next. That will not work with computers, though.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alternatives or complements to LP
&lt;/h2&gt;

&lt;p&gt;Being on the side of Literate Programming, it &lt;em&gt;looks like&lt;/em&gt; that we have no hope for the programming language to convey the concepts of the domain. Its expressiveness is poor, and we resort to the natural language with all of its limits - ambiguousness, verbosity, uncertain and vague nature - to do the job.&lt;/p&gt;

&lt;p&gt;Maybe we should do something different?&lt;/p&gt;

&lt;p&gt;Yes, I think we should.&lt;/p&gt;

&lt;h3&gt;
  
  
  Take inspiration from mathematics
&lt;/h3&gt;

&lt;p&gt;Programming is, essentially, a specialized branch of mathematics (at least that's what Alexander Stepanov, author of C++ STL, says in his &lt;a href="https://www.youtube.com/watch?v=NfGeVRebiio"&gt;talk at Yandex&lt;/a&gt;). Mathematics is the art of abstraction in its purest form. We struggle with abstraction in programming. That's why I almost irrationally believe that mathematics should have methods and ways to help us make our programs better.&lt;/p&gt;

&lt;p&gt;Anyway, if you are familiar with&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mathematical logic,&lt;/li&gt;
&lt;li&gt;graph theory,&lt;/li&gt;
&lt;li&gt;finite automata theory,&lt;/li&gt;
&lt;li&gt;category theory,&lt;/li&gt;
&lt;li&gt;type theory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...and/or any special areas which may be relevant to your sphere of interests - this won't hurt you.&lt;/p&gt;

&lt;p&gt;Functional programming ideas which we've briefly touched above are now practically mainstream. They were completely derived from mathematics and only in time found their way to the minds of the majority of software developers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Domain Specific Languages
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;DSL = Domain Specific Language&lt;/strong&gt; is a formal language designed specifically for certain domain: computer graphics, warehouse management, flight path computation. SQL is one good example of a DSL. DSLs can be internal or external.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JetBrains&lt;/strong&gt; coined the term &lt;a href="https://resources.jetbrains.com/storage/products/mps/docs/Language_Oriented_Programming.pdf"&gt;Language Oriented Programming&lt;/a&gt; to describe a paradigm where you build a special language for every special job.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alan Kay&lt;/strong&gt;  was working for a while on &lt;a href="http://www.vpri.org/pdf/tr2012001_steps.pdf"&gt;STEPS operating system&lt;/a&gt; which was built upon dozens of languages, each designed for its particular purpose.&lt;/p&gt;

&lt;h3&gt;
  
  
  IDEs
&lt;/h3&gt;

&lt;p&gt;Among the things Daly mentions as benefits of Literate Programming are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Indexing and reverse links from a piece of code to other pieces which use it&lt;/li&gt;
&lt;li&gt;Tables of contents&lt;/li&gt;
&lt;li&gt;References&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, these things are not surprising for anyone who has been using any modern IDE. To the contrast: using a literate programming technique will likely make it impossible for us to use a normal IDE. We're very much accustomed to refactorings, search in code, snippets, integration with linters etc, - and that will more likely obscure our development experience rather than improve it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Linting
&lt;/h3&gt;

&lt;p&gt;With linters and static code analysis, we can find particular errors in our code which are easy to recognize. Daly provides an example. Someone introduces a number in code which is 153. What does that number mean? Why 153 and not 654?&lt;/p&gt;

&lt;p&gt;Daly continues that, because it happened in a literate program, the author was able to write something like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I chose this number for no particular reason. Choice of the number does not change anything.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If a linter would find such a number it would say this is a magic constant which should be given an explanatory name.&lt;/p&gt;

&lt;p&gt;But the linter can't do anything if you forget to describe something in the literate source: this is natural language, no hope.&lt;/p&gt;

&lt;h3&gt;
  
  
  Notebooks
&lt;/h3&gt;

&lt;p&gt;Well, when I was saying that LP did not get any traction above I was not entirely honest. One particular form of Literate Programming is quite widespread. It is called &lt;em&gt;Notebooks&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Under a notebook, we mean a document which consists of a series of blocks; every block can be either code or free-form text; and people use these to perform data analysis, conduct experiments, write one-off scripts, or do some &lt;a href="https://www.displayr.com/what-is-reproducible-research/"&gt;Reproducible Research&lt;/a&gt;. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://jupyter.org/"&gt;Jupyter Notebook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://zeppelin.apache.org/"&gt;Zeppelin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.wolfram.com/mathematica/"&gt;Mathematica&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mathcad.com/"&gt;MathCAD&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;...and others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Should you use Literate Programming in your project or not? It depends.&lt;/p&gt;

&lt;p&gt;After watching Daly's emotional talk, I was for a while fascinated by the idea of converting my &lt;a href="https://github.com/anatoly-scherbakov/ysv"&gt;ysv&lt;/a&gt; project into a literate program. However, I decided not to.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rust is a very expressive language. If I can master it well enough, I can introduce powerful abstractions which will permit me to reduce the syntactic clutter, and to make the code as transparent and concise as humanly possible.&lt;/li&gt;
&lt;li&gt;I will however use &lt;code&gt;rustdoc&lt;/code&gt; as the recommended way of documenting your source code. I will comment difficult parts of the code to describe what they are doing, and I will use standard Rust tools to generate documentation from this source.&lt;/li&gt;
&lt;li&gt;And, if I want to invite other people and communicate with them, I'd better use the language many people speak instead of creating my own obscure toolchain to support my overly literate project.&lt;/li&gt;
&lt;li&gt;And finally, I was thinking lately about the meaning of focus in life. Adding literate programming as another dimension of &lt;code&gt;ysv&lt;/code&gt; project would mean I am continuing to scatter my attention. That will not help me to succeed and get this project done.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://johnjburnslibrary.wordpress.com/2018/03/12/medicine-in-the-middle-ages-rare-books-in-the-burns-library/"&gt;(Cover source.)&lt;/a&gt;&lt;/p&gt;

</description>
      <category>literateprogramming</category>
      <category>documentation</category>
      <category>knuth</category>
    </item>
    <item>
      <title>Running Ubuntu on Lenovo Yoga 530 Transformer Laptop</title>
      <dc:creator>Anatoly Scherbakov</dc:creator>
      <pubDate>Thu, 25 Jun 2020 18:54:00 +0000</pubDate>
      <link>https://dev.to/anatolyscherbakov/running-ubuntu-on-lenovo-yoga-530-transformer-laptop-4c7m</link>
      <guid>https://dev.to/anatolyscherbakov/running-ubuntu-on-lenovo-yoga-530-transformer-laptop-4c7m</guid>
      <description>&lt;p&gt;Lenovo Yoga 530 is a rather inexpensive laptop computer. It transforms into a tablet, has a touchscreen and a stylus. I have its 14ARR variety, which runs on AMD CPU.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KsCXWr8p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/cyj26sgngjmkhlhtscsw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KsCXWr8p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/cyj26sgngjmkhlhtscsw.png" alt="Image from somewhere on the web" width="725" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article is a compilation of tips &amp;amp; tricks I found useful when running this device on Ubuntu.&lt;/p&gt;

&lt;h1&gt;
  
  
  Hardware Upgrade
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;(This section is not OS related just yet.)&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stock configuration came to me with 8G RAM, which is insufficient&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;According to a number of sources,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.lenovo.com/ru/ru/laptops/yoga/500-series/Yoga-530-14-AMD/p/88YG5001050"&gt;Lenovo website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.reddit.com/r/Lenovo/comments/8t5qx1/yoga_520_530_ram_upgrade/"&gt;Reddit thread&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;the upgrade is only possible to 16G RAM total (not to 32G, which I would love to have).&lt;/p&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The laptop comes with two 4G sticks in it, so you'll have to replace them both with 8G sticks to have 16G total.&lt;/p&gt;

&lt;h1&gt;
  
  
  WiFi
&lt;/h1&gt;

&lt;p&gt;Out of the box, Ubuntu won't see the built in WiFi adapter (which happens to be RealTek RTL8821CE).&lt;/p&gt;

&lt;h2&gt;
  
  
  BIOS
&lt;/h2&gt;

&lt;p&gt;Go to bios and turn off SecureBoot. It tends to turn it on again after BIOS upgrades.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blacklist
&lt;/h2&gt;

&lt;p&gt;Popular solution is to blacklist &lt;code&gt;ideapad_laptop&lt;/code&gt; kernel module (like mentioned at &lt;a href="https://forums.lenovo.com/t5/Other-Linux-Discussions/Yoga-920-How-to-run-Linux/td-p/3895778"&gt;this Lenovo forum thread&lt;/a&gt;), like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"blacklist ideapad_laptop"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/modprobe.d/blacklist_ideapad.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However it did not enable WiFi for me. (Though I am not certain it was not helpful together with the next point.)&lt;/p&gt;

&lt;p&gt;What helped was this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"blacklist 8821ce"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/modprobe.id/blacklist-ideapad.conf
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;rtl8821ce-dkms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;WiFi connection turned on immediately.&lt;/p&gt;

&lt;h1&gt;
  
  
  Onscreen keyboard nastily appearing every time you touch the screen
&lt;/h1&gt;

&lt;p&gt;This is enormously annoying, trust me. But:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;chrome-gnome-shell
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and &lt;a href="https://extensions.gnome.org/extension/1326/block-caribou/"&gt;this Gnome extension&lt;/a&gt; — voila, problem solved.&lt;/p&gt;

&lt;h1&gt;
  
  
  Some generic stuff not related to this laptop but I will write it anyway
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Docker won't run without sudo
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; docker &lt;span class="nv"&gt;$USER&lt;/span&gt;
reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ElasticSearch won't run under Docker
&lt;/h2&gt;

&lt;p&gt;...saying:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'echo "vm.max_map_count=262144" &amp;gt;&amp;gt; /etc/sysctl.d/local.conf'&lt;/span&gt; | &lt;span class="nb"&gt;sudo &lt;/span&gt;bash
&lt;span class="nb"&gt;sudo &lt;/span&gt;service procps restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As per this &lt;a href="https://dev.toGitHub%20comment"&gt;https://github.com/docker-library/elasticsearch/issues/111#issuecomment-268511769&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Issues not yet resolved
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;When configured Caps Lock for switching keyboard layouts, the light indicator on the button itself won't work&lt;/li&gt;
&lt;li&gt;Keyboard is not disabled when laptop is laying on it&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Planning Poker app for Humans</title>
      <dc:creator>Anatoly Scherbakov</dc:creator>
      <pubDate>Thu, 25 Jun 2020 18:28:33 +0000</pubDate>
      <link>https://dev.to/anatolyscherbakov/planning-poker-app-for-humans-162l</link>
      <guid>https://dev.to/anatolyscherbakov/planning-poker-app-for-humans-162l</guid>
      <description>&lt;p&gt;In Scrum, you are usually expected to estimate your tasks — preferably relying on &lt;em&gt;estimation points&lt;/em&gt;, a transcendental measurement unit that no living human I have met can completely understand.&lt;/p&gt;

&lt;p&gt;Process of estimation is often called &lt;em&gt;poker&lt;/em&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  How is it done?
&lt;/h1&gt;

&lt;p&gt;Here is how one &lt;a href="https://marketplace.atlassian.com/apps/700473/agile-poker-for-jira-planning-estimation?hosting=cloud&amp;amp;tab=overview"&gt;Agile Poker app&lt;/a&gt;, which we happen to use in our company, does this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AQO6rfvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/3xopkx0wguhczcv8uvgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AQO6rfvL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/3xopkx0wguhczcv8uvgr.png" alt="This screenshot is not mine" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article &lt;em&gt;might&lt;/em&gt; start sounding like a piece of stupid marketing. Except it's not, - because the user experience of this app is awful.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every member of the team clicks the little dropdown to choose the preferred estimation number;&lt;/li&gt;
&lt;li&gt;When the one who leads the meeting decides that sufficient count of estimates has been gathered - he or she clicks the "Show Estimates" button, and the estimates are revealed.&lt;/li&gt;
&lt;li&gt;Now the attendees discuss the estimates and agree on one final number;&lt;/li&gt;
&lt;li&gt;The lead uses the same nasty dropdown to choose that number.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--786tRWu1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/p6odfvyeh2q42vbdznhu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--786tRWu1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/p6odfvyeh2q42vbdznhu.png" alt="This one is" width="741" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This dropdown is enormously annoying. It forces you to do too much work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click to open it,&lt;/li&gt;
&lt;li&gt;and then click on the desired number.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You have also to scroll the issues list and click on the issue itself if you'd like to find out additional information from the issue...&lt;/p&gt;

&lt;p&gt;This world is full of pain.&lt;/p&gt;

&lt;h1&gt;
  
  
  Did I say this was a quick and dirty article?
&lt;/h1&gt;

&lt;p&gt;Well, it is. And that's why I did not spend too much time looking for alternatives. I've come up with the following instead.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--66Lga-Q9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/apikigwkbxk47xtox8p6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--66Lga-Q9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/i/apikigwkbxk47xtox8p6.png" alt="Basicly my first UI mockup EVER" width="800" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drawing this, I tried to rely upon the following principles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When using the tool, you can keep your hands on the keyboard. No mouse needed.&lt;/li&gt;
&lt;li&gt;The tool should be independent of the task management system you use. It should integrate with Jira, Notion card boards, Trello, ... - whatever you wish.&lt;/li&gt;
&lt;li&gt;I would love it to be open source.&lt;/li&gt;
&lt;li&gt;The screen displays the summary of the task, maybe a piece of its description and probably some basic properties like rank, etc.&lt;/li&gt;
&lt;li&gt;The estimation figures are displayed in a large font.&lt;/li&gt;
&lt;li&gt;To specify your estimate, just enter the number and hit &lt;code&gt;Enter&lt;/code&gt;. It will be submitted.&lt;/li&gt;
&lt;li&gt;Or, you can use arrows to move from one estimate to another. System will show you which other tasks (preferably those of yours) were previously marked with the given story points value.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I want to specifically highlight the diagram which explains story point values. I got it from a colleague of mine, who says she found it on some video and made a screenshot, but she can't remember what video that was and who was the author. So, if anyone can help here, I'd be grateful - since I like this diagram a lot.&lt;/p&gt;

&lt;h1&gt;
  
  
  So what?
&lt;/h1&gt;

&lt;p&gt;I will be glad to hear any opinions. I do know there are planning poker apps on the web, but I couldn't find quite the one matching my description - open source, integrated with many task management systems, and easy to use. Maybe such a marvel does exist and I don't know?&lt;/p&gt;

&lt;p&gt;But if you are an aspiring web developer and want to do something interesting - &lt;a href="https://planning.casino"&gt;planning.casino&lt;/a&gt; seems to be available yet :-)&lt;/p&gt;

</description>
      <category>idea</category>
      <category>scrum</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
