<?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: Carlos Galarza</title>
    <description>The latest articles on DEV Community by Carlos Galarza (@carloslfu).</description>
    <link>https://dev.to/carloslfu</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%2F55842%2F92b7ca98-ef8f-447b-ba9b-216ae1681cc2.jpeg</url>
      <title>DEV Community: Carlos Galarza</title>
      <link>https://dev.to/carloslfu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carloslfu"/>
    <language>en</language>
    <item>
      <title>Top Engineers I have learned the most from 💡</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Tue, 05 May 2020 17:08:53 +0000</pubDate>
      <link>https://dev.to/carloslfu/top-engineers-i-have-learned-the-most-from-3a55</link>
      <guid>https://dev.to/carloslfu/top-engineers-i-have-learned-the-most-from-3a55</guid>
      <description>&lt;p&gt;I have been working in the software industry since 2010. I learned a lot on this journey by trial and error, contributing to OSS, and working on enterprise software. But a thing that helped me a lot in my career was learning from top people, top engineers, people with &lt;strong&gt;skills I did not have&lt;/strong&gt;, and &lt;strong&gt;ideas I did not understand&lt;/strong&gt;, and that was possible because they shared their knowledge through insightful articles and content. So, thanks for sharing your experience and helping a lot of people on this journey!&lt;/p&gt;

&lt;p&gt;I divided this list into two major topics, Software Engineering and Architecture and Web &amp;amp; JavaScript, so without further ado, here it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Software Engineering and Architecture
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Martin Fowler: &lt;a href="https://martinfowler.com"&gt;martinfowler.com&lt;/a&gt;, &lt;a href="https://twitter.com/martinfowler"&gt;@martinfowler&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Joel Spolsky: &lt;a href="https://joelonsoftware.com"&gt;joelonsoftware.com&lt;/a&gt;, &lt;a href="https://twitter.com/spolsky"&gt;@spolsky&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Martin Kleppmann: &lt;a href="https://martin.kleppmann.com"&gt;martin.kleppmann.com&lt;/a&gt;, &lt;a href="https://twitter.com/martinkl"&gt;@martinkl&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Jeff Atwood: &lt;a href="https://blog.codinghorror.com"&gt;blog.codinghorror.com&lt;/a&gt;, &lt;a href="https://twitter.com/codinghorror"&gt;@codinghorror&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Eric Evans: &lt;a href="https://domainlanguage.com"&gt;domainlanguage.com&lt;/a&gt;, &lt;a href="https://twitter.com/ericevans0"&gt;@ericevans0&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Robert C. Martin: &lt;a href="http://cleancoder.com"&gt;cleancoder.com&lt;/a&gt;, &lt;a href="https://twitter.com/unclebobmartin"&gt;@unclebobmartin&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Rob Pike: &lt;a href="https://commandcenter.blogspot.com"&gt;commandcenter.blogspot.com&lt;/a&gt;, &lt;a href="https://twitter.com/rob_pike"&gt;@rob_pike&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Web &amp;amp; JavaScript
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Douglas Crockford: &lt;a href="https://www.crockford.com"&gt;crockford.com&lt;/a&gt;, &lt;a href="https://github.com/douglascrockford"&gt;@douglascrockford&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Jake Archibald: &lt;a href="https://jakearchibald.com"&gt;jakearchibald.com&lt;/a&gt;, &lt;a href="https://twitter.com/jaffathecake"&gt;@jaffathecake&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Axel Rauschmayer: &lt;a href="https://2ality.com"&gt;2ality.com&lt;/a&gt;, &lt;a href="https://twitter.com/rauschma"&gt;@rauschma&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;James Long: &lt;a href="https://jlongster.com"&gt;jlongster.com&lt;/a&gt;, &lt;a href="https://twitter.com/jlongster"&gt;@jlongster&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Kyle Simpson: &lt;a href="https://me.getify.com"&gt;me.getify.com&lt;/a&gt;, &lt;a href="https://twitter.com/getify"&gt;@getify&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Christopher Chedeau: &lt;a href="https://vjeux.com"&gt;vjeux.com&lt;/a&gt;, &lt;a href="https://twitter.com/Vjeux"&gt;@Vjeux&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Evan Wallace: &lt;a href="http://madebyevan.com"&gt;madebyevan.com&lt;/a&gt;, &lt;a href="https://twitter.com/evanwallace"&gt;@evanwallace&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Rich Harris: &lt;a href="https://github.com/Rich-Harris"&gt;github.com/Rich-Harris&lt;/a&gt;, &lt;a href="https://twitter.com/Rich_Harris"&gt;@Rich_Harris&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Nicolás Bevacqua: &lt;a href="https://ponyfoo.com"&gt;ponyfoo.com&lt;/a&gt;, &lt;a href="https://twitter.com/nzgb"&gt;@nzgb&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Dan Abramov: &lt;a href="https://overreacted.io"&gt;overreacted.io&lt;/a&gt;, &lt;a href="https://twitter.com/dan_abramov"&gt;@dan_abramov&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Kent C. Dodds: &lt;a href="https://kentcdodds.com"&gt;kentcdodds.com&lt;/a&gt;, &lt;a href="https://twitter.com/kentcdodds"&gt;@kentcdodds&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Nicholas C. Zakas: &lt;a href="https://humanwhocodes.com"&gt;humanwhocodes.com&lt;/a&gt;, &lt;a href="https://twitter.com/slicknet"&gt;@slicknet&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Andre Staltz: &lt;a href="https://staltz.com"&gt;staltz.com&lt;/a&gt;, &lt;a href="https://twitter.com/andrestaltz"&gt;@andrestaltz&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Krasimir Tsonev: &lt;a href="https://krasimirtsonev.com"&gt;krasimirtsonev.com&lt;/a&gt;, &lt;a href="https://twitter.com/KrasimirTsonev"&gt;@KrasimirTsonev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Basarat Ali Syed: &lt;a href="https://basarat.com"&gt;basarat.com&lt;/a&gt;, &lt;a href="https://twitter.com/basarat"&gt;@basarat&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if you are interested in learning Software Engineering or you are already on the journey, I highly recommend you follow them and read their articles. I am sure you will find insightful articles that will level-up your skills!&lt;/p&gt;

