diff options
Diffstat (limited to 'articles/index.xml')
-rw-r--r-- | articles/index.xml | 184 |
1 files changed, 122 insertions, 62 deletions
diff --git a/articles/index.xml b/articles/index.xml index 40507060..dbb9bb8f 100644 --- a/articles/index.xml +++ b/articles/index.xml @@ -6,10 +6,131 @@ <description>Recent content in Articles-rsses on Nine Nines</description> <generator>Hugo -- gohugo.io</generator> <language>en-us</language> - <lastBuildDate>Tue, 03 Jan 2017 00:00:00 +0100</lastBuildDate> + <lastBuildDate>Sun, 22 Jan 2017 00:00:00 +0100</lastBuildDate> <atom:link href="https://ninenines.eu/articles/index.xml" rel="self" type="application/rss+xml" /> <item> + <title>Don't let it crash</title> + <link>https://ninenines.eu/articles/dont-let-it-crash/</link> + <pubDate>Sun, 22 Jan 2017 00:00:00 +0100</pubDate> + + <guid>https://ninenines.eu/articles/dont-let-it-crash/</guid> + <description><div class="paragraph"><p>We have a specific mindset when writing Erlang
+programs. We focus on the normal execution of the
+program and don&#8217;t handle most of the errors that may
+occur. We sometimes call this normal execution the
+<em>happy path</em>.</p></div>
+<div class="paragraph"><p>The general pattern behind writing only for the
+<em>happy path</em>, letting the VM catch errors (writing
+them to a log for future consumption) and then
+having a supervisor restart the processes that
+failed from a clean state, has a name. We call it
+<em>let it crash</em>; and it drives many of our design
+decisions.</p></div>
+<div class="paragraph"><p>It&#8217;s a really great way to program and the results
+are fantastic compared to most other programming
+languages. And yet, <em>let it crash</em> barely convinced
+anyone that they should use Erlang. Why would that
+be?</p></div>
+<div class="paragraph"><p>You may already know that Cowboy is capable of
+handling at least 2 million Websocket connections
+on a single server. This is in large part thanks
+to the capabilities of the VM. Still, 2 million
+is good, much better than most other servers can
+do.</p></div>
+<div class="paragraph"><p>Cowboy is not just a Websocket server; it&#8217;s also
+an HTTP and HTTP/2 server, and it handles many
+related features like long polling or the parsing
+of most request headers.</p></div>
+<div class="paragraph"><p>Can you guess how large the Cowboy codebase is,
+without looking at the source?</p></div>
+<div class="paragraph"><p>Do make sure you have a clear answer in your mind
+before you go check.</p></div>
+<div class="paragraph"><p>Good, you are back. Now what were the results? If
+I am correct, you overestimated the size of Cowboy.
+Cowboy is in fact about five thousand lines of code.
+You probably thought it was at least ten thousand.
+About eighty percent of readers will have
+overestimated the size of Cowboy. And you did only
+because I mentioned it can handle millions of
+Websocket connections.</p></div>
+<div class="paragraph"><p>Numerous studies show this effect. Just mentioning
+the large number already prepared your mind to think
+in that direction. Repeating the number made you
+focus even more on it. Then the question asked for
+a number, which ended up larger than the reality.</p></div>
+<div class="paragraph"><p>The same effect can be applied to negotiation for
+example. You generally want to start by giving your
+offer (and not let the other party initiate) and
+you want to give a really large number first. You
+can also prepare your customer by mentioning an even
+larger number in the previous discussion.</p></div>
+<div class="paragraph"><p>And it&#8217;s not just numbers either. An experiment
+showed that just by looking at an image of clouds,
+customers of a pillow store were buying pillows
+more comfortable (and more expensive) than those
+who didn&#8217;t see that image.</p></div>
+<div class="paragraph"><p>This is the power of associations. It is covered in
+much larger detail in the books
+<a href="https://www.amazon.com/Influence-Psychology-Persuasion-Robert-Cialdini/dp/006124189X">Influence</a>
+and
+<a href="https://www.amazon.com/Pre-Suasion-Revolutionary-Way-Influence-Persuade/dp/1501109790">Pre-suasion</a>.
+I highly recommend reading those and applying what
+you learn to your daily life. I&#8217;m definitely not
+a professional psychologist so take this post with
+a grain of salt.</p></div>
+<div class="paragraph"><p>When selling Erlang, whether we are selling it to
+a customer or trying to convince a developer friend
+to start using it, we often talk about how Erlang
+<em>lets you sleep at night</em>, that it is auto healing
+and always gets fantastic uptimes.</p></div>
+<div class="paragraph"><p>And then we talk about <em>let it crash</em>.</p></div>
+<div class="paragraph"><p>And we describe what it means.</p></div>
+<div class="paragraph"><p>We might as well just say that Erlang crashes a lot
+and then take the door. It would have the same effect.
+It doesn&#8217;t even stop at programs crashing. You know
+what else crashes? Cars, planes, trains. Often with
+disastrous consequences. Is that really the message
+we want to convey?</p></div>
+<div class="paragraph"><p>They even <a href="https://img.youtube.com/vi/oEUBW2lCkIk/0.jpg">printed it on a t-shirt</a>!
+Keep calm and let it crash. It&#8217;s the kind of t-shirt
+you probably shouldn&#8217;t wear in an airport, and for good
+reasons. A few people did, then realized what they were
+wearing and were not too smug about it.</p></div>
+<div class="paragraph"><p>And yet this is how we sell Erlang.</p></div>
+<div class="paragraph"><p>A better way would be to focus on the positives, of
+course, but also to make sure that those positives
+are phrased in a way that prevents bad associations
+to be formed in people&#8217;s minds.</p></div>
+<div class="paragraph"><p>Instead of <em>let it crash</em>, you can say that Erlang
+has <em>auto healing mechanisms</em>. Healing is a good
+thing and accurately describes what happens in the
+system.</p></div>
+<div class="paragraph"><p>Should you need to go into more details, you will
+probably want to avoid <em>recover from crashes</em> and
+instead say <em>recover from exceptions</em>. Exceptions
+are a pretty neutral word and, should you explain
+what you mean by that, you can talk about exceptions
+that occur for reasons unrelated to Erlang, like
+hardware failure or network instability.</p></div>
+<div class="paragraph"><p>The trick is to always use positive words and
+phrases to describe Erlang, and to use external
+factors to explain how Erlang deals with failures.
+Never mention the failures internal to Erlang
+systems unless you are asked specifically, in
+which case you can say that the auto healing
+applies to all exceptions.</p></div>
+<div class="paragraph"><p>The <em>let it crash</em> philosophy is great when
+learning Erlang or when writing fault-tolerant
+systems. But it&#8217;s not going to convince anyone
+to use it unless they were already looking for
+it.</p></div>
+<div class="paragraph"><p>Do you like this post? Tell me on Twitter. I might
+make more.</p></div>
+</description> + </item> + + <item> <title>Cowboy 2.0 pre-release 4</title> <link>https://ninenines.eu/articles/cowboy-2.0.0-pre.4/</link> <pubDate>Tue, 03 Jan 2017 00:00:00 +0100</pubDate> @@ -1527,66 +1648,5 @@ http://www.gnu.org/software/src-highlite --> </description> </item> - <item> - <title>Xerl: expression separator</title> - <link>https://ninenines.eu/articles/xerl-0.4-expression-separator/</link> - <pubDate>Fri, 01 Mar 2013 00:00:00 +0100</pubDate> - - <guid>https://ninenines.eu/articles/xerl-0.4-expression-separator/</guid> - <description><div class="paragraph"><p>As promised we are adding an expression separator this time.
-This will be short and easy.</p></div>
-<div class="paragraph"><p>In the tokenizer we only need to add a line recognizing the
-comma as a valid token.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>, <span style="color: #990000">:</span> {<span style="color: #FF6600">token</span>, {<span style="color: #FF6600">','</span>, <span style="color: #009900">TokenLine</span>}}<span style="color: #990000">.</span></tt></pre></div></div>
-<div class="paragraph"><p>Then we need to change the following lines in the parser:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #FF6600">exprs</span> <span style="color: #990000">-&gt;</span> <span style="color: #FF6600">expr</span> <span style="color: #990000">:</span> [<span style="color: #FF6600">'$1'</span>]<span style="color: #990000">.</span>
-<span style="color: #FF6600">exprs</span> <span style="color: #990000">-&gt;</span> <span style="color: #FF6600">expr</span> <span style="color: #FF6600">exprs</span> <span style="color: #990000">:</span> [<span style="color: #FF6600">'$1'</span> | <span style="color: #FF6600">'$2'</span>]<span style="color: #990000">.</span></tt></pre></div></div>
-<div class="paragraph"><p>And add a comma between the expressions on the second line:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #FF6600">exprs</span> <span style="color: #990000">-&gt;</span> <span style="color: #FF6600">expr</span> <span style="color: #990000">:</span> [<span style="color: #FF6600">'$1'</span>]<span style="color: #990000">.</span>
-<span style="color: #FF6600">exprs</span> <span style="color: #990000">-&gt;</span> <span style="color: #FF6600">expr</span> <span style="color: #FF6600">','</span> <span style="color: #FF6600">exprs</span> <span style="color: #990000">:</span> [<span style="color: #FF6600">'$1'</span> | <span style="color: #FF6600">'$3'</span>]<span style="color: #990000">.</span></tt></pre></div></div>
-<div class="paragraph"><p>That takes care of everything except the optional trailing
-comma at the end of our lists of expressions. We just need an
-additional rule to take care of this.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 3.1.8
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #FF6600">exprs</span> <span style="color: #990000">-&gt;</span> <span style="color: #FF6600">expr</span> <span style="color: #FF6600">','</span> <span style="color: #990000">:</span> [<span style="color: #FF6600">'$1'</span>]<span style="color: #990000">.</span></tt></pre></div></div>
-<div class="paragraph"><p>That&#8217;s it.</p></div>
-<div class="paragraph"><p>Wondering why we don&#8217;t have this optional trailing comma in
-Erlang considering how easy it was and the number of people
-complaining about it? Yeah, me too. But that&#8217;s for someone else
-to answer.</p></div>
-<div class="paragraph"><p>Another change I want to talk about is a simple modification
-of the compiler code to use an <code>#env{}</code> record for
-tracking state instead of passing around individual variables.
-This will be required later on when we make modules into proper
-expressions so I thought it was a good idea to anticipate.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="https://github.com/extend/xerl/blob/0.4/">View the source</a>
-</p>
-</li>
-</ul></div>
-</description> - </item> - </channel> </rss>
\ No newline at end of file |