<?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: Mariappan S</title>
    <description>The latest articles on DEV Community by Mariappan S (@marigameo).</description>
    <link>https://dev.to/marigameo</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%2F383153%2Fa2e16699-94bb-4109-82fb-8a22f6b40b11.jpg</url>
      <title>DEV Community: Mariappan S</title>
      <link>https://dev.to/marigameo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marigameo"/>
    <language>en</language>
    <item>
      <title>Proxies in Javascript simplified</title>
      <dc:creator>Mariappan S</dc:creator>
      <pubDate>Sat, 05 Feb 2022 09:56:52 +0000</pubDate>
      <link>https://dev.to/marigameo/proxies-in-javascript-simplified-3c95</link>
      <guid>https://dev.to/marigameo/proxies-in-javascript-simplified-3c95</guid>
      <description>&lt;p&gt;Let's rewind your school (or) college days, how creative one can be when proxying? Woah, don't tell me you haven't done any 😈 (I can share a bunch of my experiences, but definitely not here 😂)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a5dJC9EM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fr9aos4m4k72jh1706bk.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a5dJC9EM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fr9aos4m4k72jh1706bk.jpeg" alt="Image description" width="500" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Aren't they funny looking back today? What if I can drift the same thrill into Javascript. Have you tried morphing any existing properties/operations hiding behind a different object? Trust me, that would be cool. Let's find out how.&lt;/p&gt;

&lt;p&gt;I came across this term when reading about &lt;a href="https://v3.vuejs.org/guide/reactivity.html#how-vue-tracks-these-changes"&gt;Vue's Reactivity System&lt;/a&gt;. Vue3 uses javascript &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy"&gt;proxy&lt;/a&gt; to track state changes and react to them. Proxies were introduced in ES6 and allow Vue 3 to avoid some of the reactivity caveats that existed in earlier versions of Vue. Earlier, in Vue2 they were derived by &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty"&gt;object.defineproperty &lt;/a&gt;approach.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By the way, Sarah Drasner's take on Vue's reactivity System would never disappoint you - check the doc &lt;a href="https://v3.vuejs.org/guide/reactivity.html#how-vue-tracks-these-changes"&gt;here&lt;/a&gt; if you're interested &lt;a href="https://v3.vuejs.org/guide/reactivity.html#how-vue-tracks-these-changes"&gt;https://v3.vuejs.org/guide/reactivity.html#how-vue-tracks-these-changes&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  So what is a proxy?
&lt;/h3&gt;

&lt;p&gt;A proxy is just an object, that can wrap another object and intercept operations on behalf (if intended).&lt;/p&gt;

&lt;p&gt;Bla, bla... 😕 let's dive into some code &amp;amp; understand it better.&lt;/p&gt;

&lt;p&gt;First, let's check the syntax,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SKXI0LNg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09zpy6exq6zuuywmkt38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SKXI0LNg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/09zpy6exq6zuuywmkt38.png" alt="Image description" width="880" height="382"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, target - is the object to be wrapped. It can be anything, including functions&lt;/p&gt;

&lt;p&gt;handler - an object with a trap method to intercept the operations (get, set, etc)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ORTB0Rvw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wz9osac4ec9uwdhwk8du.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ORTB0Rvw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wz9osac4ec9uwdhwk8du.png" alt="Image description" width="880" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's have a look at a couple of practical examples where proxy can be really useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Default/Zero values:
&lt;/h3&gt;

&lt;p&gt;If you've used golang anytime before, you might be aware of a concept called &lt;a href="https://go.dev/tour/basics/12"&gt;zero value&lt;/a&gt;. Which is nothing but, Variables declared without an explicit initial value are given their zero value.&lt;/p&gt;

&lt;p&gt;In Javascript that's not the case, we people are addicted to undefined for some reason I guess 😜&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MLwfSgLJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/famypdeysxadn9ekd9cl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MLwfSgLJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/famypdeysxadn9ekd9cl.png" alt="Image description" width="880" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above one is a simple emoticon app, that returns emoji for the corresponding reaction. Here, when I try to input a reaction that doesn't exist in my data - it returns undefined. Instead, if I manage to return the reaction itself, it would be somewhat meaningful right?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kXNKhK5d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6hhjx25cbap5ca8j5xuw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kXNKhK5d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6hhjx25cbap5ca8j5xuw.png" alt="Image description" width="880" height="686"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, To intercept reading, the handler should have a method get(target, property).&lt;/p&gt;

&lt;p&gt;It triggers when a property is read, with the following arguments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;target – is the target object, the one passed as the first argument to new Proxy,&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;property – property name&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's see one more use case to get closer to this concept.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--80tgf21q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5u73e24rs5zfond4lwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--80tgf21q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5u73e24rs5zfond4lwn.png" alt="Image description" width="880" height="729"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Basically, if you look at the above code - it behaves like a logging system that keeps a track of how many times an API is called and logs the count to the console. Similarly, we can intercept and create any sort of logging system we need. Isn't that cool?&lt;/p&gt;

&lt;p&gt;There are plenty of other use cases to which I won't be talking here. Will leave it to you to explore more in the below link as it's already an amazing resource from &lt;a href="https://medium.com/@tbarrasso"&gt;Thomas Barrasso&lt;/a&gt;. Check out his article here - &lt;a href="https://blog.bitsrc.io/a-practical-guide-to-es6-proxy-229079c3c2f0"&gt;https://blog.bitsrc.io/a-practical-guide-to-es6-proxy-229079c3c2f0&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://blog.bitsrc.io/a-practical-guide-to-es6-proxy-229079c3c2f0"&gt;https://blog.bitsrc.io/a-practical-guide-to-es6-proxy-229079c3c2f0&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://larsgraubner.com/javascript-proxy/"&gt;https://larsgraubner.com/javascript-proxy/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://javascript.info/proxy"&gt;https://javascript.info/proxy&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any suggestions (as I'm new to this) or wish to discuss more on this topic please write to me at &lt;a href="mailto:mariappangameo@gmail.com"&gt;mariappangameo@gmail.com&lt;/a&gt;. I'd also love to connect with you all on &lt;a href="https://www.linkedin.com/in/marigameo/"&gt;Linkedin&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>proxy</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Reactive Programming</title>
      <dc:creator>Mariappan S</dc:creator>
      <pubDate>Fri, 04 Feb 2022 09:21:04 +0000</pubDate>
      <link>https://dev.to/marigameo/reactive-programming-51j0</link>
      <guid>https://dev.to/marigameo/reactive-programming-51j0</guid>
      <description>&lt;p&gt;Well, you heard it right? I’m here talking about one of those fancy programming terms which you might have clocked many a time, yet a stranger (un)fortunately. If so, I’ll try to break my learnings and introduce the paradigm in a simple practical way as possible.&lt;/p&gt;

&lt;p&gt;It took me some time to grasp good references talking about reactive programming in general. There were tons of &lt;a href="https://rxjs.dev/"&gt;RxJS&lt;/a&gt; articles but those didn’t relate much until I read about reactive programming in general. If you’re someone tired of frameworks and looking to recharge yourself this could excite you. Let’s dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is reactive in general?
&lt;/h2&gt;

&lt;p&gt;Have you ever been excited about an upcoming mobile phone launch on some e-commerce sites? Or let’s say you’re a bike enthusiast you might be having an eye on some upcoming superbike launch, right? In this online world, it’s so easier to stay updated with these launches. If you’ve been to those companies' online stores, probably you’d find a &lt;strong&gt;NOTIFY ME&lt;/strong&gt; trigger somewhere on the product page. I was looking for a smart band and landed at the official Xiaomi site — tada, this splashed up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iSIiuTMS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqg72g3isibffdtneq1n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iSIiuTMS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqg72g3isibffdtneq1n.png" alt="Image description" width="880" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you click on this notify button, they might take your mobile number/email and notify you on launch. Let’s think of this flow.&lt;/p&gt;