&lt;p&gt;PS: For sure, I have left out of this list a lot of valuable people, but thank you to everyone that shares useful content 🙂&lt;/p&gt;

&lt;p&gt;Follow me on Twitter &lt;a href="https://twitter.com/carloslfu"&gt;@carloslfu&lt;/a&gt; and here on the DEV Community; I share insights on Software Engineering often :)&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>web</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Computer Language Benchmarks Game</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Tue, 04 Feb 2020 12:30:01 +0000</pubDate>
      <link>https://dev.to/carloslfu/the-computer-language-benchmarks-game-1bno</link>
      <guid>https://dev.to/carloslfu/the-computer-language-benchmarks-game-1bno</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sj-aWxDv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mxyv8sd8kwwbg5q28diy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sj-aWxDv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mxyv8sd8kwwbg5q28diy.png" alt="velocity illustration"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An interesting resource for people that care about performance and efficient resource utilization or just for the curious is &lt;a href="https://benchmarksgame-team.pages.debian.net/benchmarksgame"&gt;The Computer Language Benchmarks Game&lt;/a&gt;. Some interesting history about it &lt;a href="https://benchmarksgame-team.pages.debian.net/benchmarksgame/sometimes-people-just-make-up-stuff.html"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Two benchmarks that I found useful in the past is the &lt;a href="https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go-python3.html"&gt;Go versus Python 3 benchmark&lt;/a&gt; and the &lt;a href="https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/go-node.html"&gt;Go versus NodeJS benchmark&lt;/a&gt;, those were part of the reasons why I started using &lt;a href="https://golang.org/"&gt;Golang&lt;/a&gt; for my projects.&lt;/p&gt;

&lt;p&gt;What do you think about it?&lt;/p&gt;

&lt;p&gt;Follow me here on the Dev Community,&lt;br&gt;
and on Twitter: &lt;a href="https://twitter.com/carloslfu"&gt;https://twitter.com/carloslfu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have a good day :)&lt;/p&gt;

