<?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 Diogo Cunha on Medium]]></title>
        <description><![CDATA[Stories by Diogo Cunha on Medium]]></description>
        <link>https://medium.com/@diogofcunha?source=rss-164e6378e362------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZvM2qjeHFhDWR2qZdvOXeg.jpeg</url>
            <title>Stories by Diogo Cunha on Medium</title>
            <link>https://medium.com/@diogofcunha?source=rss-164e6378e362------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:38:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@diogofcunha/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[2018 here we go]]></title>
            <link>https://medium.com/@diogofcunha/2018-here-we-go-7722296a4837?source=rss-164e6378e362------2</link>
            <guid isPermaLink="false">https://medium.com/p/7722296a4837</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[2018]]></category>
            <category><![CDATA[new-years-resolutions]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Diogo Cunha]]></dc:creator>
            <pubDate>Sat, 06 Jan 2018 09:52:59 GMT</pubDate>
            <atom:updated>2018-01-06T09:52:59.278Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KPvGAxHe-mIjjr6VISe-ag.jpeg" /></figure><p>In two days it will be two years since I moved to the UK, it has been an amazing experience. When having a glance back I know that by that time I would never imagine myself at the position I’m right now, that’s what drives me forward to keep a bold mentality and all the hard work.</p><p>2017 was probably the second best year I’ve ever had, after 2014 where I won my fight against a long running liver tumor and in the meantime was able to finish my computer science college degree against all odds.</p><p>I guess that when a new year comes we all think about what went well, what went wrong and what can be done improve our life for the year to come. This post is an exercise about that, so that by the end of 2018 I can have an understanding of what went according to plan and what didn’t.</p><h4>Software engineering</h4><blockquote>Choose a job you love, and you will never have to work a day in your life.</blockquote><p>Since I first saw that quote a few years ago I though how lucky I’m to do something I’m absolutely passioned about, I love to put things together, I love to write code, I love to build a product, I love to talk about technology, I love to mentor others and I love to work with other individuals to achieve a greater good. As a tech lead I can do all of that and that’s priceless.</p><p>While 2017’s professional success will be really hard to match I want to take that challenge, for this new year I want to keep evolving and keep smashing the problems that arrive as user stories on the day to day job, I want the team’s pace to increase a lot and I hope we can have a 2018 full of happiness and accomplishment as a group.</p><p>Outside of work I’m focussed to keep experimenting new technology (have you seen how amazing the idea behind <strong>facebook’s</strong> <strong>relay</strong> is?), I want to write more about front end development and team management, I want to meet people as passioned as I’m about all of this, and most of all I want to start having meaningful contributions to the open source community.</p><h4>Investment</h4><p>I hope this year to be big on investment, it’s time to prepare myself to make meaningful applications of money, or at least try. In a mid year review I hope to know what those applications are and how they can benefit me over the next 20 years.</p><h4>Travel</h4><p>I love to travel and 2017 was big on that matter, I got to know Europe a little bit better but it always fell like it isn’t enough. Unfortunately due to the investments I’m planing over the course of the year it’s makes the possibility to make it as big 2017 on this topic a very remote, but I absolutely hope to cross at least five new european countries of my list preparing myself for the big exploration of Asia and Australasia in 2019 and 2020.</p><h4>Health</h4><p>It looks strange but I live a much healthier lifestyle than I used to back in Portugal. The only two things that can warm me in the long run at this moment are Sugar and Coffee consumptions. Over the past year I’ve cutting on sugar but I fell like it had an opposite effect on the counterpart. Over the new year I want to cut off my coffee addiction a little bit and keep reducing on sugars.</p><h4>Conclusion</h4><p>And that’s a sum of it. I’m looking forward to see how far I get in each of this topics and take any lessons from eventual failures or accomplishments.</p><p>What about you? What are your plans?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7722296a4837" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JS Myths - ES6 the sweetest parts]]></title>
            <link>https://medium.com/@diogofcunha/js-myths-es6-the-sweetest-parts-cca658a22e75?source=rss-164e6378e362------2</link>
            <guid isPermaLink="false">https://medium.com/p/cca658a22e75</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Diogo Cunha]]></dc:creator>
            <pubDate>Fri, 28 Oct 2016 23:45:45 GMT</pubDate>
            <atom:updated>2016-10-31T14:19:09.250Z</atom:updated>
            <content:encoded><![CDATA[<p>As someone having a background mainly on backend development and typed languages I never looked into javascript with good eyes, I had several reasons for that:</p><ul><li>The classic syntax (<strong>ES3-ES5</strong>) is ancient and limited;</li><li>Took ages to debug some bugs that would be completely trivial to figure out in Languages like C# or Java;</li><li>Mutability everywhere.</li></ul><p>On this opinion article I will explore the first topic, I will show some of my favourite features and explain why I absolute love them and why I just can’t get sick of them. In the future I will keep posting about the other topics. These are my top 3 ES6 features!</p><h4>Object Destructuring</h4><p>This is my all time favourite, in a time when functional programming in web development starts to be a big deal this feature will get more and more handy.</p><p>Personally, I absolutely hate to repeat myself and to lose time with trivial operations, these operations are hard to maintain and ugly to read, this means that long code blocks taking several lines just to extract some data to variables make me frustrated an stressed out, we don’t want to lose time doing this kind of operations, that’s not what we signed up for, we signed up to do amazing things, we signed up to change the world!</p><p>Let’s look into these simple code snippets with and without destructuring:</p><pre>const iAmGonnaBeDestructured = {<br>   firstProp: 1,<br>   secondProp: 2,<br>   thirdProp: 3<br>}</pre><pre>// Without using object destructuring.<br>let firstProp = iAmGonnaBeDestructured.firstProp<br>let secondProp = iAmGonnaBeDestructured.secondProp<br>let thirdProp = iAmGonnaBeDestructured.thirdProp</pre><pre>// Using object destructuring.<br>let { firstProp, secondProp, thirdProp } = iAmGonnaBeDestructured</pre><p>I can see several advantages on this:</p><ul><li>Between one line and three, what do you prefer? The answer for me is obvious;</li><li>Easier to read;</li><li>Easier to maintain;</li></ul><p>Aside from the standard example object destructuring can have several more cool usages, these ones are definitely in my top choices:</p><pre>const iAmGonnaBeDestructured = {<br>   firstProp: 1,<br>   secondProp: 2,<br>   thirdProp: 3<br>}</pre><pre>// Destructuring a function param object<br>const func = ({ firstProp, sencondProp, thirdProp }) =&gt; {<br>   console.log(firstProp + sencondProp + thirdProp );<br>}</pre><pre>func(iAmGonnaBeDestructured) // 6</pre><pre>// Assign with new variable names.<br>let { firstProp: amazingFirstProp } = iAmGonnaBeDestructured<br>console.log(amazingFirstProp) // 1</pre><pre>// Default values.<br>let { firstProp = 25, fourthProp = 4 } = iAmGonnaBeDestructured<br>console.log(firstProp) // 1<br>console.log(fourthProp) // 4</pre><pre>// Nested object destructuring.<br>const nestedObject = {<br>   notNested: &quot;I am not nested&quot;,<br>   nested: {<br>      firstNest: &quot;I am the first nest&quot;,<br>      secondNest: &quot;I am the second nest&quot;<br>   }<br>}</pre><pre>let { notNested, nested: { secondNest: lastNested }} = nestedObject<br>console.log(notNested) // &quot;I am not nested&quot;<br>console.log(lastNested) // &quot;I am the second nest&quot;</pre><h4>Let and const</h4><p>Back in the days to create a block scope local variable you would need to create a closure, at the end of the day your code would become polluted by redundant closures and newbies would take ages to figure out why, the same newbies wouldn’t even be aware that the variables they were squashing into the code base weren’t local in the first place. The main problem with this is that code that wasn’t supposed to work would work “magically” and in other cases side effects of the global variable would rise in the most unpredictable places.</p><p><strong>let </strong>gives us to power to declare variables that are limited to the block’s scope, statement or expression where we declare them. It also introduces several advantages as throwing errors in “temporal dead zones” and emulation of private interfaces.</p><p>Declaring constants wasn’t possible in javascript, to do that you could only count on naming conventions and “home made implementations”. Personally, I love naming conventions (and all kinds of clean code conventions!), they are great, but in huge projects they are not enough. In a rush hour or after 10 hours of hard work anyone can make a mistake and change a variable that should be treated as a constant!</p><p><strong>const </strong>is the new magical keyword that saves us from this nightmare and it’s also block scoped! Do you want to define a “magic string”? Do you want to force immutability? Do you want to define a new function? Use a const. More than the standard usage that you can find in some typed languages, const can be used to make sure that your functions are pure, that you’re not changing object properties that you’re not expecting to.</p><h4>Arrow functions and lambdas</h4><p>You can be a OO believer, you can be a skeptic but don’t fool yourself, functional programming arrived and it’s not going to leave any time soon.</p><p>An arrow function is an expression that creates a function, they are more flexible than standard functions and they have a big advantage, they don’t bind their own <strong>this</strong>, <strong>arguments</strong> and <strong>super</strong>.</p><p>Some examples of this flexibility are shown on the following code snippet:</p><pre>// Standard functions<br>const example = function(a, b) {<br>   return {<br>      a: a,<br>      b: b <br>   };<br>}</pre><pre>// Arrow functions<br>const example = (a, b) =&gt; {<br>   return {<br>      a: a,<br>      b: b <br>   };<br>}</pre><pre>const example = (a, b) =&gt; ({<br>   a: a,<br>   b: b<br>});</pre><pre>// Standard functions<br>const oneParamExample = function(a) {<br>   return { a: a };<br>}</pre><pre>// Arrow functions<br>const oneParamExample= (a) =&gt; { return { a: a }; }</pre><pre>const oneParamExample= (a) =&gt; ({ a: a })</pre><pre>const oneParamExample = a =&gt; ({ a: a })</pre><pre>// Standart functions<br>stringArray.map(function(s){ return s.length })</pre><pre>// Arrow functions<br>stringArray.map(s =&gt; s.length)</pre><h4>Conclusion</h4><p>It wasn’t easy to choose only three of the best, ES6 was a huge step forward and features like the <strong>new module system</strong>, <strong>template literals</strong>, <strong>multi line strings</strong>, <strong>promises </strong>and <strong>classes </strong>also deserve a mention.</p><p>In the second part I will be talking about client side builds, javascript compile and unit testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cca658a22e75" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>