<?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: Saurav Khdoolia</title>
    <description>The latest articles on DEV Community by Saurav Khdoolia (@ksorv).</description>
    <link>https://dev.to/ksorv</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%2F398503%2F508166b0-ae7d-4cbe-a08e-f4cbc298c0bf.jpg</url>
      <title>DEV Community: Saurav Khdoolia</title>
      <link>https://dev.to/ksorv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ksorv"/>
    <language>en</language>
    <item>
      <title>Dear Developer, I need your help, in helping you!</title>
      <dc:creator>Saurav Khdoolia</dc:creator>
      <pubDate>Sun, 19 Jul 2020 16:12:08 +0000</pubDate>
      <link>https://dev.to/ksorv/dear-developer-i-need-your-help-in-helping-you-20gg</link>
      <guid>https://dev.to/ksorv/dear-developer-i-need-your-help-in-helping-you-20gg</guid>
      <description>&lt;p&gt;Dear Developer,&lt;/p&gt;

&lt;p&gt;I write this while I'm resting as I've nothing to do.&lt;/p&gt;

&lt;p&gt;Laying down on this couch, &lt;br&gt;
with a white coffee mug(it has a github sticker) on the table, &lt;br&gt;
And watching the rain fall. &lt;/p&gt;

&lt;p&gt;It sounds amazing, peaceful and I feel so connected to the Nature.&lt;/p&gt;

&lt;p&gt;Then, Suddenly i found myself in deep Thoughts about the purposeless-ness that I've been feeling. It's weird to think about it, when I've a job, family and good friends too. &lt;/p&gt;

&lt;p&gt;Heck I've not even got cold since a year or so.&lt;/p&gt;

&lt;p&gt;But it's restless, &lt;/p&gt;

&lt;p&gt;You: Why?&lt;/p&gt;

&lt;p&gt;Me: (coughs) You probably dont know, but I've a worm of teaching people hard stuff after learning it for myself. And I'm not getting opportunities to do that.&lt;/p&gt;

&lt;p&gt;You: What does that even mean?&lt;/p&gt;

&lt;p&gt;Me: That means you should tell me what you want to learn(Web development or Software development related, if i may say that) some stuff, that you found hard or are just interested in it.&lt;/p&gt;

&lt;p&gt;You: Well, I can rather just look up Google. Then why?&lt;/p&gt;

&lt;p&gt;Me: Well, First of all It's gonna be personal, I'll write it as you asked, so you can learn.&lt;br&gt;
We'll have chance to discuss it, between us and with our other developer friends. Sounds good?&lt;/p&gt;

&lt;p&gt;You: Yeah, I guess.&lt;/p&gt;

&lt;p&gt;Me: Then, Comment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What's that one thing that you're struggling with? &lt;/li&gt;
&lt;li&gt;What's that one thing that you want to learn but find it hard to grab? &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go ahead, I'll try my best to learn and then teach you. I'm waiting for you.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Great Lexical Scope of JS?</title>
      <dc:creator>Saurav Khdoolia</dc:creator>
      <pubDate>Sun, 19 Jul 2020 11:10:44 +0000</pubDate>
      <link>https://dev.to/ksorv/the-great-lexical-scope-of-js-cmi</link>
      <guid>https://dev.to/ksorv/the-great-lexical-scope-of-js-cmi</guid>
      <description>&lt;p&gt;Have you ever wondered why sometimes, &lt;code&gt;this&lt;/code&gt; was undefined, while you thought it was there and that sometimes your functions work in weird ways. Well, then you're at the right spot. We'll be discussing &lt;strong&gt;Lexical Scopes&lt;/strong&gt;, in this post.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Lexical Scope?
&lt;/h2&gt;

&lt;p&gt;Javascript is basically a compiled language, The code you write is first compiled to AST then to a efficient binary, which is later executed by the JS Engine. All the variables and scopes are placed on their positions after declaration, So that they can be used by the engine while executing the program. All the declarations at the time of compilation are done in different scopes, For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;call&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mr.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Greet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Good Morning&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;call&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Saurav&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, What is lexical scope in here! Let's break it down.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compiler first declares the &lt;code&gt;var call&lt;/code&gt;, in global scope(No problemo).&lt;/li&gt;
&lt;li&gt;Compiler then, declares a &lt;code&gt;const Greet&lt;/code&gt; and assigns it the func we defined, in Global scope.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, Compiler goes inside the function we defined(New Scope Manager for the function), and checks(consults the global scope manager) if there is a greeting variable already defined in the upper scope(i.e, Global scope), if not, then it goes ahead and declares greeting.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Compiler checks in with current Scope Manager(of function), if there is a &lt;code&gt;greeting&lt;/code&gt; declaration.&lt;/li&gt;
&lt;li&gt;Then, Compiler checks for call, but &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The functions Scope Manager says: I don't know bruh, Who's this? Ask big brother global Scope Manager!&lt;/p&gt;

&lt;p&gt;Compiler asks global Scope manager, it replies with &lt;strong&gt;Yes!, I've call already declared&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is lexing, The &lt;code&gt;call&lt;/code&gt; declaration is available to function's Scope Manager through &lt;code&gt;lexical scope&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lexical Scope&lt;/strong&gt; is nothing too complicated(assume it!), It is just the Scope that is determined during the compilation and is available from outer to inner scopes. e.g, Global scope is available to every scope, so on and so forth.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiler then comes to the &lt;code&gt;Greet("Saurav")&lt;/code&gt; statement. Checks Greet, it's declared and Compilers compiles the code to AST.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Execution takes place after this.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are more steps, but let's not discuss them now. I think you get what lexical scope is?&lt;/p&gt;

&lt;p&gt;If still, You've got some doubts? Let's discuss them, Tweet &lt;a href="https://twitter.com/sauravkhdoolia"&gt;@sauravkhdoolia&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/ch1.md"&gt;Scopes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;This post first appeared on &lt;a href="https://sauravk.vision"&gt;The Vision Project&lt;/a&gt;&lt;br&gt;
If You're reading this post on The Vision project. Please report any issues &lt;a href="https://github.com/sauravkhdoolia/sauravk.vision/issues/new"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>lexical</category>
      <category>scope</category>
      <category>hard</category>
    </item>
    <item>
      <title>Front End Architecture 101</title>
      <dc:creator>Saurav Khdoolia</dc:creator>
      <pubDate>Sat, 30 May 2020 13:24:23 +0000</pubDate>
      <link>https://dev.to/ksorv/front-end-architecture-101-4659</link>
      <guid>https://dev.to/ksorv/front-end-architecture-101-4659</guid>
      <description>&lt;p&gt;Focus on Entities first, Then use cases then go the Presentation layer.&lt;/p&gt;

&lt;h1&gt;
  
  
  Loose Coupling, High Cohesion.
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Coupling&lt;/strong&gt;: The degree of direct knowledge that one element has of another!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High Cohesion&lt;/strong&gt;: Keep similar &amp;amp; related things together!!!&lt;/p&gt;

&lt;p&gt;Do front end as &lt;code&gt;Loose Coupling, High Cohesion!&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;--&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lGFS02qq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mucqb0gfv6gziac96n3k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lGFS02qq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mucqb0gfv6gziac96n3k.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you look in the image above, Start from Entities, Then Use Cases and then the UI! It's a good practise... Do remember the dependency rule.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://youtu.be/o8THlN8hgcw"&gt;Check this talk by Nir Kaufman @ ReactNYC&lt;/a&gt;&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>architecture</category>
      <category>101</category>
    </item>
  </channel>
</rss>