</description>
      <category>softwaredevelopment</category>
      <category>performance</category>
      <category>python</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Why didn't Microsoft use React or Angular to build Visual Studio Code?</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Tue, 21 Jan 2020 19:37:38 +0000</pubDate>
      <link>https://dev.to/carloslfu/why-didn-t-microsoft-use-react-or-angular-to-build-visual-studio-code-h3c</link>
      <guid>https://dev.to/carloslfu/why-didn-t-microsoft-use-react-or-angular-to-build-visual-studio-code-h3c</guid>
      <description>&lt;p&gt;A text editor like Visual Studio Code is a complex and performance-critical application. In this case, is better to start from scratch and use pure JavaScript instead of a framework. A clear example of this is that in 2014 the Atom text editor was &lt;a href="https://blog.atom.io/2014/07/02/moving-atom-to-react.html"&gt;rewritten in React&lt;/a&gt; and in 2015 it was &lt;a href="https://github.com/atom/atom/pull/5624"&gt;rewritten again&lt;/a&gt; into pure JavaScript because of performance concerns.&lt;/p&gt;

&lt;p&gt;I found this question poorly answered on this &lt;a href="https://www.quora.com/Why-didnt-Microsoft-use-Angular-or-React-to-build-Visual-Studio-Code"&gt;Quora&lt;/a&gt; thread and it is my motivation for writing this short article.&lt;/p&gt;

&lt;p&gt;If you have any questions, feel free to ask me in the comments.&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moving Atom To React: &lt;a href="https://blog.atom.io/2014/07/02/moving-atom-to-react.html"&gt;https://blog.atom.io/2014/07/02/moving-atom-to-react.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Implement text editor DOM updates manually instead of via React: &lt;a href="https://github.com/atom/atom/pull/5624"&gt;https://github.com/atom/atom/pull/5624&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Curious about relevant software development topics?&lt;/p&gt;

&lt;p&gt;Follow me here on the Dev community,&lt;br&gt;
and on Twitter: &lt;a href="https://twitter.com/carloslfu"&gt;https://twitter.com/carloslfu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Have a good day :)&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>5 reasons to use Golang</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Mon, 22 Jul 2019 22:48:26 +0000</pubDate>
      <link>https://dev.to/carloslfu/5-reasons-to-use-golang-3d3h</link>
      <guid>https://dev.to/carloslfu/5-reasons-to-use-golang-3d3h</guid>
      <description>&lt;p&gt;There are several reasons to start using &lt;strong&gt;Go&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It’s statically, strongly typed with a great way to handle errors, this makes Golang more reliable and robust.&lt;/li&gt;
&lt;li&gt;It compiles down to one binary. Just execute it in wherever you want.&lt;/li&gt;
&lt;li&gt;It’s faster.&lt;/li&gt;
&lt;li&gt;The main reason why I use it is &lt;strong&gt;simplicity&lt;/strong&gt;, there is only one way to do things, no more “beauty” and “clever code”, this point increases your code readability. You and your team always know what a piece of code is doing. It is the Golangs killer-feature 🔥.&lt;/li&gt;
&lt;li&gt;For the reasons above, it is easier to teach Golang to new devs from scratch and they will get productive in a short time.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In my case, I used &lt;strong&gt;NodeJS&lt;/strong&gt; for a long time and had &lt;strong&gt;Golang&lt;/strong&gt; under my eyes once I read an article by &lt;strong&gt;Tj&lt;/strong&gt;, an important member of the NodeJS community. If you have used Node, probably you have used ExpressJS or at least read about it. Well, &lt;strong&gt;TJ Holowaychuk&lt;/strong&gt; is its creator! I leave here the link to the article: &lt;a href="https://medium.com/code-adventures/farewell-node-js-4ba9e7f3e52b"&gt;https://medium.com/code-adventures/farewell-node-js-4ba9e7f3e52b&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the beginning, Golang is a bit weird and your code gets larger, you have to forget about &lt;em&gt;Array.map&lt;/em&gt; .. &lt;em&gt;filter&lt;/em&gt; .. and all kinds of “beauty” things of &lt;strong&gt;JavaScript&lt;/strong&gt; and other modern languages, also, you have &lt;strong&gt;to handle every possible error&lt;/strong&gt;. But, in the long-term, it makes your code more readable, simple and stable.&lt;/p&gt;

&lt;p&gt;For example, the unique way to iterate in Golang is “for” and there is no ternary operator 😮, but this is the Golang strength 💪, simplicity.&lt;/p&gt;

