<?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 Django Shelton on Medium]]></title>
        <description><![CDATA[Stories by Django Shelton on Medium]]></description>
        <link>https://medium.com/@djangoshelton?source=rss-2a72e24b2d5b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MUQKJJZjMFmQVYPrK5UDpg.jpeg</url>
            <title>Stories by Django Shelton on Medium</title>
            <link>https://medium.com/@djangoshelton?source=rss-2a72e24b2d5b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 05:58:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@djangoshelton/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[Building the Resident Rewards Program]]></title>
            <link>https://medium.com/hedgehog-invest/building-the-resident-rewards-program-2316495c159c?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2316495c159c</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[real-estate-investments]]></category>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[generation-rent]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Wed, 28 Jun 2023 08:40:22 GMT</pubDate>
            <atom:updated>2023-06-28T08:40:22.235Z</atom:updated>
            <content:encoded><![CDATA[<h4>A rent-to-invest opportunity for tenants to grow equity</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v-XgVC6dBosVoNupTsIBIg.jpeg" /></figure><p>This week at Hedgehog we launched a brand new pilot: The Resident Rewards program. The project aims to benefit both tenants and landlords; tenants get an opportunity to build equity while they rent, which they could use later as a down payment for a home, to travel, or any other personal plans. Landlords are incentivised to retain tenants, and save money by avoiding changeover in tenancies. You can find out more about the program <a href="https://www.hedgehog-invest.com/post/rent-to-invest-product-for-residential-tenants">here</a>.</p><p>The prospect of the program is exciting and can mean a lot for the future of the next generation of renters. We are keen to share how we got to the point of launching it. Hopefully, it’ll inspire more building owners to implement programs like these, so renters, landlords and society as a whole can benefit from them.</p><p>To facilitate this specific investment product, we used blockchain technology. Firstly, we implemented an onboarding process, which allows everyone to use blockchain technology without any complicated set up. We then used the technology to prove ownership, and also to ensure that the change of ownership of the asset settles in seconds, rather than days or weeks. All of this allowed us to mint and issue digital tokens representing an interest in the value of the building the residents live in.</p><h4>Removing the barriers to adoption</h4><p>One of the biggest challenges when it comes to building a product designed for wide adoption with blockchain technology is getting people to actually use it. Understanding of how blockchain works is not widespread, and being able to confidently navigate the world of private keys, browser extensions for wallets, and keeping seed phrases secure is a rare skill. We use a combination of multi party computation (MPC) via <a href="https://web3auth.io/docs/what-is-web3auth">Web3Auth</a> and <a href="https://ethereum.org/en/roadmap/account-abstraction/">account abstraction</a> in order to remove these barriers, creating an experience which is as simple as accessing your bank account or any other investment app. MPC lets us use the user’s login details (such as their social sign in with Apple or Google) alongside their device and other identifying information to manage a private key for their wallet. The user never needs to know the private key, or remember a seed phrase to keep it safe. Instead, their regular login methods they use today are used to authenticate requests to the blockchain. This results in a familiar authentication experience, with all the power of blockchain enabled.</p><p>We also use ERC-4337 (also known as account abstraction) to build smart contract rules into users’ wallets. The main use case we apply this to (for now — there are a lot of possibilities here) is to sponsor gas fees in transactions involving Hedgehog tokens. What this means is that Hedgehog will pay for all the fees rather than users (one reason we use Polygon blockchain is the comparatively low gas fees). To do this, we use <a href="https://www.stackup.sh/">stackup</a> and introduce a <a href="https://www.stackup.sh/blog/what-are-paymasters">paymaster</a> to sponsor the transactions. This removes a whole complicated step in the adoption process, where a user would have to access a crypto exchange, purchase currency of the right type, and transfer it to the appropriate wallet. Our users don’t need to do any of this to access the same powerful features that blockchain provides.</p><p>Ultimately we believe this will offer users a powerful form of self-custody, while reducing many of the traditional risks associated with managing a blockchain wallet. As the custody landscape and regulation continues to evolve, this should become a very interesting option for companies looking to reduce the onboarding barrier, but also give users the control associated with self-custody of assets.</p><h4>Putting it on-chain: blockchain based signatures</h4><p>The investments we offer require a <a href="https://uk.practicallaw.thomsonreuters.com/3-575-5351">subscription agreement</a> to be signed. This introduces an obvious question — if a signed subscription agreement exists, and a token representing the same investment also exists, which one represents ownership? Is it the name on the agreement, or is it the holder of the token? We wanted to eliminate this ambiguity, and move as much of the process “on chain” as possible.</p><p>We built an on-chain signature solution, where a hash (a piece of data with a fixed size which is the result of applying a mathematical function to the input data) of the subscription agreement is stored on-chain, and a record that the agreement was read and understood (i.e. a signature) is stored along with the security token representing the investment.</p><p>This allows us to record the beneficial owner of the security alongside the holder of the token, with all information kept on-chain so there is no ambiguity. Part of the transfer restrictions built into the token smart contract require this subscription agreement to be present, which prevents the two pieces of information ever drifting apart.</p><p>This also means we can generate a PDF of the signed document from the information stored on the blockchain. This creates an interface with more traditional finance processes which will require a contract, as well as DeFi processes, which will use the information stored on the blockchain. Any PDF generated by our systems can be verified for authenticity. If it’s modified in any way, in an attempt to commit fraud or change the terms of the agreement, we can check the hashes of the document against the records stored on the blockchain. This can give third parties strong assurance that the document they’re reviewing is authentic and has not been modified.</p><h4>Bringing it all together: Atomic transfers and the Hedgehog Token Standard</h4><p>The final part we needed to do was make the process as smooth as buying a stock or making a bank transfer. Residents shouldn’t have to wait for some manual process to take place after they sign the subscription agreement before they receive their tokens. Once they’ve done all they need to do, they should see their tokens in their wallet. This meant making the transaction process atomic (either it happens or it doesn’t) and removing any manual steps in the way.</p><p>We encoded this atomic transaction into the token smart contract itself. This checks that all the prerequisites are met (in this case, that there is a valid subscription agreement signature available) and if so, it mints and transfers the tokens. This ensures that users have access to their tokens as soon as possible, and asset owners don’t have to manually administer the issuance of tokens once prerequisites are met. This is a powerful concept which reduces the settlement time from days or weeks (more typical of this type of asset) down to seconds.</p><p>We are now looking to extend this concept further. By including KYC checks and money into the atomic transaction conditions, we are aiming to almost entirely reduce settlement risk when buying and selling these securities. This would be a huge step to introducing liquidity in this asset class, as easier transactions mean more volume of trading is possible. There is a lot of work to do here, and regulatory hurdles to overcome, but we see this as the future for this asset class and crucial to bringing access to as many investors as possible.</p><p>We’ve ensured we are compatible with ERC-20 and ERC-1400, as we want our tokens to be as flexible as possible and keep many integration options open. The additional atomic transfers functionality goes beyond these standards however, and creates what we’ve become to call a Hedgehog Token Standard. We see a powerful future for atomic transfers, and will be working to add more functionality to this token standard in the near future.</p><h4>Wrapping up</h4><p>We broke a lot of new ground when it comes to the technology involved in this project, and proved ideas we’ve speculated on can work in practice. This is an important step in our tokenisation journey, but it is also just the beginning. We now want to expand on the capabilities of the token smart contract we’ve built, and make it as powerful as possible. We want to prioritise working closely with other parties to make this future a reality. Writing this blog and “building in public” is part of that. If you find what we’re working on interesting, and want to talk about account abstraction, atomic transfers, or anything else to do with the smart contracts we’re creating, then reach out and let us know!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2316495c159c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgehog-invest/building-the-resident-rewards-program-2316495c159c">Building the Resident Rewards Program</a> was originally published in <a href="https://medium.com/hedgehog-invest">The Hedgehog Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hedgehog Q1 Hackathon: tackling settlement risk, ERC-4337 smart contracts, and more]]></title>
            <link>https://medium.com/hedgehog-invest/hedgehog-q1-hackathon-tackling-settlement-risk-erc-4337-smart-contracts-and-more-5d19a8df06e1?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d19a8df06e1</guid>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[fractional-investing]]></category>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Thu, 06 Apr 2023 08:47:05 GMT</pubDate>
            <atom:updated>2023-04-06T08:47:05.778Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ExU1oG7ykyH2JF3BVyI0iQ.jpeg" /></figure><p>As we move from Q1 to Q2 at Hedgehog, we’ve had a chance to reflect on what we’ve learnt so far, and generate new ideas for the future. We thought this was an ideal time to host a “hackathon” — an event where we spend a set period of time focusing on new ideas and projects, either as individuals or as teams. The goal is to create a functional prototype or solution, and present the results back to the rest of the company at the end of the event. Here’s what we learnt from it, and some of the projects we’re taking forward into the next quarter.</p><h3>Simultaneous settlement of contracts, assets, and money</h3><p>One of the key risks when it comes to financial transactions is <a href="https://www.investopedia.com/terms/s/settlementrisk.asp">settlement risk</a> i.e. the risk that one side of the transaction will fail to deliver on the terms of the contract. This risk is amplified when it comes to individual investors, who are likely to lack the same liquidity as larger investors, or simply be less reliable.</p><p>We spent time looking into how blockchain could solve this problem. We’ve brainstormed a solution where a contract, assets (in our case, digital tokens) and money could all change hands simultaneously. This is enabled by blockchain technology, where a smart contract can handle the transaction, and ensure both sides have the necessary funds or assets to fulfil the deal up front. By doing this, settlement risk is removed at the point of the transaction taking place, and the transaction speed is only limited by the blockchain protocol being used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tiOZZmLYk1alcpu1tmox-w.png" /><figcaption>A potential (rough) architecture to solve this problem without money involved</figcaption></figure><p>We see a huge benefit to this for both individuals (near instant buying and selling of previously illiquid assets) and asset owners (zero settlement risk while still accessing individual investors).</p><p>There are still significant hurdles to make this a reality, including how we make it user friendly for investors and how it can be integrated with KYC / AML requirements, but this is something we will be exploring further in the coming quarter and hopefully piloting soon.</p><h3>App to app integration</h3><p>In order to reach as many investors as possible, we need to be able to take advantage of many different distribution channels. For individuals wanting to access Hedgehog investments directly, they can use our web or iOS applications. For distribution partners, we have a web app, API integration, and file transfer options. On top of these, we investigated an “app to app” integration where a small part of Hedgehog can be directly embedded into a partners application.</p><p>This would allow a seamless transition between the two applications, with investors being directed to download the Hedgehog app from a referral widget in the partners app. Once an investor signs up to Hedgehog, that signup will be attributed back to the partner, who would then receive rewards based on investor activity with Hedgehog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3bqRcoiJBaBMPsrav8qrqA.png" /><figcaption>How the integration might look in a partners application</figcaption></figure><p>We wanted to make this as simple as possible for potential partners to add to their applications as well, so we built a library which can be easily added with just a few lines of code. Developers won’t have to be aware of any specific referral links, or the underlying implementation of how the referrals are made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*K0l7ROKPKIok_TX2" /><figcaption>All the code a developer would need to add!</figcaption></figure><p>We see this as a piece of work which could have a high impact, so we’ll be taking it into our next quarter plans and hopefully launching it with our first partners soon!</p><h3>ERC-4337 smart contract accounts</h3><p>One of the key challenges we face at Hedgehog is how to take complex, unfamiliar concepts such as blockchain and present them to our users in an easy to understand way. There’s an important balance to be struck between the user understanding what’s happening “under the hood”, and the user simply taking advantage of the benefits the technology provides.</p><p>This challenge particularly rears its head when it comes to custody of tokenized assets. We firmly believe that self custody of tokens is the best way to give users control and peace of mind when it comes to ensuring ownership of their assets. However, the process of creating, securing, and operating a crypto wallet is not something the vast majority of people have done, and even those who have will admit it’s complex and fraught with errors and gotchas. It’s a real challenge for mass adoption of crypto / blockchain technology, and not unique to Hedgehog.</p><p>This is where <a href="https://academy.binance.com/en/articles/what-is-erc-4337-or-account-abstraction-for-ethereum">ERC-4337</a> comes in. While the technical details are not crucial here, what does matter are the outcomes for users:</p><ul><li><strong>Easier set up:</strong> no need to write down seed phrases or private keys. Setting up a new wallet can be done with just a few clicks</li><li><strong>Better security:</strong> account recovery is now possible without a private key as is multi-factor authentication. This can be done with technologies that users are familiar with, such as social sign in.</li><li><strong>Flexibility on how to pay gas fees:</strong> developers can built wallets which removes this burden from the user</li></ul><p>Ultimately, ERC-4337 could mean a much simpler user experience for engaging with crypto wallets, which should in turn increase adoption.</p><p>We spent this hackathon implementing our own ERC-4337 wallets, and showed how creating a new account can be done in just a few clicks. We then also explored how to transfer tokens between accounts, and how we can make this as close as possible to a traditional banking experience which users would be familiar with.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnHvihGJk076C8x7tcZM2g.png" /><figcaption>It may not look user friendly yet…but the capability to make it user friendly is there</figcaption></figure><p>Going forward, we’re excited about the possibilities this opens up for us. ERC-4337 will likely form a key part of the other project we’ve already mentioned here, the simultaneous transfer of contracts, money, and assets. It will hopefully mean we can build an experience which feels as simple as a banking app today, but with all the power that blockchain technology has promised.</p><h3>The other ideas we focused on</h3><p>Of course not everything in a hackathon leads to some grand idea which makes its way into a companies roadmap. Over the course of the hackathon we also:</p><ul><li>Spent time getting to grips with generative AI, and how we can make use of it day to day to get better at our jobs</li><li>Exploring how we can integrate 3D elements made by designers into our application</li><li>Diving into the web of dependencies we have and understanding how we would begin to approach upgrading these over time</li></ul><p>While none of these have led directly to a new project or piece of work, they’ll all be useful reference points for us as a team, and will start to influence how we work day to day.</p><h3>Wrapping up</h3><p>Coming away from the hackathon, we’ve now got some really exciting ideas to take forward into our product. We think new ways of utilising blockchain technology could enable much faster transaction speed and remove settlement risk. We also think we have a way to make the whole process of engaging with blockchain and crypto much more user friendly. Finally, we have more ways to integrate with Hedgehog for more potential partners.</p><p>It can sometimes seem hard to justify taking a break from delivering on what we know about today, but these ideas show why it can be so valuable, considering we only invested a single working day into it. We think the whole event was an awesome success, and we will be running hackathons every 6 weeks from now on. Stay tuned to get updates on how these projects evolve, as well as future ideas which come out of our hackathons!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d19a8df06e1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgehog-invest/hedgehog-q1-hackathon-tackling-settlement-risk-erc-4337-smart-contracts-and-more-5d19a8df06e1">Hedgehog Q1 Hackathon: tackling settlement risk, ERC-4337 smart contracts, and more</a> was originally published in <a href="https://medium.com/hedgehog-invest">The Hedgehog Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Startup engineering: Delivering value while remaining adaptable]]></title>
            <link>https://medium.com/hedgehog-invest/startup-engineering-delivering-value-while-remaining-adaptable-ee7d251c991c?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee7d251c991c</guid>
            <category><![CDATA[fractional-investing]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[tokenization]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 10:56:21 GMT</pubDate>
            <atom:updated>2023-02-03T10:56:21.815Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*XuxFXYrbAWoYw2Dd_f75hA.jpeg" /><figcaption>Django Shelton, Lead Engineer @ Hedgehog</figcaption></figure><p>We know from lived experience how it can be a balancing act building an engineering team in the ever-changing start-up environment. So, we’ve decided to jot our thoughts down on paper, not only to share our views on the strategies that we have found to consistently deliver value, but also to serve as a guide for us in the future.</p><h3><strong>Keep engineers as close to the business as possible</strong></h3><p>At Hedgehog, engineers have a high level of ownership and responsibility. We didn’t simply hire extremely talented engineers, then just ask them to deliver tickets without asking questions. We hired engineers who understand and are motivated by delivering a product that broadens access to investing in real assets, then gave them ownership of problems which need to be solved. It’s up to them to speak for the business, understand the context of the problems we are trying to solve, and then make decisions which help the business solve those problems and achieve its goal.</p><p>All of the other points I’ll touch on in this article speak about the same idea of <strong>reducing cognitive overhead</strong> and <strong>saving engineers time</strong>. Engineers can then be as effective as possible by focusing on business problems. In turn, engineers understanding the business mean they will also understand how it might change in the future, and force them to consider this while designing and building the solutions. This reduces the amount of rework required overall, and incentivises engineers to make their work flexible and extensible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*05qJ2T8H8651I8tQ.png" /></figure><h3><strong>Use integrations, take advantage of tech debt, and document key decisions</strong></h3><p>When building our MVP, which we launched in the summer of 2022, we were always going to stay<a href="https://www.hedgehog-invest.com/post/why-the-why-matters-for-hedgehog"> true to our vision</a>, but we knew we couldn’t hit our deadlines by doing all the work ourselves. We ended up integrating with Veriff, Onfido, AWS Cognito, Securitize, and DocuSign all as part of the MVP. This is a lot of integration work, but still a lot less work than building in house what these companies and experts have done already. However, integration work is often messy and requires compromises, as a 3rd party’s opinionated platform or data model sometimes won’t play nicely with our own view of the world. When combined with a desire to launch as soon as possible, there were several compromises we had to make along the way, or in other words “tech debt” we needed to introduce.</p><p>At Hedgehog, we view tech debt as a powerful tool to speed up development, learn quickly, and iterate. However, unless it’s managed well, tech debt can easily get out of hand and cripple development teams. They can lose context around why decisions were originally made, and become paralysed by indecision or fear of breaking something. The main way we mitigate this is through documentation. By documenting when key decisions are made, and the context around those decisions, we gain the ability to easily undo those decisions months or years later. We use<a href="https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions"> Lightweight Architecture Decision Records</a> to document these key decisions (and compromises). This gives new team members crucial context for why things are the way they are, and gives the whole team a valuable tool to make changes in an informed and safe manner. We’ve seen these documents provide invaluable context when we’ve come to revisit decisions we’ve made on payments, authentication, and tokenization in particular. All of these projects are now owned by people who were not on the team when the original decisions were made, so the documentation provides a key resource for them to make new decisions and move forwards.</p><p>We also avoid addressing tech debt unless it’s having an immediate impact. In our view, if a piece of code is never going to be touched again, regardless of how messy, out of date, or upsetting it may be to work with, then the tech debt there is effectively irrelevant. It only matters when the piece of engineering in question is going to be adjusted, built upon, or replaced. It’s at these points in time when we choose to address tech debt. Effectively the tech debt becomes Schrödinger’s cat — it only becomes a problem when you observe it, up until that point it is neither a problem nor acceptable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cT6w9id5InWQBcLC.png" /></figure><p>This ensures we continue to focus on what matters most for our users, while also avoiding the trap of never addressing tech debt. We talk about tech debt openly and honestly with the rest of the company as well — rather than hiding tech debt or hand waving it away. We think it’s important for everyone to be bought into our way of working, and to trust that way of working. So far this has served us well and allowed us to strike a good balance between delivering quickly when it matters, and addressing critical tech debt when it matters.</p><p>This approach to integrations, documentation and tech debt allows us to support changing requirements much more easily. Rather than aiming for a perfect solution, or something we built completely ourselves, we accept imperfect solutions and solutions built by others to begin with, and deliver these quickly. Over time, we will often discover these solutions are not needed or are replaced entirely with an alternative. Anything else that remains part of the product will be improved over time when it matters. We avoid wasting time trying to be perfect the first time around, and let the success of our product dictate what is important to spend more engineering time on.</p><h3><strong>Keep it Simple Stupid: Monolith vs Microservices</strong></h3><p><a href="https://aws.amazon.com/microservices/">Microservices</a> are a very common architectural pattern these days, splitting an application into multiple small and lightweight services. This approach has a number of benefits, including agility, flexibility, and ease of deployment. All of these things sound great for an early stage start-up, but they must be weighted against the additional complexity introduced. The infrastructure overhead is not trivial, and you need to understand your domain well to be able to decide on a sensible set of services to introduce. There is also the additional complexity which comes with observing and debugging a distributed system, which is a hard problem for even huge organisations to get right.</p><p>Instead of implementing microservices, we’ve decided to build our application as a<a href="https://shopify.engineering/deconstructing-monolith-designing-software-maximizes-developer-productivity"> modular monolith</a>. This allows us to keep our codebase modular and domains separated, while avoiding the extra infrastructure complication of microservices. It also simplifies all our deployment pipelines, and gives us flexibility to adjust our domains as they evolve and emerge. When a good candidate emerges for a microservice (e.g. if we notice particular workloads slowing down the overall application which need to be scaled individually, or some data needs to be held in a more secure location which the rest of the application shouldn’t have access to) our code is already logically separated and refactoring this into a microservice should not be a huge lift. We’ve already built our first microservice to handle the most sensitive of user data in an entirely separate database. Essentially, we are treating microservices as an infrastructure problem rather than a code problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*181bhdJv1ORz7IQB.png" /></figure><p>We try to apply this general approach of Keep It Simple Stupid (or<a href="https://en.wikipedia.org/wiki/KISS_principle"> KISS</a>) wherever possible. This frees up brainpower for understanding business problems, and makes our technology simpler to adjust when a changing business requirement does emerge.</p><h3><strong>Engineering team now driving business strategy</strong></h3><p>We firmly believe in the digital transformation of financial markets. Luckily, as we now have an engineering team fully ingrained in the business, we can look to them to help deliver value as we build a platform designed to integrate in the customer journey of other financial service providers..</p><p>Over the last 12 months, we’ve managed to grow from a single engineer, to a whole team which is fully integrated within our business. We’ve done this by keeping engineers as close to the business as possible, taking a pragmatic approach to building ourselves and accepting tech debt, and keeping things as simple as we can. This has led to us having an engineering team capable of driving strategy and delivering value on its own, rather than being a factory which enables the rest of the business. We see this as key to delivering a successful startup in our industry, and we’ll continue to share our progress on this journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee7d251c991c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hedgehog-invest/startup-engineering-delivering-value-while-remaining-adaptable-ee7d251c991c">Startup engineering: Delivering value while remaining adaptable</a> was originally published in <a href="https://medium.com/hedgehog-invest">The Hedgehog Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Code Generator with TypeScript and GraphQL]]></title>
            <link>https://javascript.plainenglish.io/using-graphql-code-generator-to-create-a-great-developer-experience-with-typescript-and-graphql-30e30261b75?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/30e30261b75</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Sun, 14 Mar 2021 18:51:25 GMT</pubDate>
            <atom:updated>2021-03-15T14:16:07.165Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using GraphQL Code Generator to create a great developer experience with TypeScript and GraphQL</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IAqIy4oyldivwUNa9I6Jxw.png" /></figure><p>If you’re anything like me, you’ve recently been writing code almost exclusively in TypeScript, and the odd time you do have to open up a .js file fills you with a mild panic. You probably also spend time building REST APIs and GraphQL layers to communicate with front-end applications. At first TypeScript and GraphQL seem like a match made in heaven; they’re both typed, so they should play nicely together.</p><p>However, when you have two different type systems, or two sources of truth for how your data should look (before you even include a database), there is inevitably going to be frustration when building features, and bugs when you release those features. This had been my experience until I came across a project where GraphQL Code Generator was magically creating TS types for me whenever I changed my GraphQL schema. I’m not a huge fan of using magic without understanding the underlying tools, so I wanted to recreate a minimal example to do the same thing, and hopefully other people find this useful as well!</p><p>In this article we will:</p><ul><li>Create a TypeScript project from scratch</li><li>Add a very simple GraphQL server</li><li>Add GraphQL Code Generator to integrate them both in a seamless manner</li></ul><p>If the whole thing is TL;DR, you can find the final code <a href="https://github.com/Djangofs/graphql-ts-codegen">here</a>.</p><h3>Setting up TypeScript</h3><p><em>By the end of this section, your project should look like </em><a href="https://github.com/Djangofs/graphql-ts-codegen/commit/5f60f3a821c91e8f60dec9f5c01b9a4fd3bdace0"><em>this</em></a><em>.</em></p><p>I’m assuming that if you’re reading this you already have Node, npm, and Yarn installed on your machine, and are vaguely familiar with using them.</p><p>To get started, we want to create an empty npm project (the default options are all fine):</p><pre>mkdir my_project &amp;&amp; cd my_project &amp;&amp; npm init</pre><p>Next we want to add typescript into the devDependencies of the project. This is because we use TypeScript to transpile our code into Javascript, we don’t need to run it in our production build. While we’re here let’s also add ts-node, and nodemon, we will see how to use them shortly.</p><pre>yarn add -D typescript ts-node nodemon</pre><p>Now you want to initialise your TypeScript project. This will create a default tsconfig.json file.</p><pre>npx tsc --init</pre><p>Have a look at the options which aren’t enabled by default. Set &quot;outDir&quot;: &quot;dist&quot; and &quot;sourceMap&quot;: true . This will send your transpiled code to a dist directory which you should not commit to Git, and enable easier debugging when something goes wrong.</p><p>Now we have TS set up, let’s add an index.ts file in the src folder, and add the following code to it. This is a very simple Hello World TS project:</p><pre>const world = &quot;world&quot;;</pre><pre>export function hello(word: string): void {<br>    console.log(`Hello ${word}! `);<br>}</pre><pre>hello(world);</pre><p>You can now run npx tsc to transpile the code, and node dist/index.js to run it, and you should see the output on your console. While this is doable, it’s annoying to have to do this every time to change your code. Instead, we can transpile and execute our code at the same time, using ts-node. Simply run ts-node src/index.ts and your TS code will be transpiled and executed in one command. It’s important to note this is an optimisation only meant when rapidly iterating and running code on your machine. Any production application should not be executed with ts-node.</p><p>We can still do a bit better here. Having to run this command every time we save the file is a bit painful. Instead create a nodemon.json file, and include the following:</p><pre>{<br>  &quot;watch&quot;: [&quot;src&quot;],<br>  &quot;ext&quot;: &quot;ts&quot;,<br>  &quot;exec&quot;: &quot;ts-node ./src/index.ts&quot;<br>}</pre><p>This will all files in the src folder with a .ts extension, and execute the ts-node command when one of those files changes.</p><p>Now in order to run this nodemon file, lets add an npm script in the package.json file:</p><pre>&quot;scripts&quot;: {<br>  &quot;start&quot;: &quot;nodemon&quot;,<br>}</pre><p>We can execute this with yarn start and then change the index.ts file and see our changes executed straight away 🚀</p><h3>Adding a GraphQL server</h3><p><em>By the end of this section, your code should look like </em><a href="https://github.com/Djangofs/graphql-ts-codegen/commit/9dc1797f68fbeae1a7fa0648f7acdf802f8b1659"><em>this</em></a><em>.</em></p><p>First, let’s add the dependencies we will use in this section, we will get to these eventually:</p><pre>yarn add apollo-server graphql <a href="http://twitter.com/graphql">@graphql</a>-tools/load <a href="http://twitter.com/graphql">@graphql</a>-tools/graphql-file-loader <a href="http://twitter.com/graphql">@graphql</a>-tools/schema</pre><p>Next, let’s add our first TS types in src/types/types.ts :</p><pre>export interface Todo {<br>  title: string;<br>  description: string;<br>}</pre><p>And let’s add some data to the index.ts file which uses this type (you can remove all the old code from this file):</p><pre>import { Todo } from &quot;./types/types&quot;;</pre><pre><em>const</em> todos: Todo[] = [<br>  {<br>    title: &quot;Walk dog&quot;,<br>    description: &quot;Before 9am&quot;,<br>  },<br>  {<br>    title: &quot;Clean bathroom&quot;,<br>    description: &quot;&quot;,<br>  },<br>];</pre><p>Now let’s add a GraphQL schema (in src/schemas/index.graphql) which allows us to Query for Todo items:</p><pre>type Todo {<br>  title: String<br>  description: String<br>}</pre><pre>type Query {<br>  todos: [Todo]<br>}</pre><p>Now that we have a new file extension, let’s also update ext section of the nodemon.json file, which will enable our hot reloading whenever a .ts OR .graphql file changes.</p><pre><em>&quot;ext&quot;</em>: &quot;ts,graphql&quot;</pre><p>Now, we want to use this schema to set up our GraphQL server. To do so, first let’s add all the functions we need from the dependencies we installed earlier to the index.ts file:</p><pre>import { loadSchemaSync } from &quot;@graphql-tools/load&quot;;<br>import { GraphQLFileLoader } from &quot;@graphql-tools/graphql-file-loader&quot;;<br>import { addResolversToSchema } from &quot;@graphql-tools/schema&quot;;<br>import { ApolloServer } from &quot;apollo-server&quot;;</pre><p>First, let’s load the GraphQL schema we defined earlier using loadSchemaSync and GraphQLFileLoader . These functions let us essentially import all the GraphQL files we have defined, which there is no regular way to do in TypeScript.</p><pre><em>const</em> schema = loadSchemaSync(&quot;**/*.graphql&quot;, {<br>  loaders: [new GraphQLFileLoader()],<br>});</pre><p>Next, let’s define some a resolver to fulfill the schema:</p><pre><em>const</em> resolvers = {<br>  Query: {<br>    todos: (): Todo[] <em>=&gt;</em> todos,<br>  },<br>};</pre><p>This will simply return the todos data we defined earlier.</p><p>Finally, we can add the resolvers to the schema using addResolversToSchema:</p><pre><em>const</em> schemaWithResolvers = addResolversToSchema({<br>  schema,<br>  resolvers,<br>});</pre><p>Now, we’re ready to give this schema to our Apollo server (Apollo is a popular GraphQL implementation for Javascript):</p><pre>const server = new ApolloServer({ schema: schemaWithResolvers });</pre><pre>server.listen().then(({ url }) =&gt; {<br>  console.log(`🚀  Server ready at ${url}`);<br>});</pre><p>Now, when you save index.ts , you should see the Server ready log in your console. Now open localhost:4000 in a browser, and you can try out the query in the GraphQL playground:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XuRZsRckhgn2jZNfxkwWew.png" /><figcaption>Getting Todos data back using GraphQL</figcaption></figure><p>At this point, we have a GraphQL server, hot reloading for our GraphQL and TypeScript files, a GraphQL schema and some TS types, and some data to respond with.</p><p>However, there is a fairly obvious problem with this. When our data model inevitably changes, we have to update both the TS types and the GraphQL schema. In this simple example it’s trivial, but at any sort of scale beyond this it will go wrong. It’s also boring and not a good use of an engineers time, which is very valuable! It’s also a very common source of bugs when you release this code.</p><p>To fix this, we can take advantage of <a href="https://graphql-code-generator.com/">GraphQL Code Generator</a>.</p><h3>Adding GraphQL Code Generator</h3><p><em>At the end of this section, your code should look like </em><a href="https://github.com/Djangofs/graphql-ts-codegen/commit/8784a596e12c1153f11d1a39395ce548e81c30f5"><em>this</em></a><em>.</em></p><p>Again, let’s start by adding the dependencies we will make use of:</p><pre>yarn add <a href="http://twitter.com/graphql">@graphql</a>-codegen/cli <a href="http://twitter.com/graphql">@graphql</a>-codegen/typescript <a href="http://twitter.com/graphql">@graphql</a>-codegen/typescript-resolvers</pre><p>And also create a codegen.yaml file with the following content:</p><pre>overwrite: true<br>schema: src/schemas/**/*.graphql<br>documents: null<br>generates:<br>  src/types/types.d.ts:<br>    plugins:<br>      - &quot;typescript&quot;<br>      - &quot;typescript-resolvers&quot;</pre><p>This will take all the .graphql files in src/schemas and generate TypeScript types in src/types/types.d.ts .</p><p>In order to execute this, let’s add another npm script:</p><pre><em>&quot;generate&quot;</em>: &quot;graphql-codegen&quot;</pre><p>and run it with yarn generate . Once this is done, you can see your generated file! Now that we have this, we can delete the old file src/types.types.ts .</p><p>At this point nothing has really changed, and our code still runs the same. Let’s make sure this generate command runs each time we change code, by updating the exec section in nodemon.json :</p><pre><em>&quot;exec&quot;</em>: &quot;yarn generate &amp;&amp; ts-node ./src/index.ts&quot;</pre><p>Now when you add an id field to the Todo type in index.graphql :</p><pre>type Todo {<br>  title: String<br>  description: String<br>  id: Int<br>}</pre><p>You should see some errors as we don’t have an id field defined in our data…but we don’t?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*LhZ9JAbLGnukH3vfSQ99kA.png" /></figure><p>If we look at the Todo type, we can see that all the fields are optional, and will accept undefined. This isn’t what we want, as this data model requires all data to exist all the time, so let’s update the GraphQL schema to reflect that:</p><pre>type Todo {<br>  title: String!<br>  description: String!<br>  id: Int!<br>}</pre><p>Now when we save the file and our server reloads, it crashes and we can see the error clearly in our editor:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9tTSdVy6_zKu0dSW7Mc7w.png" /></figure><p>We can fix this error by adding ids to the Todos data object, at which point our server will restart and we can now query for iddata. 🎉</p><p>Now we’re in a lovely place where our TS types are generated entirely from our GraphQL schema, and every time the schema changes the types are regenerated. This massively simplifies the developer experience and speeds up the feedback loop, catching bugs before our code is even transpiled, let alone tested or deployed.</p><h3>Taking it further</h3><p>If you wanted to keep working on this, you could add some GraphQL Mutations which use arguments, and see how the code generator creates types for the arguments as well as the response objects. If you wanted to get really fancy you could also try and integrate this approach with a database type system to achieve complete data model synchronisation 💆‍♂.</p><p>Thanks for reading all the way to the end! If you want to hear more ramblings from me, you can find me on <a href="https://twitter.com/DjangoFS">Twitter</a>, <a href="https://www.linkedin.com/in/django-shelton-99a07aa0/">LinkedIn</a>, and <a href="https://github.com/Djangofs">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30e30261b75" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/using-graphql-code-generator-to-create-a-great-developer-experience-with-typescript-and-graphql-30e30261b75">GraphQL Code Generator with TypeScript and GraphQL</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[First month as a software engineer at Bulb]]></title>
            <link>https://djangoshelton.medium.com/first-month-as-a-software-engineer-at-bulb-d7b90538efa2?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7b90538efa2</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[bulb]]></category>
            <category><![CDATA[green-energy]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Wed, 18 Mar 2020 18:01:21 GMT</pubDate>
            <atom:updated>2020-03-18T18:01:21.399Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve recently joined Bulb as a full-stack software engineer, having spent the last 5 years working at a technology consultancy with approximately 500 times as many employees. After a month, I’ve taken some time to reflect on what I’ve done so far, how different that has been from my previous experience, and why I’m excited about working at Bulb.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gv2Hu15pRpX6CxI1ow-Pzw.jpeg" /></figure><h3>What I’ve been up to</h3><p>On my third day, I pushed a bugfix to production. While this statement would usually fill me and many other engineers with dread, in this case it was a simple and low-risk process. The small change had been reviewed and approved by other engineers, automated tests had verified both the change itself and checked for any regressions, and I had seen it working in a <a href="https://technologyconversations.com/2019/03/25/working-with-pull-requests-and-preview-environments/">pull request environment</a>. After all of this, clicking the big red deploy button didn’t feel so scary, and we had a plan for how to verify the fix in production once it was deployed (with zero downtime affecting our members). This was just the first and I’ve managed to deploy multiple other fixes already, all having a direct impact on our members.</p><p>I’ve also been taking on responsibility for the technology behind the <a href="https://help.bulb.co.uk/hc/en-us/articles/115001245512-Can-I-get-the-Warm-Home-Discount-">Warm Home Discount </a>scheme — a government program which gives people receiving certain benefits £140 off their energy bills. This has involved taking ownership of the code base, helping Energy Specialists with particular queries, and planning the next iteration of the service for winter 2020. It’s a great reminder that the role of an energy supplier is so much more than simply getting energy into our members homes, and I’m delighted to be involved with helping those in vulnerable situations.</p><p>Finally, I spent time on the <a href="https://bulb.co.uk/careers/energy-specialist/">Energy Specialist</a> training, which everyone in the company does. While I’m a software engineer not an Energy Specialist, the training was incredibly useful to understand how the company operates, and how we achieve our mission to lower bills and lower CO2. Engineers are a huge part of that, and a lot of the systems we build are used every day by the Energy Specialists, so being able to understand their role will be hugely beneficial. It also helped to open my eyes to some of the arcane inner workings of the UK energy industry, and the role Bulb plays in leading the industry to become more green.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DX5R8g9bJxQfZxA9aKMtTA.jpeg" /></figure><h3>How this has made me feel</h3><p>During my first month I’ve felt trusted with a great amount of responsibility, and also supported through that. Bulb hires good people, and then trusts them to get the job done. At no point during the first month have I felt like I was facing a problem alone, or that I didn’t know where to turn to get help. On top of that, the great technical standards in place — automated testing, peer reviews, continuous integration and delivery — have made it easy to start contributing straight away and getting work done. We work in cross-functional pods (which contain all the skills needed to deliver the work) which are closely aligned with the goals of the business. This allows teams to be autonomous, and also ensures everyone is pulling in the same direction.</p><p>One of the biggest differences from my previous jobs has been how engaged I feel with our members and their needs. We get to see the impact of our changes straight away, and are constantly using data to drive improvements. Everyone in the company also has a responsibility to get involved with customer service (even the most senior people), which helps to keep focused on the things that are important to our members. It’s this dedication to customer service which makes Bulb the UK’s fastest growing energy company.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g8-8OLf_AhH82giyR26LHg.jpeg" /></figure><h3>Looking forward to the future</h3><p>I’m really excited about the future at Bulb, and learning a lot about the tech we’re using (React, TypeScript, Koa, Kubernetes, Google Cloud Platform). I’ve also got some training coming up on operational excellence and security — at Bulb engineers are responsible for the services running in production, so these skills will be critical for my role. Mostly I’m looking forward to continuing to get to know my colleagues and learning from them — there’s a very high standard of engineering here and a huge amount of experience. And of course I’m looking forward to helping our members lower their bills, and lower their CO2!</p><p>We’re currently hiring for a number of roles across engineering, so if this sounds like a place you’d like to work, check out our open vacancies <a href="https://bulb.co.uk/careers/#open-roles">here</a> or feel free to message me to talk about it more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7b90538efa2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The practical JS 12 factor application | IV. Backing services]]></title>
            <link>https://djangoshelton.medium.com/the-practical-js-12-factor-application-iv-backing-services-4b71ab016514?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b71ab016514</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Tue, 22 Jan 2019 17:28:31 GMT</pubDate>
            <atom:updated>2019-01-22T17:28:31.036Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note: This is part a 12 part series so stay tuned for more!<br><a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-iii-config-e6a5c9826c52">&lt;&lt;Part 3</a></blockquote><p>Over the last few years I’ve found using using the 12 Factor principles to guide the way I build applications to be incredibly helpful in producing scalable, maintainable, and sensible results.</p><p>However, concrete examples of the principles in action and how they relate to JavaScript have been difficult to find, and so I’m hoping to solve this with this series of 12 articles covering, funnily enough, the 12 factors.</p><p>The material here is definitely not going to be ground breaking or revolutionary, but will hopefully provide some solid fundamentals and best practices in relation to JavaScript (both client and server side) which you will be able to use on your own projects.</p><h3>IV. Backing services</h3><h4>Treat backing services as attached resources</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*RUOHHwC9Y1SwmfI73ds93Q.png" /><figcaption><a href="https://12factor.net/backing-services">https://12factor.net/backing-services</a></figcaption></figure><p>The <a href="https://12factor.net/backing-services">fourth factor</a> covers the way to properly deal with “backing services”, i.e. those services external to your application, such as an SQL database or the Google Maps API.</p><p>To summarise the approach:</p><ul><li>A backing service is any service the application uses over the network e.g. databases, external APIs</li><li>The code makes no distinction between local services (those you manage) or those managed by third parties. They are all attached resources which are accessed by a URL or credentials stored in <a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-iii-config-e6a5c9826c52">config</a>.</li><li>Resources can be attached or detached at will. You should be able to swap out from one PostgreSQL database running locally to another one managed by a cloud provider without changing any code.</li></ul><p>The benefits I’ve observed of following this approach are as follows:</p><ul><li>Code which can easily be moved through environments without changing, allowing easy deploys to multiple environments</li><li>Modular code which follows the Single Responsibility Principle<br>Loose coupling between business logic and external dependencies. This allows for much more meaningful testing, both at a unit and integration level.</li><li>A much easier route to refactor code, both when moving from one equivalent resource to another (custom SQL DB to cloud managed DB) or when moving technologies entirely (migrating from SQL to NoSQL or vice versa).</li></ul><h3>How does this apply to JavaScript?</h3><p>There are a few techniques you’ll need to be familiar with in order to apply this approach to a JavaScript application. Firstly, as these pieces of code will be dealing with external network requests, you’ll need to be familiar with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises">Promises</a> and, ideally, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async / await</a>. To dig deeper, it is useful to look into the single threaded nature of JavaScript and in particular the <a href="https://www.youtube.com/watch?v=8aGhZQkoFbQ">event loop</a>. With this grounding, you’ll be able to construct network calls appropriately and ensure they don’t hinder the performance of your application.</p><p>Secondly, you’ll need to have a good understanding of how to break JS code down into modules which you can reuse. The basics of functions and <a href="https://medium.com/@thejasonfile/a-simple-intro-to-javascript-imports-and-exports-389dd53c3fac">modules </a>come in handy here, and how to use code from one file in another.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*UyzhUSmhMdnH4gp9VrpWKQ.png" /><figcaption>Facade pattern</figcaption></figure><p>With that in mind, you’ll be able to write a “connector” (more officially a <a href="https://addyosmani.com/resources/essentialjsdesignpatterns/book/#facadepatternjavascript">“facade”</a>), or a series of functions which give you the functionality you need to interact with the external resource. These functions don’t need to be necessarily complex or simple, but should expose some agnostic functionality e.g. getLocation or saveRegistration rather than getLocationFromGoogleMaps or saveRegistrationToPostgres. The reason for this is that it keeps your business logic code (where these functions will be called) unaware of the specific resource being called. If the need should ever arise to switch to a different location supplier or registrations database, as long as you can easily implement a new set of functions implementing the same facade, you have an easy path to refactor. You can even run the two implementations in parallel if necessary, moving from one implementation to another gradually.</p><h3>What about those examples?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*FE_GIddaHDZ0rZo0pBrnrw.png" /></figure><p>The first examples <a href="https://github.com/FoodStandardsAgency/register-a-food-business-front-end/tree/master/src/server/connectors">here</a> cover a few different use cases: connecting to a config db, connecting to a third party address lookup API, and connecting to an internal registration service. There is also a status connector which shows a good example of the power of the facade pattern — initially it stores the status information in memory, but when the team has enough time to move to storing that information inside a database, only the connector will have to change. The rest of the application will stay the same, as it only interacts with the facade (getStoredStatus, updateStoredStatus).</p><p>Thanks for reading! If you have any comments or questions please post them below and I’ll get back to you. I’ll be periodically posting the rest of this series on Medium as well so keep posted if you fancy reading the rest.</p><p>You can also follow me on <a href="https://twitter.com/DjangoFS">Twitter </a>or <a href="https://github.com/Djangofs">GitHub</a> if you’re wild enough to think what I do is interesting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b71ab016514" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The practical JS 12 factor application | III. Config]]></title>
            <link>https://djangoshelton.medium.com/the-practical-js-12-factor-application-iii-config-e6a5c9826c52?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6a5c9826c52</guid>
            <category><![CDATA[12-factor]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[configuration-management]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Thu, 10 Jan 2019 15:58:24 GMT</pubDate>
            <atom:updated>2019-01-22T17:28:59.566Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note: This is part a 12 part series so stay tuned for more!<br><a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-ii-dependencies-2a0b64f3954c">&lt;&lt;Part 2</a> <a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-iv-backing-services-4b71ab016514">Part 3&gt;&gt;</a></blockquote><p>Over the last few years I’ve found using using the 12 Factor principles to guide the way I build applications to be incredibly helpful in producing scalable, maintainable, and sensible results.</p><p>However, concrete examples of the principles in action and how they relate to JavaScript have been difficult to find, and so I’m hoping to solve this with this series of 12 articles covering, funnily enough, the 12 factors.</p><p>The material here is definitely not going to be ground breaking or revolutionary, but will hopefully provide some solid fundamentals and best practices in relation to JavaScript (both client and server side) which you will be able to use on your own projects.</p><h3>III. Config</h3><h4>Store config in the environment</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*O2YnaM1dWG-LOJEdY4xgOQ.png" /><figcaption><a href="http://www.northplains.com/ootb-configuration-customization/">http://www.northplains.com/ootb-configuration-customization/</a></figcaption></figure><p>The <a href="https://12factor.net/config">third factor</a> covers how to manage the things which vary between environments (dev, test, production) or in other words, config. Examples of this include credentials for external or backing services, and values such as logging levels which will vary between deploys.</p><p>To summarise the approach:</p><ul><li>Strictly separate config from code. Code stays the same across deploys, config does not. Thus, do not store config in source control.</li><li>Do not store config in config files which are not checked into source control. This can easily go wrong and tends to be language specific</li><li>Store config in <em>environment variables</em> which are easy to change across deploys, and cannot be accidentally checked into code repos.</li><li>Do not batch environment variables into groups according to environment (e.g. prod-submit-url test-submit-url) as this approach does not scale. As your app grows you are likely to add new environments, which means creating a whole new set of environment variables, rather than a new version of existing variables.</li></ul><p>The benefits I’ve observed of following this approach are as follows:</p><ul><li>You can open source any piece of your code, provided it does not expose intellectual property or sensitive business logic. It also reduces the risk of potential data breaches on closed source code.</li><li>Moving code between environments is easy. The applications behaviour can be changed (e.g. changing a logging level to debug) without changing code and thus needing to re test and redeploy the application.</li><li>New environments are easy to create and configure.</li><li>Environment variables are language and OS agnostic, so moving between hosting environments (if necessary) is simpler.</li></ul><h3>How does this apply to JavaScript?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*Z2AOz46LIV6xspLhy5tTaA.png" /><figcaption><a href="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png">https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.png</a></figcaption></figure><p>In Node environments, you can access environment variables on the process.env object as described <a href="https://nodejs.org/api/process.html#process_process_env">here</a>. If running in a Unix-like environment (e.g. MacOS or Linux) you can set environment variables in a bash shell using export &lt;ENV_NAME&gt;=&lt;env_value&gt; and you can check the value of a variable by using echo $&lt;ENV_NAME&gt;. These values will be made available the the Node process on process.env at start up. If a variable changes while the process is running, you will need to restart the application to read the new value of that variable. There is a common environment variable called NODE_ENV which is worth knowing about, as it affects performance on a number of important packages such as <a href="https://expressjs.com/en/advanced/best-practice-performance.html">Express</a>. If in doubt, set this to production for your production app and development everywhere else.</p><p>Things get a little bit trickier when running JS in the browser, as the environment your running is now local to the user. <a href="https://medium.com/@trekinbami/using-environment-variables-in-react-6b0a99d83cf5">Webpack</a> can solve this problem for you, as can <a href="https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#docsNav">Create React App</a> if that’s something you’re using. In general the approach will be the same (access environment variables using process.env) but some extra build steps are needed to make this possible.</p><p>While this is all well and good, it can get a bit messy having process.env.YOUR_DESCRIPTIVE_VARIABLE_NAME written throughout your code, and also impossible to know which environment variables are needed to run an application. For this reason, it makes sense to have a single file e.g. src/config.js which contains all your environment variables as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a78cd5c5bc864712712f9668eb0e9cb8/href">https://medium.com/media/a78cd5c5bc864712712f9668eb0e9cb8/href</a></iframe><p>This allows you to define all the config needed to run the application in a single place, then the rest of your app can require the config it needs as follows:</p><p>const { api_url } = require(“&lt;relative_path_to_config&gt;”)</p><p>The last piece is to ask how to apply these variables at build / run time. While this may vary based on hosting environment or cloud provider, a common approach is to use a package such as <a href="https://www.npmjs.com/package/dotenv">dotenv</a> which loads variables from a .env file to process.env. You could then create a .env file (separate from your code) e.g.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bbd966fbfb5070a0e7280b7c5ce8cd24/href">https://medium.com/media/bbd966fbfb5070a0e7280b7c5ce8cd24/href</a></iframe><p>And store this somewhere your build system can access. When building / bundling your code into an artefact, this .env file should be included. If your src/config.js is then modified like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe015c55a77548d6c09394b0149ab82b/href">https://medium.com/media/fe015c55a77548d6c09394b0149ab82b/href</a></iframe><p>All the values from .env will be available through your config module to the rest of the application.</p><h3>What about those examples?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*FE_GIddaHDZ0rZo0pBrnrw.png" /></figure><p><a href="https://github.com/FoodStandardsAgency/register-a-food-business-collections-service/blob/develop/src/services/logging.service.js">Here</a> is a simple example of using environment variables to define the level of logging the application runs with.</p><p>While <a href="https://github.com/FoodStandardsAgency/register-a-food-business-service/blob/master/src/config.js">here</a> is a more advanced example where multiple environment variables are defined in a single config file.</p><p>Thanks for reading! If you have any comments or questions please post them below and I’ll get back to you. I’ll be periodically posting the rest of this series on Medium as well so keep posted if you fancy reading the rest.</p><p>You can also follow me on <a href="https://twitter.com/DjangoFS">Twitter </a>or <a href="https://github.com/Djangofs">GitHub</a> if you’re wild enough to think what I do is interesting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6a5c9826c52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The practical JS 12 factor application | II. Dependencies]]></title>
            <link>https://djangoshelton.medium.com/the-practical-js-12-factor-application-ii-dependencies-2a0b64f3954c?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a0b64f3954c</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Fri, 04 Jan 2019 17:02:42 GMT</pubDate>
            <atom:updated>2019-01-10T15:58:48.140Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note: This is part a 12 part series so stay tuned for more!<br><a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-i-codebase-325dc81389b0">&lt;&lt;Part 1</a> <a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-iii-config-e6a5c9826c52">Part 2&gt;&gt;</a></blockquote><p>Over the last few years I’ve found using using the <a href="https://12factor.net/">12 Factor principles</a> to guide the way I build applications to be incredibly helpful in producing scalable, maintainable, and sensible results.</p><p>However, concrete examples of the principles in action and how they relate to JavaScript have been difficult to find, and so I’m hoping to solve this with this series of 12 articles covering, funnily enough, the 12 factors.</p><p>The material here is definitely not going to be ground breaking or revolutionary, but will hopefully provide some solid fundamentals and best practices in relation to JavaScript (both client and server side) which you will be able to use on your own projects.</p><h3>II. Dependencies</h3><h4>Explicitly declare and isolate dependencies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lrlj6lCFnuFNnM86DisV_Q.jpeg" /><figcaption><a href="https://insights.dice.com/wp-content/uploads/2017/07/Node.js-Javascript.jpg">https://insights.dice.com/wp-content/uploads/2017/07/Node.js-Javascript.jpg</a></figcaption></figure><p>The <a href="https://12factor.net/dependencies">second factor</a> sets out the ways to include external code or tooling into a 12 factor application. To summarise:</p><ul><li>Declare all your dependencies in a manifest, and install these using a package manager / bundler.</li><li>Isolate your application from the surrounding system to ensure no “leak in” of tools</li><li>Apply the same manifest and isolation to all environments</li></ul><p>In general, applying these rules will lead to benefits including:</p><ul><li>Simplify developer set up, should be as simple as checking out the code and running the install command. In theory it should remove the “works on my machine” errors</li><li>Dependency isolation will also make development and production deploys as similar as possible, creating consistency and reliability.</li></ul><h3>How does this apply to JavaScript?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*UqDhYiX8CunSglj65yQ_pw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxTsxyYc7-NcbcgiZvveLQ.png" /></figure><p>There are two major dependency management tools in the JavaScript ecosystem currently, npm and yarn. I won’t start a war on which is “better” here, as the advice applies to both equally.</p><p>You should declare your dependencies in a package.json file in the root of your applications repo. This should contain all the dependencies of your application, split between devDependencies which your application only needs during development (e.g. testing tools) and dependencies which your application needs to actually run. This will allow you to use the production install commands npm install --production and yarn install --production. You should declare exact dependency versions (3.4.1 instead of ^3.4.1) as this will ensure you know exactly which version of the dependency will be installed, and to help avoid situations like the <a href="https://www.theregister.co.uk/2018/11/26/npm_repo_bitcoin_stealer/">event stream incident</a>.</p><p>Once you’ve run npm install or yarn install your node_modules folder will be populated and you’ll be able to use the packages in your code by using require(&quot;some-module&quot;) . For a great detailed explanation of how this works, take a look at <a href="https://medium.freecodecamp.org/requiring-modules-in-node-js-everything-you-need-to-know-e7fbd119be8">this article.</a></p><p>Whichever tool you’re using, make sure you use a lock file (package-lock.json or yarn.lock) in order to make sure your sub-dendencies are locked down as well as your dependencies.</p><p>There is no explicit dependency isolation tool for JavaScript, but using Docker with the <a href="https://hub.docker.com/_/node/">default Node images</a> will achieve the same effect. Similarly, never install something your app needs using npm -g &lt;package&gt; as this will creep the dependency into any other application on your machine as well, making certain results inconsistent.</p><h3>What about those examples?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*FE_GIddaHDZ0rZo0pBrnrw.png" /></figure><p>Again we can look at the Food Standards Agency for some exmaples. Take a look at the application <a href="https://github.com/FoodStandardsAgency/register-a-food-business-service">here</a> for an example using npm, and <a href="https://github.com/FoodStandardsAgency/register-a-food-business-front-end">here</a> for an example using yarn. You can also compare the package.json files here for the difference between a dependency and a devDependency.</p><p>You’ll also notice the Docker files in these apps, which are used to run local versions of the applications isolated from the outside system. In production, these apps are deployed using <a href="https://azure.microsoft.com/en-gb/services/app-service/">Azure App Service</a>, which achieves the same result by isolating the application inside a Docker container.</p><p>Thanks for reading! If you have any comments or questions please post them below and I’ll get back to you. I’ll be periodically posting the rest of this series on Medium as well so keep posted if you fancy reading the rest.</p><p>You can also follow me on <a href="https://twitter.com/DjangoFS">Twitter </a>or <a href="https://github.com/Djangofs">GitHub</a> if you’re wild enough to think what I do is interesting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a0b64f3954c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The practical JS 12 factor application | I. Codebase]]></title>
            <link>https://djangoshelton.medium.com/the-practical-js-12-factor-application-i-codebase-325dc81389b0?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/325dc81389b0</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Thu, 03 Jan 2019 18:31:38 GMT</pubDate>
            <atom:updated>2019-01-04T17:06:34.629Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Note: This is part a 12 part series so stay tuned for more! <br><a href="https://medium.com/@djangoshelton/the-practical-js-12-factor-application-ii-dependencies-2a0b64f3954c">Next&gt;&gt;</a></blockquote><p>Over the last few years I’ve found using using the <a href="https://12factor.net/">12 Factor principles</a> to guide the way I build applications to be incredibly helpful in producing scalable, maintainable, and sensible results.</p><p>However, concrete examples of the principles in action and how they relate to JavaScript have been difficult to find, and so I’m hoping to solve this with this series of 12 articles covering, funnily enough, the 12 factors.</p><p>The material here is definitely not going to be ground breaking or revolutionary, but will hopefully provide some solid fundamentals and best practices in relation to JavaScript (both client and server side). As such it’s probably most relevant for anyone new-ish to JavaScript looking to understand how to build a real application in a scalable way, or for the more experienced developer who likes to refresh the fundamentals now and again.</p><h3>I. Codebase</h3><h4>One codebase tracked in revision control, many deploys</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*O0D-UcaM2HsZx50GHA-ZYw.png" /><figcaption>Image from: <a href="https://12factor.net/images/codebase-deploys.png">https://12factor.net/images/codebase-deploys.png</a></figcaption></figure><p>The first factor is a simple but very important one, partly as it frames the language we use to talk about “apps” for the rest of the factors. It boils down to:</p><ul><li>Use version control (Git etc), storing code in a repository or _repo_. A codebase is the repo (or set of repos with the same root commit).</li><li>One codebase per app. There is always a one to one relationship between codebases and apps.</li><li>Apps themselves comply with 12 factor.</li><li>Multiple apps sharing the same code is a violation of 12 factor.</li><li>Each codebase is deployed (a deploy being a running instance of the app) multiple times, likely to a production location, one or more staging locations, and every developers local copy.</li><li>Different versions may be active in each deploy, with local containing commits staging does not, and staging containing commits production does not.</li></ul><p>There are a few things I perceive to be benefits of this factor:</p><ul><li>You deploy applications, not systems. This means you can control which parts of the application need to change, speeding up release times and getting results to users faster. It also breaks your system down into smaller components (good!)</li><li>Shared code should be moved into libraries which are included in applications via dependency management. This reduces the amount of places you need to change shared code, and likely breaks your system down into smaller components (still good!)</li><li>With multiple deploys, changes can be verified, tested, and approved before being deployed to users (production). This allows you to make and deploy changes quickly with the confidence that your production deploy will produce the same results as other deploys, as they are part of the same codebase.</li></ul><h3>How does this apply to JavaScript?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*KOl42dl78T0rr-lwKi0KMA.png" /></figure><p>Let’s say you’re building a web form and an API which takes the input of the form and puts it into a database. You want to do validation both client side and server side to improve security and the user experience. You also want to test changes you make before releasing them to users to ensure that existing functionality isn’t broken.</p><p>While this <em>should</em> be a very simple scenario, there are a number of traps you could fall into which could lead to a lot of trouble further down the line.</p><p>Firstly, you could try to build and deploy this system as a single application (codebase). However, this means you have no granular control over which part of the system you’re trying to change. Say you find a bug in the API, once fixed you’ll have to rebuild and redeploy the web form and API, despite only changing one of those parts. In a world where reinstalling node_modules can take multiple minutes and the dependencies for client side and server side applications can be wildly different (think React vs Express) this can be a very expensive mistake to make. Alternatively, split this into multiple codebases which will keep your node_modules size down, reduce build time, and allow flexibility down the line — now there’s nothing stopping you from exposing the API to third parties, mobile applications etc if that need arises.</p><p>Once you’ve done this, it could be tempting to simply write some validation rules in both applications, and hope they match up. Tests for neither application will fail, but whenever a rule changes it requires developers to manually update the rules in both applications, and I certainly wouldn’t trust myself to nail that every time. JavaScript also has a lot of unintuitive parts around <a href="https://medium.freecodecamp.org/js-type-coercion-explained-27ba3d9a2839">type coercion</a>, <a href="https://flaviocopes.com/javascript-dates/">dates</a>, and who knows what else, making validation rules and changes to those rules non trivial. Luckily you’re probably already using the JavaScript package manager, <a href="https://www.npmjs.com/">npm</a>, to install something like Express or React, so you can <a href="https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages">create and publish your own npm package</a> and simply use this in both applications. Then all you need to do is ensure the version numbers in both applications are consistent, and voila they’re compatible. If you don’t require custom rules you can use great existing tools like <a href="https://www.npmjs.com/package/validator">Validator</a> to achieve the same result.</p><p>There are a host of different ways to deploy JavaScript applications, from <a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs">Heroku</a> to <a href="https://aws.amazon.com/developer/language/javascript/">AWS</a> but the details of this live outside the scope of this article. What’s more relevant is how you test both pre and post deploy in order to give confidence in that deploy. You’re going to likely want to use a unit testing tool like <a href="https://jestjs.io/">Jest</a>, a UI testing tool like <a href="https://webdriver.io/">WebDriver</a>, and some combination of the two to run integration, component, and E2E tests.</p><h3>So do you have any examples?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*FE_GIddaHDZ0rZo0pBrnrw.png" /></figure><p>Of course! If you take a look at the <a href="https://github.com/FoodStandardsAgency">Food Standards Agency GitHub</a> account you will see multiple repos referencing register-a-food-business. These are the different applications and libraries that make up the “Register a food business” service. You’ll notice there’s a split between the <a href="https://github.com/FoodStandardsAgency/register-a-food-business-front-end">front-end</a> and <a href="https://github.com/FoodStandardsAgency/register-a-food-business-service">service</a> repos, which represents a front-end application and a service which puts data into a database.</p><p>There is also the <a href="https://github.com/FoodStandardsAgency/register-a-food-business-validation">register-a-food-business-validation</a> repo which contains the shared validation rules between the applications.</p><p>Finally, the <a href="https://github.com/FoodStandardsAgency/register-a-food-business-UI-tests">UI tests repo</a> enables testing different releases, and the <a href="https://github.com/FoodStandardsAgency/register-a-food-business-front-end/tree/master/tests">test</a> <a href="https://github.com/FoodStandardsAgency/register-a-food-business-service/tree/master/tests">suites</a> inside each application are also run on build and deploy using <a href="https://github.com/FoodStandardsAgency/register-a-food-business-service/blob/master/azure-pipelines.yml">Azure Pipelines</a>.</p><p>Thanks for reading! If you have any comments or questions please post them below and I’ll get back to you. I’ll be periodically posting the rest of this series on Medium as well so keep posted if you fancy reading the rest.</p><p>You can also follow me on <a href="https://twitter.com/DjangoFS">Twitter </a>or <a href="https://github.com/Djangofs">GitHub</a> if you’re wild enough to think what I do is interesting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=325dc81389b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The (my) JavaScript Learning Process]]></title>
            <link>https://djangoshelton.medium.com/the-my-javascript-learning-process-3d7e49c023f0?source=rss-2a72e24b2d5b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d7e49c023f0</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Django Shelton]]></dc:creator>
            <pubDate>Sun, 21 Jan 2018 16:50:18 GMT</pubDate>
            <atom:updated>2018-01-21T16:51:06.825Z</atom:updated>
            <content:encoded><![CDATA[<h4>A journey through one learning path</h4><p><strong>Disclaimer:</strong> <em>This is just an exploration of the last two years or so of me learning JavaScript and Web Development. It’s not a path for others to necessarily follow nor would I recommend anyone to do that. The aim is to provide new developers with some perspective on the challenges when learning in this area. This is also not a collection of recommended blogs and tutorials — use at your own risk and with your own judgement.</em></p><p>Throughout the last two ish years I’ve gone from a brand new JavaScript developer to someone who (shockingly) is slightly less brand new. During that time I’ve built a bookmarks folder called “Web Dev”, which was a dumping ground for anything I found interesting or needed to reference frequently. When looking back over it, I realised a lot about the process I went through when learning JavaScript, and I hope that articulating that process can give some perspective to JavaScript developers both new and old about the learning process we go through, especially at the beginning.</p><h4>TL;DR</h4><p>If you don’t feel like reading the whole thing, there are three main points I’d like any new developer to pick up from this.<br>- It gets better, you have to walk before you can run<br>- It’s ok to feel overwhelmed<br>- You’re never done learning</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xrR4X-0V5mitji2e2gXH0w.jpeg" /><figcaption>The “I have no iea what’s going on” stage</figcaption></figure><p>- <a href="https://docs.npmjs.com/getting-started/what-is-npm">https://docs.npmjs.com/getting-started/what-is-npm</a><br>- <a href="https://docs.angularjs.org/guide">https://docs.angularjs.org/guide</a><br>- <a href="http://rogerdudler.github.io/git-guide/">http://rogerdudler.github.io/git-guide/</a><br>- <a href="https://24ways.org/2013/grunt-is-not-weird-and-hard/">https://24ways.org/2013/grunt-is-not-weird-and-hard/</a><br>- <a href="https://www.codecademy.com/articles/command-line-commands">https://www.codecademy.com/articles/command-line-commands</a><br>- <a href="http://microservices.io/patterns/microservices.html">http://microservices.io/patterns/microservices.html</a><br>- <a href="https://thinkster.io/tutorials/mean-stack">https://thinkster.io/tutorials/mean-stack</a></p><p>I think this is the most common stage to be in when learning, and to be honest is the most exciting because it means you’re actually picking up something new and being truly challenged. I find myself returning to this stage almost every other day, and that’s great!</p><p>The topics I find in my “Web Dev” folder at this early stage are typically broad and cover some of the most basic concepts in web development today — I distinctly remember searching “What is npm” into Google and clicking on the first result, bookmarking it immediately. Other highlights include the root link to the AngularJS documentation (I knew I would be here a lot), and several links about git and the command line. Things that I now take for granted as second nature, I felt the need to bookmark and reference frequently. It’s also interesting to note the high level descriptions of Microservices and MEAN-stack — things I definitely remember hearing in meetings, having no idea what they were, and researching later.</p><p>There’s also an interesting point here about tooling — I bookmarked an article on Grunt from 2013, which I have barely seen used recently. However, the concepts around automation of repetitive tasks, minification and optimisation of code, and writing modular code, still remain relevant. It’s important to not worry too much about the particular tools you’re learning, but to also aim to grasp the underlying concepts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*77ESABihkY-1pZd-dnucIA.jpeg" /><figcaption>The “OK I understand the basics, how do I not be terrible at this” stage</figcaption></figure><p>- <a href="https://scotch.io/tutorials/angularjs-best-practices-directory-structure">https://scotch.io/tutorials/angularjs-best-practices-directory-structure</a><br>- <a href="http://briantford.com/blog/huuuuuge-angular-apps">http://briantford.com/blog/huuuuuge-angular-apps</a><br>- <a href="https://www.jvandemo.com/how-to-configure-your-angularjs-application-using-environment-variables">https://www.jvandemo.com/how-to-configure-your-angularjs-application-using-environment-variables</a><br>- <a href="https://css-tricks.com/gulp-for-beginners/">https://css-tricks.com/gulp-for-beginners/</a><br>- <a href="https://bitsofco.de/styling-broken-images/">https://bitsofco.de/styling-broken-images/</a><br>- <a href="http://andyshora.com/unit-testing-best-practices-angularjs.html">http://andyshora.com/unit-testing-best-practices-angularjs.html</a><br>- <a href="http://blog.umur.io/2013/07/02/angularjs-directives-using-isolated-scope-with-attributes/">http://blog.umur.io/2013/07/02/angularjs-directives-using-isolated-scope-with-attributes/</a><br>- <a href="http://nvie.com/files/Git-branching-model.pdf">http://nvie.com/files/Git-branching-model.pdf</a><br>- <a href="https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md">https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md</a><br>- <a href="https://maintainablecss.com/">https://maintainablecss.com/</a><br>- <a href="https://code.tutsplus.com/tutorials/mastering-angularjs-directives--cms-22511">https://code.tutsplus.com/tutorials/mastering-angularjs-directives--cms-22511</a></p><p>So I was past the initial hump of understanding some basic concepts, but needed to understand how to build something beyond “Hello World!” and the Todo MVC. At this point you’re probably still picking up new tools (Gulp for beginners), but you’re also learning how to do things *properly* — note the articles on best practices in directory structure and unit testing. Things like style guides also began to appear, as well as articles demonstrating some more advanced ideas in Angular (isolated scope, environment variables for deploying to multiple environments).</p><p>Something important to note is the approach at this point was still scattergun — Angular style guides mixed in with CSS guides, mixed with git branching models. This is probably due to a lot of “firefighting” — noticing problems, and then reacting to those problems. Again, I think this is a normal part of the learning process. While you don’t really understand the bigger picture yet, you can see problems when they occur and make steps to ensure they don’t happen again. Troubleshooting is reactionary rather than proactive, something which naturally comes later on down the line…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oIu8L_JRP1RHJVDn0mQDfg.jpeg" /><figcaption>The “I sort of get this now, what else can I learn” stage</figcaption></figure><p>- <a href="https://github.com/gauntlt/gauntlt">https://github.com/gauntlt/gauntlt</a><br>- <a href="https://auth0.com/">https://auth0.com/</a><br>- <a href="https://uxchecklist.github.io/">https://uxchecklist.github.io/</a><br>- <a href="https://www.cloudbees.com/blog/using-pipeline-plugin-accelerate-continuous-delivery-part-3">https://www.cloudbees.com/blog/using-pipeline-plugin-accelerate-continuous-delivery-part-3</a><br>- <a href="https://uidb.io/">https://uidb.io/</a><br>- <a href="https://hackernoon.com/using-yarn-with-docker-c116ad289d56">https://hackernoon.com/using-yarn-with-docker-c116ad289d56</a><br>- <a href="https://medium.com/level-up-web/the-ultimate-list-of-best-free-tools-resources-for-front-end-web-developers-983c65de3300">https://medium.com/level-up-web/the-ultimate-list-of-best-free-tools-resources-for-front-end-web-developers-983c65de3300</a><br>- <a href="http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/">http://tobyho.com/2015/01/09/headless-browser-testing-xvfb/</a><br>- <a href="https://addyosmani.com/resources/essentialjsdesignpatterns/book/">https://addyosmani.com/resources/essentialjsdesignpatterns/book/</a><br>- <a href="https://12factor.net/">https://12factor.net/</a><br>- <a href="https://medium.com/@cramirez92/build-a-nodejs-cinema-microservice-and-deploying-it-with-docker-part-1-7e28e25bfa8b">https://medium.com/@cramirez92/build-a-nodejs-cinema-microservice-and-deploying-it-with-docker-part-1-7e28e25bfa8b</a><br>- <a href="https://github.com/ryanmcdermott/clean-code-javascript">https://github.com/ryanmcdermott/clean-code-javascript</a><br>- <a href="https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4">https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4</a></p><p>This stage was my natural progression once I was able to do most tasks efficiently and without much new research. With the extra time I began looking past what was required to just “do my job”, and instead looked at bigger picture tools and frameworks, such as the 12 Factor App, uxchecklist, Clean Code Javascript, or JS Design Patterns. These ideas were a reaction to the “firefighting” approach mentioned earlier, and part of a shift to a more proactive problem solving mindset. If implemented early on the concepts in the 12 Factor App would save you so much time and pain, but of course there would be no way of knowing what a 12 Factor App should look like when you haven’t figured out what npm is yet.</p><p>Beyond proactive problem solving, there are also some forays into more complex problems which raise their head when building web applications. Security testing tools (gauntlt), authorisation services (auth0), yarn, Docker, and even headless browser testing all make appearances. Again, all these tools are often essential on projects, and can save huge amounts of time and effort. However, they would be impossible to understand let alone implement without the basics, and so it makes sense they appear at this later stage. I’m sure I came across words like “Docker” or “Containerisation” early on, and either looked them up then forgot about them, or just ignored them entirely. Only when I was able to understand the reasons for these tools or services to exist, was I able to process and learn how to use them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*njB1KT9MSR6qvGXFnVNuYQ.jpeg" /><figcaption>Beyond JavaScript…</figcaption></figure><p>- <a href="https://gobyexample.com/">https://gobyexample.com/</a><br>- <a href="http://jordanorelli.com/post/32665860244/how-to-use-interfaces-in-go">http://jordanorelli.com/post/32665860244/how-to-use-interfaces-in-go</a><br>- <a href="https://talks.golang.org/2014/organizeio.slide#9">https://talks.golang.org/2014/organizeio.slide#9</a><br>- <a href="https://nordicapis.com/writing-microservices-in-go/">https://nordicapis.com/writing-microservices-in-go/</a> <br>- <a href="https://tutorialedge.net/golang/creating-restful-api-with-golang/">https://tutorialedge.net/golang/creating-restful-api-with-golang/</a></p><p>There was always one question nagging at me though, and that was _why_ JavaScript. I understood it ran in the browser and that made sense for front-end projects, and I understood that it then made sense to build a “full-stack” team who could also write a node.js backend. But what I didn’t see was any rationalisation about when JavaScript may not be the best tool, and in those situations what other options might exist. On a week off (and because I’m incredibly boring) I set out to learn Go, which I’d seen a few headlines on. It was a painful, eye-opening, thought provoking experience, and I would encourage anyone learning JavaScript to do something similar. It doesn’t have to be Go, but getting started with any other backend language will enable you to get some perspective on JavaScripts strengths and weaknesses, and probably give you a lot of techniques for writing better JavaScript in general.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a4RgdYAm0Ugkc1lYdhfysQ.jpeg" /><figcaption>The Cycle</figcaption></figure><p>Through writing this post I’ve realised I went through a cycle while learning JavaScript, and that’s the same cycle I go through all of the time when learning something new. From starting small and being incredibly confused, to starting to understand and getting better at the basics, to expanding and looking beyond what I had originally set out to learn. The expansion stage also naturally links back to the first stage, as you discover new concepts and begin to explore them. This happens at both the macro scale (the two year cycle of links collected here) and at the micro scale, where every single day is normally a journey through these stages!</p><p>It’s this constant state of learning that makes me love being a developer, and if you’re just starting out I hope you share that excitement.</p><p>It’s interesting to note that I haven’t bookmarked any links into this folder in the last 6 months. For some reason I’ve less felt the need to collect or hoard information, and instead rely on being able to find what I need when I need it. Of course this doesn’t mean I’m finished learning, just that I’m now confident in the process of learning. The JavaScript world doesn’t seem so overwhelming anymore.</p><p>Thanks for taking the time to read this! If you liked it, you can find other articles I’ve written <a href="https://medium.com/@djangoshelton">here</a>, or find me on <a href="https://twitter.com/DjangoFS">Twitter</a>, <a href="https://www.instagram.com/djangofs/">Instagram</a>, and <a href="https://www.linkedin.com/in/django-shelton-99a07aa0/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d7e49c023f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>