<?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[Catch&amp;Release Technology - Medium]]></title>
        <description><![CDATA[Things we found interesting while building stuff - Medium]]></description>
        <link>https://medium.com/catch-release-engineering?source=rss----7d1139bf9ad3---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Catch&amp;amp;Release Technology - Medium</title>
            <link>https://medium.com/catch-release-engineering?source=rss----7d1139bf9ad3---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 05:59:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/catch-release-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[Null Object Pattern with React]]></title>
            <link>https://medium.com/catch-release-engineering/null-object-pattern-with-react-87379ab98da4?source=rss----7d1139bf9ad3---4</link>
            <guid isPermaLink="false">https://medium.com/p/87379ab98da4</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-design-patterns]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Damian Galarza]]></dc:creator>
            <pubDate>Mon, 25 Feb 2019 04:41:00 GMT</pubDate>
            <atom:updated>2019-02-25T16:29:19.812Z</atom:updated>
            <content:encoded><![CDATA[<p>In object oriented programming, the Null Object pattern is an object that can be used to represent null behavior. This typically helps make your code more readable and easier to maintain. Let’s take a look at how we might practice this in React.</p><h3>Rendering null</h3><p>In our application, a user can upload different types of documents. When viewing a list of those documents, they can select an action to perform. See the screenshot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*0ZPjRKuICcbXoQoailnCHw.png" /><figcaption>Documents table with multiple types of documents.</figcaption></figure><p>Each of the document types has a different set of actions that can be performed. In order to encapsulate this complexity, we extracted a separate component to act as an adapter. Handling the check against the type of document we’re operating on and what should be rendered for it.</p><pre>const DocumentActions = ({ document }) =&gt; {<br>  if (document.documentType === ‘external_document’) {<br>    return &lt;ExternalDocumentActions document={document} /&gt;;<br>  } else if (document.documentType === ‘uploaded_document’) {<br>    return &lt;UploadedDocumentActions document={document} /&gt;;<br>  }<br>};</pre><p>This allows us to have a pretty straightforward test.</p><pre>import { shallow } from ‘jest’;</pre><pre>describe(‘&lt;DocumentActions /&gt;’, () =&gt; {<br>  context(‘actions for an external document’, () =&gt; {<br>    it(‘renders the ExternalDocumentActions component’, () =&gt; {<br>      const document = { documentType: ‘external_document’ };</pre><pre>      const documentActions = shallow(<br>        &lt;DocumentActions document={document} /&gt;<br>       );</pre><pre>      expect(documentActions.find(ExternalDocumentActions))<br>       .toExist();<br>    });<br>  });</pre><pre>  context(‘actions for uploaded document’, () =&gt; {<br>    it(‘renders the UploadedDocumentActions component’, () =&gt; {<br>      const document = { documentType: ‘uploaded_document’ };</pre><pre>      const documentActions = shallow(<br>        &lt;DocumentActions document={document} /&gt;<br>      );</pre><pre>      expect(documentActions.find(UploadedDocumentActions))<br>       .toExist();<br>    });<br>  });<br>});</pre><p>With only two document types, we can already see some duplication. That is, the props being passed down into the document actions for a given type. Each actions component requires access to the document itself. Another problem we have is that we can’t easily test what happens in the event that an unsupported document type is passed in.</p><p>Let’s start by cleaning up some of the duplication.</p><pre>const DocumentActions = ({ document }) =&gt; {<br>  let Component;</pre><pre>  if (document.documentType === &#39;external_document&#39;) {<br>    Component = ExternalDocumentActions;<br>  } else if (document.documentType === &#39;uploaded_document&#39;) {<br>    Component = UploadedDocumentActions<br>  }</pre><pre>  Component ? &lt;Component document={document} /&gt; : null;<br>};</pre><p>This cleans up the duplication and we could easily stop here. However, we’ve now introduced another branch in our code and as a result, more complexity. Now we have to make sure that we check if `Component` is actually something that can be rendered by React or if we need to do something else instead.</p><p>Let’s introduce a `Null` component to see how we might clean this up further.</p><pre>const Null = () =&gt; null;</pre><p>Our Null component implementation is quite basic. All it is is a function that returns null. This satisfies the JSX expected interface to be a function, which can take args for props and returns what to render if anything.</p><p>Now our code can become:</p><pre>const DocumentActions = ({ document }) =&gt; {<br>  let Component;</pre><pre>  switch (document.documentType) {<br>    case &#39;external_document&#39;:<br>      Component = ExternalDocumentActions;<br>      break;<br>    case &#39;uploaded_document&#39;:<br>      Component = UploadedDocumentActions;<br>    default:<br>      Component = Null;<br>   }</pre><pre>  return &lt;Component document={document} /&gt;;<br>};</pre><p>Now, our DocumentActions component has a single clear interface and responsibility; and we can even test the default state.</p><pre>import { shallow } from &#39;jest&#39;;</pre><pre>describe(&#39;&lt;DocumentActions /&gt;&#39;, () =&gt; {<br>  context(&#39;actions for an external document&#39;, () =&gt; {<br>    it(&#39;renders the ExternalDocumentActions component&#39;, () =&gt; {<br>      const document = { documentType: &#39;external_document&#39; };<br>      const documentActions = shallow(<br>        &lt;DocumentActions document={document} /&gt;<br>      );</pre><pre>      expect(documentActions.find(ExternalDocumentActions))<br>       .toExist();<br>    });<br>  });</pre><pre>  context(&#39;actions for uploaded document&#39;, () =&gt; {<br>    it(&#39;renders the UploadedDocumentActions component&#39;, () =&gt; {<br>      const document = { documentType: &#39;uploaded_document&#39; };<br>      const documentActions = shallow(<br>        &lt;DocumentActions document={document} /&gt;<br>      );</pre><pre>      expect(documentActions.find(UploadedDocumentActions))<br>       .toExist();<br>   });<br> });</pre><pre>  context(&#39;default&#39;, () =&gt; {<br>    it(&#39;renders the Null component&#39;, () =&gt; {<br>      const document = { documentType: &#39;unsupported_document&#39; };<br>      const documentActions = shallow(<br>        &lt;DocumentActions document={document} /&gt;;<br>      );</pre><pre>      expect(documentActions.find(Null)).toExist();<br>    });<br>  });<br>});</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87379ab98da4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/catch-release-engineering/null-object-pattern-with-react-87379ab98da4">Null Object Pattern with React</a> was originally published in <a href="https://medium.com/catch-release-engineering">Catch&amp;Release Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Stenographer]]></title>
            <link>https://medium.com/catch-release-engineering/introducing-stenographer-6a27f4437bee?source=rss----7d1139bf9ad3---4</link>
            <guid isPermaLink="false">https://medium.com/p/6a27f4437bee</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[stenographer]]></category>
            <dc:creator><![CDATA[Michael Carey]]></dc:creator>
            <pubDate>Thu, 23 Aug 2018 17:00:44 GMT</pubDate>
            <atom:updated>2018-08-23T17:00:44.308Z</atom:updated>
            <content:encoded><![CDATA[<p>A better way to keep your team informed and highlight product changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*2lm8XwCGb3qlPTRmGF_png.png" /><figcaption>The Stenographer Logo</figcaption></figure><p>At Catch&amp;Release we have a small product/engineering team and a much bigger team that use our software for their day to day jobs. When we first started building out platform, we could simply turn around and have an impromptu meeting with everyone to explain our new features. This worked pretty well, though we would still have confusion about what was released.</p><p>Looking at the options out there, we didn’t really find much. You can invite your entire team into your task tracking software but that feels heavy handed and requires them to read through the noise. You can have someone hand generate release notes but it’s likely they’ll miss something as they scan back through your last sprints changes. Not liking either of those options, we set out to create something for Rails that’s automatic and helps bring out the signal from the noise, <a href="https://github.com/CatchRelease/stenographer">Stenographer</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*oNCakDd9gGLEKED_dZWAWw.png" /><figcaption>The Stenographer Home Screen</figcaption></figure><p>Rather than relying on team memory or walking back through what could be a cryptic sprint’s worth of commit messages, Stenographer puts the onus on the developer to create a “human-readable” message when they push up their code. By simply adding [changelog Added emojis!] to your commit message, all your users will know that they can now enjoy full emoji support 😊.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*XSa4gGt7wb2xINT449fpzw.png" /><figcaption>Stenographer’s Slack Integration</figcaption></figure><p>For our first release, we focused on the technologies we use, <a href="http://github.com/">Github</a> and <a href="http://slack.com/">Slack</a>. When a commit comes in with [changelog] it’s displayed and sends a message to a Slack channel. In the future, we hope to add support for a full range of other inputs and outputs. Go ahead and check it out and let us know what you think!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a27f4437bee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/catch-release-engineering/introducing-stenographer-6a27f4437bee">Introducing Stenographer</a> was originally published in <a href="https://medium.com/catch-release-engineering">Catch&amp;Release Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>