&lt;p&gt;A couple of months ago with my team, we are using Golang for building the &lt;a href="https://licitamatic.com"&gt;LiciMatic’s&lt;/a&gt; backend, the platform I work on, and now Golang is my preferred language.&lt;/p&gt;

&lt;p&gt;So, I recommend you learning Glango, you are going to learn a lot and you will have big professional opportunities.&lt;/p&gt;

&lt;p&gt;I want to highlight that Golang is at the top of the best-paid languages of 2019: &lt;a href="https://lvivity.com/top-highly-paid-programming-languages"&gt;https://lvivity.com/top-highly-paid-programming-languages&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I leave here 3 free learning resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://goplay.space"&gt;Online development environment for Golang&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gobyexample.com"&gt;Golang by example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=G3PvTWRIhZA&amp;amp;list=PLQVvvaa0QuDeF3hP0wQoSxpkqgRcgxMqX"&gt;Golang video tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Want to learn more about Golang and other interesting tech topics?&lt;br&gt;
Follow me here on &lt;strong&gt;Dev.to&lt;/strong&gt; and on &lt;strong&gt;Twitter&lt;/strong&gt;: &lt;a href="https://twitter.com/carloslfu"&gt;https://twitter.com/carloslfu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks and happy learning! 🙂&lt;/p&gt;

</description>
      <category>go</category>
      <category>softwaredevelopment</category>
      <category>softwareengineering</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>How to write accessible code?</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Thu, 23 May 2019 00:54:24 +0000</pubDate>
      <link>https://dev.to/carloslfu/how-to-write-accessible-code-31hg</link>
      <guid>https://dev.to/carloslfu/how-to-write-accessible-code-31hg</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuxvonr4v4gfz10jybswq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuxvonr4v4gfz10jybswq.png" alt="accesible code image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Group code blocks in a logical way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep your variables close to where they are used.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use short names:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Naming a variable “a” or “b” is fine.&lt;/li&gt;
&lt;li&gt;But … I lose context, right? … DO NOT! If you respect rule 1, there is no problem, you will reduce the redundancy and the cognitive load of your code.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use names that speak for themselves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nothing of “mVal”, “tRows”, etc …&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use the new lines intentionally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the same way that you divide a text into paragraphs, make the new lines in your code communicate something.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to expand this information I recommend this video, it is based on Go but it applies to other languages as well -&amp;gt;&lt;br&gt;
⚡️⚡️⚡️&lt;/p&gt;

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

&lt;p&gt;Do you wanna know more about this topic and other interesting tech topics?&lt;/p&gt;

&lt;p&gt;Follow me on Twitter: &lt;a href="https://twitter.com/carloslfu" rel="noopener noreferrer"&gt;https://twitter.com/carloslfu&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks! and happy learning.&lt;/p&gt;

</description>
      <category>accessiblecode</category>
      <category>programming</category>
      <category>bestpractices</category>
      <category>go</category>
    </item>
    <item>
      <title>Are you using Redux or thinking about using it?</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Sun, 28 Apr 2019 15:38:25 +0000</pubDate>
      <link>https://dev.to/carloslfu/are-you-using-redux-or-thinking-about-using-it-1b3p</link>
      <guid>https://dev.to/carloslfu/are-you-using-redux-or-thinking-about-using-it-1b3p</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1jhm1awiwawx8xavqcjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1jhm1awiwawx8xavqcjn.png" alt="react.js logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Are you using Redux or thinking about using it? YOU DO NOT need it! React is a complete library to control the state of our applications. Using React Context in combination with Local State in your components is more than enough. Simplify the management of the state in your project and save valuable bytes 💰. How? Use useContext and useState, I recommend this great article by Kent C. Dodds, comes with examples and a deep explanation of this pattern that I use in all my projects and is very powerful: &lt;a href="https://kentcdodds.com/blog/application-state-management-with-react" rel="noopener noreferrer"&gt;Application State Management with React&lt;/a&gt;. If you have any questions, feel free to ask.&lt;/p&gt;

&lt;p&gt;Follow me on Twitter &lt;a href="https://twitter.com/carloslfu" rel="noopener noreferrer"&gt;@carloslfu&lt;/a&gt; if you want to learn more about React, programming, and technology.&lt;/p&gt;

