<?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: Claire Lipskey</title>
    <description>The latest articles on DEV Community by Claire Lipskey (@clairebaire).</description>
    <link>https://dev.to/clairebaire</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%2F395317%2F87f7c9c2-951d-47bd-bd2b-1e3ccdec0e17.jpeg</url>
      <title>DEV Community: Claire Lipskey</title>
      <link>https://dev.to/clairebaire</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/clairebaire"/>
    <language>en</language>
    <item>
      <title>Why can't we solve accessibility with a one line script tag?</title>
      <dc:creator>Claire Lipskey</dc:creator>
      <pubDate>Sat, 07 Aug 2021 04:29:38 +0000</pubDate>
      <link>https://dev.to/clairebaire/why-can-t-we-solve-accessibility-with-a-one-line-script-tag-508f</link>
      <guid>https://dev.to/clairebaire/why-can-t-we-solve-accessibility-with-a-one-line-script-tag-508f</guid>
      <description>&lt;p&gt;This is a good question. There are some companies that'd like to beg to differ (such as AccessiBe, which is rubbish). This post is not for them. It's for you. They know what they're doing (and not doing).&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1421660430217490433-445" src="https://platform.twitter.com/embed/Tweet.html?id=1421660430217490433"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1421660430217490433-445');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1421660430217490433&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  To start: the web is (generally) accessible by default.
&lt;/h2&gt;

&lt;p&gt;We break it. Me, you, companies, capitalism, you name it - that's what breaks the web from being accessible.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tags with an &lt;code&gt;onClick&lt;/code&gt; event when the &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; element is right there, modals that don't trap focus, and other examples are rampant throughout the Internet.&lt;/p&gt;

&lt;p&gt;Let's think about this from the angle of how your code is interpreted by the browser and accessibility software:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write some HTML.&lt;/li&gt;
&lt;li&gt;Load that HTML into a browser.&lt;/li&gt;
&lt;li&gt;The browser interprets that HTML, and creates an accessibility tree out of it (among rendering it, etc)&lt;/li&gt;
&lt;li&gt;The browser exposes an API that accessibility technology accesses, and a browser interprets the HTML as if it was written to &lt;em&gt;standards&lt;/em&gt;.

&lt;ul&gt;
&lt;li&gt;If this HTML is not up to spec, such as being used improperly (looking at a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; with an &lt;code&gt;onClick&lt;/code&gt; event, for example), the browser cannot infer what exactly that is for.&lt;/li&gt;
&lt;li&gt;This affects the accessibility technology, as it can only do with what the browser provides.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If we use web technologies improperly, do we expect a browser to somehow perform heuristics to get what we mean? After all, programming is &lt;em&gt;literally&lt;/em&gt; telling a computer what to do in a language it understands. If we do not tell it what to do in a way it understands, it will &lt;em&gt;generally&lt;/em&gt; take the safest path.&lt;/p&gt;

&lt;p&gt;An example of this is correcting for when a closing HTML tag is missing. In older browser days, the standard allowed for certain tags to omit a closing tag and that was &lt;em&gt;valid&lt;/em&gt; HTML. That's not the case anymore (except for certain exceptions, like &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;!).&lt;/p&gt;

&lt;p&gt;Take this code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
  &amp;lt;span&amp;gt;Hello!
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In any modern browser, the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; above will be automatically closed in the DOM if you inspect it.&lt;/p&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3mpksmvclqrdb8dgfs0.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe3mpksmvclqrdb8dgfs0.png" alt="Screenshot from Firefox's Inspector showing the DOM with a span that has a closing span tag, yet the source does not have that closing tag"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the source above, there's not even an HTML tag, HEAD tag, or BODY tag, yet Firefox assumes it anyway. The browser can help us in many ways, but it cannot get our intent out of our badly formed code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sometimes, the standards aren't all we need
&lt;/h2&gt;

&lt;p&gt;In other instances, we can correctly use all HTML tags and still not make an accessible interface. This is where the nuance comes into play. For example, a modal. By definition, a modal is simply a dialog over top other elements. The user experience dictates that this is treated as a separate "document", and there's no standard way to do this. Modals in general break the way the web was created. A page is a "document", yet a modal is a "document within a document."&lt;/p&gt;