&lt;p&gt;Technically, you’re subscribing to an event and the responsible entity is notifying you of the successful event. Probably once notified you would take some decision. That’s simple, isn’t it reactive? You’re reacting to an event.&lt;/p&gt;

&lt;p&gt;Let’s discuss one more edge case to explore a different dimension of this. I’m looking to buy a smartphone at amazon.com and it’s currently out of stock. Luckily, Amazon provides me a way to get notified of the product once the item is back in stock. I’m subscribing to it, so as others with similar interests. Of course, I may not be the single user waiting for the stock right? So let’s say, myself and 9 others subscribed to get notified when stock is back. After some days, there were 3 items back in stock. All 10 of us will get notified. Cool, let’s say 3 of us immediately reacted (well, we’re too reactive 👊) and what would be the case. The item would go again out of stock. Here, the system needs to handle 2 things,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It should unsubscribe 3 of us who actually brought the phones should not be notified from now on&lt;/li&gt;
&lt;li&gt;Since, it’s again out of stock, the remaining 7 should be notified of it and put back in listening mode 😔&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here if you notice, the system (producer) is unaware of certain details like whether the item would go out of stock again. If so how fast. It just reacts to the events, right?&lt;/p&gt;

&lt;p&gt;That’s the deal, how did I go? 🏄&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Little, little, let’s add some javascript to it&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Directly spicing with some code, blink over it for a while 👀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bR74gX0_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qt6xui23cite4kpj5men.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bR74gX0_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qt6xui23cite4kpj5men.png" alt="Image description" width="880" height="544"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you check the above code, why do you think Leena’s salary is not being updated? Did the boss cheat her (or) JS is lying 😆&lt;/p&gt;

&lt;p&gt;This is how typically Javascript works right? Loving it 🙋&lt;/p&gt;

&lt;p&gt;To solve this, you’ve to repeat the totalSalary calculation again. But, it’s unfair right — I’m literally repeating the same statement every time I’m updating the value. You’d say, introduce a function calculateSalary and reuse it. Even in that case, I’d repeat the function call again :)&lt;/p&gt;

&lt;p&gt;Here is where reactive programming comes into the picture. Well, I’m not going to write any &lt;a href="https://rxjs.dev/"&gt;RxJS&lt;/a&gt; code here now. Instead, let’s talk with some pictures.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--on1Xb33K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whs3o310l0y0efv3fgt9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--on1Xb33K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whs3o310l0y0efv3fgt9.png" alt="Image description" width="880" height="384"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To break the above diagram,&lt;/p&gt;

&lt;p&gt;The system has 2 components — salary and payslip&lt;/p&gt;

&lt;p&gt;Whenever there is a change in the salary component, payslip get’s updated. Here,&lt;/p&gt;

&lt;p&gt;Salary component — is the producer&lt;br&gt;
Payslip components — is the subscriber&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;And, interesting thing to note here, payslip is reactive on the salary changes and does it job. But, the salary component is unaware that the payslip component is dependent of it. That’s the beauty of this paradigm.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;What next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Are you still with me? Then one thing must be clear to you now having explored the possibilities and use cases above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reactive programming is no more a trend, and this could be the time to adopt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Does Javascript provide us with any native APIs to write reactive code?&lt;/p&gt;

&lt;p&gt;Well, the answer is surprisingly no. But, there is an active &lt;a href="https://github.com/tc39/proposal-observable"&gt;tc39 proposal&lt;/a&gt; going on around for a while, didn’t find it much active though, you could watch out here — &lt;a href="https://github.com/tc39/proposal-observable"&gt;https://github.com/tc39/proposal-observable&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now comes the next question. What are observables?&lt;/p&gt;

&lt;p&gt;The entity which can be used for reactive code and also can produce multiple values synchronously or asynchronously is called Observables.&lt;/p&gt;

&lt;p&gt;I know that doesn’t sound cool enough. To understand this better, we need to explore a few other terms conjointly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streams&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Basically, reactive programming gives you the ability to create data streams of anything.&lt;/p&gt;

&lt;p&gt;So what are streams?&lt;/p&gt;

&lt;p&gt;Anything can be a stream, variables, user inputs, properties, caches, data structure, etc.To be specific,&lt;/p&gt;

&lt;p&gt;A stream is a sequence of ongoing events ordered in time. It can emit 3 possible things,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Value (of some type)&lt;/li&gt;
&lt;li&gt;Error (something wrong happened)&lt;/li&gt;
&lt;li&gt;Completed signal (when the stream is done or completed)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dvqqeqy_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e87s7gt6ajtmf1g5ialc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dvqqeqy_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e87s7gt6ajtmf1g5ialc.png" alt="Image description" width="880" height="294"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subscribe&lt;/strong&gt; — listening to the stream is called subscribing&lt;/p&gt;

&lt;p&gt;Thus, The functions that we are defining to deal with the ongoing events are called observers. Makes sense, now?&lt;/p&gt;

&lt;p&gt;Observable will call the Observer’s next(value) method to trigger notifications, if things go well Observable will call an Observer’s complete() method exactly once. Else the Observer’s error(err) method exactly once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then what is RxJS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As discussed above Javascript doesn’t have observables. There are external libraries that fill this gap and the most famous one is RxJs. It is a reactive extension for JavaScript which provides observables along with many other handy features.&lt;/p&gt;

&lt;p&gt;Do you know chances are high that you’ve already used reactive programming? Know how?&lt;/p&gt;

&lt;p&gt;If you have used any modern frameworks such as ReactJS, Angular, Vue, Svelte, etc. you have already written a lot of reactive programming. For eg: In react/Vue you would be updating a state and the view renders with the updated value, right? Imaging, how hectic &amp;amp; costlier it would be in older days when one would query the DOM, modify it and update it manually using innerHTML for god sake 😟&lt;/p&gt;

