<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ian Ker-Seymer on Medium]]></title>
        <description><![CDATA[Stories by Ian Ker-Seymer on Medium]]></description>
        <link>https://medium.com/@ianks?source=rss-ce97660ec72------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KGOgyWd9rfX3ulTN6NW6hw.jpeg</url>
            <title>Stories by Ian Ker-Seymer on Medium</title>
            <link>https://medium.com/@ianks?source=rss-ce97660ec72------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:22:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ianks/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[3 React Patterns That Can Be Anti-Patterns]]></title>
            <link>https://medium.com/broadlume-product/3-react-patterns-that-can-be-anti-patterns-f1410402e633?source=rss-ce97660ec72------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1410402e633</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ian Ker-Seymer]]></dc:creator>
            <pubDate>Tue, 10 Nov 2020 21:42:20 GMT</pubDate>
            <atom:updated>2020-11-10T21:42:20.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*7cWNv63CKUsm-7bKw3peVg.png" /></figure><h3>1. Not Using Forms for GET Requests</h3><p>I see a lot of React components which do a ton of unnecessary state management to keep track of information. Oftentimes, these complicated queries can be simplified by using a powerful feature of HTML forms: &lt;form action=&quot;GET&quot;&gt;.</p><p>When you use a form, the browser will handle all of the state management and URL encoding for free. Using this trick will make your React code simpler, more maintainable, and easier to read. 🙌</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3369aa7a71750bf68d343fb7f5233c1/href">https://medium.com/media/e3369aa7a71750bf68d343fb7f5233c1/href</a></iframe><p>Next time you find yourself managing a ton of state for a form, see if you and get away without using Javascript at all for managing state, and instead use HTML forms and your router of choice.</p><h3><strong>2. Never Using Class Components</strong></h3><p>If you are not aware, hooks are the new hotness in React. They are incredibly useful for handling state in functional components and oftentimes make React code simpler, and easier to read.</p><p>One pattern I have seen in React apps is using hooks and functional components for <em>absolutely everything</em>.</p><blockquote>“When you have a hammer, everything looks like a nail.” 🔨</blockquote><p>In my opinion, sometimes class components can be easier to comprehend and quicker to write.</p><p>Let’s be honest here. Which of these two examples do you find <em>easier</em> to read?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7db6f71fa05ef1754d5d7d19a04fa59a/href">https://medium.com/media/7db6f71fa05ef1754d5d7d19a04fa59a/href</a></iframe><p>If you are like me, <strong>Example 1 </strong>is something I can glance at and immediately understand what it does. However, in <strong>Example 2</strong>, I had to reference <a href="https://reactjs.org/docs/hooks-reference.html#usecallback">the docs</a> and <a href="https://www.robinwieruch.de/react-usecallback-hook">a couple of blog posts</a> to remember what useCallback does.</p><p>I’m not saying that you should never use hooks; in fact, <em>I use React hooks all the time</em>! But in certain cases, class components make your code more readable and maintainable.</p><p>If you have a functional component with a lot of helper methods or confusing hooks, consider using a class component to see if it is easier to understand.</p><h3>3. Not Using CSS When It Makes Sense</h3><p>Since React has such powerful JS functionality, sometimes it is easy to forget about traditional CSS styles.</p><p>One anti-pattern I have seen a lot is what I call <strong>over-reliance on conditional rendering</strong>. For example, it is incredibly easy to hide a component in 2 lines of JS in React:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40da83d5bc60c3a6639c08a0fe966c43/href">https://medium.com/media/40da83d5bc60c3a6639c08a0fe966c43/href</a></iframe><p>However, this can often lead to jarring user experiences since components pop in and out of existence <em>instantly</em>. Instead, I prefer to use <strong>conditional classnames</strong> and CSS to create a smoother UX.</p><p>In this pattern, instead of hiding a component using an if statement, you can add a className prop which will hide the component using an animation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c32268684773053235b12f2e8028531e/href">https://medium.com/media/c32268684773053235b12f2e8028531e/href</a></iframe><p><strong>Pro Tip: </strong>Check out <a href="https://animate.style/">Animate.css</a> for some awesome, “just add water” CSS animations to use with this pattern.</p><h3>Summary</h3><p>Overall, I’d encourage all React developers to learn about all of the powerful features that the <a href="https://developer.mozilla.org/en-US/">Web Platform</a> has to offer. Oftentimes, they will make your components simpler, more maintainable, and more robust. Your team (and your customers) will thank you! ❤️</p><h3>Bonus: Study Materials</h3><ol><li><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form">Learn about all of the powerful features of HTML forms</a></li><li><a href="https://dmitripavlutin.com/dont-overuse-react-usecallback/">Your Guide to React.useCallback()</a></li><li><a href="https://medium.com/broadlume-product/are-you-wasting-precious-time-5-software-engineering-productivity-hacks-5a04f091f576">Don’t Waste Your Precious Development Time</a></li><li><a href="https://github.com/JedWatson/classnames">The classnames JS library</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1410402e633" width="1" height="1" alt=""><hr><p><a href="https://medium.com/broadlume-product/3-react-patterns-that-can-be-anti-patterns-f1410402e633">3 React Patterns That Can Be Anti-Patterns</a> was originally published in <a href="https://medium.com/broadlume-product">Broadlume Product Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using PostgreSQL to Generate Slugs]]></title>
            <link>https://medium.com/broadlume-product/using-postgresql-to-generate-slugs-5ec9dd759e88?source=rss-ce97660ec72------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec9dd759e88</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[postgresql]]></category>
            <dc:creator><![CDATA[Ian Ker-Seymer]]></dc:creator>
            <pubDate>Wed, 23 May 2018 19:08:04 GMT</pubDate>
            <atom:updated>2018-05-23T19:09:13.835Z</atom:updated>
            <content:encoded><![CDATA[<p>Slugs are useful for generating friendly identifiers for resources. For example, Yelp will generate the slug <em>kimball-house-decatur</em> for the restaurant <a href="https://www.yelp.com/biz/kimball-house-decatur">Kimball House</a> in Decatur, GA. By having a friendly slug in the URL, it makes it easier for me to find the Yelp listing when I search the web for this delicious restaurant.</p><p>We decided to use <a href="https://www.postgresql.org/">PostgreSQL</a> to create a <em>slugify</em> function that we can easily use. Here’s what the code looks like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c39b1c7fb42959360c8b3f8169bece1d/href">https://medium.com/media/c39b1c7fb42959360c8b3f8169bece1d/href</a></iframe><p>Keep in mind you may have to deal with some uniqueness constraints, so use this code as a starting point if you decide to create slugs in the DB. Specifically, we had to create a <a href="https://www.postgresql.org/docs/current/static/sql-createsequence.html">SEQUENCE</a> for duplicate slugs and append it to the slug. This worked in our case but might not work if you expect to have a ton of conflicts.</p><p>Keep sluggin’!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec9dd759e88" width="1" height="1" alt=""><hr><p><a href="https://medium.com/broadlume-product/using-postgresql-to-generate-slugs-5ec9dd759e88">Using PostgreSQL to Generate Slugs</a> was originally published in <a href="https://medium.com/broadlume-product">Broadlume Product Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quickly debug failures in RSpec]]></title>
            <link>https://medium.com/broadlume-product/quickly-debug-failures-in-rspec-c4e50c1a9c4f?source=rss-ce97660ec72------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4e50c1a9c4f</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rspec]]></category>
            <dc:creator><![CDATA[Ian Ker-Seymer]]></dc:creator>
            <pubDate>Wed, 07 Feb 2018 16:27:59 GMT</pubDate>
            <atom:updated>2018-02-07T16:27:59.881Z</atom:updated>
            <content:encoded><![CDATA[<p>The main reason I prefer using RSpec is that I find the CLI integration to be much more usable than alternatives like Minitest.</p><p>Since RSpec 3.3, RSpec has offered the --next-failure feature. With this option, RSpec will only the first spec that failed. This is perfect for situations where diffs made some tests fail, or you just want to stay focused on the current failure.</p><p>In order to make this work, RSpec keeps some metadata about your previous runs. To enable this, add this to your spec_helper.rb:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45e233ad6cb8bcadcc7d0a2fe9d7c190/href">https://medium.com/media/45e233ad6cb8bcadcc7d0a2fe9d7c190/href</a></iframe><p>Unfortunately, rspec --next-failure required a little too much typing for my liking. So as of RSpec 3.7, you can now just rspec -n. A small ergonomics improvement.</p><p>If you love writing well-tested, decoupled, happiness-inducing Ruby and React, <a href="https://angel.co/adhawk/jobs">we’re hiring!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4e50c1a9c4f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/broadlume-product/quickly-debug-failures-in-rspec-c4e50c1a9c4f">Quickly debug failures in RSpec</a> was originally published in <a href="https://medium.com/broadlume-product">Broadlume Product Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL For Your Rails App (Talk)]]></title>
            <link>https://medium.com/broadlume-product/graphql-for-your-rails-app-talk-65ad6f77ce86?source=rss-ce97660ec72------2</link>
            <guid isPermaLink="false">https://medium.com/p/65ad6f77ce86</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Ian Ker-Seymer]]></dc:creator>
            <pubDate>Wed, 07 Feb 2018 16:12:43 GMT</pubDate>
            <atom:updated>2018-02-07T16:36:09.579Z</atom:updated>
            <content:encoded><![CDATA[<p>GraphQL For Your Rails App (Talk)</p><p>Hey there! I recently did a talk for the Atlanta Ruby Meetup about using GraphQL in your Rails app. I discuss how GraphQL can be a powerful alternative to typical Rails APIs, and how to use it in an existing Rails app.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGdZUeHUEj00%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGdZUeHUEj00&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FGdZUeHUEj00%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1dbb12f49020b7289199de5cb78b1ab/href">https://medium.com/media/b1dbb12f49020b7289199de5cb78b1ab/href</a></iframe><p>I have also uploaded the slides here: <a href="https://s3-us-west-1.amazonaws.com/adhawk-random-public/GraphQL+Presentation.pdf">https://s3-us-west-1.amazonaws.com/adhawk-random-public/GraphQL+Presentation.pdf</a></p><p>Hope you enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65ad6f77ce86" width="1" height="1" alt=""><hr><p><a href="https://medium.com/broadlume-product/graphql-for-your-rails-app-talk-65ad6f77ce86">GraphQL For Your Rails App (Talk)</a> was originally published in <a href="https://medium.com/broadlume-product">Broadlume Product Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RSpec matchers are a powerful tool.]]></title>
            <link>https://medium.com/broadlume-product/rspec-matchers-are-a-powerful-tool-f6c0af420cbf?source=rss-ce97660ec72------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6c0af420cbf</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rspec]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Ian Ker-Seymer]]></dc:creator>
            <pubDate>Tue, 20 Jun 2017 11:01:01 GMT</pubDate>
            <atom:updated>2017-06-20T11:01:01.319Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*wpwQI9X7wWUAeLO4b5537w.png" /></figure><p>RSpec matchers are a powerful tool. They allow you describe what your intentions are in a concise and accurate way.</p><p>However, like anything meant to be interpreted by a machine, they can become verbose.</p><p>Imagine we have a Post class, which has a list of comments stored managed by some external service that we access over HTTPs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54f8ef72555d973fdfd97d72c781fef2/href">https://medium.com/media/54f8ef72555d973fdfd97d72c781fef2/href</a></iframe><p>We want to test that we call the API with the correct parameters. It’s a simple proposition, but the expectation can become a little unwieldy and repetitive.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc8c29e28881374c8c8f98c3ad63ebee/href">https://medium.com/media/fc8c29e28881374c8c8f98c3ad63ebee/href</a></iframe><p>Not terrible, but certainly a bit verbose and repetitive. We can do better.</p><p>In RSpec, the argument received by .to is called a <em>matcher</em>. Matchers define the expectations for the behavior of the &quot;subject&quot; you are testing. Although &quot;matchers&quot; give you a nice syntax for describing what is being tested, they can quickly become procedural. In our example, a significant portion of the matcher is boilerplate and/or implementation details.</p><p>Luckily, RSpec gives you a way to define <a href="https://relishapp.com/rspec/rspec-expectations/v/3-6/docs/custom-matchers/define-a-custom-matcher">Custom Matchers</a>; very exciting!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/763bd830e381d2661ec2c24d35863b40/href">https://medium.com/media/763bd830e381d2661ec2c24d35863b40/href</a></iframe><p>However, in my experience, people do not begin creating Custom Matchers until expectations get extremely unwieldy. It’s not because I do not like them, it is because I can never remember the syntax.</p><p>Luckily, matchers are easy to create. In fact, you create them for every spec. Since matchers are just encapsulated objects, you can name them!</p><p>So these days instead of writing a Custom Matcher, I define a plain-old Ruby Method (PORM?) which returns a matcher. If the matcher becomes useful enough that is justifies it’s own Custom Matcher, I will then extract it.</p><p>Now, our new spec now becomes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9ef594460f609498b55240ed999d63d/href">https://medium.com/media/c9ef594460f609498b55240ed999d63d/href</a></iframe><p>Much simpler, eh?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6c0af420cbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/broadlume-product/rspec-matchers-are-a-powerful-tool-f6c0af420cbf">RSpec matchers are a powerful tool.</a> was originally published in <a href="https://medium.com/broadlume-product">Broadlume Product Development</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>