&lt;p&gt;If a document is to really behave like a document, then it must be the sole document "in focus." With modals, we generally add a "focus trap" to make sure that users cannot get out of it unwillingly. A bolt-on script will not know this is what you intended.&lt;/p&gt;

&lt;p&gt;There are some instances where we &lt;em&gt;need&lt;/em&gt; JavaScript in order to make the web accessible. Stephanie Eckles &lt;a href="https://www.smashingmagazine.com/2021/06/css-javascript-requirements-accessible-components/" rel="noopener noreferrer"&gt;wrote a really good Smashing Magazine article&lt;/a&gt; that expands on this.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does someone's JavaScript know this nuance?
&lt;/h2&gt;

&lt;p&gt;It doesn't. It can't. It won't. And users that need accessible interfaces and experts in the field have said &lt;a href="https://overlayfactsheet.com/" rel="noopener noreferrer"&gt;time&lt;/a&gt; and &lt;a href="https://nfb.org/about-us/press-room/national-convention-sponsorship-statement-regarding-accessibe" rel="noopener noreferrer"&gt;time&lt;/a&gt; &lt;a href="https://twitter.com/HabenGirma/status/1390051536819023873?s=20" rel="noopener noreferrer"&gt;again&lt;/a&gt; that &lt;a href="https://adrianroselli.com/2020/06/accessibe-will-get-you-sued.html" rel="noopener noreferrer"&gt;it&lt;/a&gt; &lt;a href="https://twitter.com/toddlibby/status/1421396502052839429?s=20" rel="noopener noreferrer"&gt;doesn't&lt;/a&gt; &lt;a href="https://www.nbcnews.com/tech/innovation/blind-people-advocates-slam-company-claiming-make-websites-ada-compliant-n1266720" rel="noopener noreferrer"&gt;work&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't resort to bolt-on fixes
&lt;/h2&gt;

&lt;p&gt;AccessiBe isn't the first company to do this, but it's making big promises and &lt;a href="https://adrianroselli.com/2020/06/accessibe-will-get-you-sued.html#Update06" rel="noopener noreferrer"&gt;being slimy in the process&lt;/a&gt;. There are &lt;a href="https://overlayfactsheet.com/#statement-from-sponsors-and-signatories-to-this-fact-sheet" rel="noopener noreferrer"&gt;others named&lt;/a&gt; in the Overlay Fact Sheet - they should all be avoided.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accessibility is not a bolt-on.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Front-end development is not automatically easy. Project timelines should reflect that.</title>
      <dc:creator>Claire Lipskey</dc:creator>
      <pubDate>Sun, 07 Mar 2021 04:58:01 +0000</pubDate>
      <link>https://dev.to/clairebaire/front-end-development-is-not-automatically-easy-project-timelines-should-reflect-that-15d5</link>
      <guid>https://dev.to/clairebaire/front-end-development-is-not-automatically-easy-project-timelines-should-reflect-that-15d5</guid>
      <description>&lt;p&gt;&lt;em&gt;(thanks Unsplash for the cover image)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've had the title of "front-end engineer" in some sort of capacity for almost 9 years now. In these 9 years, one thing has not changed:&lt;/p&gt;

&lt;p&gt;| "Oh, that's just HTML and CSS, that'll take like, 2 days right?"&lt;/p&gt;

&lt;p&gt;This &lt;em&gt;could&lt;/em&gt; be true, but it is not usually true. We see this in discourse on Twitter, in meetings throughout our workplaces, and in general the vibe that front-end is not really "development", "engineering", or "programming".&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do questions / statements like this matter?
&lt;/h2&gt;