&lt;p&gt;Thus to conclude your favorite frameworks in JavaScript have adopted reactive programming at their core and you might not even have realized that you have written tones of reactive code being a frontend developer 😄&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Investing in Reactive paradigm&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Reactive programming has enabled web developers to produce features faster by providing them with the ability to compose complex tasks with ease. Reactive programming is already enabling our lives to be better by powering products built by Netflix, Slack, Microsoft, Facebook, and many more. The more we understand it, the more productive web can be built around it. We got a reason to stay excited and why not?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/staltz/868e7e9bc2a7b8c1f754"&gt;https://gist.github.com/staltz/868e7e9bc2a7b8c1f754&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/reactiveconf/the-concepts-and-misconceptions-of-reactive-programming"&gt;https://dev.to/reactiveconf/the-concepts-and-misconceptions-of-reactive-programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=BfZpr0USIi4"&gt;https://www.youtube.com/watch?v=BfZpr0USIi4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/thisdotmedia/reactive-programming-is-not-a-trend-why-the-time-to-adopt-is-now-31e8"&gt;https://dev.to/thisdotmedia/reactive-programming-is-not-a-trend-why-the-time-to-adopt-is-now-31e8&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have any suggestions (as I’m new to this) or wish to discuss more on this topic please write to me at &lt;a href="mailto:mariappangameo@gmail.com"&gt;mariappangameo@gmail.com&lt;/a&gt;. I’d also love to connect with you all on &lt;a href="https://www.linkedin.com/in/marigameo"&gt;Linkedin&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>reactiveprogramming</category>
      <category>javascript</category>
      <category>rxjs</category>
      <category>observables</category>
    </item>
    <item>
      <title>Git — correlating development</title>
      <dc:creator>Mariappan S</dc:creator>
      <pubDate>Sun, 10 May 2020 15:48:09 +0000</pubDate>
      <link>https://dev.to/marigameo/git-correlating-development-1pcg</link>
      <guid>https://dev.to/marigameo/git-correlating-development-1pcg</guid>
      <description>&lt;p&gt;If you want to start your career as a web developer/software developer blindly learn and practice git beforehand you get things nasty with frameworks. Trust me it’s worth experimenting and could be your companion of all times in your development phases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rl0Rj5i8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AYmP66hKSRBA68kcCZBPJJg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rl0Rj5i8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AYmP66hKSRBA68kcCZBPJJg.png" alt="Git — a companion for dev"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why is it so? Let me explain how I learned it the hard way. I was once interning with a fast-paced &lt;em&gt;AI startup&lt;/em&gt; at Chennai. After getting comfortable with the team and product I was assigned my first task to make changes with the UI of a particular &lt;em&gt;retail-dashboard module&lt;/em&gt;. It was quite a simple task in &lt;strong&gt;React&lt;/strong&gt;, an experienced professional would fairly complete it in minutes. I was taking almost a day to push my changes and get approved. Why do you think so? To be honest it just took me an hour to read the existing code, understand and make changes. But it took me a day to push my changes. The reason is my lack of understanding with git basics. You don’t want to be an expert to clone a repo, fork it, commit code and push changes. I have done those before, but the point where I struggled is dealing with a &lt;em&gt;distributed environment&lt;/em&gt;. I have worked the way I am the only one taking care of my repo. And here I was supposed to work with a team and I struggled to pick up. I was so afraid of what if I pushed some breaking code and if it breaks the production app. You know what I was not aware of &lt;strong&gt;branches&lt;/strong&gt; concept since the only branch I knew is the &lt;strong&gt;master&lt;/strong&gt;, hehe :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oEgoxoRV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A76dS6wq466bTZ4MnoUGHXg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oEgoxoRV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A76dS6wq466bTZ4MnoUGHXg.png" alt="git branching"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was so shy to ask doubts about starting up. How would I ask someone about cloning a repo, committing changes, etc? What would they think of me? I was confused. Googling doesn’t help me out at that time since I was not stable and calm. Later I managed to calm me down, watched a few youtube videos and done with the task. It took me a day, they didn’t make any remark on that. But I was so much disappointed. I felt inferior. I like to share the lessons learned from this experience.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;If someone is stressing you to follow the same structure, again and again, please don’t ignore it. If something is worth following don’t hesitate to spend time on it. For eg: Even if you are working with your hobby project, push the code to a repository, work distributed with your project mates and experiment how the industry works.Because these are skills that come by practice and no use in memorizing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always stick yourself firm with the basics. Refresh them again and again. Apply those skills as much as possible. Stress on the basics before getting your hands dirty with frameworks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A company may adopt any tech stack, will have its own coding principles, design system, etc. But the foundation will remain the same. At the end of the day, the goal is to stay productive. So, learn how to use Git like productive tools so that you stand out in a crowd.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let’s get our hands dirty with some &lt;strong&gt;git&lt;/strong&gt; basics which you will encounter again and again in your projects. I don’t want this to be a regular tutorial listing &lt;strong&gt;git&lt;/strong&gt; commands, which is very easy to find on the web. Instead, let’s experiment with some common issues and confusion we would encounter while getting started with git. &lt;em&gt;Let’s get the git done!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Say, your company wants to develop software to manage &lt;strong&gt;meeting rooms&lt;/strong&gt; in the office. You received the requirement documents, design modules, and other helpful resources. How will you get started? The first question that should come to your mind is&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Are you the only one who is going to work in this project?”.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer is no. Thus you would need a &lt;strong&gt;distributed version control system&lt;/strong&gt; like &lt;strong&gt;Git&lt;/strong&gt; to keep track of code changes and feature updates. The next step is to &lt;strong&gt;initialize an empty repository&lt;/strong&gt; to start working on it. It can be done provided git is available on your machine with the following command.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Terminal pops something which is not expected.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'git' is not recognized as an internal or external command,
operable program or batch file.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We would go crazy with wrinkling thoughts in our minds. But we shouldn’t react that way. Calm down and just read the statement once. Errors are not that bad, they can help you actually. They are good friends. You haven’t properly installed git in your system. It’s not recognizing it. So go back and read the documentation, refer some stack overflow solutions and come back. You will find it funny.&lt;/p&gt;

&lt;p&gt;Now let’s say you are finding that the project is not up to the deadline and you want someone to help you with the &lt;strong&gt;backend&lt;/strong&gt; tasks. So you are inviting your colleague to help you with the backend part. How can you both work distributed and stay productive? Both should contribute independently and should be aware of all the changes. The key here is working on the same repository. The guy was confused with one thing at this point whether he should fork it or clone it? What is the exact difference between those?&lt;/p&gt;

&lt;p&gt;Let’s learn how to approach this rather than discussing the actual solution. One thing you can do is just google it and find answers from some forums like &lt;strong&gt;quora&lt;/strong&gt; which would provide you relatable clear explanations. Like this one below,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.quora.com/What-is-the-difference-between-Git-Clone-and-Fork"&gt;https://www.quora.com/What-is-the-difference-between-Git-Clone-and-Fork&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, know how to branch out and work on a &lt;em&gt;new branch&lt;/em&gt; to make changes independently. Also, know how to make proper &lt;strong&gt;PR(pull request)&lt;/strong&gt; after that. Let me leave you some reference. Just google it, dude!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://thenewstack.io/dont-mess-with-the-master-working-with-branches-in-git-and-github/"&gt;https://thenewstack.io/dont-mess-with-the-master-working-with-branches-in-git-and-github/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s say the project is going well and teams were comfortable working with the distributed repo. As we make changes then and then we can &lt;strong&gt;review&lt;/strong&gt; those using,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;which would list all the tracked as well as untracked file status. In order to view those changes in detail use,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;But git diff will not list the changes if the files are already &lt;strong&gt;staged&lt;/strong&gt;. In that case, this command could be handy to use,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff --staged
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As the repo grows with many changes and &lt;strong&gt;commits&lt;/strong&gt; he like to review all his earlier commits and its changes. This can be done with,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Guess what the terminal is poured with a rain of commit details similar to the one below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PnwvazJr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ANmJJO9jDU5w5qA6TLIxbjg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PnwvazJr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ANmJJO9jDU5w5qA6TLIxbjg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is he want’s to see only the latest two commit? Here we go,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log -n2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This will do the job for us. What if the other person wishes to see the changes done with the latest commit. He can use the long commit &lt;strong&gt;SHA&lt;/strong&gt; value(the &lt;strong&gt;40 character hexadecimal&lt;/strong&gt; entity found in the above screenshot). Copy it and run,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git show "83a65ef387154658d14839fa97dd3a0d756f796a"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Git is much more capable than it can detect with the minimal optimal information you provide with. The result is the same even if you try this way,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git show "83a65ef38"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Before you commit code, you should add them to the staging area. But let’s say the app which you are working on goes for content review and you are receiving multiple &lt;strong&gt;content/typo changes&lt;/strong&gt; one after another. It could be hefty to add files and commit again and again when you are sure that the changes are not going to affect the core logic by any means. So we can skip that step in most parts of this cycle. The trick is to use,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -am "minor typo change to the title for SEO purpose"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It would be unfair if we couldn’t remember the most fundamental git commands. Yet, at times we may make some mistakes. At that point we should know how to get hints handy, one could easily get those via,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;which would make our life much easier without switching our window or navigating to the &lt;strong&gt;browser&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When the contents of the terminal are too long you will notice a &lt;strong&gt;&lt;a href="https://dev.tocolon"&gt;:&lt;/a&gt;&lt;/strong&gt; below, which you could scroll down to view more. Some would struggle without knowing how and guess what it’s hard to search on the web with the right keywords too. This can be done by hitting the space bar to race forward. You have similar controls to move up and down. The point is to get comfortable with these minor basics, possibly only via practice.&lt;/p&gt;

