<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Konstantin Zolotarev on Medium]]></title>
        <description><![CDATA[Stories by Konstantin Zolotarev on Medium]]></description>
        <link>https://medium.com/@zolotarev_k?source=rss-440c2ba9c806------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*A8Yh2zaS1Z9Si6k-.jpg</url>
            <title>Stories by Konstantin Zolotarev on Medium</title>
            <link>https://medium.com/@zolotarev_k?source=rss-440c2ba9c806------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:42:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zolotarev_k/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Elixir+Nerves for controlling your car (Part 1)]]></title>
            <link>https://medium.com/@zolotarev_k/elixir-nerves-for-controlling-your-car-part-1-3474afed4749?source=rss-440c2ba9c806------2</link>
            <guid isPermaLink="false">https://medium.com/p/3474afed4749</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[bmw]]></category>
            <category><![CDATA[can-bus]]></category>
            <category><![CDATA[elixir]]></category>
            <dc:creator><![CDATA[Konstantin Zolotarev]]></dc:creator>
            <pubDate>Wed, 08 Aug 2018 09:39:44 GMT</pubDate>
            <atom:updated>2018-08-08T09:39:44.097Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Warning ! </em></strong><em>All your modifications will cause issues with your car insurance. And may be dangerous ! Please work responsibly and think before doing something.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GJIuP5HnAemyEVxEkoIUgQ.jpeg" /></figure><p>Additional thank for <a href="http://nerves-project.org/">Nerves</a> team and community. It’s really one of the most friendly communities and developers are never sleep and always ready to help at any time. Your are the best !</p><p>I’m an happy owner of BMW 320CI (2003 coupe) and because I love my car and missing set of modern features like playing music from USB, AUX, Phone connection, voice control, mirrors memory and many other small things. I started to implement them by myself.</p><p>Elixir really suits perfect for this because of it’s stability (nobody wont’s car to stop or mirrors moved in the middle of your trip). Pattern matching fits perfect for working with binary messages. And lot of other features.</p><p>For experiments you will need CAN interface. After a while I bought 2 different devices one for developing and debugging at home (<a href="http://www.reslers.de/IBUS/index.html">Reslers USB device</a>) and one for working in car using RaspberryPi3 (<a href="http://copperhilltech.com/pican-2-can-interface-for-raspberry-pi-2-3/">PiCAN2</a>).</p><p>Let’s start with a bit of theory. Most cars using CAN Bus for internal communication. There are lot of information about it online <a href="https://en.wikipedia.org/wiki/CAN_bus">https://en.wikipedia.org/wiki/CAN_bus</a> but for your car it might be really hard to find specifications. I found this <a href="https://drive.google.com/open?id=0B5ZYJFTIIk5mflpsTE1SbU9yNFBsdGZrX2NxS1JmdHdiVUhaOGNPaGEyM1dOdnJRQ1FtcFk">folder in Google Drive</a>. Thank you George Umanov for your great work !</p><p>CAN Bus has 2 wires (high and low) for working with it but BMW IBus has only one. And you will need separate device. You could buy already assembled <a href="http://www.reslers.de/IBUS/index.html">Reslers USB device</a> with TH3122 chip. Or assemble your own (it’s really hard to order TH3122 chip). Here are details and shames about assembling: <a href="https://drive.google.com/open?id=1w3Y9V8-wWSqb3Vne_CNqRjd2DvdAXuNw">https://drive.google.com/open?id=1w3Y9V8-wWSqb3Vne_CNqRjd2DvdAXuNw</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjG9yOGRrLUPW1vqzz5XDA.png" /></figure><p>After assembling/receiving assembled device you will be able to use UART module and receive messages. Some info about CAN/IBus message. It just binary message consisting of several parts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*AgSR5O2wPeSq8Id2pZdwog.png" /></figure><p>For example if radio try to get info about CD changer it send this message &lt;&lt;0x68, 0x03, 0x18, 0x01, 0x72&gt;&gt; where:</p><ul><li>Source module: 0x68 Radio address</li><li>Message length: 0x03–3 bytes</li><li>Destination module: 0x18 CD changer address</li><li>Message 0x01 Request status</li><li>Checksum: 0x72</li></ul><p>I spent some time to understand it and wrote a really small library for parsing and working with CAN messages using Elixir. <a href="https://github.com/konstantinzolotarev/ex_ibus">https://github.com/konstantinzolotarev/ex_ibus</a>. Pretty simple lib for parsing and encoding CAN Bus and Ibus messages. And reader GenServer that can handle raw messages or part of raw messages, combine everything together and parse and pick messages from this spam.</p><p>Next step is connecting your laptop with car (I spent lot of time working inside car and bought radio, LCM (light control module, required for working with IBus) and IKE (main instrument cluster, not required). And created small dev stand at home.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*93i3fBEcsM1-cNVe_rfEGg.jpeg" /></figure><p>At home I’m working with Reslers USB device using <a href="https://github.com/nerves-project/nerves_uart">UART</a>. So for connection you have to know device name and configure it for transmitting data.</p><p>To get device name I used Nerves.UART.enumerate() function for this. Just start iex -S mix and run this command:</p><pre>iex(1)&gt; Nerves.UART.enumerate()<br>%{<br>  &quot;/dev/cu.Bluetooth-Incoming-Port&quot; =&gt; %{},<br>  &quot;/dev/cu.CHX-DevB&quot; =&gt; %{},<br>  &quot;/dev/cu.SLAB_USBtoUART&quot; =&gt; %{<br>    manufacturer: &quot;Silicon Labs&quot;,<br>    product_id: 60000,<br>    serial_number: &quot;R.Resler IBUS Interface V6b - Serial:20170918000441002322&quot;,<br>    vendor_id: 4292<br>  }<br>}</pre><ul><li>Device name (in my case) “/dev/cu.SLAB_USBtoUART”</li><li>UART options (required): active: true, speed: 9600, parity: :even</li></ul><pre>{:ok, _pid} = Nerves.UART.start_link(name: Ibus.Serial)    </pre><pre>:ok = Nerves.UART.open(Ibus.Serial, “/dev/cu.SLAB_USBtoUART”, active: true, speed: 9600, parity: :even)</pre><p>Now after physical connecting device to IBus it will start spamming you with binary data. It could be full messages, part of IBus message or one byte of message. All this binary data flow handled by <a href="https://github.com/konstantinzolotarev/ex_ibus/blob/master/lib/ex_ibus/reader.ex">ExIbus.Reader</a> combining data, fetch IBus messages and sends them to listener PID. I created GenServer for listening all ready messages and starting UART/ExIbus.Reader processes. Here is code samples for this: <a href="https://github.com/konstantinzolotarev/bmw_bot/blob/master/apps/ibus/lib/ibus/uart.ex">https://github.com/konstantinzolotarev/bmw_bot/blob/master/apps/ibus/lib/ibus/uart.ex</a></p><p>Now after all this magic we could just listen ExIbus.Message structs and react on them. For example you could send text to Radio display (in BMW Ibus you have to send message from Telephone module to IKE, have no idea why…). I wrote several helper modules for working with car here: <a href="https://github.com/konstantinzolotarev/bmw_bot/tree/master/apps/ibus/lib/ibus/device">https://github.com/konstantinzolotarev/bmw_bot/tree/master/apps/ibus/lib/ibus/device</a></p><p>And now could send commands without need to remember all device addresses. Like: Ibus.Device.Tel.send_text(&quot;Hello Medium&quot;)</p><pre>➜  bmw_bot master ✓ iex -S mix<br>Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]</pre><pre>12:07:16.780 [debug] Elixir.Ibus.UART: Start serial port</pre><pre>12:07:16.788 [debug] Elixir.Ibus.UART: Open serial connection</pre><pre>12:07:16.790 [debug] Elixir.Ibus.UART: Start serial reader</pre><pre>12:07:16.790 [debug] Elixir.Ibus.UART: Finish configure</pre><pre>12:07:16.790 [debug] Elixir.Ibus.Device.CD: Sending annoounce message<br>Interactive Elixir (1.6.4) - press Ctrl+C to exit (type h() ENTER for help)<br>12:08:35.458 [debug] Elixir.Ibus.Device.CD: Handled message 0x68 0x05 0x18 0x38 0x01 0x00 0x4C<br>iex(1)&gt; Ibus.Device.Tel.send_text(&quot;Hello Medium&quot;)<br>:ok</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uDz9wbomWD7Ba5G5BMeBAA.jpeg" /></figure><p>Now you could just play with your devices and dive into IBus specifications =D</p><p>In next part we’ll continue our journey into working with car and if something is not clear — just post a comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3474afed4749" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Elixir is worst language after Node.js]]></title>
            <link>https://medium.com/@zolotarev_k/elixir-is-worst-language-after-node-js-8ff4d73903cb?source=rss-440c2ba9c806------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ff4d73903cb</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[humor]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Konstantin Zolotarev]]></dc:creator>
            <pubDate>Wed, 01 Aug 2018 11:04:32 GMT</pubDate>
            <atom:updated>2018-08-01T11:04:32.358Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Disclaimer: </em></strong><em>first of all I have to tell that article is written under emotions. I still working with both languages on my daily bases and love both of them.</em></p><p><strong><em>Disclaimer 2</em></strong><em>: If you don’t have sense of humor please don’t read text below.</em></p><p>I’m working in web development for about 12 years in total and last 5 years on Node.js and pretty happy with it. Even when I’m listening that it’s dead, it’s unusable, it’s stupid and 1M more reasons for not using it. <em>You know what ? You just don’t know how to cook it right ! </em>It awesome language, does exact what you need and fits perfect in most tasks. In beginning of 2017 I found Elixir and was really impressed with it. So I started learning and building hobby projects and later production projects.</p><p><strong>BTW. </strong><a href="https://nerves-project.org/"><strong>Nerves</strong></a><strong> and of course Core Elixir teams — you are best ! And thank you for your job and help !</strong></p><p>Enough disclaimers and blah blah… Lets focus on theme. And why is Elixir so bad ?</p><p>When you comes to Elixir and start learning it you will start with official documentation (surprising right ?). And here you will find first thing. <strong>Everything</strong> is written in docs, you don’t need to read code, don’t need to search on github. WTF ? And even if you will open github and will look into Elixir sources you will find out that biggest part of all sources are docs. Even small modules are documented very well, come on… I spent such a lot of time with Node.js searching unexpected stuff in sources/libraries, trying to set correct communication between nodes and in Elixir I just have to open docs ? It’s not fair !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*Ep6YR2-d-SwQTV8YfASbkw.jpeg" /></figure><p>Just after you will spend time to understand how everything is working in Elixir and it’s functional paradigm (yep it broke my mind at first) you’ll find out that it’s really pretty simple language and almost everything is easy (<em>I have to say that really good understanding of OTP and architecture requires practice</em>).</p><p>Also I want to say several words about pattern matching… Closest thing in Node.js is const { some, another, other } = object; and I was happy when Node started support this. But after diving into pattern matching in Elixir it looks more like a joke. No really… getting exact bytes from Ibus message using pattern matching ? &lt;&lt;src::size(8), length::size(8), destination::size(8), message::binary&gt;&gt; ????? No splits, no loops, nothing ? Just one line to get all you need ?</p><p>Again I spent several years to know how to work with errors, exceptions and rejects in promises and now I have to let it fail. Just do nothing ? Whaaat ? “Supervisor will take care of this” © And most annoying thing — it really takes care of it. I don’t need try/catch .then/.catch and no need in .on(&#39;uncaughtException&#39;)/.on(&#39;unhandledRejection&#39;)</p><p>Most of the time people take Node.js when they need websockets. And it’s really cool. But to be able to create something fast and stable with rooms you have to be a f*king enchanter. Proxy, sticky sessions, pub/sub, autoscaling, exponential backoff — it’s only part of things you have to know to create a websocket server. And what will you find when open phoenix docs ? Everything is already done and works out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*_SLCgMdDSn0b0178j-OM0A.jpeg" /></figure><p><strong>P.S. </strong>To be honest I decided to write this yesterday, just after spent several hours before found error that yarn downloaded 2 different versions of module and run 2 instances of statefull modules in application that broke application. Yep I know that it’s an expected behaviour and everything works correct, and even using statefull modules — is pure evil in Node.js and blah blah… But first thing I thought after fixing this — I’d never had this issue in Elixir because of named processes…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ff4d73903cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First things you have to do in Node.js project]]></title>
            <link>https://medium.com/@zolotarev_k/first-things-you-have-to-do-in-node-js-project-69089fd4a06b?source=rss-440c2ba9c806------2</link>
            <guid isPermaLink="false">https://medium.com/p/69089fd4a06b</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Konstantin Zolotarev]]></dc:creator>
            <pubDate>Thu, 27 Apr 2017 08:03:09 GMT</pubDate>
            <atom:updated>2017-04-27T08:03:09.891Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m working with Node.js since 2012 and spent plenty of time on variety of Open Source and private projects. And I really enjoy my job. I also working as freelancer and from time to time joining some already existing projects. And all the time I’m open new project I look into it’s structure. And to be honest all I want to see there are this simple things:</p><ol><li>.editorconfig file.</li><li>Linter file or configuration.</li><li>Actual and up to date .gitignore file.</li><li>Correct and actual package.json file.</li><li>At least something in README.md file.</li></ol><p>Now I could give you some more information about every of this points.</p><h3>1. editorconfig file</h3><p>Every developer is individual. Every one prefer his own set of environment configurations and rules. And every developer could argue why his/her IDE/Editor/Something else is the best tool ever.</p><p>So let’s be polite to each other and respect everyone’s opinion. Almost all IDE/Editors have support for editorconfig. And spending several seconds to put set of rules in files will save much more time for others to reconfigure their editor settings.</p><p>Here is example of config that we are using in Trails.js team:</p><pre>root = true<br><br>[*]<br>indent_style = space<br>indent_size = 2<br>charset = utf-8<br>trim_trailing_whitespace = true<br>insert_final_newline = true<br><br>[*.md]<br>trim_trailing_whitespace = false</pre><p>You could find much more information and rules here: <a href="http://editorconfig.org/">http://editorconfig.org/</a></p><h3>2. Linter file or configuration.</h3><p>JavaScript doesn’t have internal code styling tool like Golang. And as a result there are tones of different code styles in companies and projects. And I almost sure you have your own. So it became obvious to add this rules into your project.</p><p>I don’t want to explain why linter is a good idea. Just believe me, it will save lot of your time and will make your code look much much nicer.</p><p>In most cases people are using jshint or eslint . I prefer eslint due to better support and flexibility.</p><p>You don’t need to copy/paste all your configs all the time from project to project. Just create a configuration as a npm module and publish it. Then just say that project uses this rules:</p><p>As a part of your package.json file:</p><pre>&quot;eslintConfig&quot;: {  &quot;extends&quot;: &quot;trails&quot;  }</pre><p>Or in file .eslintrc</p><pre>{<br>  &quot;extends&quot;: &quot;trails&quot;<br>}</pre><h3>3. Actual and up to date .gitignore file.</h3><p>This is also one of the most obvious things that every developer should know. But in reality pretty often I see files like .idea or npm-debug.log in repositories.</p><p>Just think what do you need to start project from scratch and add evrything else to your .gitignore</p><ol><li>Logs files</li><li>Runtime data *.pid *.seed</li><li>Lock files *.lock</li><li>Debug and error files npm-debug.log yarn-debug.log yarn-error.log</li><li>Env files .env</li><li>In most cases archives and backups *.zip *.tgz</li><li>And of course do not push node_modules !!! Never !!!</li></ol><p>Another point. If you are working in specific OS of editor and it creates list of specific files. Just add all this files into ~/.gitignore_global</p><p>For example I’m working in OSXvimand first lines of my ~/.gitignore_global are:</p><pre>*.sw*<br>*.DS_Store<br>.AppleDouble<br>.LSOverride</pre><p>This files should never be commited into git repo.</p><h3>4. Correct and actual package.json file.</h3><p>Every Node.js developer knows that package.json is main file in your project. But many developers care about it only when they create a new project and ignore it in future.</p><p>Article is already very big so I’ll just list you points you have to keep in mind when working on a project.</p><ol><li>Fill author field with an actual data and keep track of email address in there. If there are list of people working on module use `contributors` field</li><li>License. It’s really helps when you select correct license in your package.json and of course if you decided to change it, replace it</li><li>Split your dependencies between dependencies and devDependencies . mocha should never be in productiondependencies right ?</li><li>engines field should define list of node versions your module working with. It’s really helpful when you are searching for a new module for old project ;)</li><li>scripts at least define start and test scripts (of course if your module is just a library — you don’t need start script)</li></ol><p>Some more words about scripts section. It’s really useful if you will define commands using related paths. For example running tests with mocha . could be replaced with ./node_modules/mocha/bin/mocha . and people who does not have mocha installed globally will be able to run tests.</p><p>Run your linter before tests ! Something like:</p><pre>&quot;test&quot;: &quot;./node_modules/eslint/bin/eslint.js . &amp;&amp; NODE_ENV=testing ./node_modules/mocha/bin/mocha&quot;</pre><p>Nobody will be able to push ugly code because tests will fail.</p><h3>5. At least something in README.md file.</h3><p>No matter do you plan to open project or it’s project only for you. Write something in README.md file.</p><p>After several months you will need to open code and you will face with totally new code for you. You wouldn’t remember how is it working. You will have troubles running and configuring it again.</p><p>Even when you will start to cleanup your projects after several years it will be problem to remember if this project really needed. And without README.md file you will spend lot of time finding this out.</p><p>If you read all this till here you are really interested in a clean code and working project ! Congratulations !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69089fd4a06b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My first 5 Elixir d’ohs]]></title>
            <link>https://medium.com/@zolotarev_k/my-first-5-elixir-dohs-544db72f7c48?source=rss-440c2ba9c806------2</link>
            <guid isPermaLink="false">https://medium.com/p/544db72f7c48</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[elixir]]></category>
            <dc:creator><![CDATA[Konstantin Zolotarev]]></dc:creator>
            <pubDate>Sun, 23 Apr 2017 11:54:59 GMT</pubDate>
            <atom:updated>2017-04-23T11:54:59.189Z</atom:updated>
            <content:encoded><![CDATA[<p>I started my developer carrier about 10 years ago and primary languages I used was PHP and Java. To be honest I was pretty happy with this stack and started to collaborate in OpenSource projects like Openfire and Spark. I felt in love with OSS and spent really lot of time working on it. As you could see my tech stack was 100% around OOP.</p><p>In 2011 I met Node.js and started working with it. Let’s be honest it populated OSS like nobody before. Node.js opened world of realtime applications and highload for me. As a result now 90% of my work is realtime/highload applications and communication services.</p><p>Recently I opened a magical world of Elixir/Erlang for me. and I could say that I really enjoy working with it. But since I started to learn Elixir after many years of PHP/Java/Node.js I faced with some “D’ohs”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cvdbeVFe_QQV-ijlCiG9JA.png" /></figure><h3>1. Understanding of Processes</h3><p>Process in Elixir is not same as process in OS or thread in Java. It was really hard to me to realize that almost everything in Elixir is made with processes. Need to open connection to WS client — create a new “process”. Need to write a lib — create a “process”. Need to create a logic that communicates with something — create a “Process” that consist of “process”.</p><p>And OTP and GenServer are your first friends in this. In most cases all you need to do is to spawn processes and make the communicate with each other.</p><h3>2. Language flexibility and syntax</h3><p>In Node.js after ES6 all JS developers started to simplify their code. Async functions were replaced with promises. Iterations replaced with map/reduce. And code became much more clear and simple. Arrow functions brought beauty into JS code.</p><pre>someFunction(params, function (err, response) {<br>  if (err) {<br>    // do something<br>  }<br>  nextFunction(response, function () {<br>    if (err) {<br>      // do something<br>    }<br>    // etc...<br>  })<br>})</pre><p>Became something like:</p><pre>someFunction(params)<br>  .then(nextFunction)<br>  .then((result) =&gt; { /* etc... */ })<br>  .catch((err) =&gt; { /* do something */ })</pre><p>Elixir provides much more flexibility in it’s syntax. Same code structure could be written in Elixir in this way:</p><pre>result = some_function(params)<br>res = next_function(result)<br># etc...</pre><p>But it could be simplified with pipes:</p><pre>result = params<br>|&gt; some_function()<br>|&gt; nextFunction()<br># etc...</pre><p>Why don’t we have error handling ? Hmmm… because everything is small tiny processes. Let it fail, die OTP knows how to handle it. It would be restarted. Main idea of code in Elixir — Let if fail. No I’m serious. Let it fail. Elixir has lot of tools to handle it and knows what should it do. Should process be restarted or die or kill set of other processes…</p><h3>3. FOR loops and iterations</h3><p>When we need to iterate something in OOP language we start with various iterators and for loops. Very simple example:</p><pre>for (let i = 0; i &lt; 8; i++) {<br>  console.log(i)<br>}</pre><p>In opposite in Elixir for loop exist but is not very common to use it. Elixir provides you with pipes and set of methods to make everything clear.</p><pre>Enum.map 0..8, &amp;(IO.puts &amp;1)</pre><p>Ok it’s looks more like a magic, but here we have pipe |&gt; operator.</p><pre>0..8<br>|&gt; Enum.map(&amp;IO.puts/1)</pre><p>Much cleaner right ? In JS we also can one similar syntax. But to fill array with something — it’s really painful.</p><pre>[0,1,2,3,4,5,6,7,8].map(console.log)</pre><p>After some time working with Elixir I found out that it’s very similar to Node.js + Lodash/Underscore. Also I found this article that might be helpful for Node.js devs who want to start working with Elixir: <a href="http://www.east5th.co/blog/2017/04/17/who-needs-lodash-when-you-have-elixir/">http://www.east5th.co/blog/2017/04/17/who-needs-lodash-when-you-have-elixir/</a></p><h3>4. Error handling</h3><p>In Node.js world you have to handle all errors/exceptions that raises during application work. And if you did something wrong or forgot to handle exception — your application will die. In Elixir world in most cases you don’t need to think about such problems. Remember — “Everything is processes”.</p><p>If error will rise somewhere process will die and Supervisor will handle it. Of course there are cases when you need to handle error in code. And in that case language provides you with set of useful features. And when you use function you know what to wait form it.</p><p>For example Elixir has 2 functions that reads file. File.read and File.read! and both do same. Difference only in error reporting. File.read will return error to your code but File.read! will throw it to runtime.</p><pre>case File.read &quot;hello&quot; do<br>  {:ok, body}      -&gt; IO.puts &quot;Success: #{body}&quot;<br>  {:error, reason} -&gt; IO.puts &quot;Error: #{reason}&quot;<br>end</pre><p>And exception might be thrown like:</p><pre>iex&gt; File.read! &quot;unknown&quot;<br>** (File.Error) could not read file unknown: no such file or directory<br>    (elixir) lib/file.ex:305: File.read!/1</pre><p>There are more ways to work with exceptions, process termination but you could read it in official docs.</p><h3>5. Testing and mocks</h3><p>When you need to test something in Node.js sinon is your first friend. Mocking services and methods are pretty common in this language. Same with PHP/Java.</p><p>But in Elixir you don’t need mocks. All you need is to define module/method in tests. I wouldn’t tell you a lot about this. Because Jose Valim (creator of Elixir language) wrote an awesome article about mocking in Elixir</p><p><a href="http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/">http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=544db72f7c48" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>