<?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: Winson</title>
    <description>The latest articles on DEV Community by Winson (@wmahathre).</description>
    <link>https://dev.to/wmahathre</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%2F111732%2Fcdafa1f0-5f3e-41be-a6ff-1a023e83d01b.png</url>
      <title>DEV Community: Winson</title>
      <link>https://dev.to/wmahathre</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wmahathre"/>
    <language>en</language>
    <item>
      <title>Horizontal and Vertical scaling</title>
      <dc:creator>Winson</dc:creator>
      <pubDate>Thu, 15 Nov 2018 19:51:17 +0000</pubDate>
      <link>https://dev.to/wmahathre/horizontal-and-vertical-scaling-1lid</link>
      <guid>https://dev.to/wmahathre/horizontal-and-vertical-scaling-1lid</guid>
      <description>&lt;p&gt;Scalability is being able to handle more request and both vertical and horizontal scaling handle these request differently. Horizontal scaling has multiple servers that receive the request but vertical scaling has only one big server that handles them. In this article I’m going to share with you the good and bad of these scaling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F506en6ydcyh0yw73b0z6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F506en6ydcyh0yw73b0z6.png" alt="Alt text of image" width="435" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Horizontal scaling has what’s called load balancing so if one of the servers fails then the load balancer redirects the request to other servers and if a new server is added the load balancer will start to send requests to it. This ensures that the client request are reliable by sending request to working servers, it’s working efficiently with multiple servers, and it provides flexibility by increasing or decreasing the number of servers.  Since vertical scaling is only one huge server this can’t be done.&lt;/p&gt;

&lt;p&gt;The bad thing about vertical scaling is that it has hardware limits. Yes you can add more resources like cpu/ram/disk capacity to your server but it’s not enough if you have large users. This is why horizontal scaling is ideal for big companies because they can add more servers if the demand is needed and its scaled well as users increase.&lt;/p&gt;

&lt;p&gt;Now the good thing about vertical scaling is that it has data consistency. This is because there is only one system where all the data resides. Having a horizontal scaling where transaction send data across multiple servers can get complicated and is harder to maintain. This can be impractical especially if you had a transaction where the operation had to be atomic causing it to lock all servers and data.&lt;/p&gt;

&lt;p&gt;When deciding which scaling to use its best to decide which one is most suitable for your needs. If you’re running a small company and don’t expect many users/data to increase then having a vertical scaling can be ideal for you. If you’re working with a large company where there are increase in users then using horizontal scaling is the way to go.&lt;/p&gt;

</description>
      <category>scaling</category>
    </item>
    <item>
      <title>Var or Let?</title>
      <dc:creator>Winson</dc:creator>
      <pubDate>Sat, 10 Nov 2018 05:51:17 +0000</pubDate>
      <link>https://dev.to/wmahathre/var-or-let-4bd4</link>
      <guid>https://dev.to/wmahathre/var-or-let-4bd4</guid>
      <description>&lt;p&gt;Let is very similar to var but there are some key differences between the two. For those of you who are still struggling understanding var and let then this article will provide a quick summary of the differences between the two.&lt;/p&gt;

&lt;p&gt;Var uses a function scope and has what’s called hoisting. Hoisting allows variable to be available on a broader scope beyond where they are declared but this increases the chance of having an error in your code. If you have another variable with the same name then things can be confusing which is why using less and having a smaller scope is a nice solution to this. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F2pq564hogljlk5mifhjb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F2pq564hogljlk5mifhjb.png" alt="Alt text of image" width="437" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example you can see the hoisting process where the declaration at the top and the variable are being called throughout the whole scope. Problem with this is that i is declared twice which messes up the code.&lt;/p&gt;

&lt;p&gt;Let has what’s called a block scope which is only declared inside of the curly braces. This means the declared variable are limited in the scope unlike var where the variable is defined globally regardless of block scope. This is good for limiting any errors that might occur if you declared it outside the block scope.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fhx63t4kn3ytz41yhrlsq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fhx63t4kn3ytz41yhrlsq.png" alt="Alt text of image" width="447" height="178"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.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%2Fyaknpayth8bb6cy4fta2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fyaknpayth8bb6cy4fta2.png" alt="Alt text of image" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in this example we try to console log the variable i it gives an error message because it's outside the block scope. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F47gnkoq2ndkqpi9dfhl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F47gnkoq2ndkqpi9dfhl4.png" alt="Alt text of image" width="486" height="224"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.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%2F35eqjh36336ju6oq4dss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F35eqjh36336ju6oq4dss.png" alt="Alt text of image" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now when we do the same thing but replace let with var we get a number for i which is 100. Now even though this works it can get confusing if someone else was editing the code and used the variable i later down the line.&lt;/p&gt;

&lt;p&gt;Remember even though you can access variables on a global scale using var, it's best to limit the scope using let to reduce the number of errors you could face.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Block-level &amp; inline using div and span</title>
      <dc:creator>Winson</dc:creator>
      <pubDate>Thu, 01 Nov 2018 22:01:31 +0000</pubDate>
      <link>https://dev.to/wmahathre/block-level--inline-using-div-and-span-ohc</link>
      <guid>https://dev.to/wmahathre/block-level--inline-using-div-and-span-ohc</guid>
      <description>&lt;p&gt;When learning a new language you always get stuck on a few things and when I first started learning HTML it was the div and span tags that gave me a hard time. I couldn’t really figure out the difference between the two especially with block-level and inline. But after practicing and using it with my code I’m going to tell you the key difference between the two using html. &lt;/p&gt;

&lt;p&gt;For starters the div is a block-level element. This type of element begins on a new line and takes up the full width. Span is an inline element and this means it stays on the same line and takes up the necessary width.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--opZP85p---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6coleqfcc3zn2695ofge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--opZP85p---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6coleqfcc3zn2695ofge.png" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Notice in this example how the text highlighted is the div element which started in a new line occupying full width and now contains 3 blocks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eZmB6YZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/54moo23vsed6698s2mpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eZmB6YZO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/54moo23vsed6698s2mpj.png" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Changing it to span allows the text to be continuous and does not have any change on the width or block.&lt;/p&gt;

&lt;p&gt;So remember that span is an inline element used for taking up the space bounded by its opening and closing tag and div is a block-level element that always start on a new line and takes up the full width of the page. &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