&lt;p&gt;You would definitely encounter a situation struggling to quit the terminal, unknowingly locked with some command execution. Use **ctrl+q **to exit the terminal.&lt;/p&gt;

&lt;p&gt;Now the backend guy feels that the header part could have some more width and bright font color would make much more sense. So he makes some changes and runs it. Unexpectedly the &lt;strong&gt;UI crashes&lt;/strong&gt; and responsiveness gets affected. So he wishes to revert back those changes. How can he do so? He can undo things in the editor (2 steps). But what if he made many other changes and &lt;strong&gt;undo&lt;/strong&gt; all. Do you think he would remember all those or is it efficient to undo them one by one when you knew all those are not needed. Here is where git could help you with, say it is the &lt;strong&gt;index.html&lt;/strong&gt; file&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset -- index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let’s discuss one classic usability issue you would encounter while working on large enterprise projects. Often your colleagues would pull your changes before they start working with their fresh part. What if they need only a part of your changes and not all. Say, only a few of your changes are compatible or ready to be integrated with the backend. That if you made a bunch of changes in a single commit it would be too hard for him to separate those changes after the &lt;strong&gt;pull&lt;/strong&gt;. So let’s look at an example,&lt;/p&gt;

&lt;p&gt;Say you are making few typo changes at the &lt;strong&gt;index.html&lt;/strong&gt; file, then making some product pricing changes in the pricing page. Following it you changed the header part of the app and committed all those changes in a single commit. Now you are supposed to release a build and still, you are not done with the header changes fully. Your colleague feels that it's not that crucial and it’s ok to release the new app version with existing header itself but he needs the rest of the &lt;strong&gt;typo changes&lt;/strong&gt; and &lt;strong&gt;pricing details&lt;/strong&gt; changes there. Imagine how he could overcome this problem effectively. It looks messy right?&lt;/p&gt;

&lt;p&gt;The solution here is always we should make &lt;strong&gt;atomic commits&lt;/strong&gt;. That is all the typo changes should go in a commit, followed by pricing changes in a separate one, followed by the other one so that he can pull only what is needed.&lt;/p&gt;

&lt;p&gt;Now let’s say he wanted to make more typo changes in the same index.html file(say the previous commit is the same kind of typo changes). It would make more sense to &lt;strong&gt;amend&lt;/strong&gt; those changes with the previous commit. How can we act at this point? The solution is,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit --amend -m "typo changes as per marketing requirements"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Have you noticed these kinds of files in your project directory before?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xUrYc-tu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2168/1%2A-jZeHr99xsWMN0zf-X2XSA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xUrYc-tu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2168/1%2A-jZeHr99xsWMN0zf-X2XSA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These log files are generated on &lt;strong&gt;memory crash&lt;/strong&gt; or some done internally by the &lt;strong&gt;OS-specific&lt;/strong&gt; to them. &lt;strong&gt;Mac&lt;/strong&gt; generates such files often. They are no way project-function-specific and thus can be ignored. If you commit changes with these junk files it could look messy. So you can &lt;strong&gt;ignore&lt;/strong&gt; these by including the file name or generally including all files ending with .&lt;strong&gt;log&lt;/strong&gt; extension using a &lt;strong&gt;regular expression&lt;/strong&gt;,&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .gitignore

#ignoring log files generated by the system

