<?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[Brigad Engineering - Medium]]></title>
        <description><![CDATA[Brigad’s technical blog - Medium]]></description>
        <link>https://medium.com/brigad-engineering?source=rss----5f46552aeaa0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Brigad Engineering - Medium</title>
            <link>https://medium.com/brigad-engineering?source=rss----5f46552aeaa0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 16:00:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/brigad-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Produce more declarative TypeScript code with pattern matching]]></title>
            <link>https://medium.com/brigad-engineering/produce-more-declarative-typescript-code-with-pattern-matching-26a58c71f986?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/26a58c71f986</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[pattern-matching]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[Adrien HARNAY]]></dc:creator>
            <pubDate>Fri, 30 Sep 2022 10:14:43 GMT</pubDate>
            <atom:updated>2022-09-30T10:14:43.306Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="wall of colored tiles" src="https://cdn-images-1.medium.com/max/1024/1*Kcs1Ln0CmIQgID7A3ny6KQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@socialcut?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">S O C I A L . C U T</a> on <a href="https://unsplash.com/s/photos/pattern-matching?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><em>If you are not yet familiar with how type inference works in TypeScript, I would suggest you start with </em><a href="https://engineering.brigad.co/understanding-typescript-type-inference-and-const-assertions-4879db1cb980"><em>my previous article on the topic</em></a><em>.</em></p><p>TypeScript’s static type checking is really powerful, and language features like <a href="https://www.typescriptlang.org/docs/handbook/type-inference.html">type inference</a> and <a href="https://www.typescriptlang.org/docs/handbook/2/narrowing.html">type narrowing</a> really make the language a joy to work with. But maybe you found yourself having to <strong>handle all of the possible types a variable could be</strong>, or wanting to <strong>narrow it to just a specific type</strong>, and you had to write a lot of code — often very imperative code.</p><p>Now there is nothing wrong with imperative code, but when working with some data structures or languages (e.g. JSX / React) it can be better to go declarative. <strong>This is where pattern matching shines!</strong></p><h3>What is pattern matching?</h3><p>From the <a href="https://github.com/gvergnaud/ts-pattern#what-is-pattern-matching">ts-pattern documentation</a>:</p><blockquote><a href="https://stackoverflow.com/questions/2502354/what-is-pattern-matching-in-functional-languages">Pattern Matching</a> is a code-branching technique coming from functional programming languages, which lets you scrutinize the structure of values in a declarative way. It has proven itself to be less verbose and more powerful than imperative alternatives (if/else/switch statements), especially when branching on complex data structures or on several values.<br>Pattern Matching is implemented in Haskell, Rust, Swift, Elixir and many other languages.</blockquote><h3>What problem does pattern matching solve?</h3><p>Let’s see a simple example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TI2R_9ulQXm2BacFcOk46Q.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/MYewdgzgLgBA5gUygOSQdxAJwNYFkEQQCGiMAvDABRjpbYDKURUArhAFwwDkAlmD1B5EANlxgAfbsJBEAJnzhjJXCC2DACEJdwBmRHsJaYEXAJTkAfDADeAKBgweOqjSgYcjZm3JkKvfoIiZjb2DjDGrJhg3AAqABYIMLLMRDBoBsIw0nIwEHFYUMIAngB0XKEAvrahTi60HkysED5+2fJgiuZ2YeFIRtFc8YnJTI7NbQplldUOtdT1DI3evn6q6prB3WER-bEJSSljvXKl5Q5VoTtRewjGaUTNqQAOmCAARsIIALa9UJg8CAAbgoYFB9iMiFMKkA">TypeScript playground link</a></figcaption></figure><p>This code has a few issues:</p><ul><li>Adding a new type to the union type of networkStatus will be handled like the &#39;failure&#39; type. This code is not as “future-proof” as it could be.</li><li>This code has to be declared inside a function to be called inside JSX. You cannot use if statements inside JSX, only ternaries.</li><li>With a string as a data structure, it is pretty straightforward; but when you have to deal with more complex data structures or when you need to nest branches, it can become cumbersome.</li></ul><h3>How can I use pattern matching in TypeScript?</h3><p>You may have guessed it, <a href="https://github.com/gvergnaud/ts-pattern">ts-pattern</a> is an excellent library to introduce pattern matching in TypeScript. Let’s rewrite the previous example:</p><figure><img alt="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgHIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAUTcVIDKMNAFcKALjLAmwGMBQAbUnAA+ZaxBQATM-zuPSFfenRyFF5k+CjA1vpQ9KQAlCoAfIjscHBRMJFMyGhYGlpQkroGFDHJKXAAdGIWmGqkZhZWtgA06nHKiaQAKpj0cK5oKHBV1tZwzm5wFJjQMNYAnuWxpSmV1bXj7kyeLWptHd29-XpwwBRjLpv8iyVlFVUwNT5+AfKkO3tkB30DJ2dRbgslrdVg9aqFwpFou8Ep8elEhigzoMwEQAEbWegkNJQYD0ABuHjgD0OA2uywq9AAHpgUIZLHj6LsODggA" src="https://cdn-images-1.medium.com/max/1024/1*p9cxjR0z1AN_Ta39B0DucA.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgHIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAUTcVIDKMNAFcKALjLAmwGMBQAbUnAA+ZaxBQATM-zuPSFfenRyFF5k+CjA1vpQ9KQAlCoAfIjscHBRMJFMyGhYGlpQkroGFDHJKXAAdGIWmGqkZhZWtgA06nHKiaQAKpj0cK5oKHBV1tZwzm5wFJjQMNYAnuWxpSmV1bXj7kyeLWptHd29-XpwwBRjLpv8iyVlFVUwNT5+AfKkO3tkB30DJ2dRbgslrdVg9aqFwpFou8Ep8elEhigzoMwEQAEbWegkNJQYD0ABuHjgD0OA2uywq9AAHpgUIZLHj6LsODggA">TypeScript playground link</a></figcaption></figure><p>We just solved all of the problems we had with the previous version of the code.</p><p>Calling .exhaustive() ensures we covered all of the possible types for networkStatus, and if we add a &#39;timeout&#39; type to the union we get a comprehensive error:</p><figure><img alt="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgHIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAUTcVIDKMNAFcKALjLAmwGMBQAbUnAA+ZaxBQATM-zuPSFfenRyFF5k+CjA1vpQ9MHkoPQQ+jCkAJQqAHyI7HBwUTCRTMhoWBpaUJK6BhTJWdlwAHRiFphqpGYWVrYANOqpyhmkACqY9HCuaChwjdbWcM5ucBSY0DDWAJ51KTXZDU0tc+5Mnt1qvf1DI2N6cMAUsy4H-BvVtfWNMM0+fgHypMenZOdRuNrrcom51psXjt3i1QuFItE-ukAcMopMULcJmAiAAjaz0Ei5KDAegANw8cHeF3GTy2cE4DMZnCh9AAHpgUIZLKT6CcODggA" src="https://cdn-images-1.medium.com/max/1024/1*VuTLHD6SrW63EMeToFiuew.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgHIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAUTcVIDKMNAFcKALjLAmwGMBQAbUnAA+ZaxBQATM-zuPSFfenRyFF5k+CjA1vpQ9MHkoPQQ+jCkAJQqAHyI7HBwUTCRTMhoWBpaUJK6BhTJWdlwAHRiFphqpGYWVrYANOqpyhmkACqY9HCuaChwjdbWcM5ucBSY0DDWAJ51KTXZDU0tc+5Mnt1qvf1DI2N6cMAUsy4H-BvVtfWNMM0+fgHypMenZOdRuNrrcom51psXjt3i1QuFItE-ukAcMopMULcJmAiAAjaz0Ei5KDAegANw8cHeF3GTy2cE4DMZnCh9AAHpgUIZLKT6CcODggA">TypeScript playground link</a></figcaption></figure><p>It is also possible to call .run() instead of .exhaustive() to not check for exhaustiveness, or to call .otherwise(() =&gt; &#39;Something else happened&#39;) to keep the behaviour we had with the last return statement of our first example and have a fall-through case.</p><p>As the code doesn’t rely on if statements, if can safely be called in JSX:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TveecORLzKOJJa5SFBez9g.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wG4AoUSWOAbzhBRjQAs4BfObXAmAZwC0YJjCRQAdmXLk0EcX3gA5JDADu0ANYBZJHz4oA5kjgBeOAApa5OHHEr1UDQGUYTAK58ANOXYAuOta29pou7nz++MDiwDDAKAA2+HAAPgTxECgAJlEGSan4fG5oaLp8eQSYKMDxbkRS7ACUpgB8ATZEMLXiFoE2ADzNvTZ0jMws5nZqIa6dfA1Dw3AAdKox45HRsQn4nhZNJq34ACosxplMKHCr8fFw6VlwfCzQMPEAnkv484uLK2vm+Hu2XEuV25n2hxOZwucGAfDuGWBBk+3x+Nj+MHWhWKpR2exaBChcHOrlh8KIWQ+XwWwwx60q1VqSDx4IJx1ORCuKHhlzAOAARvEkHgOlBgEgAG45OCY6GuFE09FIAAeLBQHliEqQ4PYQz6AHpBjYGhR2BQgA">TypeScript playground link</a></figcaption></figure><p>Also, ts-pattern works well with all data structures and I encourage you to check their documentation for advanced examples (e.g. the <a href="https://github.com/gvergnaud/ts-pattern#ismatching">isMatching</a> function).</p><h3>Can ts-pattern only match literal values?</h3><p>It can do much more than that! Let’s see a few other examples so you can see what is possible.</p><p>Type narrowing in branches:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gVe6gyBTIGTioEiv1Sp3Yg.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgCIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAU7OHCbipAIQgATAJ4AuTVrgAfRHD5oArhVNlgTYDGAoANqVwWtGyR7GCcXUm8IFEM3fj8cAOtbELCyCgd0dDkKNjhDNBQXACV6bihDAB4+KFiAGjsYGqZ+AD5-AEoVNoQLKCEHZmQ0LDUdGAkoSQMTdsSAOjEPTDVgmEdnV3dPH3j6tU7lNtIAFUx6PIK4Re9vOEjou0xoGG9jOdJZyzgFpZWG9fC9xizV26gOR1O53yazgwAodyiwP470+lh+MGWiS0qwBaQyWXkuyxcAA9CS4AADABGRmMFLgAHJ4TBjGBzpgUPCqfR6ExtCgoEQxPRDHAYBBkmtQhtSOlMtlctDCnASmVKtU6g0mq1-Jw9V8tGoaTMumRIRcYXC4H1osZ6mc+rD4HDTH4ANRwABSAGUAPLCOYa5rAfDGI20uZK1FaaPfegADw5Tk8ADd6PsODgOEA">TypeScript playground link</a></figcaption></figure><p>Branching on primitive types:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAZWQeFxEUp2oD4bGzChPQ.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCwDRwApowCmUAdnAL5wBmUEIcARDAM4C0YhJpjA3AFD90EUi3gBzIjAByUgO7QA1gFkiLFiklwAvHAAUpeUoBCEACYBPAFyJ+cOGbQobAV1Jmi1YIbNwAPnBiUN7i-oEwwaTiANoAugIUAJQ6AHy29lBSLmTIaFgGRlCKppaJdvZwAHRywDCYekiOMM5wbh5ePpS4esnaaYwAKpgkRHDALHCkEA5OcDDTZuNgADYoFpWMZRVVNXV65duNTjYEMMRklUEhXQcVegBG5ha9-UOjTShjE5kolrjDmTG8HGVkYcAA1HBHpZKh9blsKtVavVbvYjs0TlwLigoFA1npTudSJcIiFkhRsKj9NDnqkmG8Zs0vnAfn84ADRrUvqCIVCnrCnJUAFYQbx6ADkuHFCPsMqqRAAHpgUC4xMAAG5EHoJARAA">TypeScript playground link</a></figcaption></figure><p>Branching on values with .when():</p><figure><img alt="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgCIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAUTcVIDKMNAFcKALjhN9IAEaMAlCoB8idnDhQh+5sjRYNWqJN0GFNZOznAAdGKY9Ewa5vamcQA8cADMAAxpADTqtsoOAOQAKlFw6CgANuVwYigUcBT66OhyFPj65WH5waHhkdGxJHkJg8qqAKwZ2Wq5BdrEQpjATPwu9BXlAJ5wFigAJnCYKGBg0fS7nd2hYRAwUVBiwBT0atPxRSVllQQowOVnFxwcBwgA" src="https://cdn-images-1.medium.com/max/1024/1*N0nCoCroTdO1sbidcH1Xpw.png" /><figcaption><a href="https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbziAhjAxgCzgXzgMyghDgCIYBnAWjDRgFMoA7UgbgCh30ImL4BzejAByQgO7QA1gFl6FCikFwAvHAAUTcVIDKMNAFcKALjhN9IAEaMAlCoB8idnDhQh+5sjRYNWqJN0GFNZOznAAdGKY9Ewa5vamcQA8cADMAAxpADTqtsoOAOQAKlFw6CgANuVwYigUcBT66OhyFPj65WH5waHhkdGxJHkJg8qqAKwZ2Wq5BdrEQpjATPwu9BXlAJ5wFigAJnCYKGBg0fS7nd2hYRAwUVBiwBT0atPxRSVllQQowOVnFxwcBwgA">TypeScript playground link</a></figcaption></figure><p>There are lots of other features, check out the <a href="https://github.com/gvergnaud/ts-pattern">documentation</a>!</p><h3>Conclusion</h3><p>ts-pattern is a nice addition to our tool kit and we use it extensively at <a href="https://www.linkedin.com/company/brigad">Brigad</a> to produce more readable, concise and declarative code!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26a58c71f986" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/produce-more-declarative-typescript-code-with-pattern-matching-26a58c71f986">Produce more declarative TypeScript code with pattern matching</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding TypeScript type inference and const assertions]]></title>
            <link>https://medium.com/brigad-engineering/understanding-typescript-type-inference-and-const-assertions-4879db1cb980?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/4879db1cb980</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Adrien HARNAY]]></dc:creator>
            <pubDate>Thu, 02 Dec 2021 13:10:51 GMT</pubDate>
            <atom:updated>2021-12-02T13:48:01.801Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A plane dashboard with lots of buttons and levers, and a pilot and copilot" src="https://cdn-images-1.medium.com/max/1024/1*3iQJYToENYNqzhMUnLADDQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@franzharvin?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Franz Harvin Aceituna</a> on <a href="https://unsplash.com/s/photos/copilot?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><a href="https://www.typescriptlang.org/">TypeScript</a> is “a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale”. By statically checking your code (during development), <strong>TypeScript shields you from runtime errors</strong> <strong>and is a great copilot for small to enormous projects</strong>.</p><p>That being said, <strong>when I introduce TypeScript to newer developers, there comes a moment when it slows them down</strong> instead of helping them. I believe this is due to the learning curve of TypeScript: it will first take you time to learn when to use which features of the language, and you might be tempted to type everything “just to be safe”, but this ends up taking you a lot of time for no real benefit.</p><p>How to get past this point? This is what I will try to cover in this article, focusing mainly on <strong>type inference </strong>and<strong> const assertions</strong>.</p><h3>Type inference in TypeScript</h3><p>Unlike some other typed languages with which we are required to type everything, <strong>TypeScript is able to understand most of the code we will write without explicitly writing types</strong>.</p><p>Consider the following code:</p><figure><img alt="const implicit = 1; const explicit: number = 1;" src="https://cdn-images-1.medium.com/max/748/1*jmT3N4cEmQ4-mDtm_U7DKw.png" /><figcaption>TypeScript understands the `implicit` variable is a number</figcaption></figure><p>Here, TypeScript is able to <strong>infer</strong> the type of the implicit variable. This means we don’t need to specify it ourselves! Even more so, <strong>not explicitly specifying the type is better</strong> because TypeScript infers the type to be 1 instead of number, which is <strong>more precise and closer to reality</strong>.</p><p>This brings us to a very important rule I follow when writing code with TypeScript:</p><blockquote>Only write types when TypeScript does not understand what we are doing.</blockquote><p>Expanding on our previous example:</p><figure><img alt="const implicit = 1; const explicit: number = 1; const acceptOnlyOne = (number: 1) =&gt; {}; acceptOnlyOne(implicit); acceptOnlyOne(explicit);" src="https://cdn-images-1.medium.com/max/1024/1*amjRMcBSGQlKtrv_ay4rYw.png" /><figcaption>By explicitly setting the type to `number`, TypeScript doesn’t treat the value as valid for a function accepting `1`</figcaption></figure><p>The acceptOnlyOne function will only accept 1 as an argument. When defining the type as number for a variable, even if the value is in fact 1, <strong>the function will not accept it</strong>. As we said earlier, it is better to <strong>not type the variable and let TypeScript infer its type</strong>.</p><p>The same principle applies to function return types:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*KBeioB_nSoQo85XPP-Utyg.png" /></figure><p>Typing the function return does not bring any value, and <strong>at worst prevents TypeScript from inferring a precise type</strong>.</p><h3>Const assertions</h3><p>TypeScript type inference works in the example above because we are defining a variable using the const keyword and assigning it a literal value. TypeScript <strong>understands the value is read-only</strong>. What would happen if we wanted to assign an object, an array, or the return value of a function?</p><figure><img alt="const implicit = { number: 1 };" src="https://cdn-images-1.medium.com/max/610/1*J2VeZV5md9WC-Km1cvYzyQ.png" /><figcaption>As objects are mutable in JavaScript, the type for the properties of the object is generic</figcaption></figure><p>As we can see, implicit.number is inferred as a number, not as 1.</p><p>If we need to pass it to a function that accepts only objects with certain values as properties:</p><figure><img alt="const implicit = { number: 1 }; const acceptObjectWithOnlyOne = (obj: { number: 1 }) =&gt; {}; acceptObjectWithOnlyOne(implicit);" src="https://cdn-images-1.medium.com/max/1024/1*j4ECZJUbG5uDlJs1r2aCSA.png" /><figcaption>The function won’t accept the object because the type for the `number` property is too generic</figcaption></figure><p>We can see the function will not accept the parameter because the type has not been inferred as a literal value but as a generic type. <strong>We need to perform a const assertion</strong>.</p><figure><img alt="const implicit = { number: 1 } as const;" src="https://cdn-images-1.medium.com/max/764/1*_UdIT1jnuLsEIft5RIaP1w.png" /><figcaption>By using `as const`, TypeScript properly infers the type for the properties of the object</figcaption></figure><p>By using as const on a variable, we hint TypeScript that it is read-only and we <strong>narrow the type to its literal value</strong>.</p><p>This brings us to a second rule I follow when writing code with TypeScript:</p><blockquote>Always use const assertions when working with objects, arrays, and return values of functions if we need precise types.</blockquote><figure><img alt="const implicit = { number: 1 } as const; const acceptObjectWithOnlyOne = (obj: { number: 1 }) =&gt; {}; acceptObjectWithOnlyOne(implicit);" src="https://cdn-images-1.medium.com/max/1024/1*da9JYkxQZuT1qecRjX9xeA.png" /><figcaption>By using `as const`, the acceptObjectWithOnlyOne function accepts the object because it properly infers the type of its properties</figcaption></figure><p>It also works with arrays:</p><figure><img alt="const numberArray = [1, 2, 3];" src="https://cdn-images-1.medium.com/max/676/1*By5ikXe8twki_GD2E9bFJQ.png" /><figcaption>Declaring an array, the type will always be generic when not using `as const`</figcaption></figure><figure><img alt="const numberArrayConst = [1, 2, 3] as const;" src="https://cdn-images-1.medium.com/max/960/1*qwhHU_fV1FO4MLaIlSR3Xg.png" /><figcaption>When using `as const`, the type of the array is narrowed to the literal value</figcaption></figure><figure><img alt="let state = 0; const incrementState = () =&gt; { state = state += 1; } const mixedArray = [state, incrementState]; const firstElement = mixedArray[0];" src="https://cdn-images-1.medium.com/max/916/1*Nbj06YxeWle2zkZVowCzNQ.png" /><figcaption>Mimicking the return of React’s useState, we define an array of size 2 (or tuple) with a state and a setter. When accessing the first element, TypeScript does not correctly infer the type</figcaption></figure><figure><img alt="let state = 0; const incrementState = () =&gt; { state = state += 1; } const mixedArray = [state, incrementState] as const; const firstElement = mixedArray[0];" src="https://cdn-images-1.medium.com/max/940/1*H8XcpeROqqUcHRgzWwbqpQ.png" /><figcaption>When using `as const`, TypeScript understands the first element is a number</figcaption></figure><p>And for function returns:</p><figure><img alt="const getMessage = () =&gt; ‘Hello!’; const message = getMessage();" src="https://cdn-images-1.medium.com/max/658/1*-T7lbv6bwzKZWSg9iAIAHg.png" /><figcaption>The return value of a function is always inferred in a generic way when not using `as const`</figcaption></figure><figure><img alt="const getMessage = () =&gt; ‘Hello!’ as const; const message = getMessage();" src="https://cdn-images-1.medium.com/max/792/1*vxvNqx3Kr_PDv8ZHUCqErQ.png" /><figcaption>When using `as const`, the return type of the function is narrowed to the literal value</figcaption></figure><h3>Wrapping up</h3><p>There are a lot of advanced concepts that will make writing code with TypeScript a more pleasant experience, but focusing on <strong>type inference</strong> and <strong>const assertions</strong> at the beginning will save you a lot of time and will make TypeScript work for you instead of against you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4879db1cb980" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/understanding-typescript-type-inference-and-const-assertions-4879db1cb980">Understanding TypeScript type inference and const assertions</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Native — Monorepos & Code Sharing]]></title>
            <link>https://medium.com/brigad-engineering/react-native-monorepos-code-sharing-f6c08172b417?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/f6c08172b417</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[yarn]]></category>
            <category><![CDATA[metro]]></category>
            <category><![CDATA[yarn-workspace]]></category>
            <dc:creator><![CDATA[Thibault Malbranche]]></dc:creator>
            <pubDate>Mon, 13 Jan 2020 17:25:50 GMT</pubDate>
            <atom:updated>2020-01-13T17:25:50.719Z</atom:updated>
            <content:encoded><![CDATA[<h3>React Native — Monorepos &amp; Code Sharing</h3><p>Let’s examine everything that might go wrong when trying to use React Native in a monorepo. Then, let’s fix it. 🎉</p><h4>But first… what’s a monorepo?</h4><p>Monorepos allow you to have multiple projects share common dependencies instead of installing the dependencies for each of them.<br>They also simplify sharing code between your projects, allowing you to import code from one package to another.</p><p>As an example, you might want to have a monorepo containing a website, a mobile application, and some shared code that you wrote.</p><p>One of the most popular options to do that is <a href="https://yarnpkg.com/lang/en/docs/workspaces/">yarn workspaces</a> — which means that, yes, It’s already built into your favorite package manager! 😄</p><figure><img alt="React Native x Yarn Workspaces" src="https://cdn-images-1.medium.com/max/972/1*a_32F_ZfpiQBllMbxCDP8g.png" /><figcaption>Save up some space by sharing node_modules</figcaption></figure><h4>Great! Let’s use it! What could go wrong? 😃</h4><p>While moving all the node_modules sounds like a great way to save so space, your dependencies code might end up somewhere where React Native struggles to find it. 😕</p><p>Let’s dive into the configuration adjustments you will need for your project to work perfectly.</p><p>Please note that this article was written while targetting React Native 0.61.5 and using React Native CLI 3.0.4, and configuration has been greatly simplified by the recent changes in the ecosystem. 💪</p><h4>Setting up the monorepo</h4><p>Following the yarn docs, if migrating from existing apps or creating a new project, add all your apps to a packages folder inside your monorepo, and run <em>yarn init</em> at the root.</p><p>Edit your package.json to add the <em>workspaces</em> field. You can either be specific or use globs. Don’t forget to run yarn!</p><figure><img alt="Package.json modifs" src="https://cdn-images-1.medium.com/max/272/1*WBoFBkcyjbDduz4zRPqN_w.png" /><figcaption>Adding the workspaces field to package.json</figcaption></figure><p><em>Optional step: Move all your config (prettier, eslint and others) to the top-level packages.json dependencies. This enforces the same coding style across your whole codebase, neat!</em> ✨</p><h4>Understanding what’s happening to your node_modules</h4><p><em>Disclaimer: This is my understanding of what’s happening with the yarn workspaces node_modules management, let me know if some things are incorrect.</em></p><p>Think of the workspaces resolution algorithm as the way to save to most space possible on your project.</p><p><strong>By default, any dependency will be “hoisted”</strong> (placed at the top-level). This allows installing dependencies only once even if they are used in multiple projects. Then it has to deal with version conflicts, the best way to save space is to share the versions that have <strong>the biggest number of packages</strong> needing it.<br><em>(You can enforce this via yarn resolutions)</em></p><p>This means that you should try to keep the same versions across your packages if you want to save space and workspace complexity for yarn because bumping some dependency might move many modules in the workspace. <em>(I remember once forgetting to update @types/react and having all the react-related dependencies moving down to the packages)</em></p><p>But in the end, you cannot really guarantee that some dependencies will stay somewhere, and <strong>that’s fine, this is how it’s supposed to work</strong>. <em>(You can force a dependency to stay inside a package by using no-hoist, but that should be avoided as it makes yarn workspaces kindof useless </em>😅<em>)</em></p><p><em>Pro-tip: if you want to look up all the versions and install directories of a dependency you can run “yarn why dependency”.</em></p><h3>Back to React Native, shall we?</h3><p>React Native has greatly simplified the use of monorepos <a href="https://github.com/react-native-community/cli/pull/768">recently</a> thanks to <a href="https://medium.com/u/3cb24422649f">Mike Grabowski</a>, and many others helping with the new CLI, but there are still a few quirks we need to take care of. <strong>But know that we are committed to making this as seamless as possible!</strong></p><h4>Solving issues in native files</h4><p>As a first step, we need to update paths to React Native and the cli <strong>if it has moved</strong> from your packages to the top of your monorepo because we use it in many native files, including Podfile, project.pbxproj, build.gradle, and settings.gradle. Our main issue here is that we would need to update the path every time it moves around in the monorepo.</p><p>Remember when I said: “<em>you cannot really guarantee that some dependencies will stay somewhere”. </em>There is another way than no-hoist to force a dependency to be somewhere. If you add a dependency to the workspace root, it will have no choice but to be at the top, so what I like to do to make sure React Native will have a consistent path in my node_modules is adding it to the top-level package.json. (Using “*” as the version number aligns it to the one in your packages)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/28821296355e8fff3fbc98f83cfad04d/href">https://medium.com/media/28821296355e8fff3fbc98f83cfad04d/href</a></iframe><p>Please note that <strong>if you choose to do this, it’s best to keep all your packages to the same React Native version</strong>, or you might end up using the wrong version in your project. ⚠️</p><p>Now that we know where React Native will be, we can update all the files referencing it. (I’m considering that React Native is hoisted at the root in my examples, but feel free to use the path where it’s installed for you)</p><p>If your React Native is still inside the packages folder node_modules, you maybe only need to update the CLI paths.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee21a53ca2e88d50c18dfc426394ed18/href">https://medium.com/media/ee21a53ca2e88d50c18dfc426394ed18/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa8e0e6fc3fe8f8f4f4c4d1946efaa48/href">https://medium.com/media/fa8e0e6fc3fe8f8f4f4c4d1946efaa48/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7874559845f7c5ad7663452b950478c1/href">https://medium.com/media/7874559845f7c5ad7663452b950478c1/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39a62c7c9bc142781763c730b97ca716/href">https://medium.com/media/39a62c7c9bc142781763c730b97ca716/href</a></iframe><p>Then you need to edit your project.pbxproj file, I would advise using your normal IDE (VSCode here) to prepend “../../” where needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CW2FPLLO7vJxJou9T2BG7w.png" /><figcaption>Replace paths inside pbxproj (screenshot before replacing, you probably want to add “../../”)</figcaption></figure><p>Then in the “Bundle React Native code and images” step, you want to add an export to specify the PROJECT_ROOT. I used XCode to edit it but use the tool you prefer.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e36738b95f5bcd96bfe5b6cef2795b9/href">https://medium.com/media/8e36738b95f5bcd96bfe5b6cef2795b9/href</a></iframe><p>Once you updated everything, do not forget to run pod install. <br>Since the V3 of React Native CLI, it will use <a href="https://nodejs.org/api/modules.html#modules_all_together">Node resolution algorithm</a> meaning that it will correctly find native dependencies even if they are hoisted. 🎉</p><p>Congrats you are done! <em>For the native part</em> 😏</p><h4>Making sure Metro ❤️ monorepos!</h4><p>Let’s get our favorite bundler to build properly, let’s edit metro.config.js and add the watchFolders field:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/48c9c086f8c87bde8ec37f1e0c2e1882/href">https://medium.com/media/48c9c086f8c87bde8ec37f1e0c2e1882/href</a></iframe><p>So now Metro is able to find all of our code! Great 😃</p><p>If you have <strong>multiple versions of React Native installed</strong> in your workspace, you want to exclude those of the haste module resolution. My workaround here is to use these few extra lines inside my metro config. What they do is exclude any react-native folder except for the one we need. Let’s use blacklistRE !</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c7384b79e9d018d88fb5a755d26c2c12/href">https://medium.com/media/c7384b79e9d018d88fb5a755d26c2c12/href</a></iframe><p>Another issue for android is that <a href="https://github.com/facebook/metro/issues/290"><strong>assets resolutions will not work</strong></a><strong> </strong>unless you use another workaround. If you plan on having shared assets (jpg, png, etc…), you need to add yet another few lines of dark magic. 🔮<br>You want to add publicPath and enhanceMiddleware. Please note that in the example you can prefix it by anything, but you need <strong>at least as many depths</strong> in your fake path that in your monorepo. See <a href="https://github.com/facebook/metro/issues/290#issuecomment-543746458">issue</a>!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/010327b6fc170661505d2f8092bb8aa9/href">https://medium.com/media/010327b6fc170661505d2f8092bb8aa9/href</a></iframe><h4>Last step before enjoying the sweet monorepo life</h4><p>This is not unique to React Native but some issue that you will often have is that some libraries will not work well at all with workspaces if you import some code from two different versions, or even from the same version installed in two places. (👋 <a href="https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react"><em>React</em></a><em>, React Navigation, React Native SVG, @apollo/react-hooks, apollo-client and many more…</em>)<br>For example, see <a href="https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react">https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react</a>.</p><p>To fight against this you can use babel and the <a href="https://github.com/tleunen/babel-plugin-module-resolver">module-resolver plugin</a>.<br>Inside my config, I force for a few known sensitive packages to be always resolved only one version, the one Node resolution algorithm would have found from the package repository. (Of course, you can add only your packages here!) 🐧</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5409d1daa8a15031a4595f48c704a7f/href">https://medium.com/media/c5409d1daa8a15031a4595f48c704a7f/href</a></iframe><h3>Congratulations if you made it till the end, now what?</h3><p>If you want to share some code between two packages you can include one package as a dependency in the package.json of another and it will just work. Even with native code!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6bbec3dc5111cff47743d64c02d2556/href">https://medium.com/media/e6bbec3dc5111cff47743d64c02d2556/href</a></iframe><p><a href="https://github.com/Brigad/monorepo-example">You can find a working demo here.</a></p><p>As always, I want to thank everyone that ever shared tips and tricks, as that is mostly just an aggregation of a lot of others solution that I remixed together and tried to simplify. Writing down all the current workaround needed is the first step to fixing those issues 😅.</p><p>Have fun and if needed you can reach me on <a href="https://twitter.com/titozzz">twitter</a>. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6c08172b417" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/react-native-monorepos-code-sharing-f6c08172b417">React Native — Monorepos &amp; Code Sharing</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A design system’s first steps]]></title>
            <link>https://medium.com/brigad-engineering/a-design-systems-first-steps-aa2f00bad63a?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/aa2f00bad63a</guid>
            <category><![CDATA[product]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[typography]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[colors]]></category>
            <dc:creator><![CDATA[Nicolas Weisslinger]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 10:30:29 GMT</pubDate>
            <atom:updated>2019-12-17T10:30:29.738Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9M1GK1sxmmAVflhsYoByw.jpeg" /></figure><p>If you are working on the early stages of a design system, you might not know where to start. Either you’re working with an existing product, and need to “retro-engineer” a design system from it, or you’re starting from scratch. There are a myriad of great articles that can walk you through this adventure, and a ton of companies that have produced some of the most robust design systems to take inspiration from (Google’s Material/IBM’s Carbon/Shopify’s Polaris…). But in my opinion, there are two things to be real careful about:</p><h4>Make the design system fit your needs.</h4><p>Unjustified complexity in your design system will <strong>always </strong>become a problem. If something is useless, then all thats left for it is to bring trouble. Your design system, in itself, must be a minimal viable product. Keep it as simple as possible. A good way to determine if something in your product is useless is through <strong>absence testing:</strong> if you’re having doubts on the purpose of something, take it down. If nothing happened, then you can keep it that way.</p><p>A design system helps bring the designer as close as possible to the front-end developer. In that sense, both parties need to settle on common ground, and one thing you can’t take away from developers is <strong>structure.</strong> Every front-end team today uses tools that allow for blazing-fast and stable development, at the cost of one thing: <strong>structure</strong>. Whatever you add to that structure will make it heavier, and more failure-prone. Ever been on a wobbly 4-legged stool ? Take one leg off, bend the 3 legs to form a triangle on the floor, problem solved!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mmakSm01PC6PjnP0" /><figcaption>3-legged stools don’t wobble</figcaption></figure><h4>Get the first few fundamental things right.</h4><p>Initializing a design system correctly can really save some time working on design and technical debt. If your structure is right from the start, then it’s much easier to pivot and adapt stuff in the future. The 3 key elements of our design system—the “atoms”—are <strong>Color, Spacing, and Typography.</strong></p><p>Here’s what these three pillars look like at Brigad:</p><h3><strong>1) The Color System</strong></h3><p>Here’s what our first color palette looked like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dx8u9Mw_dMnmDJC1hS5zuA.png" /><figcaption>Our first color palette</figcaption></figure><p>In this color palette, the only thing that defined a color was its hex code. They were named after the actual color they were. But this approach has two flaws:</p><ol><li>Imagine you have an <em>x-dark-grey</em> text, and for some reason, it’s not dark enough. You can either create another color xx-dark-grey, which adds complexity (no bueno), or directly change the value of the color <em>x-dark-grey. </em>The problem is you also had a background pointing to that same color, and now it’s too dark. Things can get pretty messed up.</li><li>Most of the time, as a designer, you never really know which color to use to stay consistent. You try to replicate patterns without really formalizing them.</li></ol><p><strong>So we transitioned to this:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bmh8uEz-lw2FWvwVhXKOTQ.png" /><figcaption>Our color system</figcaption></figure><p>The key difference between the color palette and the color system is the <strong>definition of a color.</strong></p><p>As much as possible, a color is defined by its <strong>function </strong>in the UI rather than the color itself (apart from the elementary colors, whose sole functions are to “be themselves”). Here’s how we benefit from this system:</p><ol><li>You always know which color to use, because their names are self-explanatory.</li><li>If ever we want to change a color in the future, we can do it super easily because we know exactly what will be impacted.</li></ol><p>However for this to work well, it’s important to spend enough time thinking about <strong>what you should consider being a color,</strong> and find a good balance between modularity and simplicity.</p><p>Also, because all our colors are now uncorrelated and secluded, it can be hard to maintain harmony, which is why it is always good to base the colors’ hex values on a color palette.</p><h3>2) The Spacing System</h3><p>Ever found yourself <em>Shift</em> - ⬆⬆⬆ ⬅➡⬆⬇-<em>ing </em>for ages until you find the right spacing? Moving things around until it looks right? The problem is there is a part of randomness as to what we find aesthetically pleasing, and remember, developers want <strong>structure. </strong>If you’ve decided to set a 10px margin here, a 12px margin there, 6.74 other there… and ever find yourself justifying these decisions to a developer, they might be like:</p><blockquote>bruuuh…</blockquote><p>Because it’s frustrating to have millions of constant values like these scattered around your code. What you want is a neat little framework that tells you what to do, in any situation, and allows you to bring everything down to a single true reference.</p><p>Similarly to colors, there are no <em>right</em> spacing values. You just have to settle on something that looks good enough, and stick to it.</p><p>Here are a handful of neat articles I’ve read, and have guided me through the creation of a first version of a spacing system:</p><ul><li><a href="https://medium.com/eightshapes-llc/space-in-design-systems-188bcbae0d62">Space in Design Systems</a></li><li><a href="https://medium.com/@ethersystem/generating-design-system-spacing-aa69714160bc">Generating Design System Spacing</a></li><li><a href="https://ether.thescenery.co/spacing/">Spacing | Allow for change gracefully with the ex unit.</a></li><li><a href="https://getaround.tech/design-system-spacings/">Ensuring consistent spacing in your UI | Getaround Tech</a></li><li><a href="https://blog.prototypr.io/a-framework-for-creating-a-predictable-and-harmonious-spacing-system-8eee8aaf773c">A framework for creating a predictable &amp; harmonious spacing system for faster design-dev handoff</a></li></ul><p>Some of these articles mention beautifully designed spacing systems, where spacing values are programmatically generated based on the ex-value of the main font of their styleguide. I loved it, that people had managed to formalize something that none of us really know what to do with—spacing.</p><p>But it was too complex, we didn’t need such performance.</p><p>So although some of these articles look like PhD papers, two accessible things stood out:</p><ul><li><strong>The 8-point grid<br></strong>Everyone’s talking about it, why not use it? 🤷‍♂️</li><li><strong>The Golden Ratio (1.618)<br></strong>Helps with information hierarchy. For some reason, if something has a size of <strong>1</strong>, and something next to it has a value <strong>1.618,</strong> it looks harmonious! 🤷‍♂️</li></ul><p>So here’s what we have for spacing values :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lL2qC2EM5WroJjHDoKRXDw.png" /><figcaption>The golden ratio score tells how close you are to the golden ratio between two values.</figcaption></figure><p>And here’s how to use them!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tDE26JJ3tPdr87URkEhTxw.png" /><figcaption>1st step: sorting out information hierarchy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pxA1rBR3i02kLDzzLGwcJQ.png" /><figcaption>2nd step: the spacing!!</figcaption></figure><p>Now to be perfectly honest, this is more of a guide than a framework. It’s far from perfect, and almost impossible to consistently respect, but at least it <strong>helps you</strong> <strong>understand </strong>why you have used this or that value<strong>, </strong>which is the first step towards creating a system.</p><h3>3) The Typography System</h3><p>Now this one is much simpler, I won’t go into too much detail because it doesn’t differ much from most typography systems, apart from one thing that’s seldom considered:</p><p><strong>Line-height</strong></p><p>The line-height is the <strong>real height</strong> one line of text will take up. It’s a <strong>css value</strong>, and it’s important you line up the line-heights of your designs with the line-heights the developers will be using in their code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*IdOVt4yRdn4LPu9F.png" /><figcaption><a href="https://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align">https://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align</a></figcaption></figure><p>Default line-height is somewhere around 1.4, meaning it takes up 140% of the font-size. You can also push it up to somewhere around 1.6 (Golden ratio 🤯) for a more harmonious spacing. Whatever you choose, you must be aligned with the developers for them to specify it in their css, or else browser default will take over (which isn’t necessarily your design tool’s default).</p><p>You can also specify pixel units for the line-height, and that’s what we did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n5wJg2hs2uKngmU9w8B_qA.png" /></figure><p>Notice anything?</p><p>All the line-height values are contained in the values of the spacing system above! And for the <em>Title</em> and <em>Body</em> typos, the (line-height)/(font-size) ratios are 93% and 82% close to the <strong>GOLDEN RATIO.</strong></p><h3>Conclusion</h3><p>We are still in the testing phase, but we are expecting this first framework to reduce time and randomness on low impact design tasks, along with guaranteeing consistency throughout our product.</p><p>The next steps are to broaden our design system to any element of the product that can be formalized: <strong>tone, animations, user flows… </strong>All of these will serve the same purpose of improving the performance of the product team.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa2f00bad63a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/a-design-systems-first-steps-aa2f00bad63a">A design system’s first steps</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How GraphQL can improve your development workflow]]></title>
            <link>https://medium.com/brigad-engineering/how-graphql-can-improve-your-development-workflow-d471f883778d?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/d471f883778d</guid>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Adrien HARNAY]]></dc:creator>
            <pubDate>Thu, 24 Oct 2019 15:33:48 GMT</pubDate>
            <atom:updated>2019-10-24T15:33:48.207Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QmRjeynEZkxQ8gv-IHbBHQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@slelham?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Steven Lelham</a> on <a href="https://unsplash.com/s/photos/team?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>There has been some discussion recently about whether GraphQL makes sense in an HTTP/2(3) world, followed by <a href="https://medium.com/@__xuorig__/is-graphql-still-relevant-in-an-http2-world-64964f207b8">an excellent article written by Marc-André Giroux</a>.</p><blockquote>GraphQL isn’t inherently special, and yes alternatives will exist! Typed schema? Just use OpenAPI! Server-side abstraction to handle multiple client use cases? There are many ways to do that. Introspection? Hypermedia can allow clients to discover actions and can start from the root too. The amazing GraphiQL? I’m sure there’s something for OpenAPI. It’s always possible to recreate parts of what GraphQL has. However, it’s everything together, found under one specification that made GraphQL appealing and great to so many of us.</blockquote><p>These words resonated the most with me and inspired me to share how GraphQL helped us improve our development workflow at Brigad, from the conception of the feature to the delivery.</p><h3>Pain points with our previous workflow</h3><p>Let’s start from the beginning: what was our initial situation and what are the reasons we needed to improve our workflow? Also, can you identify similarities with the way your development workflow?</p><p>Our previous workflow would look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*K5Ax0eODrkXXmHx3ngFuqw@2x.png" /><figcaption>Product -&gt; back-end -&gt; front-end -&gt; QA</figcaption></figure><p>The product would assess the problem, work on a solution and deliver it once finished. Then the back-end would implement all the routes needed to display/edit the data. Then the front-end would implement the UI and link it to the back-end. Then the QA would test the back-end and the front-end at the same time. When everyone’s clear on the solution and communication occurs naturally, this workflow isn’t so bad.</p><p>But what happens when someone at the end of the chain discovers a flaw in the solution? Everyone must start over, or at a minimum adapt their work. We needed to find a way to work in parallel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ahP9jjCZtr0iTEMJ_lgQw.png" /><figcaption>The pre-implementation meeting allows for parallelized work between three of the four teams</figcaption></figure><p>So we established a detailed pre-implementation meeting (we had one in our previous workflow, but it was not detailed enough that it deserved to be on the diagram). What’s a pre-implementation meeting? Once the product research is complete and all key features have been identified, all teams gather and define a <strong>contract</strong> that will be implemented by the back-end, and consumed by the front-end. The product is free to build the UI as they like as long as the features they use are in the contract.</p><p>Parallelized work means it is faster, right? Yes, and no. <strong>No one signed anything</strong>, and since until then we were using Javascript and REST, any change to the back-end implementation would require human communication, and changes to the front-end too, or else it could break or behave in the wrong way.</p><p>Anyway, wasn’t this article about GraphQL?</p><h3>GraphQL, the signature to our contract</h3><p>GraphQL is a query language for APIs. You define a schema, defining all the operations your API supports, and what data these operations return, with a type associated to every field. These types are our missing blocks and allow for even more parallelization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r7N3NecMcah42RDf7SCp6w.png" /><figcaption>Our new pre-implementation meeting allows testing the back-end instantly. But how?</figcaption></figure><p>What’s our new pre-implementation meeting like? The back-end and front-end teams collaborate to write the schema based on the product research just like before, but this time the server <strong>runs a validation</strong> on what gets asked and what comes out, <strong>based on the schema</strong>. This means that if any field of the schema is not defined correctly, the back-end and front-end team will both get an error. When both teams are on the same level, the communication improves.</p><p>Now, when you have types and server-side validation, it is easy to write (or generate) mocks for your operations. This will be the next step: <strong>write mocks to cover every operation of your schema</strong>. This will catch early flaws in the design of your schema, and you will have a fully operational server with which you can interact.</p><p>Once the schema and mocks are written, all the teams can work in parallel, even the QA! They will write integration tests with the mocks, and once the back-end is done the mocks will be replaced by real data and the tests should still pass. And when everyone is done, the QA can finish by testing the feature as a whole.</p><p>Well, what if you don’t want to rewrite your server using GraphQL? You don’t need to! Write your schema, and proxy each operation to your existing REST API. You will end up with a gateway between your front-end and existing REST API, powered by GraphQL and all of the advantages listed in this article.</p><h3>But wait, there’s even more</h3><p>Thanks to Apollo (a library that works with GraphQL), we can <strong>generate type definitions from our schema with one command</strong>. This means that if you’re using Typescript, Flow, Swift, Java, or any typed language, you won’t ever have to worry about the API silently breaking. One command is all it takes to regenerate the types, type check every line of code that consumes the data from our API, and see a complete list of errors (if any). All of your back-end and front-end types are derived from your schema, automatically.</p><p>If you’re using React, react-apollo gives you components and hooks that are wonderfully typed and will help you manage your data layer. All this tooling makes for a great developer experience and more confidence thanks to the types.</p><p>For most companies, startups especially, iteration speed is a matter of life and death. Optimizing your feedback loop can improve your iteration speed. GraphQL is known for its benefits on network optimizations, reduced round trips and so on.</p><p>But GraphQL is about more than just optimization, and with its ecosystem, it is a great candidate for the task and will most likely reduce the back-and-forth between your teams and improve communication. At least it has for us at Brigad, and we’re even pushing further in this direction to improve the way we work together, automate more and more things and to gain even more confidence in the solutions we build.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d471f883778d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/how-graphql-can-improve-your-development-workflow-d471f883778d">How GraphQL can improve your development workflow</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improving your Open Source tools to save time — Automate things 1]]></title>
            <link>https://medium.com/brigad-engineering/improving-your-open-source-tools-to-save-time-automate-things-1-b61f0d8f5d55?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/b61f0d8f5d55</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Thibault Malbranche]]></dc:creator>
            <pubDate>Tue, 01 Oct 2019 08:23:23 GMT</pubDate>
            <atom:updated>2019-10-01T08:29:04.209Z</atom:updated>
            <content:encoded><![CDATA[<h3>Improving your Open Source tools to save time — Automate things 1</h3><h4>I have been maintaining react-native-webview for more than a year now, let’s see how the repository is set up to achieve a lot with as little interaction as possible. This article is about Javascript projects but some of the principles are probably applicable to any programming language.</h4><figure><img alt="Peaceful image view" src="https://cdn-images-1.medium.com/max/1024/1*3ISw0jQvNpanSRHI6DnvzA.jpeg" /><figcaption>Save time on repetitive tasks to focus on what matters — Photo by <a href="https://unsplash.com/@campoilucas?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Lucas Campoi</a> on <a href="https://unsplash.com/s/photos/amazon?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>I. Use types</h3><p>Use types in your library code with either TypeScript or Flow. JavaScript is a fantastic language to get tons of things done, but when doing open source, it can quickly become very painful to maintain.</p><p>Example of types on the react-native-webview repository</p><p>Types have several benefits:<br>- Documentation living inside your codebase<br>- Tests inside your codebase<br>- Developer experience is way better (autocompletion and other perks…)</p><p>While it can be painful to convert all your codebase at once, you don’t have to and you can add them incrementally. I do recommend migrating big chunks when there are not too many pull requests opens if you don’t want to scare away contributors.</p><p>Recently, react-native-cli asked for help to convert to TypeScript and the community response was awesome! Good job everyone ❤️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9guE0SRWeajU3iGE_iLx9Q.png" /><figcaption>React-native-cli ts pull requests 🚀</figcaption></figure><h3>II. Release often and keep a changelog</h3><p>If you want to get people involved, they need feedback on what they do and they want information on what other people do.</p><p>To achieve these two goals, I decided to use semantic-release. It is a tool that will take care of several things for you:<br>- Increment your version number following semver<br>- Generate the changelog<br>- Release the new version on NPM<br>- Close and comment issues / pull requests related</p><p><em>Let’s see what’s great about each of these.</em></p><h4>SEMVER — Anyone’s addict to being up to date best friend 👭</h4><p>It is a versioning convention that informs you about what kind of change <strong>was intended</strong> between the new release and the previous one. You are never 100% safe when upgrading, but if everything goes according to plan you should be good 👍.</p><p>Semantic-release will parse your commit messages and decide to release the correct version.</p><p>Some example from webview:</p><p>- <a href="https://github.com/react-native-community/react-native-webview/commit/09372c9d95b3cceb6990d3e1ab269bcacdad4a07">fix(iOS): hideKeyboardAccessoryView on iPads</a><br><em>The previous version was 7.2.6, this only contains a fix, the new version will be 7.2.7 and everyone is safe to update.</em> ✅</p><p>- <a href="https://github.com/react-native-community/react-native-webview/commit/5da59251cea7e979f07e877deb555c8c93cf0f8c">feat(android): Expose cacheMode property</a><br><em>The previous version was 7.2.8, this contains a feature, the new version will be 7.3.0 and everyone is safe to update. </em>🚀</p><p><em>- </em><a href="https://github.com/react-native-community/react-native-webview/commit/8549be5fd0e97c6d0a73a2e8ab154d668beecf44">fix(iOS): UIWebView Removal</a> but inside the commit description it says <strong>BREAKING CHANGE: UIWebView has been removed.<br></strong><em>The previous version was 6.11.1, this contains a breaking change, the new version will be 7.0.0 and everyone is </em><strong><em>not</em></strong><em> safe to update. But maybe you are </em>😍.</p><h4>An automated changelog — Happy users 🎉</h4><p>By parsing your commits, semantic-release can generate a changelog that your users will be able to access under the release tab on Github.</p><p>That’s the best place for anyone to go when having doubts about what’s new in a version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B6_x5mZdhpLOjMFSAP6HVQ.png" /></figure><h4>Release after every merge — Smaller updates, faster feedback ⚡️</h4><p>Every time we merge a commit on react-native-webview master branch, our CI will release a new version. This provides a great experience for both users and contributors, who are both happy about not needing to wait to get an update. As a maintainer, it also saves me so much time. This also makes it easier to pinpoint where regressions might come from since there is usually only one commit to look at.</p><p>By doing that, after a year, we released 123 versions of webview in a year, but only had 5 breaking releases, most of which were only affecting few users but we don’t joke with SEMVER. 😊</p><h4>Automatic issues and pull request updates — More goodies 🍭</h4><p>After every release, a nice bot will come and comment on related issues or pull requests. This allows users to get notified that their issue has been solved and that their pull request is merged and available on NPM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*irKv4MaHSgoVwRwJ-eX9vQ.png" /></figure><p>As a bonus, there are many plugins you can use with semantic-release. For example, every time we release a new version of webview, a bot comes and updates the version inside the package.json file and commits it directly.</p><h4>Setting up semantic release takes a few minutes and saves hours. 🕐</h4><pre>yarn add -D semantic-release</pre><p><a href="https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication-for-plugins">Add tokens from Github and NPM to your CI</a>.</p><p>Make sure your CI runs the following command after your tests are successful on master:</p><pre>yarn semantic-release</pre><p>Done 🔥.</p><p>Some interesting reads:<br>- <a href="https://semantic-release.gitbook.io/semantic-release/">https://semantic-release.gitbook.io/semantic-release/</a><br>- <a href="https://semver.org/">https://semver.org/</a><br>- <a href="https://www.typescriptlang.org/">https://www.typescriptlang.org/</a></p><p>If you want a part 2, please let me know by commenting/clapping the article, and feel free to share it.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b61f0d8f5d55" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/improving-your-open-source-tools-to-save-time-automate-things-1-b61f0d8f5d55">Improving your Open Source tools to save time — Automate things 1</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to keep track of your data evolution ?]]></title>
            <link>https://medium.com/brigad-engineering/how-to-keep-track-of-your-data-evolution-b596b64b715a?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/b596b64b715a</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[time-travel]]></category>
            <dc:creator><![CDATA[Léon Stefani]]></dc:creator>
            <pubDate>Mon, 01 Jul 2019 12:50:28 GMT</pubDate>
            <atom:updated>2019-07-01T12:50:28.303Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*taviHWU33IR_e9xbJzUaTw.jpeg" /></figure><h3>How to keep track of your data evolution? A journey through time and (memory) space</h3><p>In any project, of any size, always happens a time when it is used by real users and when you stumble upon a certain wonder: what happened to my data in order to reach its current state? Whether it is a state that should never have been possible to reach or a mistake made by a user, it’s always in these cases we wished we had some tools to keep track of what happened. A solution for this is to keep track of all historical data through time.</p><p>Unfortunately (and Murphy’s law obliging), it’s always when we reach the step where we need that historical data, that we realize we don’t have it yet, and that we should’ve found ways to keep it sooner. But how to do it? And which methods best suit our needs? That’s what we will try to cover on this post, by taking our journey through different methods we use at Brigad as a red line to explain different methods and needs.</p><p><strong>I — Immutable state machines to keep track of actions</strong></p><p>Suitable for some needs, especially when dealing with quantifiable data, like money or stocks, immutable state machines are by design keeping track of the data because they can’t be edited at all. Each entry representing a single action, associated to an amount, we can know the current state of a resource by summing the values of all the actions, instead of editing a global result, and we can know when each action took place, and in which order. This way, it becomes always possible to know what happened for the data to be in its current state.</p><p>For example, if you take a database table where you keep track of your inventory, each time you have an order, you add an entry with a negative amount for the product, and each time you have a delivery you add an entry with a positive amount, allowing to know the current state of your goods simply by summing all amounts, and to keep track of when the total amount changed, for which amount, and eventually some other data on the transaction.</p><p>This kind of state machine is really simple to set up, and efficient in memory since you just store your data without ever duplicating it, but is difficult to use when having some table with non-quantifiable values, for example, the names of the products you want to sell. And you can use it only for non-qualified rows, for example, if you have a status on the order in the same row than the amount, it won’t keep track of the status changes.</p><p>This is the first solution we put in place at Brigad, in order to keep track of payments, because it is a subject that needs rock-solid data and architecture (we’re talking about real money here), and thus we needed a complete history there. But after that, we had other needs about data history that couldn’t be resolved this way, which led us to use another tool to achieve data history.</p><p><strong>II — Immutable and versioned rows</strong></p><p>While keeping the advantage of the immutability of rows that prevents data loss, another option to achieve a clean data history is to keep all versions of a row inside the same table. This way, it’s always possible to know what change happened and when it did. The main advantage is that it is very flexible, and can be applied to any row with any kind of data inside, and doesn’t require a lot of code to be put in place (just replacing the updates by insertions).</p><p>In order to be able to retrieve the current state of the data, we need to make a query to select only the latest inserted version of the row. This way, we can use normal database queries, on the current data or on the data that was the correct at a certain point in time. But we need to first select the state we want, and then execute the query on this subset, because we don’t want the filters of the main query to be applied to historical data.</p><p>Another way to use this method is, instead of relying on the date of insertion in the database, to add a version column and always query against the subset with the latest version. This allows having clearer data and group some data within the same version.</p><p>However, this method has the drawback to increasing the size needed to store the data, since each modification will insert a new row in the table, making it less suitable for heavily updated tables, or tables with rows containing a huge amount of data.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FbyyKruq3fiJcdlC0Y8%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FbyyKruq3fiJcdlC0Y8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FbyyKruq3fiJcdlC0Y8%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="543" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d89830fc34a8cbaed4ff5015309f6ec/href">https://medium.com/media/7d89830fc34a8cbaed4ff5015309f6ec/href</a></iframe><p>Another drawback is the fact that it complexifies all queries to retrieve the data, as we first have to get the subset with the current data, and then execute the actual query against this subset, which can be pretty tricky when using ORMs.</p><p>At Brigad, we started to use it to keep the history of some date ranges, but when we did some research in order to generalize it for other resources, we found out the complexity drawback on the requests and started to look after some alternative methods. That’s when we found out about a Postgresql’s extension: temporal_tables, that suited our needs since it is the database engine we currently use.</p><p><strong>III — Temporal tables: historical data for Postgres, the easy way</strong></p><p>Existing as a Postgresql extension, temporal tables allows creating some ‘history’ tables whose role is to keep track of all the versions of the data inside the main table.</p><p>This extension is based on the concept of a <a href="https://en.wikipedia.org/wiki/Temporal_database">temporal database</a>, which is a higher-level database concept and can be implemented in other engines than Postgres. While this concept is a part of the SQL:2011 standard, most engines do not natively implement it, explaining the need for extensions or scripts.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oz8xBmTULwn1QSNgI%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oz8xBmTULwn1QSNgI%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3oz8xBmTULwn1QSNgI%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/35241d3fd492c7da9244deea90ca008e/href">https://medium.com/media/35241d3fd492c7da9244deea90ca008e/href</a></iframe><p>This is made at the database level (so no need to worry about concurrent access or transactions rollback), by inserting into the history tables the data in its state before it was updated or deleted. The only thing we have to add is a sys_period column of type tstzrange , on the table, because it is this column that will indicate the time range for when the data was valid.</p><p>When we have the history and the main table, we just need to add the temporal_table extension’s triggers, and it becomes impossible to lose data, since every database action modifying a row in the main table will also insert this data on the history table, with a validity range between last update and time of current update.</p><p>You can add a sys_period column this way :</p><pre>ALTER TABLE products<br>  ADD COLUMN sys_period tstzrange NOT NULL DEFAULT tstzrange(current_timestamp, null);</pre><p>And create the temporal database, then adding the triggers like this :</p><pre>CREATE TABLE products_history (LIKE subscriptions);<br>CREATE TRIGGER versioning_trigger<br>BEFORE INSERT OR UPDATE OR DELETE ON products<br>FOR EACH ROW EXECUTE PROCEDURE versioning(<br>  &#39;sys_period&#39;, &#39;products_history&#39;, true<br>);</pre><p>For example, if I was to modify a name on a product in a database, in order to correct a typo, it would create an entry in the history table, stipulating that between product’s creation and now, the data with the typo was valid, but since now, the correct data is the one without a typo.</p><p>In order to retrieve data from the database, at the current time or at any previous time, the query is fairly simple :</p><pre>SELECT {columns} FROM {table}<br>    WHERE {where clauses} AND sys_period @&gt; <br>{time we want or now() for latest}::timestamptz<br>UNION ALL<br>  SELECT {columns} from {history_table}<br>    WHERE {where clauses} AND sys_period @&gt; <br>{time we want or now() for latest}::timestamptz;</pre><p>Just by wrapping all of our where clauses in a union with history tables we can query the table at the state it was at a certain time: a true Wayback machine!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FxsF1FSDbjguis%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FxsF1FSDbjguis%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FxsF1FSDbjguis%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="227" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5ec42f6ea99db13d61142b76ca22c99/href">https://medium.com/media/e5ec42f6ea99db13d61142b76ca22c99/href</a></iframe><p>It shares some of the drawbacks of the versioning method, such as the increasing memory on each update, but the querying is a lot simpler (and faster), and the history keeping is made at the database level, not the application level.</p><p>We started using it on multiple tables that were business-critical, and thus would greatly profit from easy-to-implement history, and so far it seemed to perfectly fill our needs, as it allowed for a generic way to query data through history, and the implementation was really easy thanks to few reusable utils.</p><p>In order to show how to implement temporal tables in Postgres, I’ve made a simple project, using Node.js, express, and Sequelize, for an API that uses a database with temporal tables, available here: <a href="https://github.com/Brigad/temporal-tables-demo">https://github.com/Brigad/temporal-tables-demo</a></p><p>Sources :</p><ul><li><a href="http://clarkdave.net/2015/02/historical-records-with-postgresql-and-temporal-tables-and-sql-2011/">Clark Dave’s wonderful article on how to use temporal tables</a></li><li><a href="https://github.com/nearform/temporal_tables">Temporal table’s extension re-written in PLPG/SQL</a>, allowing to use them with Postgres 11 and in environments where we can’t add custom extensions (AWS RDS for instance 😆)</li><li><a href="https://github.com/arkhipov/temporal_tables">Temporal tables project’s homepage</a></li></ul><p>Hope this post will help some of you not to struggle as much as we did on the matter of history, and that you found it as pleasing to read as it was for me to write! Would you have any concerns or questions you can reach me on twitter (<a href="https://twitter.com/shrodinger42">@shrodingers42</a>)!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b596b64b715a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/how-to-keep-track-of-your-data-evolution-b596b64b715a">How to keep track of your data evolution ?</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we prioritize features at Brigad — The SIEVE checklist]]></title>
            <link>https://medium.com/brigad-engineering/how-we-prioritize-features-at-brigad-the-sieve-checklist-de8c2b18d12a?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/de8c2b18d12a</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[prioritization]]></category>
            <category><![CDATA[product-design]]></category>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[product-strategy]]></category>
            <dc:creator><![CDATA[Mathieu Renaud]]></dc:creator>
            <pubDate>Thu, 06 Jun 2019 13:18:55 GMT</pubDate>
            <atom:updated>2019-06-12T12:24:06.125Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cvvZZpdk856D1GtZ" /><figcaption>Photo by <a href="https://unsplash.com/@cottercrunch?utm_source=medium&amp;utm_medium=referral">lindsay Cotter</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>How we prioritize features at Brigad — The SIEVE checklist</h3><h3>🧐 “Why should I read this article”?</h3><p>Product Prioritization is a fascinating topic, and probably like you, I read a great deal of Medium articles, Wikipedia articles, examined a lot of prioritization frameworks and prioritization processes (here is a nice sample of prioritization methods). Probably because prioritization sounds like a scientific approach, we spend a lot of time trying to rationalize it, and chase the magic mathematical formula that will crack the prioritization of our overpopulated backlog.</p><p>For years, I’ve thus been reading hundreds of articles, watching hundreds of hours of testimonies about them, experimenting them both as startup founder, freelancer and more recently as Head of Product at Brigad. Eventually, few of them did a neat job in prioritizing features, projects and/or insights in an agile and easy way to deliver the most relevant solutions efficiently and rationally.</p><p>That’s why for the last year, I’ve been iterating on a whole different method to eventually land on <strong>two elements that profoundly affected the way I prioritize topics in our Product Roadmap</strong>. I believe the way we generally consider Product Prioritization is broken, and can be hugely simplified if approached in the right way, which I think we do at Brigad. My objective here is to share with you those two silver bullets that really unlocked clarification, namely:</p><ul><li>Distinction in the <strong>types of prioritization</strong></li><li>The <strong>SIEVE Checklist</strong></li></ul><h3>📜 A bit of context: Product Process 101</h3><p>You’re probably familiar with it, but what constantly happens is that all along the Product Process, projects emerged, insights are collected, requests are made, so-called “cool” ideas are suggested, which end up clogging the Product Process and drown the product and/or tech teams.</p><p>In this magma, we’ve discovered that all those solicitations could be formalized and categorized through a more clearly defined Product Process that takes into account different types of researches: Primary Research, Secondary Research and Tertiary Research.</p><p>I’ve detailed this distinction in a previous article about our Product Process that you can <a href="https://engineering.brigad.co/how-we-build-products-at-brigad-our-product-process-218183914d7d">read here</a>, I really encourage you to read it to have a deeper understanding of what follows, but if you don’t have time, one of the main things to keep in mind is that thanks to the division of researches, the Product Process can be divided in 5 big steps:</p><ol><li><strong>Primary Research</strong> is the research we do beforehand by collecting feedbacks, insights, ideas from internal and external users in order to uncover pain points and opportunities. We then aggregate them and determine if we should work on them, and if yes, sooner or later in the roadmap.</li><li><strong>Secondary Research</strong> covers basically the same scope as the <em>Double Diamond</em>, it consists in digging deeper into a topic, identify the core problems, generate the most relevant ideas of solutions, and finally validate the best solution.</li><li><strong>Implementation</strong>, which combines Development and Testing</li><li><strong>Release</strong> covers all the communication to internal and/or external users to make sure all the relevant information around a feature is properly conveyed.</li><li><strong>Tertiary Research</strong> takes place after a feature is in production, in order to monitor how well it performs, if its quantitative and/or qualitative objectives are reached, and if we should further iterate on it or not.</li></ol><p>To help you visualize, here is a simplified illustration of the Product Process (<a href="https://engineering.brigad.co/how-we-build-products-at-brigad-our-product-process-218183914d7d">click here</a> if you want to discover the detailed one). The only thing that appears that I didn’t mention above is the Vision, which isn’t an operational step properly speaking, but nonetheless determines the long-term mission, that is then developed into a medium-term strategy and short-term projects, through OKRs for instance. As a consequence, Vision can have a transversal impact on the Product Process as well as a punctual impact with a specific project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2tL8bKr4Jmy2vhndqmElQQ.jpeg" /><figcaption>Simplified view of the Product Process</figcaption></figure><p>This is where things get interesting: indeed, this division of the Product Process encompasses all the different types of solicitations that can emerge and thus provides us with an exhaustive framework to manage them all. Put differently, if there is some prioritization to be done, it has to be here, but where?</p><h3><strong>🧩 The different types of prioritization</strong></h3><p>That’s how we realized that actually, there isn’t one type of prioritization, but several. For long, I’ve been trying to find a one-fits-all prioritization method, but it is now pretty clear that it is pointless depending on where you are in the Product Process. To have a relevant prioritization, it is crucial to first isolate an homogeneous set of solicitations: if prioritization is so difficult between a whole project and a series of isolated but very sensitive pain points, this isn’t because one is more important than the other, this is simply because they’re of different kinds.</p><p>Depending on the type solicitations you treat, it makes more sense to choose the proper tool. That’s why it really became a game changer to no longer consider <strong>the</strong> Product Prioritization, but the several types of Product Prioritization<strong>s</strong>:</p><p><strong>Insights Prioritization</strong> takes place during Primary Research and as a result of the Tertiary Research, these can be ideas, opportunities, pain points, new iterations. The content of this category is the most heterogeneous of all: they are unequally complex, informed and/or urgent. This is the most painful prioritization to address.</p><p><strong>Prioritization within projects</strong> is what happens during Secondary Research. Typically, when a Product Manager is investigating a problematic, and sorting the core problems that should be solved by priority.</p><p><strong>Prioritization between</strong> <strong>projects</strong> takes place on a more macro level, when we already have topics which aggregated a lot of pain points to fix, ideas to tests, opportunities to leverage. This is for instance when difficult choices arise such as choosing a SAAS for internal teams or a big feature for external users.</p><p>Here is an illustration of the Product Process in a linear form, so that you can visualize when each type of prioritization takes place. You can in particular observe the Double Diamond within the Secondary Research, and the Prioritization within a project happening there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZbKgYFT8lqS2u0fg0UQ4Pg.jpeg" /><figcaption>Linear view of the Product Process</figcaption></figure><p>Through this new lens, the interesting thing I observed is that many of the most famous tools and frameworks out there mostly focus on prioritization between and within projects.</p><p>Among the numerous models I experimented, you probably already know the traditional <a href="https://medium.muz.li/the-kano-analysis-c16e7d681158?gi=83b33634e328">Kano Model</a>, or the classic <a href="https://medium.com/@itamargilad/why-impact-effort-prioritization-doesnt-work-57d141fafc2c">Impact/Effort Matrix</a> (and all the matrix variations such as the <a href="https://productcoalition.com/the-art-of-the-strategic-product-roadmap-c881f261b4eb">Value/Risk Matrix</a>). There is also the <a href="https://en.wikipedia.org/wiki/MoSCoW_method">MoSCoW Method</a> or the very interesting <a href="https://www.designative.info/project/product-definition-and-requirements-prioritization/">ODI Framework</a> (close to the “Pay a feature” user research method).</p><p>I also explored more granular models, the most interesting being the <a href="https://medium.com/@itamargilad/finding-winning-ideas-using-the-confidence-tool-d8f2d8cc2c15">ICE Model</a>, its big brother the <a href="https://www.intercom.com/blog/rice-simple-prioritization-for-product-managers/">RICE Model</a>, or even the <a href="https://hbr.org/1988/05/the-house-of-quality">Quality Functional Development</a> (QFD) which can manage up to 5 dimensions for prioritization.</p><p>All of them also present the peculiarity to address Prioritization between projects and Prioritization within a project more easily. Why ? Have a look at the last illustration, my guess is that because those types of prioritization happens later in the Product Process, hence benefitting from a higher level of information (on the effort vs. complexity, on the risk vs. value, on the importance vs. emergency, on the criticity, on the feedbacks of users, on the sensitivity for internal and external stakeholders etc.). This makes those prioritizations easier to do, and easier to rationalize through frameworks and methods.</p><p>However, when it comes to prioritizing insights, this is where trouble begins. This material is probably the most heterogeneous and complicated to manage, ranging from the nice idea to test, the very sensitive pain point that has been detected, the quick win, the bug fix, to the other feedback about a feature in production. This is also the least informed material, as it comes rough, straight from the field, with no analysis, there is no idea about its complexity, nor its relevance.</p><p>Most of the methods mentioned earlier take into accounts criteria such as confidence, effort, risk, which isn’t an information you have when you receive request and feedbacks. That’s why they prioritize on the basis of information you don’t have or partially have, and which is more or less reliable. Moreover, complexity isn’t a relevant criteria at the Insights Prioritization stage: because it is already based on a solution, which you don’t have yet, and if you have, it’s probably hurried. You should be focusing on prioritizing problems at this point, not solutions.</p><p>I said earlier that this type of prioritization is the most painful prioritization to address, how is that?</p><h3><strong>⚙️ The ill-addressed insights “ratchet effect”</strong></h3><p>When you google “prioritization”, pretty much all the definitions describe it as an <em>action or a process of deciding, organizing, or ranking the relative importance of things over others</em>. What’s interesting here is to notice that prioritization never is a process of elimination, or the exclusive selection of others: it is just rearrangement of the topics while keeping all of them. <strong>Simply put, prioritization doesn’t remove anything, it only sorts elements.</strong></p><p>That’s why product teams logically end up with ever growing backlogs and illusory topics at the bottom of it that will never get treated: prioritizing the backlog is a one-way process that only fills it and rearranges it, but never empties it or cleans it from useless and irrelevant topics.</p><p>At the end of the day, the problem is that we have: one the one hand, an Insights Prioritization that is the most complicated type of prioritization to address, and on the other hand, a backlog that fills itself with ill-addressed ideas/feedbacks/pain points/bugs/requests/quick wins without ever being emptied.</p><p>That’s why to avoid this slippery slope, it is crucial to address this Insights Prioritization properly, and only let in the topics that are the most relevant and impactful. <strong>According to this mindset, “prioritization” is no longer the proper term, but “filtration”, or “sieving” seem more adapted.</strong></p><p>If you don’t, you’ll only fill your backlog and at this point, prioritization becomes the wrong battle: if you are fighting it, it means it’s already too late and you’ll overwork on elements you should have sieved beforehand. On the contrary, the more you sieve upstream, the less prioritization you’ll need in the backlog.</p><h3>✅ <strong>Enters the SIEVE Checklist</strong></h3><p>Because the elements to sieve are so heterogeneous, and suffer from a large lack of information, the main idea is to keep only those which are relevant. How? By setting a series of standards to live up to before even considering them.</p><p>The SIEVE Checklist is composed of 5 criteria that, of all checked, enables us to know what to do with any feedback/idea/pain points/quick win/suggestion. This is as simple as a pass or fail test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZr9ACUkw_afCq6y4VWh2Q.jpeg" /></figure><h4><strong>S — Stall (filter level: 50%)</strong></h4><p>This first step is the most fundamental is probably the easiest: <strong>the first thing to do when you receive a request or a feedback is to do nothing.</strong></p><p>It is very important not to react right away because most of the time you’ll react under the pressure, or the emotion when for instance an important client is complaining, or when a sales colleague just suffered a series of very bad feedbacks from a client and is insisting on Slack or physically.</p><p>In those situations you’ll jump on an easy solution and/or let yourself and your team be distracted by a so-called emergency that isn’t really one. As a consequence you’ll sacrifice time for the urgent and the short-term while you should save it for the important and the long-term.</p><p>Moreover, by stalling requests and feedback, you’ll be surprised how quickly clients and colleagues can actually calm down and take a step back on their problem, sometimes to eventually tell this is not so important after all. By giving time, you also create an opportunity for problems to solve themselves, which happens more often than you think.</p><p><strong>🧐 The questions to ask yourself:</strong></p><ul><li>Will it still matter if we wait for another week?</li></ul><p>As far as I’m concerned, it filters out 50% of the requests. Generally, a request that doesn’t survive a week isn’t so urgent. And if your internal/external users find a workaround, then it was not so important to work on it.</p><h4><strong>I — Identify (filter level 20%)</strong></h4><p>If a request or a feedback keeps coming back, then it is time to check the first box and go to the next one: Identification. However, this also supposes you create enough opportunities for stakeholders to express their solicitations: for instance at Brigad, managers can post and comment requests and feedbacks on Airtable all the time, but we also organize feedback sessions with each team, every two weeks, to talk about the most 3 or 4 pressing issues.</p><p>The objective of the Identification step is to clearly scope the solicitation to make sure we get to the root of a problem, so we can treat the cause, and not the consequences. This implies a lot of back and forth between me and stakeholders, a lot of “why” questions, but save tons of time for later: either because you realize the root problem is not related to the product, but to an operational process, or an organizational issue for instance. Or — even more interesting — because you realize this symptom is linked to another request you’ve stalled.</p><p>This is when you can start <strong>aggregating</strong> solicitations to give them more weight, and more meaning. You can think of aggregation as a kind of coagulation of symptoms, that gives you a clearer picture of the disease at the end of the day.</p><p>This is also when big problems eventually get smaller and more simple to address. Because a problem is like an onion: the more you peel off the layers, the smaller it gets. So make sure to ask as many question as possible to peel off the layers of the problem in order identify the core cause.</p><p><strong>🧐 The questions to ask yourself:</strong></p><ul><li>Can I scope it well? What’s the problem? Why is it a problem?</li><li>Use and abuse of the 5 Whys technique</li><li>Will it improve/complement/innovate on the existing workflow?</li><li>Can we do it well?</li><li>Is it a vitamin or a painkiller? (You definitely want to address the latter)</li></ul><h4><strong>E — Evaluation (filter level: 10%)</strong></h4><p>Ok so now you have a recurring and well-identified problem, with a clear scope. This is the moment where you get into details and start having a more quantitative approach, otherwise the risk is that you fall into the trap of the “frecently” bias, meaning a frequent problem, that occurred recently but on which you’ll react just impulsively.</p><p>The best solution is to simply evaluate the identified problem by digging into the data, searching into your analytics tools to objectively measure the reality and the extent of the problem.</p><p><strong>🧐 The questions to ask yourself:</strong></p><ul><li>Is the problem real?</li><li>How many users suffer from it?</li><li>To what extent do they suffer from it?</li></ul><h4><strong>V — Vision (filter level: 5%)</strong></h4><p>Once you have checked the reality and the extent of a solicitation, now is a good time to settle on it and think of the long-term consequences of addressing it. Indeed, even if a problem is recurring, well-identified and measured, do we really want to address it? The risk here is to build a product without any global logic, and ending up with what I often call a “Frankenstein” product: meaning a product where everything is important and useful to work properly, but doesn’t have any clear purpose.</p><p>Of course, this step implied you are very clear on both the Vision of your company, your long-term strategy and your short-term objectives.</p><p><strong>🧐 The questions to ask yourself:</strong></p><ul><li>Does it match our objectives (OKRs, NSM…)?</li><li>Does it fit the Vision?</li><li>Do we also want what our customers want?</li><li>Will it still matter in 5 years?</li></ul><h4><strong>E — Effects (5%)</strong></h4><p>After going through all the previous steps, this last one becomes pretty easy. The objective here is to estimate the effects of working on the given problem, anticipate the consequences that could occur. Indeed, this is not because a problem is real, is aligned with what you want to build on the long-term that this is the right time to address it, or to dedicate resources to this specific problem at that moment. Sometimes you can even also realize you can’t afford this problem to be solved, because you won’t be able to manage its success (too much use, too many users, team not big enough yet…).</p><p><strong>🧐 The questions to ask yourself:</strong></p><ul><li>If it succeeds, can we support it? Afford it?</li><li>What other problems could it create?</li><li>Will users stop doing something else?</li><li>How many users will benefit from it?</li><li>Does it grow the business at the end of the day?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SPWAzbcbAt5SAtmyD8B0Og.jpeg" /></figure><h3><strong>🧳 Key takeaways</strong></h3><ul><li>There are several types of prioritization along the Product Process: <strong>Insights Prioritization, Prioritization between projects, Prioritization within projects.</strong> The first one being the most complex and strategic not to clog your backlog.</li><li><strong>The SIEVE Checklist purpose is to be a light-weight approach to prioritization that filters out and aggregate insights</strong>, instead of implementing complex framework and methods that aren’t so agile and can’t address Insights Prioritization.</li><li>The SIEVE Checklist stands for <strong>Stall, Identify, Evaluate, Vision and Effects</strong>. It is tailored for Insights Prioritization, which comes before Prioritization between projects and Prioritization within projects.</li></ul><p>All the questions of the SIEVE Checklist constitute the netting of your sieve, it is then up to you to adjust it in order to let more or less topics in. However, you can be sure that whatever passes will be both relevant for the company, the users and the business.</p><p>Feel free to experiment it in your team and share your feedbacks with me, I’d be glad to discuss!</p><p><em>Our R&amp;D team will approximately double this year, the objective will be to see how this Process perform in those conditions, if you want to have a closer look, we’re hiring another </em><a href="https://www.welcometothejungle.co/fr/companies/brigad/jobs"><em>Product Manager and many Tech profiles</em></a><em> :)</em></p><h4><em>🇫🇷 Note for French speakers</em></h4><p><em>Cette version est l’équivalent anglophone du TAMIS que nous utilisons en interne, pour </em><strong><em>T</em></strong><em>emporisation / </em><strong><em>A</em></strong><em>lignement / </em><strong><em>M</em></strong><em>esure / </em><strong><em>I</em></strong><em>mpact / </em><strong><em>S</em></strong><em>cope. Le nom change, mais les questions restent les mêmes.</em></p><h4>The most interesting articles I read about Product Prioritization</h4><ul><li><a href="https://blackboxofpm.com/ruthless-prioritization-e4256e3520a9"><em>Ruthless Prioritization</em></a><em> (Block Box of PM)</em></li><li><a href="https://medium.com/@itamargilad/why-impact-effort-prioritization-doesnt-work-57d141fafc2c"><em>Why Impact/Effort prioritization doesn’t work</em></a> <em>(Medium)</em></li><li><a href="https://medium.com/pminsider/a-radical-and-simple-approach-to-product-prioritization-2e2c27e2c2e"><em>A radical, and simple, approach to Product prioritization</em></a><em> (Medium)</em></li><li><a href="https://www.intercom.com/blog/product-strategy-means-saying-no/"><em>Product Strategy means saying no</em></a><em> (Intercom)</em></li><li><a href="https://www.intercom.com/blog/rarely-say-yes-to-feature-requests/"><em>Rarely say yes to feature requests</em></a><em> (Intercom)</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de8c2b18d12a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/how-we-prioritize-features-at-brigad-the-sieve-checklist-de8c2b18d12a">How we prioritize features at Brigad — The SIEVE checklist</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we build products at Brigad — Our Product Process]]></title>
            <link>https://medium.com/brigad-engineering/how-we-build-products-at-brigad-our-product-process-218183914d7d?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/218183914d7d</guid>
            <category><![CDATA[startup-lessons]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[process]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[product-design]]></category>
            <dc:creator><![CDATA[Mathieu Renaud]]></dc:creator>
            <pubDate>Tue, 23 Apr 2019 13:06:22 GMT</pubDate>
            <atom:updated>2019-06-07T22:21:11.633Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GPG_XnGJTW-jfUkGhvDEGw.jpeg" /></figure><h3>How we build products at Brigad — Our Product Process</h3><h3>🧐 “Why should I read this article”?</h3><p>When it comes to articles about Product Process, I’m often very skeptical about the content: many of them are designed to attract readers with very seducing titles, setting very high expectations with an “ultimate guide” or highlighting “the most common mistakes you make”.</p><p>And as everyone, even though I know I’m going to be disappointed, I read them anyway.</p><p>I’ve been reading product articles, probably thousands of them, almost everyday, for the last 5 years. And actually, <strong>I discovered and implemented two silver bullets that really inspired and helped us formalize an efficient Product Process at Brigad.</strong></p><p>My objective is to share them with you here and explain how we learnt to leverage them in the Product Process. It is also to provide you with insights as relevant as possible so that you don’t leave this article with the same frustration I’ve been experiencing myself after reading articles about this Product Process. I’m really convinced those elements are rarely treated or used, whereas it can help many of you have even greater impact and efficiency.</p><h3>📜 A bit of context: how did we get here?</h3><p>At <a href="https://brigad.co/">Brigad</a>, we are convinced that work should be at the service of individuals, not the contrary, this is why we really defend the vision <em>“Work your way”</em>. We strongly believe that the digital tool is a wonderful one to make the independent work more flexible, but we don’t want it to make the independent work more precarious for all that. People are now pursuing independence and fulfillment through work, we want to provide our users with the right tools for that. I like to think of Brigad as a super-power to enable our workers to become the best version of themselves through independent work.</p><p>I joined <a href="https://brigad.co/">Brigad</a> 2 years ago as UX/UI designer, back when the team was composed of approximately 15 people. We’ve since raised 6M€, deployed our service across several cities and countries. We are now about 50 people and should be approximately 120 by the end of the year.</p><p>Since last year, as Head of Product, I’m in charge of :</p><ul><li>Being responsible for the Product Process <em>(this article)</em></li><li>Being responsible for the Product Organization <em>(probably for another article)</em></li><li>Absorbing insights, feedbacks and requests from internal and external users <em>(through Primary and Tertiary Research, more on that in this article)</em></li><li>Prioritizing and planning them in order to deliver and respect the company roadmap <em>(I use the </em><a href="https://engineering.brigad.co/how-we-prioritize-features-at-brigad-the-sieve-checklist-de8c2b18d12a"><em>SIEVE Checklist</em></a><em>)</em></li></ul><p>I collaborate on an everyday basis with the CTO and the Head of Engineering to make sure the R&amp;D Team (Product + Tech + QA) achieves stability, agility and velocity at the same time in our fast moving environment. This is no easy task and it took us 2 years to reach the right balance. At the moment, I’m pretty confident to say that the R&amp;D Team is experiencing a maximum velocity, along with agility in a stable environment. This article is the result of 2 years of all the error and trials we made.</p><h3>🚀 Long-term: aim far</h3><blockquote>“If you don’t know where you are going, any road will get you there.”<br> — Lewis Carroll, adapted from Alice in Wonderland</blockquote><p>Back in 2017, we didn’t have a clear vision of the company, which is completely normal at that stage of development: the very early life of a startup is focused on finding its product-market fit and maximize growth, then people start figuring out why they are doing what they are doing and crystallize the project of the startup into a clear vision.</p><p>That’s what we did at the end of 2018, and I concretely observed the benefits of formalizing a vision. It greatly helped improve the fluidity and the efficiency of our Product Process. Picture a startup as a boat, and the team as rowers: it’s definitely more motivating to row while seeing the coast, than rowing without any coast in sight.</p><p>It first gives <strong>focus to the team</strong>. When every stakeholder in the room knows why we are doing what we are doing, and the direction we’re aiming at, it prevents irrelevant elements from emerging. On the contrary, it drives only more relevant questions about a specific topic. It drives only relevant ideas as well, not ideas coming out of the blue with no impact on the given topic.</p><p>Secondly, it <strong>gives rhythm</strong> to the company and by extension, to the product life. When the team is working towards a clear horizon, objectives become clearer, achievements become concrete, and the team can more easily alternate celebrations and intense work periods.</p><p>Finally, vision <strong>helps settle product decisions</strong> more quickly and clearly. At some point in the design of feature, Product Managers dig deeper in the questions surrounding a problem, and in the reasons why to implement a particular solution. Inevitably, when we dig deep enough into several solutions, we end up questioning the “why” of the company, it’s absolutely key to have a rock-solid vision at that moment. The clearer the vision, the more easily the solution emerges.</p><p>One interesting example we experienced is the problem of availability of the independent workers we work with -the “Brigaders”. Some may be 100% available, some others are students only available at night and during week-ends, some already have part-time contracts during weekdays etc. On our side, we want to maximize the certainty that a Brigader will be available for the shifts.</p><p>Like Deliveroo, we could have implemented a calendar with limited spots per time slots, that would have made our life easier. However, fundamentally, when it came to the different solutions we could implement, this solution doesn’t align with our vision: it wouldn’t put work at the service of workers, it would do the exact opposite. That’s why we ended up implementing what we call an “unavailability calendar”, where Brigaders indicate time slots when they can’t work. Simple solution, that could have been different depending on the vision, or painful to select if there wasn’t any vision.</p><p>From that, all the rest becomes easier and more classic. From our vision we determined our long-term strategy, that we develop in OKRs, namely company-wide Objectives for the whole company, and Projects (equivalent to Key Results) for the next 6 months. <strong>This is the first stream of insights that fuels the roadmap and gives it stability.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QrGbQqJjmL2RaBfv9CZCMQ.jpeg" /><figcaption>Vision is the first stream of insights of the Product Roadmap</figcaption></figure><h3>⚖️ Medium-term: balance wisely</h3><p>Productwise, those 6-months projects eventually take the form of quarterly backlogs that we prioritize with the CTO and the Head of Engineering.</p><p>However, it’s impossible to anticipate a whole year of backlog from the vision, or the strategy, or the OKRs. Some projects are so clear than they can become the subject of a feature directly, but that’s not always the case, this is why we need to get micro, and to keep a constant stream of feedbacks and requests flowing from internal users (Ops, Care…) and external users (Brigaders, Companies). This flow of information provides the R&amp;D Team with problems to fix, opportunities to leverage, that we address if they align with OKRs.</p><p>This is that stream of insights that generated a lot of trouble on my side. It can easily become a never-ending flow, that ends up clogging all the bandwidth we have to ship new features. You can use <a href="https://hackernoon.com/finding-winning-ideas-using-the-confidence-tool-d8f2d8cc2c15">very complex (but interesting) frameworks</a> to prioritize them, or <a href="https://www.intercom.com/blog/product-strategy-means-saying-no/">say no to everything</a>, but at the end of the day, you end up like me: like a salmon struggling to swim against the tide of requests/feedbacks/insights.</p><p>We finally addressed it with the first of the two silver bullets I was talking earlier. <strong>We started distinguishing 3 types of research, to better address streams of insights: Primary Research, Secondary Research and Tertiary Research. </strong>They’re all freely inspired from <a href="https://www.intercom.com/blog/exploratory-research-in-product-development/?utm_source=ii-newsletter&amp;utm_medium=email&amp;utm_campaign=20180523-inside-intercom">this article</a> from Intercom, I’ll treat Secondary Research later in the article.</p><h4>Primary Research</h4><p>Primary Research is not exactly what Intercom describes in their article, it’s more all the user research, reflection, problem definition that are made even before any Product Manager starts working on a problematic. During Primary Research, I collect insights from internal users and external users with the Product Marketing &amp; Growth Team . <strong>The purpose is to identify problems and opportunities that we hadn’t spotted before, connect them, and analyse them in order to determine if we should work on them, and if yes, sooner or later in the roadmap. </strong>Primary Research is spontaneous and untargeted research.</p><p>For internal users, such as the Ops or the Care teams, I either interview them on a regular basis, or do some shadowing to update me on how their work. We also organise 1:1 regular feedback sessions every two weeks in order to talk about the 3 main pain points or most recurring feedbacks from their team. It enables them to filter some of the insights from their team, moderate them, reword them, and only go through me when they have prioritized a clear material for me to work on. It saves me a ton of time, it enables managers to have the same level of information and make sure their team stays aligned with their objectives.</p><p>For external users, with the help of the Product Marketing &amp; Growth Team, we organize focus groups with Brigaders or Companies, 1:1 interviews on a regular basis in order to have open and long discussions with our power users. Our Ecosystem Manager also organizes many events (aperos, webinars etc.) which is also a great opportunity to discuss with our users. One main advantage in this type of spontaneous and untargeted research is that users don’t only inform us about problems they’re experiencing, but also about what is going on with their life, the projects they have, what their short/medium/long-term plans are, how they want to live their life. This is truly passionating, reinforces the emotional bond between the team and our users and, above all, enables us to uncover some opportunities instead of problems. Opportunities are great in the sense that they enable us to go beyond our product, whereas problems are necessarily, mechanically, linked to our product.</p><p>All these insights are consolidated in the Product Requests board I manage on Airtable (our project management tool), where every manager can contribute and track the advancement of their requests. Strategically, Primary Research is a huge time saver insofar as it enables me take a step backward, to make some connections, link problems between them and formulate problematics that will address a larger and clearer scope than if I had just transferred a problem directly to a Product Manager.</p><p>If you still remember the boat metaphor, this enables us to seal two holes with one board instead of with two patches :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Km5aLDmuJb0MqUC9pqYbRQ.png" /></figure><h4>Tertiary Research</h4><p>Don’t worry, I didn’t miss Secondary Research, I’ll treat it later in the article :)</p><p>Whereas Primary Research is spontaneous and untargeted research, Tertiary Research is just the opposite: it’s sollicited and targeted research. <strong>The purpose of Tertiary Research is to ensure the follow-up of features that have been shipped, quantitatively and/or qualitatively in order to see how they perform and if objectives are reached.</strong></p><p>On the quantitative side, Product Managers, with the support of the Care Team, track KPIs and dig deeper into metrics in order to understand performance, or lack thereof, to truly understand how users are using (or not) the feature.</p><p>On the qualitative side, Product Managers may solicit the Care Team to collect insights on a specific feature directly by talking with users: this can be done by analyzing tickets on Zendesk, group them, summarize the feedbacks from users. We also trigger some other user research methods, such as calling campaigns, which is a very effective way to gather clear answers to questions in little time.</p><p>Depending on the results, the Tertiary Research may lead or not to another iteration on a given feature, that we’ll prioritize in function of the criticity of the insights that have been collected.</p><p>Along with the Vision, <strong>Primary Research and Tertiary Research constitute the two other streams of insights that we then prioritize to keep our backlog agile without clogging our bandwidth.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SXnRRz7H4fKVcF7WSxDkg.jpeg" /><figcaption>While Vision brings stability, Primary and Tertiary Research bring agility to the Product Roadmap</figcaption></figure><h3>⚡️ Short-term: execute fast</h3><p>Once prioritization is done, comes the time of the execution, which is obviously a critical part of the Product Process. I won’t recall the “classic” steps that you probably already know, and will focus on the peculiarities that we implemented at Brigad.</p><h4>Secondary Research</h4><p>So once a topic is prioritized, the Product Manager is briefed on a problem to solve. More precisely, the Product Manager is in charge of:</p><ol><li>Dig deeper and understand the problematic (Secondary Research)</li><li>Identify the core problems (Secondary Research)</li><li>Generate ideas of solutions (Secondary Research)</li><li>Validate the best solution (Secondary Research)</li><li>Implement the solution (Implementation, meaning Development and Testing)</li><li>Release (in collaboration with Product Marketing &amp; Growth)</li><li>Make sure it solves the problem (Tertiary Research)</li></ol><p>The first four steps are part of the Secondary Research that I eluded earlier in this article to keep the scope of the Head of Product and Product Managers clearly defined. Like Tertiary Research, Secondary Research is solicited and targeted research, and <strong>while Primary Research’s purpose is to roughly identify problematics to solve, Secondary Research is a laser focus on a specific problematic in order to formulate the best solution possible. </strong>Secondary Research is basically the Design Process, in which can fit many frameworks, among my favorites, the <a href="https://medium.com/digital-experience-design/how-to-apply-a-design-thinking-hcd-ux-or-any-creative-process-from-scratch-b8786efbf812">Double Diamond revamped</a>.</p><p>This laser focus doesn’t only bring more efficiency, it is also doubled with the fact that we try as much as possible to keep Product Managers working on no more than 2 or 3 topics at the same time: fundamentally, multitasking exists out of fear of prioritizing one topic, it is then reassuring to know you’re tackling 10 topics because it gives the impression to address all of them. Actually, multitasking is not amplification of your impact, it’s dilution. The better you prioritize, the fewer topics you tackle, the more impactful you become. This is fundamentally what Primary Research leverages: by enabling me to take a step backwards, take time, connect the dots, I have a finer prioritization, more relevant problematics and insights, which prepares the field for the Product Manager afterwards.</p><p>Then comes the “classic” stages, namely the Implementation (which involves the Delivery, the Development and finally the Testing) and then the Release of the feature, which is internally led by the Product Manager, and externally led by the Product Marketing &amp; Growth Team.</p><p><strong>This organization of the different types of research enables us to have clear scopes on who should investigate what</strong>, which was a huge pain point for us for quite a while. For instance, we didn’t really know when and who should dome some user interviews, or some focus groups, or some data analysis, which resulted in confusion between the Head of Product, the Product Manager, the Ecosystem Manager (part of the Product Marketing &amp; Growth Team). Now we perfectly know who is in charge of what, to uncover which type of information. This enables us to be far more efficient, to share insights crossways, and collaborate more easily and clearly with the Product Marketing &amp; Growth Team, as well as with the Care Team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpTBTd7rcZHK3NG4lsNNig.jpeg" /><figcaption>The prioritization and division of types of research enable PM to be laser focused</figcaption></figure><h4>Dual Track Process</h4><p>What if we have critical requests, emergencies, or if we detect a need that was in a blind spot until now and that Primary Research uncovered? What if at that moment, every Product Manager is already working on their topic? We should ask them to stop what they’re doing right?</p><p>This is where the second silver bullet comes into place. As I said at the beginning, part of my mission is “absorbing” insights, I do it not only through research, but also by relieving Product Managers as much as possible from being interrupted by small topics to the detriment of big and strategic topics they are working on. This is why at some point, we were constrained to find a solution to be able to tackle critical unplanned topics, and not interrupt Product Managers at the same time. That’s how we implemented the Dual Track Process.</p><p><strong>The purpose of the Dual Track Process is to bring a quick and dirty solution, that we call “tech iteration”, to a critical and unplanned problem, by short-circuiting the Product Managers and the Product Process in a regulated way.</strong> In such identified cases, I work directly with the Tech Team in order to find a basic design or tech resolution of the problem, that can be implemented as soon as possible without consuming too much time.</p><p>In its DNA, the objective is to get back to a MVP mindset and find the most simple tech iteration that will solve between approximately 60–70% of the problem of our users. This is not enough, but it presents several key advantages: it shows reactivity to our users (thus reinforcing our brand and the user experience), it solves part of the problem and relieves at least part of the users, and finally it provides us with production data —the most reliable of all— for the potential next iteration.</p><p>Along <strong>with the laser focus of the Secondary Research allowed by the work done with the Primary Research, the Dual Track Process brings even more velocity to the Product Process.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GgtG-dQGe1fBrd_uDl7tQw.jpeg" /><figcaption>The Dual Track Process enables us to short-circuit the Product Process in a regulated way</figcaption></figure><h3>Key takeaways</h3><p>To sum things up, we’ve been experiencing for the last 2 years in order to find the best way, the process to reach those 3 pillars: stability, agility, velocity.</p><p>The first silver bullet that worked for us was to distinguish 3 types of research: Primary, Secondary and Tertiary. This enables us to better define who is in charge of what, fueling smoother collaboration, finer anticipation of problematics and more focused resolution of problems.</p><p>The second silver bullet that worked for us was to implement a Dual Track Process that enables us to short-circuit Product Managers not to interrupt them, and tackle critical issues in no time.</p><p>Brought together, we thus now run a Product Process that brings:</p><ul><li>Stability, through Vision, the first stream of insights</li><li>Agility, through Primary and Tertiary Research, the other two streams of insights</li><li>Velocity, through focused Secondary Research and Dual Track process</li></ul><h3>What’s next?</h3><p>We recently had the chance to welcome an amazing Lead QA, one of our upcoming challenges will be to integrate the QA automations in the Product Process.</p><p>The R&amp;D team will approximately double this year, the objective will be to see how this Process perform in those conditions, if you want to have a closer look, we’re hiring another <a href="https://www.welcometothejungle.co/fr/companies/brigad/jobs">Product Manager and many Tech profiles</a> :)</p><h4><strong><em>The 2 most useful Product Process articles I’ve read in the last years</em></strong></h4><ul><li><a href="https://www.intercom.com/blog/exploratory-research-in-product-development/?utm_source=ii-newsletter&amp;utm_medium=email&amp;utm_campaign=20180523-inside-intercom"><em>Exploratory research: how to use it to drive product development</em></a><em> (Intercom)</em></li><li><a href="https://uxplanet.org/the-evolution-of-ux-process-methodology-47f52557178b"><em>The Evolution of UX Process Methodology</em></a><em> (UX Planet)</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=218183914d7d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/how-we-build-products-at-brigad-our-product-process-218183914d7d">How we build products at Brigad — Our Product Process</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Companies and open-source: a win for everyone]]></title>
            <link>https://medium.com/brigad-engineering/companies-and-open-source-a-win-for-everyone-f055013b8112?source=rss----5f46552aeaa0---4</link>
            <guid isPermaLink="false">https://medium.com/p/f055013b8112</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Thibault Malbranche]]></dc:creator>
            <pubDate>Tue, 09 Apr 2019 14:30:53 GMT</pubDate>
            <atom:updated>2019-04-09T14:30:53.008Z</atom:updated>
            <content:encoded><![CDATA[<h4>How using open source to help others can benefit you and your company.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rRfBBeTplnGgZ466" /><figcaption>Share these open source sweets — Photo by <a href="https://unsplash.com/@brookelark?utm_source=medium&amp;utm_medium=referral">Brooke Lark</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>This article is based on what I experienced as a React Native lead developer while working @ </em><a href="https://medium.com/u/89ef27090104"><em>Brigad</em></a><em>. I want to share what contributing allowed me to achieve, hoping to inspire you to do the same or help you encourage your peers around to do the same.</em></p><h3>Open source is good for you</h3><p>Recently, I have been invited to Facebook HQ in<strong> London</strong> as part of a React Native core contributors 3 days summit (thanks to <a href="https://medium.com/u/9ea60eb6fc7c">Christoph Nakazawa</a>). And this really made me realize why <strong>I love my job</strong>. 💛</p><p><em>How did I end up there? Well, it all started with my first contribution to react-native. Which was then followed by another one. And one after that. And discussing with other contributors. And helping people. And now I’m maintaining the first component that was extracted as part of the </em><a href="https://github.com/facebook/react-native/issues/23313"><em>lean core</em></a><em> effort: </em><a href="https://github.com/react-native-community/react-native-webview"><em>WebView</em></a><em>.</em></p><p>During the event, it really felt good as we were <strong>there to help people</strong> and discuss with each other: The main goal was to <a href="https://twitter.com/reactnative/status/1107699010012213250">bring the core contributors of React Native and Jest together into one place</a> and we also did a bunch of issue triage. I feel like we achieved a lot more than that. We also managed to get to know each other. 👋</p><p>Overall<strong> it feels great to be part of a community,</strong> and I think that react-native community is a great one. It’s also a huge and very challenging one as everything you do has quite a lot of impact. 👊</p><p><a href="https://github.com/facebook/react-native/issues/24032">We managed to triage more than 300 issues</a> <em>(don’t worry there are still some open ones if you want to help </em>👀<em>). </em>And this is what open source is about: being part of a bigger group that allows you to <strong>deal with problems and find solutions faster. 🔥</strong></p><p>But there’s more, it’s also very encouraging when people acknowledge that work is being done. Because <strong>these are the rewards of open source as an individual</strong>. You can <strong>share</strong> what you are doing with others, by <strong>traveling</strong>, going to <strong>meetups</strong>, or by giving <strong>talks</strong>. 🤓</p><p>Open-source will provide you with access to a lot of experience. 📚</p><h3>Open source is good for your company</h3><p>Of course, at first, it might seem inefficient to spend a little bit extra time to create pull requests, discuss with others that will challenge your work, but <strong><em>open-source is not working for others, it’s working with others. </em>😙</strong></p><p>I can testify that every minute I spent doing open-source work, it has allowed me <strong>to save time later on</strong>. As an example: let’s say that you’ve already helped out a library maintainer by contributing before and now you want to add a new feature that your company needs. Given your existing relationship with the maintainer you are most likely able to discuss this with them freely, get feedback, answers to any questions about implementation and perhaps even work together to implement it, all because you’ve shown a willingness to help out before. 🤝</p><p>Everyone doing open-source is <strong>trying to achieve a common goal,</strong> make everything better. Not everyone has the same way to do it or the same motivations, but I’ve certainly never seen a pull request that would intentionally make something worse. 🙌</p><p>Encouraging developers in your company to do that will also <strong>attract people to your company</strong> because they know the advantage they can get from doing open-source, so you can hire better profiles. Keeping a good mood is essential to have a healthy workplace. 💪</p><p>But <strong>encouraging people to do open-source does not mean they have to spend all their time working on it</strong>, or that they have to do a certain amount of time per week. It should always stay on a voluntary basis and people should still be able to prioritize any task over it if needed. The worst thing that could happen to anyone is burning out due to too much pressure, so <strong>do not let open-source be a duty, let it be a treat. 🍬</strong></p><p>I hope to see you all contributing to open-source projects or/and encouraging people to do so, as<strong> we will never be too many</strong>. 🎉</p><p><em>I’d like to thank my company, </em><a href="https://medium.com/u/89ef27090104"><em>Brigad</em></a><em>, for encouraging me to do all these things. Also, huge thanks to the React Native Community, where working with everyone is awesome. 💯</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f055013b8112" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brigad-engineering/companies-and-open-source-a-win-for-everyone-f055013b8112">Companies and open-source: a win for everyone</a> was originally published in <a href="https://medium.com/brigad-engineering">Brigad Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>