<?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 David Salazar on Medium]]></title>
        <description><![CDATA[Stories by David Salazar on Medium]]></description>
        <link>https://medium.com/@davidjsmoreno?source=rss-83ab0d63445b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Dy_TadcaUgCdNQ9Jtu6CUA.png</url>
            <title>Stories by David Salazar on Medium</title>
            <link>https://medium.com/@davidjsmoreno?source=rss-83ab0d63445b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 04:34:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davidjsmoreno/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[React Crash Course for Angular Developers: React Architecture]]></title>
            <link>https://javascript.plainenglish.io/react-crash-course-for-angular-developers-react-architecture-3353e270dc09?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3353e270dc09</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Mon, 12 Sep 2022 07:16:01 GMT</pubDate>
            <atom:updated>2022-09-17T19:17:39.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VCObBvDAr3PBzSWQ8YMBgg.png" /><figcaption>React Architecture</figcaption></figure><p>I recently talked with a colleague who is an Angular specialist but was looking to learn React to add one more tool to his portfolio. We were talking about similar ways to do the same thing in Angular and React and the idea for this article came about: <strong>how about a React Crash Course for Angular Developers?</strong> In the end, it is frontend or UI development, and most of the knowledge is transferable.</p><p>We will divide the course into topics and how things are done in Angular and then the React counterpart side by side.</p><p>This is an intensive-turbo-crash course, which means that I’ll be assuming you are familiar with a lot of Web Development concepts but if not, I’ll be adding reference links at the end of each chapter, let’s begin.</p><h3>React Architecture.</h3><blockquote>A <strong>JavaScript</strong> <a href="http://freecodecamp.org/news/is-react-a-library-or-a-framework/">library</a> for building user interfaces (<a href="http://reactjs.org/">official site</a>)<em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rupPWcxOMsC_mFaRl1bk6A.jpeg" /><figcaption>Real vs virtual DOM, by <a href="https://www.altexsoft.com/blog/engineering/the-good-and-the-bad-of-reactjs-and-react-native/">altexsoft</a></figcaption></figure><p>One of the main differences between React and Angular is that with the latter you get a lot of out-the-box: a Router, HTTP request client, Pipes, Directives, etc.</p><p>But React main responsibility is to allow you to build and render your IU components, and it does that using a <a href="https://www.geeksforgeeks.org/data-structures/#:~:text=A%20data%20structure%20is%20a,%2C%20retrieving%2C%20and%20storing%20data.">data structure</a> called virtual DOM and reconciliation algorithm.</p><h3>How does React work?</h3><h4>Virtual DOM and the reconciliation algorithm</h4><p>Virtual DOM is a data structure built to mimic the real DOM with one difference:</p><blockquote>A virtual DOM object has the same properties as a real DOM object, but it lacks the real thing’s power to directly change what’s on the screen, <a href="https://www.codecademy.com/article/react-virtual-dom">codecademy</a><em>.</em></blockquote><p>The thing is that operations to update the real <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction">DOM</a> are generally expensive in memory.</p><p>When you update the component <a href="https://en.wikipedia.org/wiki/State_(computer_science)">state</a> in React these changes are applied to the virtual DOM, then it’s time for the reconciliation algorithm (or diffing algorithm) to compare the changes between the virtual DOM and the Real DOM.</p><p><strong>Finally, it will apply and update the changes only to those objects and only those objects in the Real DOM.</strong></p><p><strong>if you’re familiar with Git, you could think of DOM as your main branch, Virtual DOM as your Develop branch, and the reconciliation algorithm as your Pull Request, </strong>it’s not exactly the same but it’s a mental model that makes it easier to understand the concept.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gNQmOzE_8SKbTecqmPAPuw.jpeg" /><figcaption>Virtual DOM and the reconciliation algorithm, by <a href="https://brainhub.eu/library/what-is-react">brainhub</a></figcaption></figure><blockquote>React can update only the necessary parts of the DOM. React’s reputation for performance comes largely from this innovation,<strong> </strong><a href="https://www.codecademy.com/article/react-virtual-dom">Codecademy</a>.</blockquote><p>Also, this abstracts out the attribute manipulation, event handling, and manual DOM updating that you would otherwise have to use to build your app according.</p><h3>Next Chapter: Components in React vs Angular (Next week)</h3><p>For now, this is enough of React’s architecture, later in the course, we’re going to revisit it expanding it with more stuff like React Fiber and other interesting things.</p><p>In the next chapter, we’re going to check the side-by-side differences between React and Angular components: the basics, local state management, component life cycles, and basic styling.</p><p><strong>If would like to know when the next chapter in this course gets released, please subscribe to my newsletter at </strong><a href="https://davidjsmoreno.dev/"><strong>davidjsmoreno.dev</strong></a><strong>.</strong></p><h3>Learn more</h3><ul><li><a href="https://reactjs.org/docs/faq-internals.html">Virtual DOM and Internals</a></li><li><a href="https://www.codecademy.com/article/react-virtual-dom">React: The Virtual DOM</a></li><li><a href="https://github.com/acdlite/react-fiber-architecture">React Fiber Architecture</a></li><li><a href="https://www.freecodecamp.org/news/is-react-a-library-or-a-framework/">Is React a Library or a Framework? Here’s Why it Matters</a></li><li><a href="https://brainhub.eu/library/what-is-react">What Is React? Everything a Tech Leader Needs to Know</a></li><li><a href="https://www.altexsoft.com/blog/engineering/the-good-and-the-bad-of-reactjs-and-react-native/">The Good and the Bad of ReactJS and React Native</a></li><li><a href="https://twitter.com/apollographql/status/1255907988210057217/photo/1">Client-side architecture</a></li></ul><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><strong><em>, </em></strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><strong><em>, and</em></strong><em> </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong><em> Interested in Growth Hacking? Check out </em><a href="https://circuit.ooo/"><strong><em>Circuit</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3353e270dc09" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/react-crash-course-for-angular-developers-react-architecture-3353e270dc09">React Crash Course for Angular Developers: React Architecture</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Solve the replaceAll Error in Jest]]></title>
            <link>https://javascript.plainenglish.io/how-to-solve-the-replaceall-error-in-jest-815dc296c34b?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/815dc296c34b</guid>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Tue, 06 Sep 2022 11:16:05 GMT</pubDate>
            <atom:updated>2022-09-06T11:16:05.780Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TnLAiqL8pKTzEoMD" /><figcaption>Photo by <a href="https://unsplash.com/@dav420?utm_source=medium&amp;utm_medium=referral">David Pupaza</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Don’t forget to keep in sync all your project configurations.</blockquote><p>One time I was working on a legacy React project, I ran a recently added unit test and I got this error:</p><p><strong>Problem</strong></p><p><em>Jest: TypeError: replaceAll is not a function</em></p><p>I was confused at the beginning because in the browser, the component was working like a charm using the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll">replaceAll</a> method, but it turns out that <em>replaceAll is a new function not implemented in all browsers or older Node.js versions.</em></p><p><strong>Solution</strong></p><p>Install the replaceAll polyfill and add it to the jest setup configuration file.</p><ol><li>Install the replaceAll</li></ol><pre>npm i string.prototype.replaceall</pre><p>2. Modify your Jest config, add a <em>setupFilesAfterEnv</em> property as below:</p><pre>{</pre><pre>    &quot;jest&quot;: {</pre><pre>        &quot;setupFilesAfterEnv&quot;: [&quot;&lt;rootDir&gt;/jestSetup.js&quot;]</pre><pre>    }</pre><pre>}</pre><p>3. Add the following code to your <em>jestSetup</em> file</p><pre>import replaceAllInserter from &#39;string.prototype.replaceall&#39;;<br></pre><pre>replaceAllInserter.shim();</pre><p>Happy coding!</p><p><a href="https://stackoverflow.com/questions/65295584/jest-typeerror-replaceall-is-not-a-function/67877325#67877325">Source</a></p><p>Hi, <a href="https://davidjsmoreno.dev/">here</a> we talk about software development, JavaScript, self-taught education, and other stuff.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=815dc296c34b" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-solve-the-replaceall-error-in-jest-815dc296c34b">How to Solve the replaceAll Error in Jest</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Print the Entire Component using screen.debug() in React Testing Library]]></title>
            <link>https://javascript.plainenglish.io/how-to-print-the-entire-component-using-screen-debug-in-react-testing-library-330db38d3e78?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/330db38d3e78</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 16:16:10 GMT</pubDate>
            <atom:updated>2024-07-24T19:11:21.193Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pwaMMWXnxh3t4NCu" /><figcaption>Photo by <a href="https://unsplash.com/@jkoblitz?utm_source=medium&amp;utm_medium=referral">Julia Koblitz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I love React Testing Library and if you’re here, you probably love it too.</p><p>But when we’re testing a component with many lines of JSX and trying to print it, React Testing Library will not show the entire component.</p><h4><strong>Problem</strong></h4><blockquote>// Problem 🔴</blockquote><blockquote>screen.debug()</blockquote><h4><strong>Solution </strong>✅</h4><p>Luckily, the solution to this problem is straightforward, the following command will print the whole component in the console.</p><pre>screen.debug(undefined, Infinity)</pre><p><a href="https://github.com/testing-library/react-testing-library/issues/503#issuecomment-853783968">Source</a></p><blockquote><em>💡 </em>Speed up your blog creation with <a href="https://differ.blog/differ-ai"><strong><em>DifferAI</em></strong></a>.</blockquote><blockquote>Available for <strong><em>free</em> </strong>exclusively on the <strong><em>free and open blogging platform, </em></strong><a href="https://differ.blog/"><strong><em>Differ</em></strong></a><strong><em>.</em></strong></blockquote><p><a href="https://differ.blog/differ-ai">Introducing DifferAI</a></p><p>Hi, <a href="https://davidjsmoreno.dev/">here</a> we talk about software development, JavaScript, self-taught education, and other stuff.</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=330db38d3e78" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-print-the-entire-component-using-screen-debug-in-react-testing-library-330db38d3e78">How to Print the Entire Component using screen.debug() in React Testing Library</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ideal Frontend User Story]]></title>
            <link>https://javascript.plainenglish.io/the-ideal-frontend-user-story-e2b40f3437b1?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2b40f3437b1</guid>
            <category><![CDATA[agile-methodology]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[product-design]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Mon, 29 Aug 2022 15:17:21 GMT</pubDate>
            <atom:updated>2022-08-29T15:17:21.532Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*POlL7a4WGkZL_V2g" /><figcaption>Photo by <a href="https://unsplash.com/@chesnutt?utm_source=medium&amp;utm_medium=referral">Eran Menashri</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Let’s face it: <a href="https://www.atlassian.com/agile/scrum">Scrum</a> is not perfect and while a lot of teams do their best to follow the methodology the best way possible the truth is that the real world is wild and sometimes you need to make compromises to deliver value and meet the business needs.</p><h3>Problem</h3><p>Part of this imperfection is the way the user <a href="https://www.romanpichler.com/blog/10-tips-writing-good-user-stories/amp/">stories are written</a>, one day I was given a story comprised just of a UI design and a title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oNdHrQoNa7vUtTph" /><figcaption>Bad user story</figcaption></figure><p>Somehow this story managed to escape from refinement and planning sessions and was not <a href="https://www.scruminc.com/definition-of-ready/">ready to be done</a>, for me the story lacks <a href="https://frontend.turing.edu/lessons/module-3/user-stories.html">key aspects</a> an ideal good Frontend User Story should have:</p><ul><li>Descriptive title, check ✅.</li><li>Final UI Design, check ✅.</li><li>Clear and defined scope through <a href="https://www.mobindustry.net/blog/how-to-write-acceptance-criteria-examples-and-best-practices/">acceptance criteria</a>, fail 🔴.</li><li>Unknown check: Dependencies, feasibility, follow-up tickets that should be created? etc, fail 🔴.</li></ul><h3>The ideal user story structure</h3><p>In the real world sometimes we can’t return things to the backlog if they are not ready, deadlines need to be met and a story like this needs to be “refined along the way”, let’s analyze this story and refine it the most possible.</p><h3>The questions</h3><ul><li><strong>Fruit name: </strong>What are the character limits for the fruit name? instead of a text box, should not be a selection box showing all the fruits offered by the business?</li><li><strong>Country: </strong>Why the country is not a selection box?</li><li><strong>Parent brand: </strong>Where do the values for the parent brand come from? should be hardcoded?, or come from an API service? does this service exist?</li><li><strong>Quantity: </strong>What’s the minimum and maximum quantity of fruits to be added to the basket? is this quantity the same for all the fruits offered by the business?</li><li><strong>(Possibly child) brand: </strong>Where do the values for a brand come from? Do the brands are related to the parent brand? what kind of cross-validation between parent and child brand exists? What the hell is “items” in the items selection box? what’s the maximum or minimum of brands to be added?</li><li>And finally, <strong>the create button,</strong> does the service for creating a basket exist? also, the ticket says create and edit, does this service handle the edit functionality too?</li></ul><h3>The answers</h3><p>We met with our Product owner, the designer, and the backend developer, after that we also got intel from real users and we brought clarity to the previous questions, leaving us with a beautifully crafted user story.</p><p><strong>Ticket name:</strong> Create a new basket of fruits modal</p><p><strong>Design:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EYTKBUtCqgb1_bHz" /><figcaption>A better user story</figcaption></figure><p><strong>Acceptance criteria</strong></p><p><strong>List screen</strong></p><ul><li>As a user, I’d like to create a new basket of fruit from the Basket fruit List Screen.</li><li>Add a new basket button should show the Create a new basket of fruits modal.</li></ul><p><strong>Fruits</strong></p><ul><li>Fruits selection is a required field and its values come from Fruits service.</li><li>The country is a required field, we should reuse the existing Country Component.</li></ul><p><strong>Quantity</strong></p><ul><li>Quantity is a required field and is an integer between 1 and 10.</li></ul><p><strong>Brands</strong></p><ul><li>Parent brand selection is a required field and its values come from Brands service.</li><li>Children’s brand’s selection and branches are required fields and its values come from Brands service.</li><li>I’d like to select a parent brand before being able to add or modify children’s brands, at least one child brand with a branch should be selected.</li><li>If I select a new parent branch the children’s branch should be rebooted to its initial state.</li></ul><p><strong>Create</strong></p><ul><li>The previous validation should be met so I can create a correct basket of fruit.</li></ul><p><strong>Loading and Error states</strong></p><ul><li>Loading and error handling should use the same pattern used throughout the application.</li></ul><p><strong>Dependencies</strong></p><p><strong>Covered</strong></p><ul><li>Loading and error state mechanism, ticket link.</li><li>Basket fruit List Screen, ticket link.</li><li>Get Fruits service, service swagger documentation.</li><li>Get Brands service, service swagger documentation (for both parent and children brands).</li></ul><p><strong>Existing</strong></p><ul><li>Create Fruit Basket API Service Ticket — To do but API contract defined, mock API used in the meantime.</li><li>Update Fruit Basket API Service Ticket — To do but API contract defined, mock API used in the meantime.</li></ul><p><strong>Follow up tickets</strong></p><ul><li>Edit a new basket of fruits modal — To Do</li><li>Connect to the real API ticket for both Edit and Create flows — To do</li></ul><p><strong>Story points</strong>: 3</p><p>A note about Acceptance criteria, some people prefer to use BDD to write clear acceptance criteria, I usually prefer that too but in this article, for sake of brevity we did not use the given-then-when formula but I encourage you to take a look at <a href="https://revelry.co/insights/development/behavior-driven-development-bdd/">this link</a> if you’re not familiar with it.</p><h3>Give a hand to the Product Owner</h3><p>A solution to this problem could be as Developers, pre-refine the stories: ask your Product Owner what will be the priority for the next sprint and take one hour per day and check the backlog, review the tickets and collect a list of the questions to bring to the next refinement, that way we decrease the risk of very thin or unclear stories reaching the sprint plus your knowledge about the business will increase over the time, which is always valuable.</p><h3>Conclusion</h3><p>The way that we wrote the user story here is not intended to be the only one or the perfect one with no flak, actually, we surely leave some unknows to be answered that might be discovered once the ticket is started and require small adjustments down the road, but hey: that’s the magic of agile, or not? adapt to the change! 🙈.</p><p>Also, some people would argue that we should not be <a href="https://www.mountaingoatsoftware.com/blog/video-training-how-to-split-user-stories#comments">dividing</a> a story between a backend or frontend, or backend or mobile, and we should avoid the <a href="https://pm.stackexchange.com/a/26421">silos approach</a>, and I tend to agree with this but sometimes this is how things work in some organizations and sometimes we should adapt to the current flow before trying to change it or improve it progressively, this is a story for another article.</p><p>The thing is that the structure given in this article serves as a starting point, The real takeaway behind this article is no matter what User Story structure you use the most important thing is: <strong>to use one that allows you to understand the requirement; we must not create software in the darkness assuming a lot of stuff, ask, refine, iterate.</strong></p><p>Hi, <a href="https://davidjsmoreno.dev/">here</a> we talk about software development, JavaScript, self-taught education, and other stuff.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2b40f3437b1" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/the-ideal-frontend-user-story-e2b40f3437b1">The Ideal Frontend User Story</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mi experiencia con Deno, Svelte y Tailwind este 2021]]></title>
            <link>https://davidjsmoreno.medium.com/mi-experiencia-con-deno-svelte-y-tailwind-este-2021-287db48a7e7b?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/287db48a7e7b</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[deno]]></category>
            <category><![CDATA[tailwind]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Tue, 23 Mar 2021 22:07:29 GMT</pubDate>
            <atom:updated>2021-03-23T22:36:37.345Z</atom:updated>
            <content:encoded><![CDATA[<p><em>If you want to read a version of this article in English please check this </em><a href="https://davidjsmoreno.medium.com/my-experience-using-deno-svelte-and-tailwind-in-2021-59ca5c057c49"><em>link</em></a><em>.</em></p><blockquote>“Una inversión en conocimiento siempre paga el mejor interés”. Benjamin Franklin.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U0yMhjrxUu7d2omx" /><figcaption>Photo by <a href="https://unsplash.com/@jamie452?utm_source=medium&amp;utm_medium=referral">Jamie Street</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Usando la frase anterior, el libro <a href="https://www.amazon.com/-/es/Thomas-David-ebook/dp/B07VRS84D1/">Pragmatic Programmer</a> comienza el capítulo “<em>Your Knowledge Portfolio</em>”, donde el libro te alienta a invertir regularmente en el conocimiento como un hábito.</p><p>Después de leer eso, me pregunté: ¿estoy invirtiendo lo suficiente? ¿Qué debo aprender a continuación durante las próximas semanas?: ¿una inversión de bajo riesgo como Flutter, Python o Laravel? o (posiblemente) opciones de alto riesgo¹ como Deno o Svelte ?.</p><p>Me decidí por lo último porque me parecía más atractivo debido a la frescura de esas tecnologías, así que creé un pet project sólo por diversión: un clon (parcial) de la popular <a href="https://swapi.dev/">SWAPI API</a>. Este artículo no trata sobre cómo lo hice, sino sobre <strong>mi experiencia durante el proceso de aprendizaje e implementación</strong>, si está más interesado en el “<em>cómo</em>”, vaya al <a href="https://github.com/davidjsalazarmoreno/swapi-deno">repositorio de GitHub del proyecto</a> :-).</p><h3><a href="https://deno.land/">Deno</a></h3><blockquote><em>Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.</em></blockquote><h4>Empezando con Deno</h4><p>Esta es una de esas cosas que me enamoró de Deno: el proceso de instalación sin problemas y la increíble integración de <a href="https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno">Visual Studio Code</a> (aunque Deno proporciona integraciones para otros IDE), algunas características son formateo (no se necesita <a href="https://deno.land/manual/tools/formatter">prettier</a>), <a href="https://deno.land/manual/tools/linter">linting</a> (no se necesita eslint), Intellisense (gracias a Typescript), etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5HTtMAkQDPAB98Gq2Ts7Q.png" /><figcaption>Instalando Deno desde la línea de comando</figcaption></figure><p>A pesar de que “<em>no hay un instalador de paquetes</em>” para Deno, manejar las dependencias es bastante sencillo: la convención es crear un <a href="https://github.com/davidjsalazarmoreno/swapi-deno/blob/master/server/deps.ts">deps.ts</a> e importar directamente cada dependencia desde la URL, puede usar un repositorio público (como un CDN) o un repositorio privado .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OGQlAJqJTUq2888paZt7fA.png" /><figcaption>El archivo dept.ts es donde deberíamos poner todas las dependencias.</figcaption></figure><p>Algunas cosas sobre la captura de pantalla anterior: especifiqué la versión exacta que se buscará en la URL, esto no estrictamente necesario porque ejecutar Deno usando el flag <a href="https://deno.land/manual@v1.8.1/linking_to_external_code/integrity_checking">— lock = lock.json</a> creará un archivo <a href="https://deno.land/manual@v1.8.1/linking_to_external_code/integrity_checking">lock.json</a>, que es similar en propósito a <em>yarn.lock/package-lock.json</em> por ejemplo, <strong>bloqueando efectivamente tus dependencias y salvándonos del infierno de dependencias.</strong></p><p>Aunque usar un entorno virtual (como <a href="https://github.com/nvm-sh/nvm">NVM</a> para Nodejs) sería ideal a largo plazo para administrar diferentes versiones de Deno, no existe tal cosa en el mundo Deno (todavía): así que es tu (nuestra) oportunidad de crear algo similar o contribuir a las pocas <a href="https://github.com/asdf-community/asdf-deno">propuestas</a> que <a href="https://github.com/MarkTiedemann/deno.mk">existen</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*O1yx9PJuGqDEtPO135codA.png" /><figcaption>Pero tal vez no sea necesario porque podemos elegir qué versión de Deno instalar</figcaption></figure><h4>Unit testing</h4><p>Deno proporciona un <a href="https://deno.land/manual@v1.8.1/testing">Testing framework</a> agradable y ordenado, tal vez no sea tan extenso como Jasmine, por ejemplo, pero creo que es lo ideal para hacer lo que se <a href="https://github.com/davidjsalazarmoreno/swapi-deno/blob/master/server/models/people.test.ts">necesita</a>.</p><h4>Oak es como estar en casa</h4><p>Podemos dividir Deno en la <a href="https://deno.land/std@0.91.0">biblioteca estándar</a> y los <a href="https://deno.land/x">módulos de terceros</a>, donde <a href="https://deno.land/x/oak@v6.5.0">Oak</a> se destaca entre la multitud.</p><p>Oak tiene una API similar a Express, por lo que se sentirá como en casa al crear API REST, usar middlewares, manejar la negociación de contenido, etc., para mí, esto fue realmente genial porque reduce el cambio de contexto usando una convención que está bastante establecida entre los desarrolladores de Nodejs (porque podrían ser el público objetivo de Deno).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yN-4n1C6K3FDn4QwwFIf3A.png" /><figcaption>Definición de rutas usando MVC</figcaption></figure><h4>ORM?</h4><p>Para el <a href="https://github.com/davidjsalazarmoreno/swapi-deno/commit/f68e2e68f6f7298a00a07b66669eeb5e89074cb7">momento</a> en que comencé el proyecto, no pude encontrar una opción de <a href="https://es.wikipedia.org/wiki/Asignaci%C3%B3n_objeto-relacional">ORM</a> madura, pero pasó una cierta cantidad de tiempo hasta que terminé (pereza y procrastinación como siempre), a<a href="https://deno.land/x?query=orm">sí que tal vez ya debería existir una buena opción</a>, pero para ser honesto contigo: Usé SQLite y funcionó bien, quizás en el futuro lo actualice a Postgres o MySQL solo por diversión.</p><h4>Permisos para todo</h4><p>Este es uno de los <a href="https://deno.land/manual/getting_started/permissions">buques insignia</a> de Deno, lo que significa que Deno no tiene acceso a la red, lectura / escritura de disco o incluso a variables de entorno de forma predeterminada, por lo que si está desarrollando un script de shell probablemente tendrá sentido solo otorgar acceso al disco pero no a la red, o viceversa para una API REST.</p><h4>Actualización de la versión Deno</h4><p>Otra buena experiencia gracias a Typescript es que cuando actualizas tus dependencias y hay un cambio de API, las cosas se van a romper abruptamente cuando compilas, facilitando el trabajo de localizar el código a actualizar.</p><h3><a href="https://svelte.dev/">Svelte</a></h3><blockquote><em>Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your app.</em></blockquote><h4>Simple as possible, but not simpler.</h4><p>Si ya conoce Angular, React o Vue, aprenderá rápidamente a Svelte debido al hecho de que está usando muchos de los mismos principios implementados en otros frameworks (aunque Svelte es más un <a href="https://svelte.dev/blog/frameworks-without-the-framework">compilador</a> que un framework) pero hace honor a su lema: Realmente escribes código más sucinto, así que no sentí que estuviera aprendiendo algo totalmente diferente sino aplicando las mismas ideas de una manera simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V02E15AFBJm14hqtmfMpTA.png" /><figcaption>Un componente en Svelte, ignora el Comic Sans :-)</figcaption></figure><p>Eso significa que podemos usar <a href="https://svelte.dev/examples#declaring-props">props</a>, <a href="https://svelte.dev/examples#if-blocks">template syntax</a> para<a href="https://svelte.dev/examples#dom-events"> event handlers,</a> component <a href="https://svelte.dev/examples#onmount">lifecycles</a> e incluso API más completas como Context (similar a React Context), <a href="https://svelte.dev/examples#writable-stores">Stores</a> y un <a href="https://svelte.dev/examples#reactive-assignments">mecanismo de reactividad</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4c5RkgRsNCjnLiLMhhxYw.png" /><figcaption>Me encantó cómo se simplificó resource={resource} a {resource}, usando algo muy similar a ES6 <a href="https://alligator.io/js/object-property-shorthand-es6/">Object Property Value Shorthand</a></figcaption></figure><h4>Routing?</h4><p>Como solo cloné la pagina pricipal de SWAPI no necesitaba un mecanismo de enrutamiento. Es bueno saber que puede usar el paquete svelte-navigator para manejar esto, puedes probarlo en el <a href="https://svelte.dev/repl/c81d8f3dff584065a82b2d3ea7cd4aee?version=3.35.0">Svelte playground</a>.</p><h3><a href="https://tailwindcss.com/">Tailwind</a></h3><blockquote><em>Rapidly build modern websites without ever leaving your HTML.</em></blockquote><h4>¿Dónde está mi CSS?</h4><p>En los últimos años he estado usando frameworks como Bootstrap, Material IU, Metronic, pero un colega me habló de Tailwind en 2018 y mi primer pensamiento fue “<em>¿qué clase de brujería es esta ?, ¿dónde está mi CSS?</em>”, que equivocado estaba.</p><p>Pasó el tiempo y Tailwind se hizo cada vez más popular y terminé descubriendo una forma más declarativa de crear interfaces de usuario, sin escribir CSS (casi) en absoluto, pero dado que muchas de las clases de utilidad Tailwind se parecen al CSS original que representa: <strong>necesitas conocer CSS</strong>, <a href="http://www.youtube.com/watch?v=nCDWzV9wzW4&amp;t=4m18s"><strong>teniendo que concentrarte mas en el material que la herramienta</strong></a><strong>.</strong></p><p>Además, es bastante sencillo ampliarlo con tus propias utility classes si es necesario, fui evangelizado de hecho.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_nNSumZENxySh5Gd2Z23Q.png" /><figcaption>Jugando con Tailwind</figcaption></figure><h4>Integración con Tailwind</h4><p>Para la integración de Tailwind seguí <a href="https://dev.to/swyx/how-to-set-up-svelte-with-tailwind-css-4fg5">este</a> tutorial, no es demasiado complicado y para un proyecto de prueba está bien, pero para una aplicación de producción real tal vez debas buscar una mejor manera de hacerlo según el autor del artículo:</p><blockquote>This method outlined above is simple to get running but does end up running thousands of lines of Tailwind’s CSS through the Svelte compiler. This may cause performance issues (primarily, every time you change the entry point file)</blockquote><p>quizás usar <a href="https://sapper.svelte.dev/">Sapper</a>?</p><h3>Pensamientos finales</h3><p>Fue entretenido aprender estas tecnologías, pero siento que solo arañé la superficie, especialmente con Svelte, donde no usé cosas como enrutamiento o crear componentes más complejos, irónicamente invertí menos tiempo en Tailwind o Svelte, ¿hay más posibilidades de encontrar un trabajo <a href="https://trends.google.com/trends/explore?q=deno,svelte,tailwind">aprendiendo Svelte y Tailwind</a>?.</p><p>Deno es una buena herramienta, realmente disfruté la experiencia de desarrollo y si tengo que trabajar en un script de shell probablemente sugiera usar Deno, pero apartando eso creo que Nodejs sería mi primera opción para un nuevo proyecto web, la cantidad de paquetes probados que existen en el mundo de Nodejs es algo que aún no existe en Deno.</p><p>Pero existe la posibilidad en el futuro de usar paquetes NPM en Deno usando sus <a href="https://deno.land/std@0.91.0/node">Node Compatibility Modules</a>, entonces, ¿quién sabe?.</p><p>En cualquier caso: siga invirtiendo en tu portafolio de conocimientos, ya sea en herramientas o materiales de alto o bajo riesgo, crea (<strong>y termina</strong>) un nuevo proyecto de prueba con frecuencia para que así mantenga tus habilidades afiladas mientras aprende algo nuevo o practica algo aprendido, enfrentarás nuevos problemas a resolver que enriquecerán tu experiencia, y lo más importante: estarás construyendo un buen showcase para tu currículum.</p><p>Keep coding! :-)</p><p>[1]: Me refiero aquí a la <a href="https://medium.com/r?url=https%3A%2F%2Ftrends.google.com%2Ftrends%2Fexplore%3Fq%3Ddeno%2Csvelte%2Ctailwind">posibilidad de encontrar </a>trabajo utilizando estas tecnologías en comparación con las opciones más populares y no al riesgo técnico.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=287db48a7e7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My experience using Deno, Svelte, and Tailwind in 2021]]></title>
            <link>https://javascript.plainenglish.io/my-experience-using-deno-svelte-and-tailwind-in-2021-59ca5c057c49?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/59ca5c057c49</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tailwind]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[deno]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Tue, 23 Mar 2021 22:05:47 GMT</pubDate>
            <atom:updated>2021-04-03T16:58:34.348Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“An investment in knowledge always pays the best interest.” </em>Benjamin Franklin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U0yMhjrxUu7d2omx" /><figcaption>Photo by <a href="https://unsplash.com/@jamie452?utm_source=medium&amp;utm_medium=referral">Jamie Street</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Using the previous phrase the <a href="https://www.amazon.com/-/es/Thomas-David-ebook/dp/B07VRS84D1/">Pragmatic Programmer</a> book begins the chapter “<em>Your Knowledge Portfolio</em>” where the book encourages you to invest regularly in knowledge as a habit.</p><p>After reading that I asked myself: am I investing enough? What should I learn next for the next few weeks?: a low-risk investment like Flutter, Python, or Laravel? or (possibly) highly risky¹ options like Deno or Svelte?.</p><p>I decided on the latter because it seemed more appealing to me due to the freshness of those technologies, so I created a pet project just for fun: A (partial) clone of the popular <a href="https://swapi.dev/">SWAPI API</a>. This article is not about how I did it but instead <strong>my experience during the learning and implementation process</strong>, if you are more interested in the “<em>how</em>” please go to the <a href="https://github.com/davidjsalazarmoreno/swapi-deno">GitHub repo of the project</a> :-).</p><h3><a href="https://deno.land/">Deno</a></h3><blockquote><em>Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.</em></blockquote><h4><strong>Getting started with Deno</strong></h4><p>This is one of those things that made me fell in love with Deno: the smooth installation process and the amazing <a href="https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno">Visual Studio Code integration</a>, although Deno provides integrations for other IDEs, some features are <a href="https://deno.land/manual/tools/formatter">formatting</a> (no prettier needed), <a href="https://deno.land/manual/tools/linter">linting</a> (no eslint needed), Intellisense (thanks to typescript), etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5HTtMAkQDPAB98Gq2Ts7Q.png" /><figcaption>Installing Deno from the command line</figcaption></figure><p>Despite “<em>there’s no package manage</em>r” for Deno, handling the dependencies it’s pretty straightforward: the convention is to create a <a href="https://github.com/davidjsalazarmoreno/swapi-deno/blob/master/server/deps.ts">deps.ts</a> and import directly every dependency from the URL, you could use a public repository (like a CDN) or a private repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OGQlAJqJTUq2888paZt7fA.png" /><figcaption>dept.ts file is where we should put all the dependencies.</figcaption></figure><p>A few things about the previous screenshot: I specified the exact version to be fetched in the URL that is not strictly necessary because running Deno using the<em> </em><a href="https://deno.land/manual@v1.8.1/linking_to_external_code/integrity_checking"><em>— lock=lock.json</em></a> flag will create a <a href="https://deno.land/manual@v1.8.1/linking_to_external_code/integrity_checking">lock.json</a> file, that is similar in purpose to <em>yarn.lock/package-lock.json</em> for instance, <strong>effectively locking your dependencies and saving you from dependency hell.</strong></p><p>Although using a virtual environment (like <a href="https://github.com/nvm-sh/nvm">NVM</a> for Nodejs) would be ideal in the long term for managing different versions of Deno there’s not such a thing as that in the Deno world (yet): so it’s your (our) opportunity to create something similar or contribute to the few <a href="https://github.com/asdf-community/asdf-deno">proposals</a> <a href="https://github.com/MarkTiedemann/deno.mk">around</a> there.</p><p><strong>Update April 3, 2021</strong>: You can also check out <a href="https://github.com/justjavac/dvm">dvm</a>, thanks <a href="https://medium.com/@borsemayur2/there-is-a-deno-module-dvm-nvm-alternative-for-managing-different-deno-installations-2d18a4c29610">Mayur</a> for the suggestion :-).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*O1yx9PJuGqDEtPO135codA.png" /><figcaption>But maybe it’s not needed because we can choose which Deno’s version to install</figcaption></figure><h4><strong>Unit testing</strong></h4><p>Deno provides a nice and tidy <a href="https://deno.land/manual@v1.8.1/testing">Testing framework</a>, maybe it’s not so extensive like Jasmine for instance but I think it’s well suited to get the job <a href="https://github.com/davidjsalazarmoreno/swapi-deno/blob/master/server/models/people.test.ts">done</a>.</p><h4><strong>Oak is like being home</strong></h4><p>We can divide Deno into the <a href="https://deno.land/std@0.91.0">Standard library</a> and <a href="https://deno.land/x">Third-party modules</a> where <a href="https://deno.land/x/oak@v6.5.0">Oak</a> stands out from the crowd.</p><p>Oak has an API similar to Express so you’re going to feel at home when creating REST APIs, using middlewares, handling content negotiation, etc, for me, this was really cool because reduces the context switching using a convention that’s pretty established between the Nodejs devs (because they might be the Deno target audience).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yN-4n1C6K3FDn4QwwFIf3A.png" /><figcaption>Defining routes using MVC</figcaption></figure><h4>ORM?</h4><p><a href="https://github.com/davidjsalazarmoreno/swapi-deno/commit/f68e2e68f6f7298a00a07b66669eeb5e89074cb7">By the time</a> I started the project I could not find a mature <a href="https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping">ORM</a> option, but a certain amount of time passed until I finished (laziness and procrastination as always) so maybe a <a href="https://deno.land/x?query=orm">good fit should exist</a> by now, but to be honest with you: I used <a href="https://deno.land/x/sqlite@v2.3.2">SQLite</a> and it worked well, perhaps in the future I’ll update it to Postgres or MySQL just for fun.</p><h4>Permissions all over the place</h4><p>This is one of Deno’s <a href="https://deno.land/manual/getting_started/permissions">flagships</a>, which means that Deno does not have access to the network, read/write disk access, or even to environment variables by default, so if you’re developing a shell script probably it will make sense only to grant read/write disk access but not the network, or vice versa for a REST API.</p><h4>Upgrading Deno version</h4><p>Another nice experience thanks to Typescript is that when you update your dependencies and there’s an API change things are going to break abruptly when you compile, facilitating the work of locating the code to be updated.</p><h3><a href="https://svelte.dev/">Svelte</a></h3><blockquote><em>Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue do the bulk of their work in the browser, Svelte shifts that work into a compile step that happens when you build your app.</em></blockquote><h4>Simple as possible, but not simpler.</h4><p>If you already know Angular, React, or Vue you will pick up quickly Svelte due to the fact it’s using a lot of the same principles implemented in other frameworks (although Svelte is more like a <a href="https://svelte.dev/blog/frameworks-without-the-framework">compiler</a> than a framework) but it honors its motto: you really write a more succinct code, so I did not feel I was learning something totally different but applying the same ideas in a simple way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V02E15AFBJm14hqtmfMpTA.png" /><figcaption>A component in Svelte, please ignore the Comic Sans :-)</figcaption></figure><p>So that means we can use <a href="https://svelte.dev/examples#declaring-props">props</a>, <a href="https://svelte.dev/examples#if-blocks">a template syntax</a> for<a href="https://svelte.dev/examples#dom-events"> event handlers,</a> component <a href="https://svelte.dev/examples#onmount">lifecycles</a>, and even more complete APIs like <a href="https://svelte.dev/examples#context-api">Context</a> (similar React Context), <a href="https://svelte.dev/examples#writable-stores">Stores</a>, and a <a href="https://svelte.dev/examples#reactive-assignments">reactivity mechanism</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N4c5RkgRsNCjnLiLMhhxYw.png" /><figcaption>I loved how resource={resource} was simplified into {resource}, using something very similar to the ES6 <a href="https://alligator.io/js/object-property-shorthand-es6/">Object Property Value Shorthand</a></figcaption></figure><h4>Routing?</h4><p>Since I only cloned the SWAPI home I did not need a routing mechanism, It is good to know that you can use the svelte-navigator package to handle this, give it a try in the <a href="https://svelte.dev/repl/c81d8f3dff584065a82b2d3ea7cd4aee?version=3.35.0">Svelte playground</a>.</p><h3><a href="https://tailwindcss.com/"><strong>Tailwind</strong></a></h3><blockquote><em>Rapidly build modern websites without ever leaving your HTML.</em></blockquote><h4>Where is my CSS?!</h4><p>In the last few years I’ve been using frameworks like Bootstrap, Material IU, Metronic, but a colleague told me about Tailwind in 2018 and my first thought was “<em>what kind of blasphemy is this?, where’s my CSS?!</em>”, I could not be more wrong.</p><p>Time passed and Tailwind became more and more popular and I’ve ended discovering a very declarative way to creating UIs, no writing CSS (almost) at all but since a lot of the Tailwind utility classes resembles the original CSS that represents: <strong>you must know CSS, </strong><a href="http://www.youtube.com/watch?v=nCDWzV9wzW4&amp;t=4m18s">moving your focus from the tool to the material</a>.</p><p>Also, it’s pretty straightforward to extend it with your own utility classes if needed, I was evangelized for sure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_nNSumZENxySh5Gd2Z23Q.png" /><figcaption>Playing around with the utility classes</figcaption></figure><h4>Tailwind integration</h4><p>For the tailwind integration I followed <a href="https://dev.to/swyx/how-to-set-up-svelte-with-tailwind-css-4fg5">this</a> tutorial, it’s not too complicated and for a pet project it’s ok but for a real production app maybe you need to look for a better way to do it according to the article’s author:</p><blockquote>This method outlined above is simple to get running but does end up running thousands of lines of Tailwind’s CSS through the Svelte compiler. This may cause performance issues (primarily, every time you change the entry point file)</blockquote><p>maybe using <a href="https://sapper.svelte.dev/">Sapper</a>?</p><h3>Final thoughts</h3><p>It was entertaining learning these technologies but I feel I only scratched the surface, especially with Svelte where I did not use things like routing or create more complex components, ironically I invested less time on Tailwind or Svelte but maybe more chances are to <a href="https://trends.google.com/trends/explore?q=deno,svelte,tailwind">find a job learning them?.</a></p><p>Deno is a nice tool, I really enjoyed the development experience and if I have to work in a shell script I’ll probably suggest using Deno, but other than that I think Nodejs would be my first choice for a new web project, the amount of battle-tested packages that exist in the Nodejs world is something that does not exist yet in Deno.</p><p>But there’s a possibility in the future to use NPM packages in Deno using its <a href="https://deno.land/std@0.91.0/node">Node Compatibility Modules</a>, so who knows?</p><p>In any case: keep investing in your knowledge portfolio, either high or low-risk tools or materials, create (and <strong>finish</strong>) a new pet project frequently so that way you will keep your skill sharp while learning something new or rehearse something learned, you will face new problems to solve that will enrich your experience, and most important: <strong>you’ll be building a good showcase for your resume.</strong></p><p>Keep coding! :-)</p><p>[1]: I’m referring here to the possibility <a href="https://medium.com/r?url=https%3A%2F%2Ftrends.google.com%2Ftrends%2Fexplore%3Fq%3Ddeno%2Csvelte%2Ctailwind">to find a job using</a> these technologies compared to the most popular options and not about technical risk.</p><p><em>Si desea leer una versión de este artículo en Español, consulte este </em><a href="https://davidjsmoreno.medium.com/mi-experiencia-con-deno-svelte-y-tailwind-este-2021-287db48a7e7b"><em>enlace</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59ca5c057c49" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/my-experience-using-deno-svelte-and-tailwind-in-2021-59ca5c057c49">My experience using Deno, Svelte, and Tailwind in 2021</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Desmitificando el uso del punto y coma en Javascript]]></title>
            <link>https://davidjsmoreno.medium.com/desmitificando-el-uso-del-punto-y-coma-en-javascript-c6bd69fe4e04?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6bd69fe4e04</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Sun, 26 May 2019 01:22:54 GMT</pubDate>
            <atom:updated>2019-05-27T13:05:04.880Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<blockquote>Mito 1 “El punto y coma es requerido en todo momento”</blockquote><blockquote>Mito 2 “No necesitas punto y coma en ningún lugar.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gLHPUHHCS7-yk4BO" /><figcaption>Photo by <a href="https://unsplash.com/@timothylbrock?utm_source=medium&amp;utm_medium=referral">Timothy L Brock</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>El punto y coma o <em>semicolon </em>(;) es uno de esos temas muy susceptibles a <em>flame wars </em>🔥 debido a que está ligado a las preferencias de código del desarrollador o de un equipo de desarrollo (así como <em>tabs vs espacios</em>, <em>comillas simples vs dobles</em>,<em> Vim vs Emacs</em>, entre otros).</p><h3>“El punto y coma es requerido en todo momento”</h3><p>Este código es perfectamente Javascript válido:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/51a624b5b632eea62299bbd6a1958382/href">https://medium.com/media/51a624b5b632eea62299bbd6a1958382/href</a></iframe><p>Esto gracias al <strong>ASI.</strong></p><h3>Automatic Semicolon Insertion (ASI)</h3><p>Es el <strong><em>Automatic Semicolon Insertion (ASI)</em></strong>, inserción automática de punto y coma, un mecanismo por el cual (como su nombre indica) Javascript insertará un punto y coma donde <a href="https://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi/2846298#2846298">haga sentido hacerlo</a>, como en el ejemplo anterior.</p><p><strong>Está activado por defecto y siempre está activo, es parte del lenguaje y no puede ser desactivado o removido total o parcialmente.</strong></p><p>Pero hay excepciones, que nos lleva al segundo mito.</p><h3>“No necesitas punto y coma en ningún lugar.”</h3><p>Un salto de linea (\n) termina una declaración cuando:</p><ol><li>La declaración tiene un paréntesis no cerrado, un array literal o un objeto literal o termina de alguna otra manera que no es una forma válida de finalizar una declaración. (Por ejemplo, terminando con punto o coma.).</li><li>La línea es — o ++ (en cuyo caso disminuirá / incrementará el siguiente token).</li><li>Es un for (), while (), do, if (), o else, y no hay llaves {}</li><li>La siguiente línea comienza con [, (, +, *, /, -, coma, punto , o algún otro operador binario que solo se puede encontrar entre dos tokens en una sola expresión.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49c86a2ebe0a467f5bad6697bc10fe1c/href">https://medium.com/media/49c86a2ebe0a467f5bad6697bc10fe1c/href</a></iframe><h3>El punto y coma no te salvará del restricted productions</h3><blockquote>Si tiene un salto de linea (\ n) inmediatamente después de una <em>return, throw, break o continue</em>, o un <em>++ o —</em> como operador postfijo, entonces se termina la declaración.</blockquote><blockquote><a href="http://bit.ly/2Wa7zdC">http://bit.ly/2Wa7zdC</a></blockquote><p>Considera este ejemplo:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2c5685e4cf30ca8a98ec9c1082f4abfd/href">https://medium.com/media/2c5685e4cf30ca8a98ec9c1082f4abfd/href</a></iframe><p>Agregar o no agregar un punto y coma no te salvará de un <em>return</em> o <em>continue</em> con salto de linea,<strong> conocer el <em>Automatic Semicolon Insertion</em> si lo hará</strong></p><h3>Conclusión</h3><p>Olvídate de la guerra de punto y coma o no, lo que deben importarte son dos cosas: conocer el <strong>ASI</strong> (visto en este articulo, yeeeeiii) y el principio de consistencia.</p><p>¿Tu proyecto se va por punto y coma requerido porque están usando SQL y quieren disminuir el <a href="https://simpleprogrammer.com/context-switching/"><strong><em>context switching</em></strong></a><strong><em>?</em></strong>, ¿o prefieren no usarlo para nada porque les parece que el código se ve más limpio?, ambas razones son validas pero cualquiera que elijas: apégate a ello, ayúdate con <a href="https://eslint.org/docs/1.0.0/rules/no-unexpected-multiline">linters</a>, <a href="https://prettier.io/">code formatter,</a> code review, pero hazlo.</p><p>Lo que no debes dejar es caer en el miedo que alguien te diga que un estilo es superior a otro ya que al final termina siendo un asunto de preferencia, usar punto y coma no hará tu código más “seguro” contra el <strong>ASI</strong> y no usarlo no hará tu código “superior” a los que si lo usan.</p><p><strong><em>Toma una decisión y atente a ella.</em></strong></p><h4><strong>Enlaces de interés</strong></h4><ul><li><a href="https://blog.izs.me/2010/12/an-open-letter-to-javascript-leaders-regarding">An Open Letter to JavaScript Leaders Regarding Semicolons</a></li><li><a href="https://www.freecodecamp.org/forum/t/semicolons-in-javascript/80595">Semicolons in Javascript (Freecodecamp)</a></li><li><a href="https://www.youtube.com/watch?v=Qlr-FGbhKaI">Semicolons cannot save you! — FunFunFunction #9</a></li><li><a href="https://medium.com/@WebReflection/an-open-letter-to-javascript-leaders-regarding-no-semicolons-82cec422d67d">An Open Letter to JavaScript Leaders Regarding No Semicolons</a></li><li><a href="https://www.youtube.com/watch?v=gsfbh17Ax9I&amp;t=5s">Are Semicolons Necessary in JavaScript?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6bd69fe4e04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Entendiendo el Event Loop o Bucle de Eventos en Javascript]]></title>
            <link>https://davidjsmoreno.medium.com/entendiendo-el-event-loop-o-bucle-de-eventos-en-javascript-b294d882fd14?source=rss-83ab0d63445b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b294d882fd14</guid>
            <category><![CDATA[desarrollo-web]]></category>
            <category><![CDATA[ecmascript]]></category>
            <category><![CDATA[programación]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[David Salazar]]></dc:creator>
            <pubDate>Sun, 09 Apr 2017 18:30:43 GMT</pubDate>
            <atom:updated>2017-04-09T18:44:59.476Z</atom:updated>
            <content:encoded><![CDATA[<p>Mirando el siguiente código, ¿puedes decir con certeza cuál será la salida de la consola?.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65ced8eca280b3a3b204abb82cb0233e/href">https://medium.com/media/65ced8eca280b3a3b204abb82cb0233e/href</a></iframe><p>Si tu respuesta fue…</p><p>1. Hola<br>4. Este es un mensaje extra<br>5. ¿Acertaste el orden de la salida?<br>2. Mundo<br>3. A todos</p><p>…<strong>enhorabuena, es la respuesta correcta</strong>, en cualquier caso te invito a seguir leyendo para revisar el <em>por qué</em> de la salida anterior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vMYZZ5oSnxRszIp9XzG5pw.gif" /><figcaption>Ejemplo anterior funcionando gracias a <a href="http://latentflip.com/loupe/">http://latentflip.com/loupe/</a></figcaption></figure><h3>Web APIs, Stack, Heap y Queue</h3><h3>Web APIs</h3><p>Javascript (del lado del cliente en particular) tiene muchas <a href="https://developer.mozilla.org/en-US/docs/Web/API">APIs disponibles</a>, <em>estas no son parte del lenguaje Javascript en sí</em>, más bien están construidas <em>sobre</em> Javascript, proveyéndonos de súper poderes extra para usar en nuestro código Javascript, alguna de ellas van desde setTimeout y XMLHttpRequest hasta WebGL o FileReader.</p><h3>Stack</h3><p>Las llamadas de las funciones crean el llamado <em>stack of frames</em>, veamos el siguiente ejemplo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e717381dd79fda4783859f12eec03346/href">https://medium.com/media/e717381dd79fda4783859f12eec03346/href</a></iframe><ol><li>Cuando llamamos primeroAlStack un primer <em>frame</em> es creado, conteniendo los argumentos de primeroAlStack y todas sus variables locales.</li><li>Cuando primeroAlStack llama a segundoAlStack un segundo frame es creado y agregado encima del stack o pila de llamada conteniendo igualmente los argumentos de segundoAlStack y sus variables locales.</li><li>Cuando segundoAlStack <strong>retorne</strong>, el frame en la parte superior del stack es removido, dejando sólo el call frame deprimeroAlStack.</li><li>Cuando primeroAlStack <strong>retorne</strong> el stack queda vacío.</li></ol><h3>Heap</h3><p>Los objetos son asignados en un <em>heap</em> el cual sólo es un nombre para denotar una larga y no estructurada región de memoria.</p><h3>Queue</h3><p>Un entorno de ejecución Javascript contiene una cola de mensajes (<em>messages queue</em>), <strong>el cual es una lista de mensajes a ser procesados</strong>.</p><p><strong>Una función está asociada a cada mensaje</strong>. Cuando el stack tiene suficiente capacidad, un mensaje es tomado del queue y procesado.</p><p>El procesamiento consiste en <strong>llamar a la función asociada (y por lo tanto crear un stack frame inicial)</strong>.</p><p>El procesamiento del mensajes finaliza cuando el stack vuelve estar vacío de nuevo.</p><h3>Event loop o Bucle de Eventos</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad39bb36b0f74e5536beed186177f3f6/href">https://medium.com/media/ad39bb36b0f74e5536beed186177f3f6/href</a></iframe><p>El <em>event loop</em> o bucle de eventos obtiene su nombre por como está usualmente implementado, el cual probablemente se parece al código anterior, queue.esperaPorMensaje()aguarda de forma <strong>síncrona</strong> a que un mensaje llegue si no hay ninguno actualmente.</p><h3>Re-visitando el primer ejemplo</h3><p>Manejando los concepto anteriores podemos re-analizar el primer ejemplo y verificar que el comportamiento no es ningún tipo de magia oscura o error de ejecución.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/404c6ebef77d3d4c8b495c1c81ef160a/href">https://medium.com/media/404c6ebef77d3d4c8b495c1c81ef160a/href</a></iframe><h3>Zero delays</h3><blockquote>“Un momento, un momento, el segundo setTimeout tiene un tiempo de delay igual a cero, ¿no debería ejecutarse el cuerpo de su función justo después de console.log(‘1. Hola’)”</blockquote><p>Llamar a setTimeout con cualquier intervalo de tiempo no ejecutará su código inmediatamente sino en cambio lo agregará al <strong>queue</strong> luego que el tiempo establecido en el delay haya pasado, <em>por lo que debe considerarse al segundo argumento como el tiempo mínimo de ejecución no el tiempo garantizado</em>.</p><p>Este modelo es similar al de Node aunque hay algunas diferencias, lo dejo como ejercicio al lector investigarlas (o quizás lo visitemos en otro articulo).</p><h3>Enlaces de interés</h3><ul><li><a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ">Philip Roberts: What the heck is the event loop anyway?</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop">Concurrency model and Event Loop</a></li><li><a href="https://danmartensen.svbtle.com/events-concurrency-and-javascript">Events, Concurrency and JavaScript</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction">Introduction to web APIs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b294d882fd14" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>