&lt;p&gt;This sentiment towards a craft really "grind my gears" so to speak. It emboldens the following assumptions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;That front-end (HTML, CSS, and JavaScript) languages are easy.&lt;/li&gt;
&lt;li&gt;That there is no lead time to "getting things ready"&lt;/li&gt;
&lt;li&gt;That there is no lead time to really get a project into a "let's go" state.&lt;/li&gt;
&lt;li&gt;That there is nothing to clean up (if it's an existing project)&lt;/li&gt;
&lt;li&gt;That you can write code once and it works and it's good to go (browser testing across devices is a thing!)&lt;/li&gt;
&lt;li&gt;That organization and writing clean, maintainable code takes no time at all.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These assumptions are harmful to any craft - but we see it all the time with front-end engineering.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a better response?
&lt;/h2&gt;

&lt;p&gt;Timelines are important to any project - I'm definitely not disputing that. Front-end engineers are usually sandwiched between design and back-end engineers - both of whom are usually given a bit of lead time to really understand the problem. Many front-end engineers want to be and &lt;em&gt;need&lt;/em&gt; to be part of that lead time / discussion.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Ask the ones writing the code&lt;/strong&gt; &lt;br&gt;
This might sound wild, but &lt;em&gt;ask the people who are making the changes&lt;/em&gt; and adjust your business priorities accordingly. They may waffle on an answer, but their waffling is &lt;em&gt;also&lt;/em&gt; a good indication it may take a bit more time than you realize.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;If you allow time for design, allow time for development&lt;/strong&gt; &lt;br&gt;
It is not unfathomable that the time it took to research / come up with finessed designs might be around the same time a developer needs to execute the designs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Give front-end engineers the respect they deserve&lt;/strong&gt;&lt;br&gt;
Front-end engineers have to support a wide range of clients, deal with languages that are &lt;em&gt;constantly&lt;/em&gt; changing (like, literally, every 4-6 weeks a browser might support something new), and constantly have to watch out for themselves by not painting themselves into a corner when a new design comes across the table.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Design is not easy.
&lt;/h2&gt;

&lt;p&gt;This applies to the actual creation of designs (UX, visual, content, etc) but also architectural design of a codebase. Companies &lt;em&gt;all the time&lt;/em&gt; find themselves in a situation where a codebase is not "feasible" to be upgraded because things weren't thought of when it was designed.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you overcome this problem?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Slow down.&lt;/strong&gt; Take a bit more time to create a &lt;em&gt;scalable&lt;/em&gt; system, no matter the language, that can take you from small to large. I'm not advocating for perfection - &lt;strong&gt;I'm advocating for sensible and pragmatic development&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Invest in what you're making - whether you're a small startup or a company that can throw tens of millions of dollars at a project on a whim.&lt;/p&gt;

&lt;p&gt;Allow your engineers this time. It will help you (and your team) later.&lt;/p&gt;

</description>
      <category>html</category>
      <category>webdev</category>
      <category>css</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Developing with Empathy: Using a Code Style Guide</title>
      <dc:creator>Claire Lipskey</dc:creator>
      <pubDate>Sat, 12 Sep 2020 03:33:31 +0000</pubDate>
      <link>https://dev.to/clairebaire/developing-with-empathy-using-a-code-style-guide-48j4</link>
      <guid>https://dev.to/clairebaire/developing-with-empathy-using-a-code-style-guide-48j4</guid>
      <description>&lt;p&gt;Being a developer doesn't mean you're just coding all the time. You code, but you also communicate, interact with other people's code, maybe even &lt;em&gt;get on a zoom call&lt;/em&gt;. Whatever it might be that you do, being on the same page is probably a good idea.&lt;/p&gt;

&lt;p&gt;In my various development experiences, I've found that setting expectations of what "good code" or "clean code" looks like is a great way to help folks who do not necessarily know what questions to ask or if they even have any questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is good code?
&lt;/h2&gt;

&lt;p&gt;Well, honestly, good code is what you make it to be. As long as it works / compiles / whatever, it's code. You can show your fellow coworkers / cohorts what good code &lt;em&gt;looks&lt;/em&gt; like, but until you write down or codify (&lt;em&gt;giggle&lt;/em&gt;) what that is, folks are going to write what they want to get the job done.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is this necessary?
&lt;/h2&gt;

&lt;p&gt;For a lack of better jokes: so that everyone is speaking the same language. If everyone writes code &lt;em&gt;similarly&lt;/em&gt; then it helps code reviews, discovering bugs and pairing in general. I find myself doing at least two things before I really can start thinking about the problem being presented to me when I am pairing with someone:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adjusting to the style of the code, whether that is the organization of the CSS rules or how abstracted the JS is.&lt;/li&gt;
&lt;li&gt;Re-reading through everything before making sense of it and making recommendations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I feel like this goes faster when everyone kinda does things similarly.&lt;/p&gt;

&lt;p&gt;Style guides help do the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure everyone is writing similar code&lt;/li&gt;
&lt;li&gt;Ensure readability&lt;/li&gt;
&lt;li&gt;Ramp up new developers to the "expectations" of "good code" or "clean code"&lt;/li&gt;
&lt;li&gt;Clears up any issues regarding the above otherwise vague terms.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What does a good style guide look like?
&lt;/h2&gt;

&lt;p&gt;Well, again, that's up to you! I have some recommendations, though:&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/airbnb/css"&gt;Airbnb's CSS Style Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cssguidelin.es/"&gt;Harry Roberts' CSS Guidelines&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://piccalil.li/cube-css/"&gt;Andy Bell's CUBE CSS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Javascript
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/airbnb/javascript"&gt;Airbnb's Javascript Style Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://google.github.io/styleguide/jsguide.html"&gt;Google's Javascript Style Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://standardjs.com"&gt;StandardJS (an enforced style guide)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many others out there, and some of those out there come with their own tooling, such as Airbnb's &lt;code&gt;banel-preset-airbnb&lt;/code&gt; or even StandardJS' &lt;code&gt;npm install standard&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Being on the same page with your team with regard to "good code" not only improves communication and team dynamics, but it reduces the "omg who wrote this?" reaction you might have before you pull out git blame :)&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Developing with Empathy: Reusability</title>
      <dc:creator>Claire Lipskey</dc:creator>
      <pubDate>Thu, 10 Sep 2020 19:01:02 +0000</pubDate>
      <link>https://dev.to/clairebaire/developing-with-empathy-reusability-b6a</link>
      <guid>https://dev.to/clairebaire/developing-with-empathy-reusability-b6a</guid>
      <description>&lt;p&gt;"Reusability", "Reusable Components"... we've all heard it before.&lt;/p&gt;

&lt;p&gt;In my &lt;a href="https://dev.to/clairebaire/developing-with-empathy-single-responsibility-359"&gt;last post&lt;/a&gt;, I spoke about the Single Responsibility Principle. Now, if we take this idea and apply it to "reusable components" or "reusability" it makes total sense. But aside from reusable components, what other ways can we make our code more modular and reusable?&lt;/p&gt;

&lt;p&gt;Let's put it in the context of the code below:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;index.html&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;script src="date.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;form&amp;gt;
    &amp;lt;input type="date" id="date1" name="date1"&amp;gt;
    &amp;lt;input type='date" id="date2" name="date2"&amp;gt;
    &amp;lt;button&amp;gt;Submit&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;date.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener('submit', () =&amp;gt; {
    let date1 = document.getElementById('date1').valueAsDate
    let date2 = document.getElementById('date2').valueAsDate

    console.log(Math.abs(parseInt(date1 / 60 * 60 * 1000 * 24) - parseInt(date2 / 60 * 60 * 1000 * 24)))
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a very rudimentary example, but I have found a lot in my experience as a front-end engineer that when writing code, sometimes there is not a thought to abstract something that could be calculated / used somewhere else.&lt;/p&gt;

&lt;p&gt;How might we make the above code a bit more abstract? Or how might we break out some functionality to be able to be used elsewhere?&lt;/p&gt;

&lt;p&gt;Take this modified code sample for example:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;date.js&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;document.addEventListener('submit', () =&amp;gt; {
    let date1 = document.getElementById('date1').valueAsDate
    let date2 = document.getElementById('date2').valueAsDate

    console.log(calculateDaysBetween(date1, date2))
});

function calculateDaysBetween(date1: Date, date2: Date): number {
    const toDays = 60 * 60 * 1000 * 24;
    return Math.abs(parseInt(date1 / toDays) - parseInt(date2 / toDays));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above takes the hard-to-read bit in the &lt;code&gt;console.log()&lt;/code&gt; from the first script block and makes it easier to read &lt;em&gt;and&lt;/em&gt; makes it so we can call it anywhere.&lt;/p&gt;

&lt;p&gt;Writing code in a way that is very &lt;em&gt;easy&lt;/em&gt; to read is caring for your fellow developer, and it makes it easier for you to come back to in a few months and not want to pull your hair out!&lt;/p&gt;

&lt;p&gt;Happy abstracting!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Developing with Empathy: Single Responsibility</title>
      <dc:creator>Claire Lipskey</dc:creator>
      <pubDate>Sun, 12 Jul 2020 19:47:46 +0000</pubDate>
      <link>https://dev.to/clairebaire/developing-with-empathy-single-responsibility-359</link>
      <guid>https://dev.to/clairebaire/developing-with-empathy-single-responsibility-359</guid>
      <description>&lt;p&gt;Single responsibility is a concept that has been around for a while.&lt;/p&gt;

&lt;p&gt;Wikipedia &lt;a href="https://en.wikipedia.org/wiki/Single-responsibility_principle"&gt;defines it&lt;/a&gt; as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;...a computer programming principle that states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This helps your codebase be easier to maintain, easier to debug, and easier to learn.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do one thing, and do it well
&lt;/h2&gt;

&lt;p&gt;Whether you’re building something for yourself, you’re the only one on the team, or you’re part of a giant development team - there's a certain need for having an “orderly” way of “doing things”.&lt;/p&gt;

&lt;p&gt;In my &lt;a href="https://dev.to/clairebaire/developing-with-empathy-introduction-92m"&gt;intro post&lt;/a&gt;, I started off the introduction to this topic by saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;script.js is so 2014&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Think about having all of your current JavaScript code in one file. It used to happen! It still &lt;em&gt;does&lt;/em&gt; happen. It’s daunting for anyone coming into a project. Sure, you can help supplement the knowledge you’ve dumped into it by annotating with comments or naming your functions properly, but it’s still a daunting thing to look at.&lt;/p&gt;

&lt;p&gt;Imagine coming into a project for the first time. You’ve been tasked with updating this function on a website:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$('.price').on('click', function() {
  $('.item').css('color': 'green');
  $.ajax( // stuff );
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above creates an event handler via jQuery (don’t get me started on jQuery), but doesn’t really infer &lt;em&gt;why&lt;/em&gt; it exists.&lt;/p&gt;

&lt;p&gt;The switch to component-based architecture in the front-end world and really just the transformation of JavaScript from being simply a DOM manipulation tool to a complex infrastructure language (thanks Node) has brought about a lot of change to the ways we write it.&lt;/p&gt;

&lt;p&gt;In an Angular 2+ world with TypeScript (when written according to &lt;a href="https://angular.io/guide/styleguide"&gt;John Papa’s Angular Style Guide&lt;/a&gt;), the above code would be written in at &lt;em&gt;least&lt;/em&gt; three different files, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// price.component.ts

import { TransportService } from "../../services/transport.service";

@Component()
export class PriceComponent extends Component implements OnInit {
  @Input() price: number;

  constructor(private _transportService: TransportService) {}

  ngOnInit() {
    this.addEventListener('click', (e: MouseEvent) =&amp;gt; {
      this._transportService.send('stuff');
    })
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// transport.service.ts

@Injectable()
export class TransportService {
  public send(item: string) {
    // do stuff
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There would probably be another file to act as a state class across modules (another Angular Service) to change the CSS as in the first example as well, but I think you get the idea of what I’m going for here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing more code isn't necessarily a bad thing
&lt;/h2&gt;

&lt;p&gt;I find myself being verbose in my writing of JavaScript / TypeScript nowadays, and I don’t view that &lt;em&gt;as a bad thing&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Verbosity in code isn’t inherently inefficient. It isn’t going to slow down my application, at least in a way that’d really matter. Tree shaking and whatnot exist now! Let things be singletons. Let things do &lt;em&gt;exactly&lt;/em&gt; what they should do and not a thing more. There was a time when we didn’t compile our JavaScript code, and it made sense to not be verbose. But now, &lt;em&gt;now&lt;/em&gt; that we can compile our code means we can be verbose too. The front-end world gains access to a lot of things back-end / compiled languages have enjoyed for a while with these new tools.&lt;/p&gt;

&lt;p&gt;I’m of the opinion that it doesn’t go against the idea of pragmatism to be a bit verbose. Writing a bit more meaningful code than would be necessary for &lt;em&gt;the now&lt;/em&gt; makes my job of maintaining / adding / scaling the thing I’m doing &lt;em&gt;now&lt;/em&gt; easier for me (or someone else!) in the future.&lt;/p&gt;

&lt;p&gt;Of course the jQuery code listed first above would work for the purpose we’d want. It did back then! It would do so still. But there’s a way, and then there’s a better way (for all those involved).&lt;/p&gt;

&lt;h2&gt;
  
  
  My codebase isn't built with this in mind. Do I have to scratch it all?
&lt;/h2&gt;

&lt;p&gt;Codebases are always changing. We’re always adding to them, deleting from them, and manipulating in between. Start on the path toward single responsibility.&lt;/p&gt;

&lt;p&gt;I’ve encountered this in the past. I came into a codebase that had several different frameworks within it. One was used in one part of the app, another in another part. No real rhyme or reason for any of it. I made it my duty to go through and bring everything under the same umbrella. &lt;/p&gt;

&lt;p&gt;Developing with empathy means that you keep the following in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the person before you may not have had the time to think about the bigger picture.&lt;/li&gt;
&lt;li&gt;the person before you may not have had the technical know-how to always think about the most common denominator.&lt;/li&gt;
&lt;li&gt;you should leave the codebase in a better state than it was before you arrived.&lt;/li&gt;
&lt;li&gt;the people you work with &lt;em&gt;now&lt;/em&gt; are likely to need your help in keeping the codebase healthy.&lt;/li&gt;
&lt;li&gt;you can’t solve everything.&lt;/li&gt;
&lt;li&gt;the person after you could very well be in the same position you are in right now if you don’t fix what you can.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I made my aspirations for the codebase &lt;em&gt;part of the expected work&lt;/em&gt; and not just “outside” the realm of the project work.&lt;/p&gt;

&lt;p&gt;This meant bringing items that did similar or even &lt;em&gt;the same thing&lt;/em&gt; into one hunk of code by introducing reusable components.&lt;/p&gt;

&lt;h2&gt;
  
  
  I've already employed this strategy. I'm good to go.
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Is it?&lt;/em&gt; This isn’t a “we built it with this in mind” kind of topic. Quite the contrary - what you wrote on Friday, was it built with this principle in mind? This is an &lt;em&gt;always on&lt;/em&gt; principle, and without it always on, you can get lost from it pretty quickly.&lt;/p&gt;

&lt;p&gt;At a previous job, my team and I for the most part maintained this principle. This was a codebase I led for a while and I still let some of this slip. It came back to haunt us! When asked about &lt;code&gt;x&lt;/code&gt; being a reusable component, I had to admit that it wasn’t, that it was built specifically for a particular purpose because we didn’t have enough time to generalize it and merge it into our existing patterns. It’s not a failure - but it shows that it requires constant communication with project leaders, designers, and everyone else on the team to maintain a codebase in the most optimal way.&lt;/p&gt;

&lt;h2&gt;
  
  
  This doesn't just apply to JavaScript / TypeScript
&lt;/h2&gt;

&lt;p&gt;Single responsibility makes its way into CSS too. OOCSS, BEM, and all the other "ways" of doing CSS make some part of this part of their schema too. I'll expand on this in another post.&lt;/p&gt;

&lt;h2&gt;
  
  
  tl;dr
&lt;/h2&gt;

&lt;p&gt;Writing a codebase with single responsibility in mind is hard work. It takes a lot of thinking and planning to be comfortable breaking complex ideas up into small bits that all do “their own thing” and can be reused. However, it allows developers and teams alike to work quicker, increase speed &lt;em&gt;and&lt;/em&gt; efficiency, and helps onboard new developers and instills good heuristics on what should be “new” and what can be reused.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Developing with Empathy: Introduction</title>
      <dc:creator>Claire Lipskey</dc:creator>
      <pubDate>Wed, 08 Jul 2020 19:26:23 +0000</pubDate>
      <link>https://dev.to/clairebaire/developing-with-empathy-introduction-92m</link>
      <guid>https://dev.to/clairebaire/developing-with-empathy-introduction-92m</guid>
      <description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;My name is Claire. I am a front-end engineer in Chicago. I really enjoy writing code, and seeing what that code can do.&lt;/p&gt;

&lt;p&gt;I want to talk about what it means to be a developer / engineer / do-er.&lt;/p&gt;

&lt;p&gt;There are a lot of things that many folks consider metrics for how "good" I am at my job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Performance. This might come in the form of a Lighthouse score (or insert Your Favorite Tool Here®), or something more low-level like the complexity of a function and how well it performs (such as the dreaded "Big O" notation - more on that later)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Soft skills, or how able I am to disseminate a topic of great technical complexity to someone who does not share the same skill set as me.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Speed. How fast am I able to ship a feature? When that feature is shipped, is it riddled with bugs?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are familiar metrics to any developer. I'd argue, however, that there are more. More that we don't ask about in interviews, more that we don't really grade each other officially, but know implicitly about each other.&lt;/p&gt;

&lt;p&gt;We all have our styles, but having a core set of values in a development team leads to a lot of good. That's what this series is all about.&lt;/p&gt;

&lt;p&gt;I want to talk about the following more at length. Expect these to be their own post(s) in the future!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Architecture&lt;/strong&gt;: Is the architecture you're building reasonable? Believe it or not, you're building architecture every day. Every bit of code you place into the codebase is part of the architecture. Does it make sense?

&lt;ul&gt;
&lt;li&gt;Consistency is key.&lt;/li&gt;
&lt;li&gt;Folder structure shouldn't be dictated by one side of the codebase.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools&lt;/strong&gt;: Do you monitor and ask why when someone adds a new node module? Did you choose it because it is shiny?

&lt;ul&gt;
&lt;li&gt;Less is more.&lt;/li&gt;
&lt;li&gt;Fundamentals are forever.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Discussions&lt;/strong&gt;: In the world of COVID-19, a lot of us might know what it is like to be thrown into a new work-from-home-indefinitely position. Have your "go to someone's desk and ask a question" discussions directly transitioned to just a DM on Slack? Is that good?

&lt;ul&gt;
&lt;li&gt;When does it make sense to become a video meeting?&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single Responsibility&lt;/strong&gt;: &lt;em&gt;script.js is so 2014&lt;/em&gt;. Components! Atomic Design! Insert system here! Single responsibility is, in my mind, one of the best ideas to come out of the UNIX world. The command cd doesn't also make directories, does it? No. It only changes the active one. The things you build should be the same way.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pushing back, but in a good way&lt;/strong&gt;: We all know the stereotype of the developer who states “Nope, bad idea. Don’t like it. Won’t have it.” I’ve worked with them before. Pushing back is a &lt;em&gt;good thing&lt;/em&gt; when it’s done empathetically. I find myself day in and day out pushing back on ideas designers, product folks, and even back-end developers give me.

&lt;ul&gt;
&lt;li&gt;How do you keep it from being “gatekeeping”, though?&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building for everyone&lt;/strong&gt;: Accessibility. It’s not a buzzword. It’s not a bolt on. It affects you if you write only JavaScript. It affects you if you write anything for the web.

&lt;ul&gt;
&lt;li&gt;Don’t sacrifice accessibility because of time.&lt;/li&gt;
&lt;li&gt;Don’t sacrifice accessibility for &lt;em&gt;anything&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Who really is the customer anyway?&lt;/strong&gt;: Is it John or Jane Doe who visits example.com? Maybe. But I’d implore you to think of the person who fills your chair after you leave to the next line item on your resume. They’re important too.

&lt;ul&gt;
&lt;li&gt;Will they understand what you’ve written? My experience is that if there’s a damn good reason for something existing there and there’s documentation to boot, I’m much more inclined to not touch it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This series kind of sounds like it might just be about how to be a good developer / engineer / do-er, and you might be right about that. In order to be good at our job, we must always be thinking of who the customer is - and the customer is not just the end user. Developers - yes, you! - are also the customers.&lt;/p&gt;

&lt;p&gt;These are the general topics I want to hit on, and there might be multiple posts per topic, and even possibly a topic not on this list! I want this series to not only explore all the different ways we can add / lead with empathy, but also expose that for myself. This is a writing journey for me, and I hope you find it useful too.&lt;/p&gt;

&lt;p&gt;Our product really is the code we write, the discussions we have, and the feelings we leave with others. Developing with empathy will get us all to a better, more inclusive and helpful development world.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
