<?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 Steven de Salas on Medium]]></title>
        <description><![CDATA[Stories by Steven de Salas on Medium]]></description>
        <link>https://medium.com/@sdesalas?source=rss-415f9a136f48------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*RrLZhw06x4Z187B9fBCP7Q.jpeg</url>
            <title>Stories by Steven de Salas on Medium</title>
            <link>https://medium.com/@sdesalas?source=rss-415f9a136f48------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 02 Jul 2026 11:15:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sdesalas/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[Deno.js in production. Key takeaways.]]></title>
            <link>https://medium.com/@sdesalas/deno-js-in-production-main-takeaways-247a2fd2d198?source=rss-415f9a136f48------2</link>
            <guid isPermaLink="false">https://medium.com/p/247a2fd2d198</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[deno]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Steven de Salas]]></dc:creator>
            <pubDate>Sun, 27 Feb 2022 17:20:41 GMT</pubDate>
            <atom:updated>2023-11-18T12:19:18.221Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qEl7xArPX4wc4ZrfOrtoFQ.jpeg" /></figure><p><em>TL/DR: The hot new JavaScript runtime by Ryan Dahl is sleek, powerful, easy to use and best of all, stable in production. The smaller ecosystem compared to Node.js limits your use cases, so it really depends on what you want to use it for. This is not all bad news though, a smaller ecosystem can also mean your project does not get bloated with dependencies. Unlike Node.js, Deno is actually TypeScript native without transpilation, making it simpler to track down server errors. It also a mixed usage model so you can transition your codebase from JS to TS at your own pace. Teams thinking of making the switch over to Golang might want to consider it before going ahead, as it provides a lot of overlap in terms of use cases.</em></p><p>Hiya, my name is Steven de Salas. I’ve been the Founding Engineer and CTO for a Series-A startup in Madrid for the last couple of years. We’ve been running <a href="https://deno.land/">Deno</a> in production for a little under a year.</p><p>We are mostly a JavaScript shop running Node.js services and I wanted to comment on my experience setting up a <a href="https://deno.land/">Deno</a> API service and running it. You’re probably busy so I’ll try be as brief as possible. Feel free to write a comment if you want some further clarification.</p><p><strong>WHAT IS DENO.JS:</strong></p><p>‘Deno’ (‘No-de’ flipped over) is a new JavaScript runtime announced in 2018 by the Node.js creator Ryan Dahl after commiserating his mistakes in a <a href="https://youtu.be/M3BM9TB-8yA">now-famous presentation</a>.</p><p>Its basically a re-write of the Node.js JavaScript engine (famous for bringing server-side JavaScript to the masses) and its been getting a fair bit of traction lately. You can <a href="https://en.wikipedia.org/wiki/Deno_(software)">read more about it in Wikipedia</a>.</p><p><strong>WHAT WE USED DENO FOR:</strong></p><p>We used Deno for API integration mainly. Our startup distills information and interacts with many parking providers and most have some sort of JSON API we can talk to, other times we rely on information provided by their website. Its all HTTP in any case. Easily solved with <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">fetch()</a> calls under the hood.</p><p>Our stack is essentially: <a href="https://deno.land/">Deno</a> on <a href="https://aws.amazon.com/docker/">dockerised</a> <a href="https://www.debian.org/">Debian</a>, with <a href="https://deno.land/x/oak">Oak</a> for Web/API framework and <a href="https://deno.land/x/superoak">SuperOak</a> for testing. With various libraries added as needed. All running as load-balanced containers hosted in AWS.</p><p>❤️ <strong>WHAT WE LOVED:</strong></p><ul><li><strong>Native TypeScript.</strong> No need to fiddle with ts-node, babel, esbuild or any of the other ways to fit a (TS) square peg into a (Node.js) round hole. TypeScript is <a href="https://deno.land/manual/typescript/overview">supported by Deno natively</a>. There is no setup, config or instructions needed. It <em>just works</em>. The lack of transpilation also means that by default, any errors thrown by the server will point to a line in your source code, not the intermediate transpiled garbage. We used TS for all our libraries and core utility scripts, and JS for the routes. Interoperability is pretty seamless, just change the file extension to .ts and you are good to go.</li></ul><p>👍 <strong>WHAT ELSE WAS GREAT:</strong></p><ul><li><strong>Stable in production. </strong>Never had a hitch with the process. The loads were not huge but it was a critical part of our infrastructure and it ran smoothly all along to the point you forget its even there doing its job.</li><li><strong>Simple to package.</strong> Due to its single executable and easily accessible <a href="https://hub.docker.com/r/denoland/deno">Docker Images</a>, Deno is a breeze to package for production. Even when the docker images were not published, a simple Dockerfile based ondebian:slim with installation script will run your code without a problem.</li></ul><p>👎 <strong>THINGS THAT WERE ANNOYING OR MISSING:</strong></p><ul><li><strong>Less mature ecosystem.</strong> Lets face it, Node.js has NPM so whatever problem your are facing your are usually one npm install away from solving it. This can be annoying with Deno, but it does force you to be minimal about dependencies… a little too much npm install can also ruin your project. For example, if you want to create automated tests for your API, there are 20 different ways you can go about it in Node.js. In Deno you have less choice or you have to build your own. We ended up going with <a href="https://github.com/cmorten/superoak">superoak</a>.</li></ul><p>🤘 <strong>WHAT WAS A BIT HYPED:</strong></p><ul><li><strong>Security model.</strong> Deno.js is touted as having a superior security model to Node.js, where <a href="https://deno.land/manual/getting_started/permissions">permissions are explicitly declared</a> at run-time and enforced by the executable. While this sounds great in theory, the practice of running a real-world use-case such as an API service is that as the project expands and your needs change, you will just keep adding permissions to the main executable in your startup-script. This means that the needs of a single execution pathway (ie GET /document/{documentId}) will also apply to EVERY OTHER execution pathway, so little is gained overall, particularly as projects expand and become more complex. There are ways around this, but honestly, I think it would have been more useful for run-time permissions to be applied to each file on a case-by-case basis.</li></ul><p>🤔 <strong>PROBLEMS:</strong></p><ul><li><strong>Complex dependencies. </strong>The only significant problem we faced was when trying to upgrade our service to include the Chromium&#39;s <a href="https://github.com/puppeteer/puppeteer">Puppeteer runtime</a> in our deployment. I think this problem would have occurred with Node.js as well. Running a fully-fledged browser as a background process has too many platform-specific requirements in terms of libraries and settings to get right, as well as a forked process running in the background. Components like these tend to make solutions a bit more delicate. We could have got it running given enough time but it was not worth the effort as there were other ways to accomplish what we were after without a headless browser.</li></ul><p><strong>WHO WOULD WANT TO USE IT?</strong></p><p>Lets face it. A project like this only gains traction because people want to use it. I’ve noticed that <a href="https://go.dev/"><strong>Golang</strong></a><strong> </strong>has taken a lot of steam out of Node.js for the middle-tier lately.</p><p>And why? To me it seems like the main reasons overlap a fair bit with the use-cases for Deno.js.</p><ul><li><strong>Bloatware:</strong> Projects written in Node.js suffer from a plethora of unsecured dependencies. Just try npm audita project older than 6 months. This has become worse lately, and its not that Golang or Deno do not suffer from security issues too, just they have far less dependencies to worry about.</li><li><strong>Standardized way of doing certain things</strong>: Golang has opinionated linting, testing, and dependency management. Same as Deno.</li><li><strong>Type safety. </strong>Golang provides strong types but the syntactic overhead is also fairly light. TypeScript in Deno is not exactly ‘type safe’ but it does overlap a bit in terms of requirements.</li><li><strong>Barrier to entry: </strong>Node.js is too easy to get started. This means that the pool of available programmers is not the highest quality. Runtimes like Go or Deno are still havens for the ‘connoisseur’ programmer.</li></ul><p>The only place Deno can’t compete is in raw performance. Deno can compile executables using deno compile however it is still <a href="https://medium.com/deno-the-complete-reference/deno-vs-go-native-hello-world-performance-c57d8fc13c75">30% slower than Golang</a> for common use cases.</p><p>In my opinion Deno should interest senior developers working in projects that are tired of the Node.js ecosystem, but want to use a similar runtime instead of moving their codebase a different language.</p><p>If you are after something minimal, and don’t mind coding your way around certain problems it really provides an excellent platform. I would start with simple use-cases (like we did) and then move on to more complex ones on a case-by-case basis.</p><h3>About the Author</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/0*VuHGTtu__UEVxYFf.png" /></figure><p><a href="https://www.linkedin.com/in/sdesalas/">Steven de Salas</a> is a Founding Engineer/CTO at <a href="https://www.linkedin.com/company/letmepark/">LetMePark</a>, a Series-A startup based in Madrid. His superpower is coding platforms from scratch with Node.js, &lt;any database&gt; and &lt;any frontend framework&gt;, but he has many other talents like playing board games and explaining homework to his 8-year twins.</p><h3>Like the article?</h3><p>Please press the👏 right below you. It helps more people see it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=247a2fd2d198" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDb aggregation pipelines.]]></title>
            <link>https://medium.com/@sdesalas/founding-engineer-know-how-mongodb-aggregation-pipelines-d9551ffb8f62?source=rss-415f9a136f48------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9551ffb8f62</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Steven de Salas]]></dc:creator>
            <pubDate>Fri, 04 Feb 2022 10:47:41 GMT</pubDate>
            <atom:updated>2022-05-17T06:52:42.036Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*NOEORMhph8Nfu1F4patM3A.png" /></figure><p><a href="https://docs.mongodb.com/manual/core/aggregation-pipeline/">Aggregation Pipelines</a> are a powerful tool to process millions of records quickly and efficiently. If you have used other database systems before, you may be familiar with <a href="https://www.postgresql.org/docs/9.3/rules-materializedviews.html">Materialised Views</a> (Postgres/Oracle) or <a href="https://desalasworks.com/article/faster-web-applications-with-indexed-views/">Indexed Views</a> (SQL Server).</p><p>These are all awesome solutions to one specific problem:</p><h3>How do I combine vast amounts of information into a single dashboard in a way that requires minimum effort to load?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tDSUHJ9zRiUN2Tj6vSQX9Q.png" /><figcaption>Use MongoDb aggregation pipelines to create dashboards in a way that is easy to load.</figcaption></figure><p>You see people like to consume information in the form of summary tables and charts, but getting this information ready for them often requires trawling through thousands or millions of records. This is a slow and time-consuming process which should never be executed in real-time every time a user requests the information (they’ll be waiting a long time, and you’ll be doing a lot of processing unnecessarily).</p><p>The ideal approach here is two pronged:</p><ol><li>Have a way of building the aggregate information INSIDE your database, so that your millions of records do not have to be moved around to get the result.</li><li>Store the result into disk, so it is essentially written once and read many times easily.</li></ol><p>While you can define your aggregation pipelines in any language (Node.js, Python, Java, etc..) once they are sent to MongoDb they get executed using C++ inside the MongoDb context, so your thousands/millions of records are processed in an optimized manner and do not need to go anywhere.</p><p>You then get a result which may be a few hundred rows long, but contains data put together from thousands or millions of records. This result can then be stored to disk using the <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/out/">$out</a> or <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/merge/">$merge</a> aggregation stages, depending on whether you want to replace the resulting collection or add to it.</p><h4>How to put together your first aggregation pipeline</h4><p>If you are going to put together an aggregation pipeline for the first time I recommend using <a href="https://www.mongodb.com/try/download/compass">MongoDb Compass</a>, which comes with a <a href="https://docs.mongodb.com/compass/current/aggregation-pipeline-builder/">UI for building pipelines</a> that makes it easy to get familiar with the language for creating aggregation steps.</p><p>Once you are done your can export the result to your language of choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GJVRvRcZFHH893kP.png" /></figure><h4>Use the $out/$merge aggregation and schedule your execution.</h4><p>Done building your pipeline? No worries, when you are happy with the result don’t forget to add either the <em>$out </em>or <em>$merge</em> aggregation step at the end, this will essentially save your results to disk as the last step of the aggregation.</p><p><a href="https://docs.mongodb.com/manual/reference/operator/aggregation/out/"><strong>$out</strong></a><strong>: </strong>Replaces the target collection with the results of the pipeline<br><a href="https://docs.mongodb.com/manual/reference/operator/aggregation/merge/"><strong>$merge</strong></a><strong>:</strong> Adds to or partially modifies your target collection.</p><p>You can then schedule execution through a variety of ways:</p><ul><li><strong>Timed scheduling</strong>: Use your favorite scheduler to run your pipeline every few minutes. (I like <a href="https://opensource.com/article/17/11/how-use-cron-linux">cron</a>, or <a href="https://github.com/jhuckaby/Cronicle">cronicle</a> for a great Node.js equivalent with a web UI, but any scheduler will do.)</li><li><strong>Database triggers</strong>: You can also run your aggregation pipeline when there is a change to any of your desired collection/s (might be more than one if your data is put together from several collections). I recommend using Atlas Triggers for this (if your database is using MongoDb Atlas). Here is a <a href="https://www.mongodb.com/blog/post/spirits-in-the-materialized-view-automatic-refresh-of-materialized-views">good write-up</a>.</li></ul><h4>Why not use another solution?</h4><p>Aggregation pipelines are the right tool to use if you are already committed to MongoDb.</p><p>Obviously it doesn&#39;t make a lot of sense to use them if your data is stored in a different backend database. Depending on your database there is probably a more suitable tool for the same niche:</p><p><strong>Postgres SQL</strong>: Use <a href="https://www.postgresql.org/docs/9.3/rules-materializedviews.html">Materialized Views</a><br><strong>MySQL</strong>: No equivalent. But can be <a href="https://fromdual.com/mysql-materialized-views">cooked-up manually</a> with a stored proc.<br><strong>Couchbase</strong>: Use <a href="https://blog.couchbase.com/couchbase-views-and-better-alternatives-part-1-of-2/">Couchbase Views</a><br><strong>DynamoDb</strong>: Use <a href="https://stackoverflow.com/questions/64327676/will-dynamodb-get-materialized-views">Global Secondary Indexes</a><br><strong>MSSQL</strong>: Use <a href="https://desalasworks.com/article/faster-web-applications-with-indexed-views/">Indexed Views</a><br><strong>ORACLE</strong>: Use <a href="https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6002.htm">Materialised Views</a></p><h3>What is a Founding Engineer?</h3><p>This is a series of articles on Founding Engineer know-how. But they are useful for all kinds of engineers out there.</p><p>A <a href="https://www.mooreds.com/wordpress/archives/2555">Founding Engineer</a> is a special kind of CTO for startups. Early in a startup (seed or pre-seed), you need a developer who can ship product and then build business around it. CTOs of bigger companies actually don’t spend any time coding. They work on strategy, partnerships, hiring and other higher leverage activities. But that won’t work for a startup.</p><p>A founding engineer will turn over a product quickly (ie, get s*** done) and iterate it until your have a working solution for a startup, as nothing is more important than choosing the right market and getting a solution out to that market so that customers can give you feedback (with their dollars). They can build a solution, store the code in Github/Gitlab, setup a database, CI/CD pipelines, cloud hosting, container workloads, email, DNS, SSL, reverse proxying, automated testing, code branching and collaboration guidelines.</p><p>In addition to all of that, the founding engineer must communicate with non technical folks, both within the organization (including the CEO) and outside of the company. They need to be able to grow a team from a single person and be willing and able to drive decisions, especially around technical issues, when to hire, which technology stack to use, when to use <a href="https://en.wikipedia.org/wiki/Low-code_development_platform">lowcode</a>/<a href="https://en.wikipedia.org/wiki/No-code_development_platform">nocode</a>, and when to accrue <a href="https://en.wikipedia.org/wiki/Technical_debt">technical debt</a> and when to pay it back.</p><h4>About the Author</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/1*RL_eALEIbSxeV07abIyOpg.png" /></figure><p><a href="https://www.linkedin.com/in/sdesalas/">Steven de Salas</a> is a Founding Engineer/CTO at <a href="https://www.linkedin.com/company/letmepark/">LetMePark</a>, a Series-A startup based in Madrid. His superpower is building API-based platforms from scratch with Node.js, MongoDb and Vue.js, but he has many other talents like playing board games and explaining homework to his 8-year twins.</p><h4>Like the article?</h4><p>Please press the👏 right below you. It helps more people see it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9551ffb8f62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 tips for new developers.]]></title>
            <link>https://medium.com/@sdesalas/5-tips-for-new-developers-f99b0be4dd89?source=rss-415f9a136f48------2</link>
            <guid isPermaLink="false">https://medium.com/p/f99b0be4dd89</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Steven de Salas]]></dc:creator>
            <pubDate>Mon, 08 Jul 2019 22:22:04 GMT</pubDate>
            <atom:updated>2021-04-06T12:23:12.879Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eJjO0BFEZNusg5yWhQAcFg.jpeg" /><figcaption><strong>Steven de Salas</strong>, Full-stack JavaScript developer for more than 15 years.</figcaption></figure><h3>5 tips for new developers</h3><p>The last few months I have been teaching an <a href="https://wildcodeschool.com/madrid/">intensive full-stack programming course</a> at <a href="https://wildcodeschool.es/">Wild Code School</a> in Madrid, and being around people who want to embark on the journey of becoming new developers has made me realise that there is room for advice from an old timer like me🦖.</p><p><em>This article was originally published in the </em><a href="https://wildcodeschool.com/blog/5-tips-for-your-developer-career/"><em>website</em></a><em> of Wild Code School and the </em><a href="https://wildcodeschool.es/blog/5-trucos-para-conseguir-un-trabajo-como-desarrollador-a-junior/"><em>Madrid blog</em></a><em>. This is the re-edited version that is (hopefully) a bit easier to read.</em></p><blockquote><strong><em>What is your background as a developer?</em></strong></blockquote><p>When I was 8 years old I got a tape-deck <a href="https://en.wikipedia.org/wiki/ZX_Spectrum#ZX_Spectrum_128">ZX Spectrum</a> for Christmas. It came with a whooping 128Kb of RAM and a <a href="http://zxnext.narod.ru/manuals/Basic_Programming.pdf">manual</a> on how to program your own games using BASIC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*4Pzq1KevncW-kR2XbzrKyA.jpeg" /><figcaption>It came with a manual…</figcaption></figure><p>I was hooked. Programming computer games was WAY more fun that playing them. Fast-forward 10 years later when the Internet got started and I was keen to build myself a website and help other people with theirs. Before I knew I had too many websites to build and not enough time.</p><p>These days I build <a href="https://desalasworks.com/#cloud-and-web-apps">web and mobile applications</a>, the technologies have changed but there is still plenty of demand. I feel extremely lucky that I get to create interfaces and automations that bring some improvement to people’s lives, and that I get paid for it. In a way its like I’m still making games.</p><blockquote><strong><em>Could you give us 5 tips for people who are planning to become developers?</em></strong></blockquote><p>Sure can, they may not be exactly what you expect, and I bet every developer will tell you something different, but this is the advice I can give.</p><h4>TIP 1: Get comfortable with feeling useless</h4><p>Every time i’ve felt confused and useless and ready to give up has been during a period of intense growth. If you want a long and fruitful career as a developer you are going to have to recycle yourself over and over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8q4v9UdiyN_wHnAoITR1dA.png" /><figcaption>Welcome to the new you… for the rest of your career.</figcaption></figure><p>I think we usually tell ourselves that learning is an <em>intellectual </em>journey, but from my experience its more of an <em>emotional </em>journey, in other words, a case of letting new knowledge sink in while managing a powerful range of emotions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBuhXPghvITBKWIEIUu3eA.png" /></figure><p>You have probably already experienced the feeling of utter uselessness that comes when trying to learn something new, and not doing a particularly good job of it. Well, this feeling is your new best friend, try and welcome it, as it comes when you are growing… Life will be easier if you do. Learn to identify it early and become detached from it, learn to be kind to yourself, and to welcome the knowledge that comes with it.</p><p>Just because you <em>feel </em>useless, doesn’t mean that you <em>are </em>useless.</p><p>And remember that when you start feeling like you know everything, you are no longer learning and you are getting left behind. Do yourself a favor and keep putting yourself out of your comfort zone so you can keep growing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*CKJOHSheDvLGK2FtpnikhQ.jpeg" /><figcaption>Take care of your image, and your image will take care of you.</figcaption></figure><h4>TIP 2: Sell your brand</h4><p>It is scary putting yourself out there, building your network. Specially when there is so much you still don’t know about.</p><p>But the reality is that technologies change so fast that many other developers are in a similar situation, they know some things yes, but those are probably outdated, and they will likely have to learn most of their next job anyway. Establishing yourself as a brand will give you choices later. Think of it as an investment. It will mean the difference between finding a job you enjoy and being forced into the least bad of your options.</p><p>When you get past the initial shyness, public attention is not so bad. And it saves wasted time on endless job applications which will end up in a black hole anyway. The idea is make it easy for people to find you, so work on every opportunity to make this happen. Try writing articles on LinkedIn, shaking hands with people at meetups, build your portfolio site, share something you’ve read (like this article), talk to people about a project you are working on, make some cool videos or get in touch with recruiting professionals.</p><p>Do NOT sell yourself falsely, but put yourself out there anyway. There will be plenty of people that need your skills as they are, even if they are not fully developed, so long as you are open to learning the techology stack specific to that client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*nUshW-kQS-giBY9qxUJ7Jg.jpeg" /></figure><h4>TIP 3: Aim for jobs that expand your knowledge.</h4><p>Many times I have faced a choice between earning more money or gaining the skills that will push my career in the right direction. I have to say that every time I picked a job for the skills rather than the money, I have been happier in the long run.</p><p>I think this is particularly relevant for developers that are getting started with picking their first jobs. Do yourself a favor and point your carreer in the right direction, even if it comes at a cost in the short term.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dz5d-U7oKJImoFbBjFVR0A.jpeg" /></figure><h4>TIP 4: Build projects you love.</h4><p>I can’t stress the usefulness of programming something because you love what you are doing.</p><p>Try and find time to do this. Life is busy I know, i have have 2 kids. And yet every time I have managed to put time aside to write code for fun I have found some learning that has helped me later in.</p><p>This is another way to invest in yourself. Some people are lucky enough to get paid to build something they love. If you can find yourself in this position then great. If not, then there are plenty of opportunities to build cool things too, just seek them out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*hOUTxHDM6WZhH_S2ZQ_rRw.jpeg" /></figure><h4>TIP 5: Learn to fail.</h4><p>Lets face it. You are going to break things.</p><p>This is particularly true for junior developers.. You can stay away from risk and spend your time adding little value and just getting by, or be useful and risk having sh#t hit the fan.</p><p>Obviously tread with care wherever you go. But life is short, and as they say.. `if you want to make an omelette… you have to break some eggs`.</p><p>So keep the bigger picture in mind, and when bad things happen (and they will) learn how to avoid blaming yourself and others, and to focus your energy on picking up the pieces (with the help of your seniors). If you do this well, the damage will usually be minimal, yet the lesson will be invaluable.</p><p>Each time your break something, remember 3 things:</p><ol><li>DON’T make it worse in a panic.</li><li>Be open, and put your effort on recovery, not on finding blame.</li><li>Take steps to avoid it happening again. This doesn’t mean firing people, it means automating the process to avoid what just happened.</li></ol><p>If you take this approach you will generally gain the respect of your peers and managers, who have probably gone through the same right of passage at some point.</p><blockquote><strong><em>What other advice could be useful?</em></strong></blockquote><p>Be yourself.</p><p>Honestly, work (and life) is hard for everyone. If you behave as yourself in as many interactions as possible (yes, even that job interview), and you make as many honest choices along the way as you can, you will find a measure of peace in all the chaos and pain that life has to offer.</p><p>Whatever path you choose, you can’t take the suffering away, but you can add the satisfaction that every step of the way you did what was most true to yourself as a person.</p><h3>So go forth ✌️, and be fruitful 🍇 🍓 🍍🍒 …</h3><p>.. and remember to clap 👏 if you enjoyed this. So more people can see it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f99b0be4dd89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flow, a programmer’s most productive state.]]></title>
            <link>https://medium.com/@sdesalas/flow-a-programmers-most-productive-state-4de6a66654f8?source=rss-415f9a136f48------2</link>
            <guid isPermaLink="false">https://medium.com/p/4de6a66654f8</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[flow]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Steven de Salas]]></dc:creator>
            <pubDate>Mon, 08 May 2017 13:49:28 GMT</pubDate>
            <atom:updated>2022-01-13T12:06:21.174Z</atom:updated>
            <content:encoded><![CDATA[<p><em>You are deep in a coding trance. Absolutely focused. Time flies. You are in a state of Flow. And its your best and worst friend.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lqQy_JxaogqqEHXk7D7ADA.jpeg" /></figure><p>My parents bought me a <a href="https://en.wikipedia.org/wiki/ZX_Spectrum">Sinclair ZX Spectrum</a> when I was 8 years old. It came with a manual for how to write your own games using <a href="https://en.wikipedia.org/wiki/BASIC">BASIC</a>.</p><p>I was there early. Looking back I remember long spells in front of the computer in absolute focus. I wrote <a href="https://en.wikipedia.org/wiki/Tic-tac-toe">tick-tac-toe</a>, <a href="https://en.wikipedia.org/wiki/Arkanoid">arkanoid</a>, <a href="https://en.wikipedia.org/wiki/Monopoly_(game)">monopoly</a>, <a href="https://en.wikipedia.org/wiki/Space_Invaders">space invaders</a>, even a stock market simulator.</p><p>I kept coming back because writing code provided a sense of achievement and a state of mind that I rarely experienced in any other setting. I was absolutely focused, incredibly productive and I enjoyed it.</p><p>But it doesn’t leave room for much more.</p><p>As a kid sometimes my parents would talk to me and I wouldn’t respond until later when they’d already left the room. I wasn’t being rude intentionally, I was just so immersed in what I was doing that I forgot to respond, or rather, the response got queued up behind whatever else I was doing.</p><p>If you are reading this you probably know what I’m talking about. I wasn’t aware that it had a name until I heard it being described as <a href="https://en.wikipedia.org/wiki/Flow_(psychology)"><strong><em>Flow</em></strong></a><strong><em> </em></strong>(or ‘the zone’) well into my career.. I just knew it as what happened to me when I got deep into a project.</p><h4><strong>Social interaction. The negative side of Flow.</strong></h4><p>For a long time I’ve been aware (and wary) of the relationship between Flow state and my capacity for social interaction.</p><p>Basically, the more I code the worse I am at talking to people. The more I talk to people the worse I am at coding.</p><p>Its like I’m walking a tightrope and on one side is maximising my productivity, and on the other my capacity to interact with others and maintain a high degree of verbal fluency.</p><p>A combination of both is necessary if you want to succeed, after all its pretty useless if you are super-productive doing something that is <a href="http://www.stupidhackathon.com/">not wanted or necessary</a>. Plus you don’t want to neglect relationships with your co-workers.</p><p>But you can also take it too far the other way, say, if you land a role that involves a large amount of mentoring or managing stakeholders. You can lose the ability to perform your core skill writing code, to the point of being unable to provide useful advise and sending people off-track.</p><p>I’ve had both happen to me, and everything in between. Now I try to settle for happy medium so I can be useful doing what I love.</p><h4>How do you enter Flow willingly?</h4><p>There are a few ingredients needed to enter flow state.</p><p>You need an interesting problem — one that is within or just beyond your capacity— and a block of time to dedicate to it exclusively. I also like to listen to trance music. <a href="https://soundcloud.com/steven-de-salas/sets/goa-trance">Psy Trance</a>, <a href="https://soundcloud.com/steven-de-salas/sets/trance">Progressive</a>, <a href="https://soundcloud.com/steven-de-salas/sets/epic">Epic Trance</a>, anything with a steady beat.</p><p>I find its easier to enter flow state that way. Doesn’t always work but it tends to do so more often that not.</p><h4>How do you exit Flow gracefully?</h4><p>I can’t say I’m the most graceful at it, depending on how deeply concentrated I am I tend to jump, mumble, ask for clarification multiple times until I can shift my focus etc.</p><p>What I have learnt is that regardless of how far you need to resurface, you must be prepared to drop it all for the person that is standing in front of you. It is the willingness to detach yourself that helps make the exit as graceful as it can be.</p><h4>Worth reading?</h4><p>Please press the👏 right below you. It helps more people see it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4de6a66654f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Immutability in JavaScript: A Contrarian View]]></title>
            <link>https://medium.com/@sdesalas/immutability-in-javascript-a-contrarian-view-505a0940205a?source=rss-415f9a136f48------2</link>
            <guid isPermaLink="false">https://medium.com/p/505a0940205a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[immutability]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <dc:creator><![CDATA[Steven de Salas]]></dc:creator>
            <pubDate>Thu, 13 Apr 2017 11:48:59 GMT</pubDate>
            <atom:updated>2022-04-18T21:50:09.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iftTCw4Tj1O8UliluTNA0A.jpeg" /></figure><p><em>So if everyone says Immutability is good, that means mutating objects is bad, right?</em></p><p>I wrote this originally as a answer to a <a href="http://stackoverflow.com/questions/34385243/why-is-immutability-so-importantor-needed-in-javascript/43318963">stack overflow question</a> posted by someone who was as baffled by this JavaScript programming trend as I was.</p><p>Here is my answer to this topic, it is contrarian and may also be contentious, but bear in mind its not the only answer, its just my own point of view.</p><blockquote><em>Why is immutability so important(or needed) in javascript?</em></blockquote><p>Well, I’m glad you asked!</p><p>Some time ago a very talented guy called <a href="https://twitter.com/dan_abramov">Dan Abramov</a> wrote a javascript state management library called <a href="https://github.com/reactjs/redux">Redux</a> which uses pure functions and immutability. He also made some <a href="https://egghead.io/lessons/javascript-redux-the-single-immutable-state-tree">really cool videos</a> that made the idea really easy to understand (and sell).</p><p>The timing was perfect. The novelty of <a href="https://angularjs.org/">Angular</a> was fading, and JavaScript world was ready to fixate on the latest thing that had the right degree of cool, and this library was not only innovative but slotted in perfectly with <a href="https://facebook.github.io/react/">React</a> which was being peddled by another <a href="http://facebook.com/">Silicon Valley powerhouse</a>.</p><p>Sad as it may be, fashions rule in the world of JavaScript. Now Abramov is being hailed as a demigod and all us mere mortals have to subject ourselves to the <a href="https://medium.com/javascript-scene/the-dao-of-immutability-9f91a70c88cd">Dao of Immutability</a>… Wether it makes sense or not.</p><blockquote><em>What is wrong in mutating objects?</em></blockquote><p>Nothing!</p><p>In fact programmers have been mutating objects for er… as long as there has been objects to mutate. <a href="https://en.wikipedia.org/wiki/Object-oriented_programming#History">50+ years</a> of application development in other words.</p><p>And why complicate things? When you have object cat and it dies, do you really need a second cat to track the change? Most people would just say cat.isDead = true and be done with it.</p><blockquote><em>Doesn’t (mutating objects) make things simple?</em></blockquote><p>YES! .. Of course it does!</p><p>Specially in JavaScript, which in practice is most useful used for rendering a view of some state that is maintained elsewhere (like in a database).</p><blockquote><em>What if I have a new News object that has to be updated? … How do I achieve in this case? Delete the store &amp; recreate it? Isn’t adding an object to the array a less expensive operation?</em></blockquote><p>Well, you can go the traditional approach and update the News object, so your in-memory representation of that object changes (and the view displayed to the user, or so one would hope)...</p><p>Or alternatively…</p><p>You can try the sexy FP/Immutability approach and add your changes to the News object <em>to an array tracking every historical change</em> so you can then iterate through the array and figure out what the correct state representation should be (phew!).</p><blockquote><em>I am trying to learn what’s right here. Please do enlighten me :)</em></blockquote><p>Fashions come and go buddy. There are many ways to skin a cat.</p><p>I am sorry that you have to bear the confusion of a constantly changing set of programming paradigms. But hey, WELCOME TO THE CLUB!!</p><p>Now a couple of important points to remember with regards to Immutability, and you’ll get these thrown at you with the feverish intensity that only naivety can muster.</p><p><strong>1) Immutability is awesome for avoiding </strong><a href="https://stackoverflow.com/questions/34510/what-is-a-race-condition"><strong>race conditions in multi-threaded environments</strong></a>.</p><p>Multi-threaded environments (like C++, Java and C#) are guilty of the practice of locking objects when more than one thread wants to change them. This is bad for performance, but better than the alternative of data corruption. And yet not as good as making everything immutable (Lord praise Haskell!).</p><p>BUT ALAS! In JavaScript you always <a href="http://ryanmorr.com/understanding-scope-and-context-in-javascript/#execution-context">operate on a single thread</a>. Even web workers (each runs inside a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Web_Workers_API">separate context</a>). So since you can’t have a <em>thread related</em> race condition inside your execution context (all those lovely global variables and closures), the main point in favour of Immutability goes out the window.</p><p>(Having said that, there <em>is</em> an advantage to using pure functions in web workers, which is that you’ll have no expectations about fiddling with objects on the main thread.)</p><p><strong>2) Immutability can (somehow) avoid race conditions in the state of your app.</strong></p><p>And here is the real crux of the matter, most (React) developers will tell you that Immutability and FP can somehow work this magic that allows the state of your application to become predictable.</p><p>Of course this doesn’t mean that you can avoid <a href="https://softwareengineering.stackexchange.com/questions/263726/how-to-prevent-race-conditions-in-a-web-application">race conditions in the database</a>, to pull that one off you’d have to coordinate <em>all users in all browsers</em>, and for that you’d need a back-end push technology like <a href="https://en.wikipedia.org/wiki/WebSocket">WebSockets</a> (more on this below) that will broadcast changes to everyone running the app.</p><p>Nor does it mean that there is some inherent problem in JavaScript where your application state needs immutability in order to become predictable, any developer that has been coding front-end applications before React would tell you this.</p><p>This rather confusing claim simply means that <strong><em>if you use React your application is prone to race conditions, but that immutability allows you to take that pain away</em></strong>. Why? Because React is special.. its been designed first and foremost as a <a href="https://reactjs.org/docs/optimizing-performance.html">highly optimised rendering library</a> with state management <a href="https://reactjs.org/docs/react-component.html#setstate">subverted to that aim</a>, and thus component state is managed via an <a href="https://github.com/facebook/react/issues/11527">asynchronous chain of events</a> (aka “one-way data binding”) that optimize rendering but you have no control over and rely on you <a href="https://facebook.github.io/react/docs/state-and-lifecycle.html#using-state-correctly">remembering not to mutate state directly</a>…</p><p>Given this context, its easy to see how the need for immutability has little to do with JavaScript and a lot to do with React: if have a bunch of inter-dependent changes in your spanking new application and no easy way to figure out what your state is currently at, <a href="https://reactjs.org/docs/faq-state.html#why-is-setstate-giving-me-the-wrong-value">you are going to get confused</a>, and thus <em>it makes perfect sense to use immutability to track every historical change</em>.</p><p><strong>3) Race conditions are categorically bad.</strong></p><p>Well, they might be if you are using React. But they are rare if you pick up a different framework.</p><p>Besides, you normally have <strong>far bigger problems</strong> to deal with… Problems like dependency hell. Like a bloated code-base. Like your CSS not getting loaded. Like a slow build process or being stuck to a monolithic back-end that makes iterating almost impossible. Like inexperienced devs not understanding whats going on and making a mess of things.</p><p>You know. Reality. But hey, who cares about that?</p><p><strong>4) Immutability makes use of </strong><a href="https://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value"><strong>Reference Types</strong></a> to reduce the performance impact of tracking every state change.</p><p>Because seriously, if you are going to copy stuff every time your state changes, you better make sure you are smart about it.</p><p><strong>5) Immutability allows you to UNDO stuff</strong>.</p><p>Because er.. this is the number one feature your project manager is going to ask for, right?</p><p><strong>6) Immutable state has lots of cool potential in combination with WebSockets</strong></p><p>Last but not least, the accumulation of state deltas makes a pretty compelling case in combination with WebSockets, which allows for an easy consumption of <a href="https://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html">state as a flow of immutable events</a>…</p><p>Once the penny drops on this concept (state being <em>a flow of events</em> — rather than a crude set of records representing the latest view), the immutable world becomes a magical place to inhabit. A land of <a href="https://martinfowler.com/eaaDev/EventSourcing.html">event-sourced</a> wonder and possibility that <em>transcends time itself</em>. And when done right this can definitely make real-time apps easi<em>er</em> to accomplish, you just broadcast the flow of events to everyone interested so they can <a href="https://martinfowler.com/eaaDev/ParallelModel.html">build their own representation</a> of the present and write back their own changes into the communal flow.</p><p>But at some point you wake up and realise that all that wonder and magic <a href="https://chriskiehl.com/article/event-sourcing-is-hard">do not come for free</a>. Unlike your eager colleagues, your stakeholders (yea, the people who pay you) care little about philosophy or fashion and a lot about the money they pay to build a product they can sell. And the bottom line is that its harder to code for immutability and easier to break it, plus there is little point having an immutable front-end if you don’t have a back-end to support it. When (and if!) you finally convince your stakeholders that you should publish and consume events via a <a href="https://en.wikipedia.org/wiki/Push_technology">push techology</a> like WebSockets, you find out what a <a href="https://samsaffron.com/archive/2015/12/29/websockets-caution-required">pain it is to scale in production</a>.</p><p>Now for some advice, should you choose to accept it.</p><p>A choice to write JavaScript using FP/Immutability is also a choice to make your application code-base larger, more complex and harder to manage. I would strongly argue for limiting this approach to your Redux reducers, unless you know what you are doing… And IF you are going to go ahead and use immutability regardless, then apply <a href="https://martinfowler.com/eaaDev/EventSourcing.html">immutable state to your whole application stack</a>, and not just the client-side, as you’re missing the real value of it otherwise.</p><p>Now, if you are fortunate enough to be able to make choices in your work, then try and use your wisdom (or not) and <a href="https://en.wikipedia.org/wiki/Golden_Rule">do what’s right by the person who is paying you</a>. You can base this on your experience, on your gut, or whats going on around you (admittedly if everyone is using React/Redux then there a valid argument that it will be easier to find a resource to continue your work).. Alternatively, you can try either <a href="https://dev.to/tra/expert-resum-driven-development">Resume Driven Development</a> or <a href="https://blog.daftcode.pl/hype-driven-development-3469fc2e9b22">Hype Driven Development</a> approaches. They might be more your sort of thing.</p><p>In short, the thing to be said for immutability is that it <em>will</em> make you fashionable with your peers, at least until the next craze comes around, by which point you’ll be glad to move on.</p><p>And <a href="http://stackoverflow.com/questions/34385243/why-is-immutability-so-importantor-needed-in-javascript/43318963#link-post-43318963">the reply</a>!</p><blockquote>Hello Steven, Yes. I had all these doubts when I considered immutable.js and redux. But, your answer is amazing! It adds lot of value and thanks for addressing every single point that I had doubts on. It’s so much more clear/better now even after working for months on immutable objects. — bozzmob</blockquote><p>I’ve now added this as an article in my blog =&gt; <a href="https://desalasworks.com/article/immutability-in-javascript-a-contrarian-view">Immutability in JavaScript: A Contrarian View</a>. Feel free to reply in there if you have strong feelings you’d like to get off your chest too ;).</p><h4>Like what you are reading?</h4><p>Click on the 👏 below, it helps more people see it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=505a0940205a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>