&lt;p&gt;Good luck!&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>javascript</category>
      <category>statemanagement</category>
    </item>
    <item>
      <title>Tackling UI complexity with State Machines</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Tue, 20 Nov 2018 17:35:31 +0000</pubDate>
      <link>https://dev.to/carloslfu/tackling-ui-complexity-with-state-machines-3kd8</link>
      <guid>https://dev.to/carloslfu/tackling-ui-complexity-with-state-machines-3kd8</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HDHOuum0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gq487rt6bjrcbupaomyh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HDHOuum0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gq487rt6bjrcbupaomyh.png" alt="A simple on-off state machine"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’ll tell you my story, maybe is yours too …&lt;/p&gt;

&lt;p&gt;So it’s a great day at my workplace and I start coding an app that seems pretty simple.&lt;/p&gt;

&lt;p&gt;Time passes, I get some tasks done and, at some point, the application starts getting messy.&lt;/p&gt;

&lt;p&gt;I solve the problem by making some tricks because I’m quite smart and experienced developer 😉.&lt;/p&gt;

&lt;p&gt;But, I start feeling dirty and sometimes astonished about how that simple idea, I had in my mind, is getting so complex and verbose to map to code. I think there is no &lt;strong&gt;one-to-one relationship&lt;/strong&gt; between my mindmap and the code, it seems like a &lt;strong&gt;one-to-many relationship&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I’m the creator. I know how things work and this is not worrying me so much, because I do my best to write understandable and readable code.&lt;/p&gt;

&lt;p&gt;After that, the app starts getting bigger and now I have to work with a colleague to speed things up.&lt;/p&gt;

&lt;p&gt;Right now my colleague has many questions because he doesn’t know how the f*ck the app works! and what’s the idea behind it. I care about his health and I take the time to explain him the code. I’m a kind person I don’t want to make him waste that time 😅.&lt;/p&gt;

&lt;p&gt;Sometime later I’m assigned to other app and, right now, I can understand the pain it was to my dear colleague to understand my code because I have to figure out how the cr*p this new UI code works.&lt;/p&gt;

&lt;p&gt;Some months ago I’m reassigned to the first app for solving a bug, and you know, I should figure out how was my thinking these days.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/a5viI92PAF89q/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/a5viI92PAF89q/giphy.gif" alt="Batman interesting meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I always thought that there is something I’m missing, some solution that doesn’t come with extended and outdated UI specification documents. Something that makes me and others catch the idea faster and spend less time understanding the code. And yep, I was right, finally, I found it.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introducing Statecharts
&lt;/h1&gt;

&lt;p&gt;These problems happen to almost all people involved in any kind of reactive systems development such as UI development and, some people are too used to struggle with it, that it seems unavoidable and natural, but it is not.&lt;/p&gt;

&lt;p&gt;The problem is a well known one, &lt;em&gt;reactive systems are complex because of event orchestration complexity&lt;/em&gt;. And, solving this problem is a matter of getting things explicit from the beginning. So, your mental model should be coded in a way that you and others can easily reason about.&lt;/p&gt;

&lt;p&gt;In simple terms, a &lt;strong&gt;Statechart&lt;/strong&gt; is a pure function that contains all the logic related to the event-state orchestration in an explicit way. This way we can avoid the most common bugs and, if there are some, it’s easy to find them.&lt;/p&gt;

&lt;p&gt;With statecharts, you have a simple and manageable way to organize this logic by using a graph and some constructions. This gives us the power to reason about complex UI flows at the same time as prevents unexpected behavior to happen. Just FYI this formalism is used at NASA for &lt;a href="https://spectrum.chat/?t=9ed1415b-ce18-444e-83aa-55b5e18ce047"&gt;the Mars Science Laboratory Mission&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1CnE3fhg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/b5qmfaw7fm1gzjrtue43.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1CnE3fhg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/b5qmfaw7fm1gzjrtue43.jpeg" alt="Taken from the NASA gallery"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yep! Curiosity uses statecharts! 😮 😎&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;state, actions = Statechart(state, event, data?)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You give to the statechart the &lt;em&gt;current state&lt;/em&gt;, the &lt;em&gt;event&lt;/em&gt; that happened and optionally some &lt;em&gt;external data&lt;/em&gt;, and it gives you back the &lt;em&gt;next state&lt;/em&gt; and the &lt;em&gt;actions&lt;/em&gt; that should be performed. &lt;strong&gt;Actions&lt;/strong&gt; is a pretty simple concept, you can understand it as commands or functions that should be executed in response to the happened-event.&lt;/p&gt;

