<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sean Bowen-Williams</title>
    <description>The latest articles on DEV Community by Sean Bowen-Williams (@sbowenwilliams).</description>
    <link>https://dev.to/sbowenwilliams</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F193220%2F0797b8a8-3fd4-4b6a-a1d9-36352a53e16c.png</url>
      <title>DEV Community: Sean Bowen-Williams</title>
      <link>https://dev.to/sbowenwilliams</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sbowenwilliams"/>
    <language>en</language>
    <item>
      <title>Going Against the Grain</title>
      <dc:creator>Sean Bowen-Williams</dc:creator>
      <pubDate>Mon, 15 Jul 2019 18:43:59 +0000</pubDate>
      <link>https://dev.to/sbowenwilliams/going-against-the-grain-k09</link>
      <guid>https://dev.to/sbowenwilliams/going-against-the-grain-k09</guid>
      <description>&lt;p&gt;Despite the title, this blog post is actually about when &lt;em&gt;not&lt;/em&gt; to go against the grain.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;BATEMAN: In '87, Huey released this; Fore!, their most accomplished album. I think their undisputed masterpiece is "Hip To Be Square". A song so catchy, most people probably don't listen to the lyrics. But they should, because it's not just about the pleasures of conformity and the importance of trends. It's also a personal statement about the band itself.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F27xubwgdnf5y2ozs8mo7.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F27xubwgdnf5y2ozs8mo7.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me set the stage:&lt;br&gt;
Our monolith rails app is 7-ish years old. That's old enough to drink in code years. I've been asked to create a &lt;em&gt;new&lt;/em&gt; kind of user that isn't tied to any particular client. &lt;/p&gt;

&lt;p&gt;Do I...&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Prepare myself for some &lt;a href="https://en.wikipedia.org/wiki/Shotgun_surgery" rel="noopener noreferrer"&gt;shotgun surgery&lt;/a&gt; and find every instance of &lt;code&gt;user.client&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;Go with the grain and maintain the expectation that all users have clients?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Well, since I am not a smart man, I went with option 1 first. It'll be so much more elegant, I told myself. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Narrator: It wasn't.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The problem with creating a user that doesn't have a client when all the code written in the past 7-ish years expects a a user-client relationship is that it breaks everywhere and it breaks all at once. I found myself debugging authentication, background data processing jobs, front-end bugs... &lt;/p&gt;

&lt;p&gt;I went down this path for a few days, thinking if I stomped out all the bugs I could merge my "elegant" solution. Luckily a much more wise engineer stepped in and imparted some wise words about the pleasures of conformity.&lt;/p&gt;

&lt;p&gt;In order to add this functionality (and to not have to regression test the entire application) I needed to find a solution that operated within the bounds set by years and years of expectations. It would be so &lt;em&gt;very&lt;/em&gt; unnecessarily disruptive to change a fundamental expectation to our application, like users having clients. &lt;/p&gt;

&lt;p&gt;And that's &lt;em&gt;okay&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;Yes, as software engineers it is a virtue for our objects to be as loosely tied together as possible. However, for most of the life span of the application (and it got us this far) users having clients and vice versa was not very likely to change. For most of the life span of the application, writing code that would break if that expectation changed was totally fine.&lt;/p&gt;

&lt;p&gt;At this point it was up to me to determine if I wanted to rebel against the expectations and shoulder the responsibility of changing years of code, or did I want to write my code &lt;em&gt;with&lt;/em&gt; the grain of the application.&lt;/p&gt;

&lt;p&gt;It wasn't that hard of a choice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I used to be a renegade, I used to fool around&lt;br&gt;
But I couldn't take the punishment and had to settle down&lt;br&gt;
-Huey Lewis and the News, Hip to Be Square&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
      <category>agile</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
