<?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: hayashi-ay</title>
    <description>The latest articles on DEV Community by hayashi-ay (@hayashiay).</description>
    <link>https://dev.to/hayashiay</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%2F333857%2F830cdfe7-8978-4a78-bf7d-329bfe70e295.gif</url>
      <title>DEV Community: hayashi-ay</title>
      <link>https://dev.to/hayashiay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hayashiay"/>
    <language>en</language>
    <item>
      <title>Is declaring helper variables which are simply removal of `this` bad practice?</title>
      <dc:creator>hayashi-ay</dc:creator>
      <pubDate>Sun, 29 Mar 2020 15:44:12 +0000</pubDate>
      <link>https://dev.to/hayashiay/is-declaring-helper-variables-which-are-simply-removal-of-this-bad-practice-1ie4</link>
      <guid>https://dev.to/hayashiay/is-declaring-helper-variables-which-are-simply-removal-of-this-bad-practice-1ie4</guid>
      <description>&lt;p&gt;Hi there, I'm newbie for dev.to and this is my first post.&lt;/p&gt;

&lt;p&gt;Our company has a convention to declare helper variables which are simply removal of &lt;code&gt;this&lt;/code&gt; like the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;SampleClass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// this is a constructor&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;sampleGetter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// return something&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;sampleMethod&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// What do you think about the following?&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sampleGetter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sampleGetter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// do something&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I was thinking that it's efficient when the variables are used multiple times.&lt;br&gt;
However, I've been recently pointed out that it's premature optimaization and just adds a tiny bit of complexity with no clarity.&lt;/p&gt;

&lt;p&gt;What do you think? I'd like to hear your opnions.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>javascript</category>
      <category>codequality</category>
    </item>
  </channel>
</rss>