&lt;h2&gt;
  
  
  You already have state machines in your code
&lt;/h2&gt;

&lt;p&gt;So, you already have this logic in your code but, the problem is that &lt;strong&gt;it is no explicit&lt;/strong&gt;. Here I have to quote Reginald Braithwaite:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;*Any sufficiently complicated model class contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of a state machine. — Reginald Braithwaite in &lt;a href="http://raganwald.com/2018/02/23/forde.html"&gt;How I Learned to Stop Worrying and ❤️ the State Machine*&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You already implement all kind of flows in your UI code, and probably you do it by manually handling all the cases and figuring out the edge cases by doing some exploratory testing. This is known as the &lt;em&gt;bottom-up approach&lt;/em&gt; and it is the most common approach to developing UIs these days. We attach event listeners to UI components and perform some kind of action inside it. For instance, in vanilla JS you can have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signUpButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;signUpButton&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;signUpButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// mutate state and/or perform side effects&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But what about &lt;strong&gt;Redux&lt;/strong&gt;? Well, in Redux-like architectures you split the event handlers in reducers, for state management, and effect handlers. This is a great practice and Redux solves the state management problem, but you still have to struggle with the event orchestration one.&lt;/p&gt;

&lt;h2&gt;
  
  
  A matter of paradigms
&lt;/h2&gt;

&lt;p&gt;The above approaches are known as the &lt;em&gt;event-action paradigm&lt;/em&gt;. In this paradigm, when some event happens you fire an action in response to it. The problem with it is that, in order to coordinate the UI, you have to put a lot of conditions inside your event handler and even worse you may have nested if-else conditionals, switch cases and so on.&lt;/p&gt;

&lt;p&gt;In Redux you split this up in the reducer and the effect handlers but you still have the same problem. This paradigm makes your code complex and bug-prone. You as a developer have to maintain all those cases in your mind and be careful to not forget something.&lt;/p&gt;

&lt;p&gt;Statecharts use the &lt;em&gt;event-state-action paradigm&lt;/em&gt; which is the nature of complex UIs. And you may say, what’s the difference between statecharts and state diagrams. Long story short:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;statecharts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="nx"&gt;diagram&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;nesting&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;parallelism&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;broadcast&lt;/span&gt; &lt;span class="nx"&gt;communication&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Building a Statechart 🏗
&lt;/h1&gt;

&lt;p&gt;There is a notation for building statecharts using XML called &lt;a href="https://www.w3.org/TR/scxml/"&gt;SCXML&lt;/a&gt;. We are going to use XState, a JavaScript library which has its own notation but implements most of the things of the SCXML spec. Let’s hands-on building our first statechart.&lt;/p&gt;

&lt;h2&gt;
  
  
  State diagram
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;A state diagram is built of nodes and edges&lt;/em&gt;. A node represents one of the possible &lt;strong&gt;states&lt;/strong&gt; of the machine and, an &lt;strong&gt;edge&lt;/strong&gt; represents a transition between states. Transitions are dispatched in response to events and, very often those are user events.&lt;/p&gt;

&lt;p&gt;So let’s implement a simple on-off statechart:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/xstate-example-on-off?embed=1&amp;amp;&amp;amp;" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Nested states
&lt;/h2&gt;

&lt;p&gt;Let’s make some nested states. Suppose that when our UI is in the &lt;strong&gt;on&lt;/strong&gt; state &lt;strong&gt;traffic lights&lt;/strong&gt; are visible and the user can click on them.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/xstate-example-on-off-nested-lights?embed=1&amp;amp;&amp;amp;" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Conditions
&lt;/h2&gt;

&lt;p&gt;We can make conditional transitions. For example, I want that the user only turn off the machine while it is on the &lt;em&gt;on.green&lt;/em&gt; state. For that lets use the &lt;strong&gt;In Guard&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/xstate-example-on-off-nested-lights-conditional-off?embed=1&amp;amp;&amp;amp;" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;You may be wondering, but in which cases do I need it? Well, let’s start using it for widgets and stateful components.&lt;/p&gt;