log/*.log.[0-9]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;which ignores all files inside the logs directory as well as any files with **.log **extension if any.&lt;/p&gt;

&lt;p&gt;Last but not least I wish to share something related to &lt;strong&gt;vim editor&lt;/strong&gt; which you would be prompted to use at times. If you try to make a git commit without any commit message you would land up in a terminal window similar to the one below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LtTYZRcq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AKgogMDZKm-pBHwf35weoNA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LtTYZRcq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AKgogMDZKm-pBHwf35weoNA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dealing with this would be hard initially since no common keys we use will work until we use exact shortcuts to proceed with that. In such a case type the commit message and use &lt;strong&gt;:wq&lt;/strong&gt; end then &lt;strong&gt;enter&lt;/strong&gt; to commit.&lt;/p&gt;

&lt;p&gt;This is just to ensure you start working with git comfortable initially. These are some basic confusions you would encounter when you experiment git. There is a lot more to explore which you could do it yourself. Start today, learn to stay productive with your team. &lt;strong&gt;Happy coding!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
&lt;a href="https://mariappan.netlify.app/"&gt;Mariappan S&lt;/a&gt;&lt;br&gt;
Email: &lt;strong&gt;&lt;a href="mailto:mariappangameo@gmail.com"&gt;mariappangameo@gmail.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Developer’s draft on AWS jargons</title>
      <dc:creator>Mariappan S</dc:creator>
      <pubDate>Sun, 10 May 2020 15:45:22 +0000</pubDate>
      <link>https://dev.to/marigameo/developer-s-draft-on-aws-jargons-88d</link>
      <guid>https://dev.to/marigameo/developer-s-draft-on-aws-jargons-88d</guid>
      <description>&lt;p&gt;Being a developer, it’s almost impossible to ignore a few technical jargon namely cloud computing solutions(say AWS, Azure, Google cloud platform, etc) and version control systems(say, Git). These are some major players in all aspects of development irrespective of the position or phases. Thus it adds more power to our travel if we managed to understand them at least to the ground level and break myths relating to them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eLDOhYn9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ANcrK1Eq82uQ82lc_6mW0sA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eLDOhYn9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ANcrK1Eq82uQ82lc_6mW0sA.jpeg" alt="AWS — cloud"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;With more power to computing, efficient usage of computing resources, fast-paced methodologies in arriving at appropriate solutions world got simplified and became much more connected. Nothing at present is too far or too complex to approach and solve.AWS is a major conquerer of this cloud space and they promote the utmost flexibility in providing computing solutions to this world.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: I am not working with amazon or anyway trying to promote them with my content. All the opinions and suggestions below are personal and not subject to any sort of promotion.&lt;/p&gt;

&lt;p&gt;Let’s initially try to grasp a few basic concepts ground up from common questions below.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What is cloud computing and why it’s everywhere a sensation now?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Let’s get back to the earlier stages of computing. Remember those days, when we used to manage high-end computing resources like costly servers under maintenance in a safe monitored server room with **24*7 **round the clock administrators. Those were a daydream for many early-stage startups those days. Why is it so? How a bootstrapped startup just grounded up will be capable of enabling such costly server setup powering them? What if they were scaling up rapidly in weeks and there arises more need for such resources later?&lt;/p&gt;

&lt;p&gt;Let’s add more power to this with an example. &lt;strong&gt;Jhon&lt;/strong&gt;, seasoned entrepreneur kick-started his first startup on customized online cake delivery store. He started selling customized cakes in and around Paris initially. To his surprise, the business hiked in a week to more deliveries that he is in need of more computing resources to cope up with those online orders. He noticed that his server is responding too slow for requests from customers. On a weekend the traffic hiked to peek and as a result, his website got down for 3 hrs. It took 2 days for Jhon to scale his server setup and lift his business back. Guess what, unfortunately, he lost a few of his potential customers because of the bad user experience for the last two days. They were compromised by his competitors. His user base decreased and now he is into another problem. Problem with resources. He now hardly find his server’s busy. He felt most of the time the extra server remained idle and exactly he is in no need of them anymore. He paid for too them despite being useless now. What could be the solution? Can Jhon sell the extra server setup? If he does it, what if he again requires them for his business when the festive season is arriving. If he managed to keep on paying for those resources will he sustain the overall revenue?&lt;/p&gt;

&lt;p&gt;John is not the only one facing this problem, millions of business are in need of an effective tactic to solve these issues. There came the advent of cloud computing solutions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Here you only pay for what you use and use only when you are in need&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What does that mean? John now shifted his business to the cloud. He has his website running on AWS powered suites.&lt;/p&gt;

&lt;h3&gt;
  
  
  In what way moving to the cloud helped Jhon lift his business?
&lt;/h3&gt;

&lt;p&gt;Since Jhon adapted using AWS powered solutions now he is paying only for the resources he uses up. For eg: He stores all his user data and order-related data on &lt;strong&gt;RDS&lt;/strong&gt; (Relational Database Solution) provided by AWS.Thus he pays only for what it uses up. Moreover, he managed to increase his website traffic by providing an awesome user experience with CloudFront and S3. With all his assets delivered from S3 and rendered via CloudFront CDN, it hardly took time to load up. Under the ground, all these services are powered by AWS EC2 instance of his choice which is exclusively maintained and provided by amazon for free. Assured of limited downtime and zero maintenance cost as well.No headache of arranging space for huge severs and hiring administrators anymore.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You know what, initially while starting up Jhon managed to run his beta business run with 1 year AWS free-tier itself, which means with zero upfront cost to kick-start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What else one demands to kick-start your idea?&lt;/p&gt;

&lt;h3&gt;
  
  
  Why it’s important to grasp AWS concepts being a developer?
&lt;/h3&gt;

&lt;p&gt;With the benefits mentioned earlier, you will hardly find some business adapting the traditional server-setup anymore. Already millions have moved their businesses into the cloud and thus it’s inevitable you should also start using it.&lt;/p&gt;

&lt;p&gt;Cloud service providers have simplified their services a lot and continuously pushing them focusing on usability. Thus it’s more obvious that a developer can independently handle them for their projects now. It’s not that each and every deployment activities are taken care of the DevOps professional on his own. With the basic knowledge of these, you could power more flexibility and security to your applications. Let me remind you something an AWS system administrator has unique responsibilities aligned with their profiles and it’s inappropriate to expect them to help you with all stuff relating to cloud. From now on, go get your hands dirty with basic concepts, at least a bit with the console initially. I bet you that things won’t be that smooth if you are not practiced to these kinds of cloud setups as a developer that too in early staged startups.&lt;/p&gt;

&lt;h3&gt;
  
  
  What extend should I learn about these services being a developer?
&lt;/h3&gt;

&lt;p&gt;To be honest, there is no boundary for learning these services and usage in industries. You can try your hands dirty with almost all if you are really interested and comfortable learning those. But there are few kinds of stuff which you would encounter most often during your development phases and thus it’s important to ensure having good command over them. Let me list a few commonly used up solutions in AWS,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;S3&lt;/strong&gt; — scalable storage in the cloud (hopefully it would be the place where all your static assets reside)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;EC2&lt;/strong&gt; — virtual servers in the cloud (all your load runs here)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;RDS&lt;/strong&gt; — managed relational database service (say, you would store your user data here)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Route53&lt;/strong&gt; — scalable DNS and domain name registration&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And few other extended services like,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;VPC&lt;/strong&gt; — helps in maintaining isolated cloud resources (will be acting as a container for your resources)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CloudFront&lt;/strong&gt; — global content delivery network(probably enhancing the overall loading experience)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DynamoDB&lt;/strong&gt; —managed no-SQL database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cloudwatch&lt;/strong&gt; — helps you monitor resources and applications (can be your lifesaver at times)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s----vv0aEF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ADQDDNtQOady_eBXtAYbd-w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s----vv0aEF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ADQDDNtQOady_eBXtAYbd-w.png" alt="AWS services"&gt;&lt;/a&gt;&lt;em&gt;AWS services&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now let’s drill down to these basic services concepts as short crisp snippets,&lt;/p&gt;

&lt;h3&gt;
  
  
  What is EC2? What can you do with it?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;EC2&lt;/strong&gt; is nothing but computing tools on the cloud. You can do almost anything that you can do with the help of a computer. It’s basically a virtual machine.&lt;/p&gt;

&lt;p&gt;With EC2 you can easily launch EC2 instances (say Linux servers, third-party AMIs which are available in the marketplace).&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an AMI then?
&lt;/h3&gt;

&lt;p&gt;An &lt;strong&gt;Amazon Machine Image&lt;/strong&gt; (AMI) provides the information required to launch an instance. You must specify an AMI when you launch an instance. An image is basically a combination of operating system and related software (like java, python, etc)&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  Image = OS + softwares
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What is cloudwatch and why should I care about it?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cloudwatch&lt;/strong&gt; is a monitoring service for other AWS services. The beauty is that you probably would have been already using them without realizing it’s cloudwatch since most often they exist as integrated form with other AWS services.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Alarms + metrices — alerted via email,messages etc&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It’s extremely handy and useful in many cases. For eg: Since I started experimenting with AWS in a free-tier, I have set up alarm for billing such that it alerts me via mail when the CPU utilization exceeds a certain limit. The condition I have set up was,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;CPUUtilization &amp;lt; 10000 for 1 datapoints within 5 minutes&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This ensured me a more reliable and informed service utility.&lt;/p&gt;

&lt;h3&gt;
  
  
  What typical services would I require for a minimal scalable web app?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;EC2 — for app hosting&lt;br&gt;
Images and assets stored and served via — S3&lt;br&gt;
All your user's data stored in — dynamo DB or RDS&lt;br&gt;
Objects (say cart items in e-commerce solutions) — RDS&lt;br&gt;
Sessions — managed via elastic cache&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This could make sense for a scalable web app for a decent user base.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is IAM? Why we are so much bothered about it?
&lt;/h3&gt;

&lt;p&gt;Identity and Access Management (IAM) enables you to manage access to AWS services and resources securely. Using IAM, you can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources. Let me make it clear how I have been managed with access to my company AWS account.&lt;/p&gt;

&lt;p&gt;The company I have been interned with has a joined AWS account which will be extensively used by each member across functions and products. Being an intern, I was working with the company’s marketing website and thus I have been provided access only for it by one of the admin. I requested access to it from one of our admin. Say, if I have been assigned some other work dealing with a different product in the future I should request access to it the same way. It’s important to note that only those who were given access to particular services would be allowed to work with them. This ensures restricted access to services. I was also advised to set up &lt;strong&gt;MFA&lt;/strong&gt;(multi-factor authentication) for the AWS environment as an extra layer of security. It requires me to enter an MFA code before sign-in synced up with some device or virtual machine. These things can be effectively handled with the &lt;strong&gt;IAM&lt;/strong&gt; console.&lt;/p&gt;

&lt;p&gt;Few things that you can do with IAM are,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/iam/features/manage-users/"&gt;Manage IAM users &lt;/a&gt;and &lt;a href="https://aws.amazon.com/iam/features/managing-user-credentials/"&gt;their access&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/iam/features/manage-roles/"&gt;Manage IAM roles&lt;/a&gt; and &lt;a href="https://aws.amazon.com/iam/features/manage-permissions/"&gt;their permissions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/identity/federation/"&gt;Manage federated users&lt;/a&gt; and &lt;a href="https://aws.amazon.com/iam/features/manage-permissions/"&gt;their permissions&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How assets are stored and managed in S3?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HbYbybAT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3372/1%2ASH-q2gdhBVoe7SmJ4EnBww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HbYbybAT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3372/1%2ASH-q2gdhBVoe7SmJ4EnBww.png" alt="S3 — simple storage"&gt;&lt;/a&gt;&lt;em&gt;S3 — simple storage&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple Storage&lt;/strong&gt; (S3) is one of the oldest AWS services like EC2. It stores as objects whatever it may be. An object is something,&lt;/p&gt;

&lt;blockquote&gt;
&lt;h1&gt;
  
  
  object = file + metadata
&lt;/h1&gt;
&lt;/blockquote&gt;

&lt;p&gt;Objects are stored in AWS buckets. Each bucket will have a unique bucket name. Thus you can’t have same name for two buckets.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are some database options available under RDS?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;MYSQL&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PostgreSQL&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SQL Server&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MariaDB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Oracle DB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Amazon Aurora&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PostgreSQL is my personal favourite :)&lt;/p&gt;

&lt;h3&gt;
  
  
  In what way RDS is efficient?
&lt;/h3&gt;

&lt;p&gt;Traditional databases setup may require you to manually perform the following,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Installing and managing DB’s — need completely different software and hardware considerations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It sometimes requires hiring someone to do&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;software updates&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performance&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backups&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;usually a Database Admin on demand. These things will be taken care of by RDS solutions. Since they support,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Regular software upgrades&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nightly DB backups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also supports features like,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;RDS Backups:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Periodic backups — occurs daily&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backups would be stored up to 35 days&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;easily you can restore DB from a backup snapshot&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi-AZ deployment (AZ stands for availability zone)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It allows DB replication to a different zone&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automatic failover in case of a catastrophic event&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Db read replication&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is essentially a copy of your DB which is not used in production&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What are some small minor details we miss and struggle with AWS being a developer?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make sure you are comfortable with the usage of console search options. Try setting up pins to create quick access to services you use the most.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Be conscious of the region you are in. At times you will be in the default region value. You would be charged for the services based on your region sometimes and also region could affect the speed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set up MFA without fail as it ensures security for your working environment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS encourages you to organise users under groups and assign permissions to groups rather than individual users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don’t mess up with the root access always.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is an elastic IP?
&lt;/h3&gt;

&lt;p&gt;Elastic IP is nothing but a public Ip that can be associated with subnets. When the particular subnet is deleted it stays remained. So that it can be used to associate with others.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the auto-scaling groups and load balancers?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Autoscaling group&lt;/strong&gt; — automatically shrink or expand a pool of instances based on pre-defined rules&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Load balancer&lt;/strong&gt; — routing appliance that maintains a consistent DNS entry and balances requests to multiple instances.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is a lot more to cover with AWS technically and descriptively. But my aim is just to create a developer reference markup guide to refresh basics before diving deep into them as AWS developers. I hope this helped you some way refreshing your knowledge on AWS. &lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
&lt;a href="https://mariappan.netlify.app/"&gt;Mariappan S&lt;/a&gt;&lt;br&gt;
Email: &lt;strong&gt;&lt;a href="mailto:mariappangameo@gmail.com"&gt;mariappangameo@gmail.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
    </item>
    <item>
      <title>Web Browser internals</title>
      <dc:creator>Mariappan S</dc:creator>
      <pubDate>Sun, 10 May 2020 15:41:31 +0000</pubDate>
      <link>https://dev.to/marigameo/web-browser-internals-2c1m</link>
      <guid>https://dev.to/marigameo/web-browser-internals-2c1m</guid>
      <description>&lt;p&gt;Why this should be your first step towards web development?&lt;/p&gt;

&lt;p&gt;If you’re someone hoping to kickstart a career in &lt;strong&gt;web development&lt;/strong&gt;, getting introduced to web browser internals could become a great lifesaver.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Browser is the master — await react,vue,node a bit&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learn React, learn Vue, experiment Ember — you’ll feel the connection with these cool frameworks and the ability to adapt any in the future if you’re managed to grasp the browser internals.&lt;/p&gt;

&lt;p&gt;What to grasp with browser though? Definitely there’s a lot besides the millions of lines of &lt;strong&gt;C++&lt;/strong&gt; powering it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---OdeDd2---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2600/1%2Arh8NEpOcigg1J4N1Jp_eSQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---OdeDd2---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2600/1%2Arh8NEpOcigg1J4N1Jp_eSQ.png" alt="Commonly used browsers"&gt;&lt;/a&gt;&lt;em&gt;Commonly used browsers&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What a browser is? How does it work? What are the most commonly used browsers?&lt;/p&gt;

&lt;p&gt;There are millions of articles, references, Wikipedia insight on these. There is a high probability that you already knew those too. So let’s try to spot a few details which matter a lot but we hardly grasp them.&lt;/p&gt;

&lt;p&gt;Have you ever encountered this type of CSS code?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;-webkit-border-before&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="err"&gt;1&lt;/span&gt;&lt;span class="nt"&gt;px&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;-webkit-border-before&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="err"&gt;2&lt;/span&gt;&lt;span class="nt"&gt;px&lt;/span&gt; &lt;span class="nt"&gt;dotted&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;-webkit-border-before&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;medium&lt;/span&gt; &lt;span class="nt"&gt;dashed&lt;/span&gt; &lt;span class="nt"&gt;blue&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes, have you ever wondered how they relate to the web browser and how they help with compatibility.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Almost all popular browsers are based on &lt;a href="https://webkit.org/"&gt;webkit&lt;/a&gt; engine&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;WebKit is basically a &lt;a href="https://webkit.org/project"&gt;web browser engine&lt;/a&gt; used by &lt;a href="https://www.apple.com/in/safari/"&gt;Safari&lt;/a&gt;, Mail, App Store, and many other apps on macOS, iOS, and Linux.&lt;/p&gt;

&lt;p&gt;Let’s see what kind of engines are actually powering the master browser we love to use,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Chrome and Opera (from version 15) — &lt;a href="https://www.chromium.org/blink"&gt;Blink&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Firefox — &lt;a href="https://developer.mozilla.org/en-US/docs/Mozilla/Gecko"&gt;Gecko&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Safari — &lt;a href="https://developer.apple.com/documentation/webkit"&gt;Webkit&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Edge — &lt;a href="https://www.chromium.org/blink"&gt;Blink&lt;/a&gt; [Internet explorer — &lt;a href="https://en.wikipedia.org/wiki/Trident_(software)"&gt;Trident&lt;/a&gt;]&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Well, now let’s look at how the high-level structure of the browser would be.&lt;/p&gt;

&lt;p&gt;A normal web browser should have the following components,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;UI (user interface) — this includes everything we interact with like address bar, buttons (front, back, search, etc)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Browser engine — it works as an interface between the browser and the rendering engine(which we will cover next)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rendering engines — It is the one that parses HTML, CSS, etc. That this is what responsible for displaying requested content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Networking — for HTTP requests&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UI backend — used for drawing basic widgets like combo boxes and windows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Javascript interpreter — parses and executing javascript code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data storage — All data capabilities you find in a browser namely cookies, IndexedBD,localStorage, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this context, let me share with you one more thing interesting.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.google.com/chrome/"&gt;Chrome&lt;/a&gt; uses a separate instance of the rendering engine for separate processes (say tabs)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is how the flow normally would be,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9zjbKnJJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AcfQpu6Xvb7e9IiH4CCuiCg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9zjbKnJJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AcfQpu6Xvb7e9IiH4CCuiCg.png" alt="Credit — html5rocks.com"&gt;&lt;/a&gt;&lt;em&gt;Credit — html5rocks.com&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here we might be familiar with DOM but what about the rest in the flow,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;While the DOM tree is being constructed the browser constructs another tree known as render tree.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It’s nothing but visual elements in the order in which they will be displayed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Its main purpose is to enable painting the content in their correct order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.mozilla.org/en-US/"&gt;Firefox&lt;/a&gt; calls them as frames, while WebKit based ones call thems as renderer or renderer object.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Oh yes, let me share one important note aligning with the above context,&lt;/p&gt;

&lt;p&gt;Non-visual DOM elements will not be inserted in the render tree. Sounds convincing right?&lt;/p&gt;

&lt;p&gt;Non-visual means lets say the &lt;strong&gt;head&lt;/strong&gt; element.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The renderers correspond to DOM elements, but the relation is not one to one. There are DOM elements which correspond to several visual objects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For eg: the “select” element has three renderers: one for the display area, one for the drop-down list box and one for the button.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When the renderer is created and added to the tree, it does not have a position &amp;amp; size. This is where the &lt;strong&gt;layout&lt;/strong&gt; comes to place.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Style computation
&lt;/h3&gt;

&lt;p&gt;This is one of the most interesting parts,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Building the render tree requires calculating the visual properties of each render object. This could be more complex than we actually think.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The origin of the style sheets is the browser’s default style sheets.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Follow this &lt;a href="https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/#Style_Computation"&gt;link&lt;/a&gt; if you wish to know more about this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stylesheet cascade orders
&lt;/h3&gt;

&lt;p&gt;How many of you have experienced difficulties in debugging CSS behaviour? I guess it could be daunting. It could be never easy if we have an understanding of stylesheet cascade orders and how to use them within our project properly.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Browsers inhale styles differently — trust me&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The order goes like,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Browser declarations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User normal declarations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Author normal declarations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Author important declarations&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User important declarations&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wait, which user or author we are talking about?&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;author&lt;/strong&gt; specifies style sheets for a source document according to the conventions of the document language. It is basically the website creator (or) the codes it.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;user&lt;/strong&gt; may be able to specify style information for a particular document. It's us who interact with it in a browser!&lt;/p&gt;

&lt;p&gt;Here is the detailed doc for &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade"&gt;CSS cascading &lt;/a&gt;which could help you dive deeper on this.&lt;/p&gt;

&lt;p&gt;Go, get your hands dirty with some different levels of CSS declarations to get a clear view on this.&lt;/p&gt;

&lt;p&gt;Then how scripts would be processed? That’s important too.&lt;/p&gt;

&lt;p&gt;Let’s break the loop now,&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Order of execution of scripts&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The nature of the web is synchronous in general. Say, you have an HTML document,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
            &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;myFunction&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;demo&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;Paragraph&lt;/span&gt; &lt;span class="nx"&gt;changed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;A Web Page&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"”demo”"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;A Paragraph&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"”button”"&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"”myFunction()”"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Try it&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What would happen when browser reads it?&lt;/p&gt;

&lt;p&gt;It first starts parsing the HTML,it goes on like html tag,head tag …uff,&lt;/p&gt;

&lt;p&gt;It then notices the script tag, it jumps in processing the script. It returns back to HTML parsing only after completing this. In this case, it’s acceptable, just an innerHTML statement. But what if it had to process some hundreds of lines, making few API calls, etc. That could be really daunting right? Thus there is debate at all times where to place the scripts in an HTML document. It’s a very different topic. Let me leave it to you.&lt;/p&gt;

&lt;p&gt;Thanks to modern HTML specifications, now you can explicitly specify whether the browser should wait or process asynchronously.&lt;/p&gt;

&lt;p&gt;Have a look at &lt;a href="https://javascript.info/script-async-defer"&gt;async&lt;/a&gt; and &lt;a href="https://javascript.info/script-async-defer"&gt;defer&lt;/a&gt; attributes. It makes the job easier.&lt;/p&gt;

&lt;p&gt;Now let’s discuss on how browser optimizes the changes happen on the layout creation process. It would sound very interesting if you dive deep into this. Don’t worry I will share a beautiful resource at the end for your experimentations :)&lt;/p&gt;

&lt;h3&gt;
  
  
  Optimizations
&lt;/h3&gt;

&lt;p&gt;When a layout is triggered by a “resize” or a change in the renderer position(and not size), the renders sizes are taken from a cache and not recalculated. Cool right?&lt;/p&gt;

&lt;p&gt;Just imagine if browser recalculates each change how time-consuming and less interactive the experience would be.&lt;/p&gt;

&lt;p&gt;In some cases, only a subtree is modified and the layout does not start from the root. This can happen in cases where the change is local and does not affect its surroundings–like text inserted into text fields.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The browsers try to do the minimal possible actions in response to a change.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is a lot more you could explore and learn about browsers. I just planned to share certain concepts in a very brief minimal manner such that it doesn’t complicate too much and encourage you to dive deep.&lt;/p&gt;

&lt;p&gt;If these fascinated you,it’s time to experiment more. Please do have a look at this in-depth &lt;a href="https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/"&gt;article&lt;/a&gt; which was shared to me by one of my mentors. I bet you’ll never regret after reading it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Credit&lt;/strong&gt;: &lt;a href="https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/"&gt;https://www.html5rocks.com/en/tutorials/internals/howbrowserswork/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;By&lt;/strong&gt; &lt;a href="https://www.html5rocks.com/profiles/#taligarsiel"&gt;Tali Garsiel&lt;/a&gt; and &lt;a href="https://www.html5rocks.com/profiles/#paulirish"&gt;Paul Irish&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
&lt;a href="https://mariappan.netlify.app/"&gt;Mariappan S&lt;/a&gt;&lt;br&gt;
Email: &lt;strong&gt;&lt;a href="mailto:mariappangameo@gmail.com"&gt;mariappangameo@gmail.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>browsers</category>
      <category>career</category>
    </item>
    <item>
      <title>Exploring MongoDB</title>
      <dc:creator>Mariappan S</dc:creator>
      <pubDate>Sun, 10 May 2020 13:37:08 +0000</pubDate>
      <link>https://dev.to/marigameo/exploring-mongodb-ck9</link>
      <guid>https://dev.to/marigameo/exploring-mongodb-ck9</guid>
      <description>&lt;p&gt;Data is the new age fuel — If I am not wrong you would have somehow witnessed the power of data and how often we encounter them in our walks of life. The demand to harness the wide range of data, usage of resources, insights gathered from them and necessity to network pushed us to adapt wide varieties of database solutions.&lt;/p&gt;

&lt;p&gt;Today’s data we encounter tend to be unstructured preferably. This led to the revolution of No-SQL database solutions. Right now, if you experiment with the market, you would probably encounter hundreds of such solutions available to adapt to your problems. Let’s break the doors of MongoDB now, one of the most popular and widely adapted No-SQL solution briefly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yk8-wRzP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2400/1%2Afl_ySpJQeoebfcDbBNLsIQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yk8-wRzP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2400/1%2Afl_ySpJQeoebfcDbBNLsIQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As a programmer, you think in objects. Now your database does too.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This one from MongoDB’s official document is pretty self-explanatory and note-worthy.&lt;/p&gt;

&lt;p&gt;Diving a bit into their homepage you could find this definition,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;MongoDB is a general-purpose, document-based, distributed database built for modern application developers and for the cloud era.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Enough with the theory let’s take a use case and experiment the basics of MongoDB intuitively,&lt;/p&gt;

&lt;p&gt;Usecase that would make much sense, relatable and interesting would be the present &lt;strong&gt;COVID-19 pandemic&lt;/strong&gt; we are witnessing. Let’s use MongoDB to explore few useful insights about COVID-19 and find how these kinds of solutions stand out when we are dealing with huge volumes of unstructured data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: I do preassume you have MongoDB installed on your machine and we are good to go.&lt;/p&gt;

&lt;p&gt;We are going to stick with absolute basics and thus we would deal with data via Mongo shell. We are not going to interact with any actual backend like node or python, which we would possibly cover in one of the upcoming posts.&lt;/p&gt;

&lt;p&gt;Make sure your MongoDB server is running and start the shell with the command,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;mongo&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you are noticing a terminal screen similar to this you are good to go, just make sure the (&amp;gt;) arrow pointing at,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xhy6X7HS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AlXMJvsvyxrir7gwr7tOttg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xhy6X7HS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AlXMJvsvyxrir7gwr7tOttg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MongoDB is a document database, which means it stores data in JSON-like documents. You would more likely to encounter such kind of data often and MongoDB community believes this as the most natural way to think about data, and is much more expressive and powerful than the traditional row/column model.&lt;/p&gt;

&lt;p&gt;Let’s create a database (say, COVID19-dB) and create a new collection(say, covidReports) and store the current numbers as per the reports from WHO. We planned to continuously update the collections almost every day.&lt;/p&gt;

&lt;p&gt;First, let’s check for the available databases using the command,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;show dbs&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This will list all the available databases,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---v6KJw3A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AaxtH7_gHvBshFAXaZtvUkQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---v6KJw3A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AaxtH7_gHvBshFAXaZtvUkQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you notice you can find the database name along with the storage information for each,&lt;/p&gt;

&lt;p&gt;Now let’s create one for us,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;use COVID19-db — will do the job for us.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LM0Ec99r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A6cuQbC90PEar7AhTgPnsoA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LM0Ec99r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A6cuQbC90PEar7AhTgPnsoA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s create a new collection for general COVID world-wide stats and add some data,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: MongoDB checks if the collection is available else it creates one for us exclusively on insert.&lt;/p&gt;

&lt;p&gt;Let’s say our overall report looks like this,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a-APdVR4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AmGcE2OxsIlc8lHuuPqtEjA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a-APdVR4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AmGcE2OxsIlc8lHuuPqtEjA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To add it to the collection covidReports,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ynQKHddt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2An5SP5Vjdt_sikeuOCO2jrA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ynQKHddt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2An5SP5Vjdt_sikeuOCO2jrA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can notice that the data is successfully inserted and acknowledged, to verify we can use find and inspect all the collections available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HJrb7q3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AlG1XpWBLljGpFemIG2nD5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HJrb7q3r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AlG1XpWBLljGpFemIG2nD5g.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: The pretty() over there is just to prettify the document to make it more readable. One more thing is you can find a unique id is being created for the document automatically by MongoDB.&lt;/p&gt;

&lt;p&gt;Now let’s say we need country-wise reports too. We can just insert them at the same collection following the previous report as follows,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c1jpdVtl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ArFCz_4YLN8pbLS_-EdKcdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c1jpdVtl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ArFCz_4YLN8pbLS_-EdKcdg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we look closer, this is an array of data being inserted, let’s check how the collection looks like,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dEi1qm-M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2Ar0Lw9Qsu2wr0_NVJVYt0dw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dEi1qm-M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2Ar0Lw9Qsu2wr0_NVJVYt0dw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QngzvFqb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A_7C8m8BmDm_rgN11Cw--XQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QngzvFqb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A_7C8m8BmDm_rgN11Cw--XQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If we look at this result carefully you will find two different types of data is present inside the same collection(one is an overall report and country-wise report with different key-value pairs). This is termed as unstructured data and MongoDB completely accepts this. But we should avoid this kind of usage. Why?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Because imagine you are interacting with this data from some backend like Node.js or PHP and if you try to iterate over this you will find it difficult. Thus even though MongoDB is a schema-less database,it’s good to have a schema model based on our use case to facilitate such kinds of retrievals.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Fine, now we have all the data needed.&lt;/p&gt;

&lt;p&gt;For some reason, Let’s say India plans to maintain a separate collection so that they can operate independently and planned. Thus we should remove them from this collection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z-Lbo-so--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AB0FON6AxASLNs44JVuh2kA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z-Lbo-so--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AB0FON6AxASLNs44JVuh2kA.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;World leaders also wish to know the critical cases count so that they could focus more on their welfare and work accordingly. To update,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---znkJdpd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ANlTaxy5ZwX2hzJ4dNoua_Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---znkJdpd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ANlTaxy5ZwX2hzJ4dNoua_Q.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let’s verify if things are going as required,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mPVlYark--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AxbEpuI11fBWt4rmP9lKkRg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mPVlYark--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AxbEpuI11fBWt4rmP9lKkRg.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qAfEP-NJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AJCKOPr2hN5GLIO0vf4zvQw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qAfEP-NJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AJCKOPr2hN5GLIO0vf4zvQw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So If you notice here, we see India is been removed and new additional information regarding the critical cases is also updated. Hurray!&lt;/p&gt;

&lt;p&gt;Now let’s say we need to mark all those countries and overall report status as critical those satisfies the condition death count greater than 2000, how can we achieve this?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OFtpqiXP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ARbb2Dun9qEbEJhrHQN5mOQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OFtpqiXP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ARbb2Dun9qEbEJhrHQN5mOQ.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our case all four documents satisfy the condition, thus all get updated.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;One unique feature of MongoDB is embedded documents. This you will not find in any other databases. Thus MongoDB is so much popular and widely used.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This means you can embed any levels of documents inside other documents.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;MongoDB supports a maximum of 100 levels of nesting (but it’s a good practise to stop with 2,3 levels itself)&lt;br&gt;
It facilitates us to store a maximum of 16MB, which is fair reasonable since we are going to store only key-value pairs, nothing that heavy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now let’s see it in action. Well, each country will have its set of testing and treatment centers at different locations. It should include information such as total patients they could accommodate, helpline numbers, address information, etc.How can we embed such data,&lt;/p&gt;

&lt;p&gt;For simplicity let’s embed those data only for the USA since they were in most critical condition and thus it would be extremely helpful for them.&lt;/p&gt;

&lt;p&gt;We can update something similar to this,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_BrmMXFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ATohdE5qzXM8pgLi8DBSlgw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_BrmMXFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2ATohdE5qzXM8pgLi8DBSlgw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you execute find and see how the data looks now,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WuOeyEdp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A5k_6pOq6MboMtwJpCETjtw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WuOeyEdp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A5k_6pOq6MboMtwJpCETjtw.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This way you can embed any levels of data if required.&lt;/p&gt;

&lt;p&gt;Apart from this, I just wish to touch upon a few things but definitely not in-depth as we decided to stick to the very basics, right? So let me just give a glance of them,&lt;/p&gt;

&lt;p&gt;You can have these many types of data types when working with MongoDB,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;text&lt;br&gt;
boolean&lt;br&gt;
number — integer, long, decimal&lt;br&gt;
objectId — will contain the timestamp at which the object is created&lt;br&gt;
ISODate — date format to store the date and time in MongoDB&lt;br&gt;
Embedded document — can store one entire document against a key&lt;br&gt;
array — multiple documents or multiple nested documents can be stored for a key&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can also establish a certain relationship between data just like any other databases,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;one to one&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;one to many&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;many to many&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is a lot more to cover, let’s shift those experimentations to some other future posts hopefully. I hope you had some fun working with MongoDB and let me know if something could have been better 😄&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
&lt;a href="https://mariappan.netlify.app/"&gt;Mariappan S&lt;/a&gt;&lt;br&gt;
Email: &lt;strong&gt;&lt;a href="mailto:mariappangameo@gmail.com"&gt;mariappangameo@gmail.com&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>nosql</category>
      <category>database</category>
    </item>
  </channel>
</rss>