&lt;p&gt;So, when you have to orchestrate events (state + network requests + user interaction + anything), &lt;em&gt;remember the Statechart is your friend&lt;/em&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  What’s next
&lt;/h1&gt;

&lt;p&gt;Next article I ‘ll show how to create a real-world app as well as explaining some good practices and tips for &lt;em&gt;building statecharts&lt;/em&gt; for your apps as well as other Statechart features.&lt;/p&gt;

&lt;p&gt;Thanks to SchoolApply and especially to Mikael Karon who encourage me to learn and discover the Statecharts world.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web</category>
      <category>statemachine</category>
      <category>react</category>
    </item>
    <item>
      <title>Do not leak your codebase in private projects</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Wed, 12 Sep 2018 11:18:29 +0000</pubDate>
      <link>https://dev.to/carloslfu/do-not-leak-your-codebase-in-private-projects-ad6</link>
      <guid>https://dev.to/carloslfu/do-not-leak-your-codebase-in-private-projects-ad6</guid>
      <description>&lt;p&gt;Sometimes tech people forget to disable source-maps in production, especially when using the create-react-app project.&lt;/p&gt;

&lt;p&gt;This might sound too basic, but I've looked this mistake so many times in private production projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL&amp;amp;DR ... not really, this is a very small article
&lt;/h2&gt;

&lt;p&gt;The create-react-app build command is not production ready, before publishing your project you should remove source-maps. However, this applies to any private web project, so, be careful and take a look at your production code maybe you are leaking the whole codebase.&lt;/p&gt;

&lt;p&gt;Related issue: &lt;a href="https://github.com/facebook/create-react-app/issues/2005"&gt;https://github.com/facebook/create-react-app/issues/2005&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>react</category>
      <category>web</category>
      <category>bundling</category>
    </item>
    <item>
      <title>The way I have learned programming</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Sat, 28 Apr 2018 10:55:15 +0000</pubDate>
      <link>https://dev.to/carloslfu/the-way-i-have-learned-programming-3ckb</link>
      <guid>https://dev.to/carloslfu/the-way-i-have-learned-programming-3ckb</guid>
      <description>

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fc6758lhjd6q249bffkko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fc6758lhjd6q249bffkko.png" alt="Programming"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have learned programming 16 years ago and right now I continue to learn things every day. By the way I improved how I learn. Here, I will teach you how is my process after a many years of programming and learning many things.&lt;/p&gt;

&lt;p&gt;For me, there are &lt;strong&gt;3 levels&lt;/strong&gt; of expertise in the field you want to learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Basic flow and concepts&lt;/strong&gt;, for this I recomend videos&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intermediate level&lt;/strong&gt;, for this I recommend textual tutorials&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced level&lt;/strong&gt;, I recommend technical documentation and blog posts from experts in the field&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Videos 🎥
&lt;/h1&gt;

&lt;p&gt;Videos are really nice when you don’t know how or where to click in the screen. I see video tutorials when I don’t know how to do basic things such as using an IDE or the workflow of an specific tool. In these cases, seeing things in video is insightful.&lt;/p&gt;

&lt;h1&gt;
  
  
  Textual Tutorials 📚
&lt;/h1&gt;

&lt;p&gt;If you have learned the basics, you should read and follow textual tutorials. The main advantage is that reading tutorials is faster than seeing videos. Also you can copy &amp;amp; paste example code and try it out by yourself.&lt;/p&gt;

&lt;h1&gt;
  
  
  Technical Documentation and Expert Blog Posts 📎
&lt;/h1&gt;

&lt;p&gt;The best tip for being a better programmer is IMO:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Gain a deeper understanding of the system&lt;/em&gt;. &lt;a href="https://staltz.com/" rel="noopener noreferrer"&gt;André Staltz&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After experimenting and applying the knowledge you learned in textual tutorials you can go ahead and read technical documentation that allows you to going &lt;strong&gt;deeper&lt;/strong&gt; in the field.&lt;/p&gt;

&lt;p&gt;Also, you should see for expert blogs that helps you with &lt;strong&gt;advanced concepts and the best practices&lt;/strong&gt;. Follow them and constantly search for new articles.&lt;/p&gt;

&lt;p&gt;And a bonus step …&lt;/p&gt;

&lt;h1&gt;
  
  
  Iterate over and over ➿
&lt;/h1&gt;

&lt;p&gt;Once you have an advanced level in a field, starts seeing for specific things or &lt;strong&gt;complementary topics you feel uncomfortable with&lt;/strong&gt; and start seeing videos, read textual tutorials and so on.&lt;/p&gt;

&lt;p&gt;There are many &lt;strong&gt;amazing knowledge&lt;/strong&gt; out there and you can learn a lot if you are &lt;strong&gt;curious&lt;/strong&gt; and &lt;strong&gt;disciplined&lt;/strong&gt;. So I ecourage you to &lt;strong&gt;start learning&lt;/strong&gt; something you want right now! A paradise of insights and awesomeness are waiting for you behind your screen.&lt;/p&gt;




&lt;p&gt;I would love to read in the comments what is the way you learn, so go ahead and write it!&lt;/p&gt;

&lt;p&gt;Thanks for reading :)&lt;/p&gt;

</description>
      <category>learntocode</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Make a P2P connection in 10 minutes</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Mon, 19 Mar 2018 22:19:54 +0000</pubDate>
      <link>https://dev.to/carloslfu/make-a-p2p-connection-in-10-minutes-4b32</link>
      <guid>https://dev.to/carloslfu/make-a-p2p-connection-in-10-minutes-4b32</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6z935l4g3vze2xkzqem.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm6z935l4g3vze2xkzqem.png" alt="Distributed Network" width="640" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a short guide on how to make a P2P chat. My aim is to give you only a taste if you like I could write a deeper article explaining how all these things work. That said, let's start.&lt;/p&gt;

&lt;h1&gt;
  
  
  Preparation
&lt;/h1&gt;

&lt;p&gt;The only thing you will need is the latest NodeJS and your favorite editor, mine is Visual Studio Code. Now create a folder for our project, open a command line, initialize an npm repo with npm init and install some libraries we will need with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;--save&lt;/span&gt; discovery-swarm dat-swarm-defaults portfinder get-port
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Our first P2P connection
&lt;/h1&gt;

&lt;p&gt;Let's start by doing a simple P2P connection, thanks to some great libraries from the Node.js community it is too simple:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Run this code in two consoles and this is it!. Now you can run it in other device right in your LAN and should work even without internet, also you can share and run this script in any other computer or device with internet around the world and it just works, so nice!&lt;/p&gt;

&lt;h1&gt;
  
  
  How it works?
&lt;/h1&gt;

&lt;p&gt;This code uses the technology behind the &lt;a href="https://datproject.org/" rel="noopener noreferrer"&gt;Dat Project&lt;/a&gt;. All communications are decentralized and work over a P2P network.&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;I love feedback. Ask me questions, comment on your experience with P2P technologies and share your ideas! Thanks for reading :)&lt;/p&gt;

&lt;p&gt;This series is possible thanks to the awesome tools delivered by the DatProject, Webtorrent and the NodeJS community.&lt;/p&gt;

&lt;p&gt;Follow me on here and on Twitter if you want to know more about tech and distributed P2P networks: &lt;a href="https://twitter.com/carloslfu" rel="noopener noreferrer"&gt;https://twitter.com/carloslfu&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web</category>
      <category>node</category>
      <category>descentralized</category>
    </item>
    <item>
      <title>Can I publish a post here that I have published in other platform i.e. Medium?</title>
      <dc:creator>Carlos Galarza</dc:creator>
      <pubDate>Wed, 21 Feb 2018 06:13:21 +0000</pubDate>
      <link>https://dev.to/carloslfu/can-i-publish-a-post-here-that-i-have-published-in-other-platform-ie-medium--6m8</link>
      <guid>https://dev.to/carloslfu/can-i-publish-a-post-here-that-i-have-published-in-other-platform-ie-medium--6m8</guid>
      <description>&lt;p&gt;I am new here and want to share interesting things I know and help others, I have some posts on Medium and I don't know if it is allowed to publish same content here, thanks!&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
  </channel>
</rss>
