<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alok Kumar on Medium]]></title>
        <description><![CDATA[Stories by Alok Kumar on Medium]]></description>
        <link>https://medium.com/@alokk830?source=rss-f604bf081055------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mTws8lpR54jdHtFJHYHntw.png</url>
            <title>Stories by Alok Kumar on Medium</title>
            <link>https://medium.com/@alokk830?source=rss-f604bf081055------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:22:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alokk830/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Promise. Promise. Promise. But do you really understand Promise?]]></title>
            <link>https://medium.com/swlh/promise-promise-promise-but-do-you-really-understand-promise-bf6d0d680ae5?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf6d0d680ae5</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[asynchronous-javascript]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[promises-in-javascript]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Wed, 10 Dec 2025 07:43:42 GMT</pubDate>
            <atom:updated>2025-12-10T07:49:13.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*OhbkYwR8O4YY7gSj.jpg" /></figure><p>Today I am going to save you from <strong>THE</strong> JavaScript Asynchronous tricky output questions, which makes a lot of people fall into its trap, and regret later.</p><p><strong>There is something very important in the last of this article, you don’t want to miss, so be there with me till the end. You won’t regret. Promise 😉</strong></p><p>The expectation is, that you understand a little bit of Promise, and how does event loop works. <strong>If not, go ahead and explore that, I would recommend checking Akshay Saini’s YouTube videos. </strong>They are perfect.</p><blockquote>There is a difference between understanding Promises theoretically, and practically. If you don’t understand the later part (practical), you are not going to get through the tricky output based questions.</blockquote><p>Let’s jump into the practicality and understand where do we lag</p><ul><li>Usage with <strong>async </strong>and <strong>await</strong></li><li>Usage with <strong>.then() </strong>or <strong>Promise Chaining</strong></li></ul><p>How does that affect the output you might ask? Well the behaviour of both of the above mentioned stuff varies here. Let’s see what they are.</p><h3>Async and Await Operation</h3><p>Usage of await <strong><em>pushes the Promise and the leading synchronous operation to a Promise chain, in short, in .then() form to then EVENT LOOP. The catch here the trailing new Promise() has to have the resolve/reject inside it. </em></strong>And it comes out of the call stack, and gives the control to other synchronous operations happening in the call stack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/0*ceONB0d4cySwRLXU.gif" /></figure><p>Scratching your head like this guy, right? Let’s understand it with an example:</p><pre>async function asyncFunction() {<br>  // resolve() code is there, hence, next console gets pushed<br>  const data = await new Promise((resolve, reject) =&gt; resolve(&#39;data&#39;));<br>  console.log(&quot;Synchronous operation&quot;);<br>}<br><br>asyncFunction();<br>console.log(&quot;Outside Async Function&quot;);</pre><p>When I ask the output, a lot of us might say, it shall print first “Synchronous operation” → “Outside Async Function”. Right?</p><p>Wrong.</p><p>As per the standard protocol “await” by default makes the leading synchronous to be chained into the previous operation, so the above becomes like</p><pre>Promise.resolve(&quot;data&quot;).then((value) =&gt; console.log(&quot;Synchronous operation&quot;));</pre><p>So the whole operation will be pushed to the Event loop with the <strong>console.log(“Synchronous operation”)</strong>, and the next set of code is operated immediately without blocking the main thread, i.e., <strong>console.log(‘Outside Async Function’);</strong></p><blockquote><strong>Q.</strong> Does every synchronous operation gets pushed to a chain after await? <strong>Yes</strong>. Every single one of them, but in order. So the output will be in order only.</blockquote><p>Once the synchronous operation is finished, the event loop then pushes the task to the call stack, and then the async-await operation finally gets executed leading to this output:</p><pre>&gt;&gt;&gt; Outside Async Function<br>&gt;&gt;&gt; Synchronous operation</pre><h3>.then() Operation</h3><p>.then(), unlike await doesn’t move out of the code, but it looks out for <strong>.then()</strong> operation and pushes immediately to the event loop and lets the next set of synchronous code (if any) operate normally.</p><p>Let’s take a look at the previous code with some tweaks, shall we?</p><pre>function asyncFunction() {<br>  // .then() operation is pushed to the event loop<br>  Promise.resolve(&quot;data&quot;).then(value =&gt; console.log(value));<br>  console.log(&quot;Synchronous operation&quot;);<br>}<br><br>asyncFunction();<br>console.log(&quot;Outside Async Function&quot;);</pre><p>So, if you have understood the pattern, I want you to take a pause and then tell yourself the output. I know you will be right this time. And if you’re not, tell me what did you not understand in the comment section</p><pre>&gt;&gt;&gt; Synchronous operation<br>&gt;&gt;&gt; Outside Async Function<br>&gt;&gt;&gt; data (Coming from Event Loop)</pre><p>If you’re right, then give a pat on your back. And if you did not, then no problem, go through this article again, and try. I know you will get it very soon.</p><h3>Trickiest Part of All Time (TPAT)</h3><p>As promised, I now would like to help you understand what happens to exceptional cases where you observe the following cases</p><pre>async function asyncFunction() {<br>  const data = await new Promise((resolve, reject) =&gt; {<br>    console.log(&quot;Inside Promise&quot;);<br>    resolve(&quot;data&quot;);<br>  });<br>  <br>  console.log(&quot;Synchronous Operation&quot;);<br>}<br><br>asyncFunction();<br>console.log(&quot;Outside Async Function&quot;);</pre><p>In this case, the output will be</p><pre>&gt;&gt;&gt; Inside Promise<br>&gt;&gt;&gt; Outside Async Function<br>&gt;&gt;&gt; Synchronous Operation</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EWjP6ntxN3FCasil" /><figcaption>Photo by <a href="https://unsplash.com/@hhh13?utm_source=medium&amp;utm_medium=referral">傅甬 华</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I know you’re doubting yourself, as to why did you choose JavaScript to code 😄 Let me explain</p><p><strong>RULE: </strong>The code in the callback of Promise is called as an <strong>Executable Code</strong>, which is not asynchronous here. So whatever you write is read <strong>immediately </strong>inside the callback function.</p><p>The code will be pushed to the EVENT loop is the <strong>resolve()/reject()</strong>. Here it is <strong>resolve(“data”)</strong>. So as per the operation, the code executor checks whether there is any synchronous code present inside callback apart from <strong>resolve/reject</strong>.</p><p>Let’s check out other case here, where there is no resolve/reject operation present</p><pre>async function asyncFunction() {<br>  const data = await new Promise((resolve, reject) =&gt; {});<br>  console.log(&quot;Synchronous Operation&quot;);<br>}<br><br>asyncFunction();<br>console.log(&quot;Outside Async Function&quot;);</pre><p>Take your time and try giving the output before you see the results.</p><p>Drum rolls….</p><pre>&gt;&gt;&gt; Outside Async Function</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iOoX3bAccnSserCJ" /><figcaption>Photo by <a href="https://unsplash.com/@dre0316?utm_source=medium&amp;utm_medium=referral">Andre Hunter</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I know. I know. You are angry. But let me explain again.</p><p>The case here is of classic <strong>await-resolve()-synchronous code operation</strong>. Let us recall the learnings. So when await arrives, the code first gets inside the callback, and sees if there are any synchronous operation to be executed immediately.</p><p>Then it checks whether we have resolve()/reject() there, via which the whole Promise and rest of the leading synchronous operation will be pushed to the EVENT loop.</p><blockquote>The catch here is, the synchronous code <strong>(console.log(“Synchronous Operation”)) </strong>pushed to the event loop, but it never gets implemented, cos, it could not find <strong>resolve()/reject(). The promise is in a PENDING state and never gets fulfilled. Due to which the rest of the operation comes to a halt, and never gets executed. Hence, the only code gets executed is the outside function console.</strong></blockquote><h3>Final Test</h3><p>If you have really understood the game, then try giving output yourself, without cheating and explain why in the comment section.</p><pre>async function asyncFunction() {<br>  const data = await new Promise((resolve, reject) =&gt; {<br>    console.log(&quot;Inside Promise&quot;);<br>    resolve(&quot;data&quot;);<br>    console.log(&quot;Inside Promise. After Resolve&quot;);<br>  });<br>  <br>  console.log(&quot;Synchronous Operation&quot;);<br>}<br><br>asyncFunction();<br>console.log(&quot;Outside Async Function&quot;);</pre><p>If you do it right, my teaching was successful. And if it was not, then you can share your doubt, and I will come back with a better explanation. But do give a read to this article again, something will click for sure, the next time you read it.</p><p>Thank you very much for reading this post, and I wish you will never get stuck in question like these ever. Wishing you the best. Cheers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*B04AzHzHl00Hcj8C.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf6d0d680ae5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/promise-promise-promise-but-do-you-really-understand-promise-bf6d0d680ae5">Promise. Promise. Promise. But do you really understand Promise?</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rising Above Adversity: Your Ultimate Guide to Finding a Job and Rebuilding Your Career in…]]></title>
            <link>https://alokk830.medium.com/rising-above-adversity-your-ultimate-guide-to-finding-a-job-and-rebuilding-your-career-in-aa5f99ac07c?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa5f99ac07c</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[job-search]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[layoffs]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Wed, 12 Jul 2023 06:59:39 GMT</pubDate>
            <atom:updated>2023-07-12T12:55:03.946Z</atom:updated>
            <content:encoded><![CDATA[<h3>Rising Above Adversity: Your Ultimate Guide to Finding a Job and Rebuilding Your Career in Challenging Times</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*OkQL59QWMv1iOULP" /><figcaption>Image Credit: Google</figcaption></figure><p>Year 2022–23 is an year, which majority of professionals will remember for the rest of their lives. After <strong>2008 crash</strong>, this year was something, which had a huge setback on a lot of people. While people were recovering from the <strong>CoVID</strong>, the recession and layoffs hit and created a massive shock amongst the professionals, pushing them deep into their fear once again. Almost <strong>20–40 million layoffs </strong>happened during this time. Massive!</p><p>But with setbacks, comes greater advantages. During this time, people were seen doing the things which they always wanted to do, be it preparing for a dream job, to starting their own businesses. <strong><em>And this post is all about coming out of the adversities, becoming a better professional and achieving something which we want to achieve</em></strong>.</p><p>Just a little bit about my story, so that you can relate, and move forward with why am I writing this in the first place, as I am coming from the same place. I was amongst those people who got laid off, but my case was a bit different and critical. I was in the category where <strong>immigrants were laid off, looking out for a job with a visa sponsorship, and had a deadline to stay in the country</strong>. I was working as a <strong>Software Engineer </strong>in one of the <strong>Fin Tech </strong>industries in the hear of the country <strong>United Kingdom</strong>, i.e., <strong>London</strong>.</p><p>I had to find out a job, and had appeared for numerous jobs, looking for a <strong>skilled worker visa sponsorship</strong>. Unfortunately, after a lot of trying, due to the complications of overstaying in a new country, I had to come back to my homeland, <strong>India</strong>. I had shared my story in my <strong>LinkedIn</strong> post, which you can read, which talks about <strong><em>what was my journey during this period</em></strong>. I would suggest you to read it at your own pace 👇🏻</p><p><a href="https://www.linkedin.com/posts/alokk830_india-uk-layoffs-activity-7072092217573560320-MMFF?utm_source=share&amp;utm_medium=member_desktop"><strong>I came back to #india 🇮🇳 from the #uk 🇬🇧. Why? 🔗</strong></a></p><p><strong><em>But when I came back home, I got a job! Exciting, isn’t it?</em></strong> Who wouldn’t be. After a long toil, you finally got a good job offer, and now can you take a breath, rest, and look forward to contributing next. The only sadness was, that I had to leave the country and move back to India. I wanted to stay, and learn more, but couldn’t.</p><p>Now, the question arises, <strong>what did I do to secure a job? </strong>A very common question which if not hundreds, then thousands of job seekers are asking currently. In order to help people, I wrote another <strong>LinkedIn </strong>post 👇🏻</p><p><a href="https://www.linkedin.com/posts/alokk830_laidoff-upskill-linkedin-activity-7077166717830897667-BXjZ?utm_source=share&amp;utm_medium=member_desktop"><strong>I have got a job after being #laidoff 😊 Here is what I’ve done to secure a job after this challenging situation 🔗</strong></a></p><blockquote>I know, you might be asking, what is the purpose of this blog, if I am just sharing links? Isn’t it?</blockquote><p>You’re right, and you should ask this question, cos, you are investing your valuable time in reading this blog, for which I am very thankful to you. Coming back to the point. So, post writing the above post, a lot of people/professionals started asking questions, and strategies, which helped me to secure a job.</p><blockquote>I had felt that, aggregating all the necessary information in one place, is the answer to the problem, and hence I am writing this down for you. So that you can save, read it, and have it till the rest of your lives. Of course, till Medium is here 😅</blockquote><p>The post did get some good engagement, and I got an opportunity to appear in <strong>Shrayansh Jain’s (who is a</strong> <strong>Technical Staff Member at PayPal)</strong> podcast on his <strong>YouTube </strong>channel, <strong>Concept &amp;&amp; Coding</strong>, where he talks about <strong>HLD and LLD concepts in Software Engineering. </strong>I talked about some more strategies on how to find the job in a right way with some myth busting about few platforms, <strong><em>coming from my experience</em></strong>.<strong> </strong>Here is the <strong>YouTube </strong>video for the same.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUmlHMdv26Mg%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUmlHMdv26Mg&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUmlHMdv26Mg%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/94a978ab5d062e6a610395cefd11caad/href">https://medium.com/media/94a978ab5d062e6a610395cefd11caad/href</a></iframe><p>While those pointers/links are there to help you in a greater way, you also need to maintain a composure and need to panic during this situation. I know it sounds weird, and even I had panicked, but maintaining a composure will help you think properly. There are lot of feelings, emotions out there right now, and being someone who went through this, could give some insights in tackling the situation.</p><p>I came across a website, called as <strong>Topmate</strong>, which is a perfect platform for helping out people, seeking guidance or learnings. I firmly believe that when you connect with some one face to face you will be able to get and give more. So, I had also, created an account there, you can look out for the services you’d like to get, and reach out to me. I will make sure to help you to the best of my knowledge and skills: <a href="https://topmate.io/alokkumar"><strong>Book 1:1 Call at Topmate ✈️</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZaPcvGpd3X7TBWDqBKufXQ.jpeg" /><figcaption>Alok Kumar Topmate Profile</figcaption></figure><blockquote>“Remember, you’re not alone in this sea, and being anxious is a good sign that you’re serious about your career, but don’t let that demotivate you, or let you stop what you have started again”</blockquote><p>Would love to get your views, feedbacks to help improve this post, and help people in a better way. All the best. Cheers 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa5f99ac07c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Front End Vs Back End Vs Full Stack Engineer]]></title>
            <link>https://medium.com/swlh/front-end-vs-back-end-vs-full-stack-engineer-b381a408c3f6?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/b381a408c3f6</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Thu, 19 May 2022 08:29:02 GMT</pubDate>
            <atom:updated>2022-05-19T08:29:02.171Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*k5WMQTXTBGzdUubZ.jpg" /><figcaption>Image Source: Google</figcaption></figure><p>I have been seeing a lot of discussion around this amongst the new developers, who wants to build a career in the <strong>Software Engineering</strong> field. Even this discussion is popular amongst companies for their engineers’ hiring, as the belief is all about <strong>Full Stack Engineer is in demand, and Front End or Back End Engineering is fading with the time</strong>.</p><p>I wish the above statement was true, but the truth is something which doesn’t aligns with the above notion at all, provided you do research about things on a daily basis or a frequent basis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/0*QDGxHBTnOHIrhxz6.jpg" /><figcaption>Image Source: Google</figcaption></figure><blockquote>Full Stack stream definition is all about covering aspects of Front End and Back End.</blockquote><p>I believe it is a fair definition ✅, as it is true that the developers handles both the things based upon the requirements. But there is a catch, and that is <strong>Full Stack </strong>developers are not optimal when it comes to handling <strong>complicated/complex tasks in a particular niche, be it Front End or Back End</strong>. It demands something which is close to expertise/mastery, and a Full Stack Engineer has the challenge of becoming one. Hence, they are called as <strong><em>Jack of All Trades and Master of None</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*d-pRx835ZYZd4EB2" /><figcaption>Image Source: Google</figcaption></figure><h4>Now the question arises, is Front End or Back End engineering specifically will still be in demand in future?</h4><p>The answer to the above question is a big <strong>YES</strong>. To add more weight to the above notion, let us take an example of a company which need it’s database to be re-written in a new database, which uses a specific version being optimised enough to perform the same tasks or may be configure the database again to be able to enhance it’s capabilities. In this case my friend, the company is <strong>never</strong> going to hire a full stack engineer, and all they are going to be looking for will be, a <strong>back end engineer having expertise in Database Engineering</strong>.</p><p>The same ground rule is applicable to the Front End engineers as well. Some expertise will always be required to handle some complicated tasks, and a Full Stack developer is not enough to handle the same. Hence, the <strong>requirements</strong>.</p><p>See, it is practically okay to be the <strong>Jack of all trades and master of none </strong>precisely, but if you want to become a master/expert, then pick a niche and delve deeper into it.</p><p>As per the research I have done so far, I would say, no specific development niche is going to replace one another in the coming future.</p><blockquote>There will always be complicated systems, which only requires an expert in the field to deal with the situation. And to become one, you need a thorough research and work experience in the same field!</blockquote><p>Choose your path wisely, and move forward. Nothing bad in being a Front End, or a Back End or a Full Stack Engineer. It is all about priorities and perspectives.</p><p>All the best and be a <strong>Great Software Engineer</strong>, cos the baton of this responsibility is going to be passed to some one who will look up to you. Think wisely, and work for change! 👍🏻</p><p>Let us connect on <a href="https://www.linkedin.com/in/alokk830/">LinkedIn</a>, if you would like to see short contents on <strong>Startups</strong>, <strong>Learnings</strong>, <strong>Algorithms</strong>, <strong>Development</strong>, and <strong>Software Engineering 🙏🏻</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b381a408c3f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/front-end-vs-back-end-vs-full-stack-engineer-b381a408c3f6">Front End Vs Back End Vs Full Stack Engineer</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Engineering Industry (IT) Bubble Burst]]></title>
            <link>https://medium.com/swlh/software-engineering-industry-it-bubble-burst-1e16ffb6cc5d?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e16ffb6cc5d</guid>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[strategies-for-success]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[planning]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Wed, 18 May 2022 06:59:57 GMT</pubDate>
            <atom:updated>2022-05-18T06:59:57.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9fsb_ECWiCjBOE2V.png" /><figcaption>Image Source: Google</figcaption></figure><p>I have been hearing about this frequently, and I am sure that it has been bothering a lot of Engineering folks, especially those working in the IT sectors. This news is indeed haunting to so many people, who are <strong>completely </strong>relying on their pay checks to pay off their monthly bills. Resulting, it had led me to research more about this <strong>terminology</strong> and the situation going on right now <em>(I am also a Software Engineer, so obviously, I will have to look into it 😅)</em>.</p><p>Now first thing first, I agree that a lot of big tech companies are going in a loss in the <strong>Stock Market</strong>, some of them are going beyond <strong>80%</strong>, which is insane. Also, hearing about companies like <strong>Meta </strong>freezing their hirings for sometime.</p><p>I am aware that Software Engineering industry has or had been a very successful sector in the past few years, and it made people believe that they can succeed in life coming into this path as well. IT indeed attracted a lot of engineers and non-engineers in the past few years. It has built a trust in people, but having this news hitting the world is indeed mind boggling.</p><p>In the meantime, looking into the brighter side of the aspects as well. <strong>Amazon </strong>doubling their hirings, <strong>Microsoft </strong>is doubling their engineers’ salary. These are positive news and exciting as well, isn’t it? So what is happening, what do we do in this so called <strong>tough</strong> <strong>times</strong>. I have few answers for you. So let’s take a quick break first, if you have read this far, and then we shall finish the rest of the content.</p><p><em>Assuming that you are done with your break 😎, and are ready to read the good news. So here we go 😀</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*G1qHgMKnA0Dvw5G1.jpeg" /><figcaption>Image Source: Google</figcaption></figure><p>At this point, you shall be asking, <strong>“Should we be worrying about this situation or not?” </strong>I say, that is a fair question, and to answer that, I have few pointers:</p><ol><li>If you think you’re a <strong>potential </strong>developer or a software engineer, then I would say, you <strong>should not </strong>be worried about this situation. <strong>There will never be any scarcity of opportunities in this sector</strong>, as majority of things like business, start ups, or any XYZ ideas which needs to grow, needs to be <strong>Online</strong>. And for that need, engineers like you will always be required in the first place.</li><li>This situation or I must say this terminology is applicable to those companies, who are <strong>completely </strong>relying on their <strong>VCs’ (Venture Capitalists)</strong> money to run their company, or survive in this market, without having made a competitive revenue for their growth, hence, <strong>loss</strong>, hence, cost cutting in the form of employees’ layoffs and what not.</li></ol><p>If by any chance, in this unfortunate condition, you fell into that bucket, where you have been laid off from one of those companies, then be abreast of the following things:</p><ol><li>There are literally <strong>N number of opportunities</strong> out there, and if you think you’re ready, then you will be able to <strong>bounce back </strong>in no time my friend. But I can assure you one thing, <strong><em>regret will never come into your mind being a Software Engineer, if you think you’re skilled</em></strong>.</li><li>Take a look at the <strong>current</strong> <strong>market</strong>, it’s <strong>demand(s)</strong>, and <strong>up-skill</strong> accordingly. Again, there are <strong>N number of materials online</strong>, available at your convenience, for <strong>Free</strong>! Thanks to all those content creators, who are taking out their valuable time to mentor, guide and teach people like us to grow and excel in their careers 🙏🏻🙏🏻.</li></ol><h4>Last but not the least, a <strong>bonus </strong>advice, learn something about <strong>Investing</strong> as well, it will help you when you need it the most. I believe it is always a <strong>good idea </strong>to have a <strong>back up </strong>ready ❤️</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*pKUNohpSVZxPwgsi" /><figcaption>Image Source: Google</figcaption></figure><p>And for those people who’re facing some rough times:</p><blockquote>Have patience my friend, your time will come. But don’t let this situation stop you from doing something or anything. It is a process, and you will soon succeed!</blockquote><p>All the best!</p><p>Let us connect on <a href="https://www.linkedin.com/in/alokk830/">LinkedIn</a>, if you would like to see more of my short contents about <strong>Software Engineering, Start ups, Learnings, Algorithms, Development. </strong>See you there 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e16ffb6cc5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/software-engineering-industry-it-bubble-burst-1e16ffb6cc5d">Software Engineering Industry (IT) Bubble Burst</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Startups vs Tech Giants. Where to start?]]></title>
            <link>https://alokk830.medium.com/startups-vs-tech-giants-where-to-start-7cfae8fe0196?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cfae8fe0196</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[freshers-jobs]]></category>
            <category><![CDATA[freshers]]></category>
            <category><![CDATA[startup-lessons]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Sat, 13 Mar 2021 15:42:26 GMT</pubDate>
            <atom:updated>2021-03-15T02:00:07.272Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*wYjorgLNih2fyM8h.jpg" /><figcaption>Image Source: Google</figcaption></figure><p><strong>Looking</strong> at the trend of being at the top notch companies has now become a vogue, and this paranoia exists majorly in the mind of <strong>fresher/recent graduates</strong>. I do agree with the fact that the big tech giants has certain privileges, which the small scale companies cannot give right now. But if I were to give suggestions to the <strong>recent graduates/freshers</strong> from where should they start, I would really recommend <strong>startups</strong>. To support my point, I have something for you, so please follow these pointers, and then ask the question again, <strong>“Is it really the FAANG, TAANG etc always, or the right start up?”</strong> :</p><p>➼ The reality is, the tech giants like <strong>FAANG</strong>, was once a startup. If everybody would have preferred the same mentality like today’s world, joining only top notch companies, <strong>FAANG, TAANG etc </strong>would have stopped after some time. The best recent example I could give you right now is <strong>Tesla-PayPal</strong>, Elon Musk had started <strong>PayPal </strong>and <strong>Tesla</strong>, a company once nobody gave a crap about joining, but the people who stayed there with Musk, a place which in layman terms the recent graduates calls, <strong>“Nah! not so interesting, and famous”</strong>, are the ones, who are the achievers in this very field.<br>➼ The freedom you get to learn something new, expand your mind, and experiment is huge in <strong>startups</strong>. And that is how you learn and grow, and become great at it. Tech giants cannot have that, cos of the larger team, and they are already expanded, so chances of experimenting on new things minimizes (I am comparing the scenario, and that is the truth)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*Jp8E-p1fbV577o_S" /><figcaption>Image Source: Google</figcaption></figure><p>➼ Apart from your work, you can explore new teams, and work with them in <strong>startups</strong>, the chances of becoming an all rounder personality is exponential here.<br>➼ It is always a great feeling to become a part of the product/core team which will be changing/impacting thousands of life in future. You will cherish these things while looking back into your life, and see how life changing product you have created with the team which was once just a bunch of employees. You will have the opportunity to say that, yes, you were a part of a legacy product which is now changing thousands of lives. The chances of saying that right now would not be as great as the one in the startups. <br>➼ Startups makes you tough in different ways, which will save your life in the upcoming roads which you will be taking in the future, as you grow in your respective careers. There will be a time, when you will ask questions to yourselves, <strong>“Am I in the right place, do I know anything about what I want to do right now?”, </strong>but I can assure you, if you can survive that, nobody will ever be able to push you down, cos you will be <strong>invincible</strong>, and your graph will always go up, like this one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*iB0x2SgcKhKrM6Yr.jpg" /><figcaption>Image Source: Google</figcaption></figure><p>➼ It is 100% true, that the amount of time you take to learn a new thing by working in startups is way greater than the tech giants. And it is a proven fact, even the people who are working in the tech giants will agree on that.<br>➼ The most important part, the <strong>learnings</strong>. This part is a life changing part. The secret to success is — <strong>How fast you can learn something, and be comfortable at it. </strong>In this tough competitive market, it is almost impossible to stay behind, cos the way the technologies are evolving, you cannot afford to stay behind. You need to update yourself by the time you see a new tech arrives into the market. Let me break it down for you, in the next section.</p><p><strong>Learnings</strong>, it is something very important, and how do we say that a start up gives us more learning? Now let us first understand, how you can survive into the market. <br>➼ As said earlier, the lesser the better. What I meant is, the less time you take to learn something, and become comfortable at it, will always make you stay ahead in the curve. Hence, more confidence, which is directly proportional to more growth. <br>➼ The ability to decide which technology is better for your use case, and which is not is the ability which every body wants to learn, but only few have it. Cos, this is something which has to be imparted when you start your journey in your respective field, and if you look at the scenario, startups has got this for you.</p><blockquote><em>You are the part of the small team, in which you will be made to think like that, to decide, and your decision will also decide the future of the product, which is again proportional to the success of the company.</em></blockquote><p>And that is how a future leader is moulded, who can take up the responsibility, and become someone, to whom every body can look up-to. Getting these privileges in the Tech Giants is not as much as startups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pQOzLNQ__56zz_jv.png" /><figcaption>Image Source: Google</figcaption></figure><p>You might be thinking, that’s okay even if some points are valid, but <strong>what should I do? How should I move my step forward? There are a lot of companies, which are not good too, so I am afraid, if I will land up in a place where my career is taking a wrong turn, then what?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*9m7C18Q79MBeUaMZ.jpg" /><figcaption>Image Source: Google</figcaption></figure><p>The above questions are normal yet very important, and everybody should think before starting their career (for freshers), or while making choices for a switch (for experience professionals). I will be now giving you the answers to the above questions, so that it can help you take the right decision, or make you good enough to decide something better for your career. So let’s start, shall we?</p><p>A <strong>What should I do? </strong>First of all, if you have come this far, then something made sense to you, and I thank you for that. So without further a do, let us start. There are fair point of places where you can find different jobs in the various start ups. Now, my personal favorite is <a href="https://angel.co/">AngelList</a>. <em>AngelList is world’s largest start up community, and is helping thousand of candidates to start their journey in one of the greatest startups present anywhere in the world.</em><strong> Not to forget, AngelList helped me land into one of the startups in Bengaluru</strong>. Never regretted my choice, and now I am here sharing some insights with all of you! There are other places as well, but <strong>AngelList is something great in respect of finding great startups to work in</strong>.</p><p><strong>B How should I move my step forward? </strong>Another great question. Now that you know where to find the jobs, you can check out various interested positions in different companies (Assuming, you are already done with your interested profile decision). Try reading about what they want from a candidate, and also, what are they offering you as a company to learn and grow. Some companies, gives out various assignments for the same. So check those out as well. Make sure to check for these things as well:<br>➡ How many people you will be working with?<br>➡ What are they offering, in respect of facilities?<br>➡ What will be the team size in which you will be working, and so on and so forth<br>➡ Reviews about the company on websites like <a href="https://www.glassdoor.co.in/index.htm">Glassdoor</a>, or simply google search about the same<br>➡ Is the location fine for you?<br>➡ Work From Home facility <strong>(For Pandemic Only)<br></strong>➡ What machine they are offering to perform your job <strong>(Very Important)<br></strong>➡ What is the week-off schedule for you? Are you getting enough breaks for you to be mind fit too.</p><p>C <strong>There are a lot of companies, which are not good too, so I am afraid, if I will land up in a place where my career is taking a wrong turn, then what? </strong>Some of the answer to this particular query has already been clarified in point number <strong>B</strong>, now adding some more pointers to that. For finding this one out, whether you might take the wrong turn in your career:<br>➡ You should always be ready with all the desired work list which you want to perform in the company. For example you want to become a <strong>Full Stack Developer, and want to work on various stacks (which is demanding) on both the ends. <br></strong>➡ Does the company uses latest techs to work/build products, or using obsolete techs like PHP to build some of their products <strong>(Very Important)<br></strong>➡ How does the company helps you take decision, and are you allowed to make decision based upon the demand it has in the current market?</p><p>In most of the cases, companies calls you and gives you some challenge to complete, be it coding challenge or some of your work related challenge to complete. In that case, see these:<br>➡ How much they are offering to give you for completion<br>➡ What is their expectations level, are they asking too much as per the timeline?<br>➡ Are they asking you to just submit your project, and don’t give a GitHub like for the same? (This case, they are just using you to complete one project, and then they will just use your full code, and go away, if they don’t want you, so beware)</p><p>Now that we have talked a lot about every thing, but you might have one question, that, hey! we did not even talk about <strong>Money </strong>part. This is important too… <em>I know it is important, and you should be having some expectations as well, but there is one thing which I wanted to tell you and that is</em></p><blockquote>Startups are a small scale companies, and if you find a good start up, your life will be made! It will offer you way more than your expectations, when it comes to learning and growing part. Now with all being said, if the company offers you a lesser package then your expectations, then see what is the margin level, and try understanding one thing, it is totally fine to start with a lesser salary, and with the learnings you will get, you will definitely reach to a bigger salary.</blockquote><p>With that being said, the optimum salary which I think which will be enough for a fresher Software Engineer would be <strong>3.6–4LPA for a start up</strong>. I think it is a good deal, when it comes to learnings and earnings! :D</p><blockquote>Do not ever compare yourself with other people, there will always be people who are above you, and who are below you, so don’t compare. Just focus on one thing, is it really worth it! Become the best version of yourself, and conquer the world!</blockquote><p>I think, if you follow the above pointers, it is really difficult that you will be falling into a dark pit, which will hamper your career growth as a fresher in the industry. But if you think you have any other apprehensions regarding working in the start up, let me know in the comment. Happy to help!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cfae8fe0196" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding React, Redux, and React-Redux]]></title>
            <link>https://medium.com/swlh/understanding-react-redux-and-react-redux-c52d46dd1a04?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/c52d46dd1a04</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[react-native-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[redux]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 09:58:22 GMT</pubDate>
            <atom:updated>2023-05-15T19:16:33.007Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SSJmCyy7DSSFPpMN.png" /><figcaption>Image Source: Google</figcaption></figure><p><strong>React</strong> is indeed a trending JavaScript library for building great UI components. But I am here to talk about something which I believe is very important and somehow every application (be it a React or any other platform specific) needs it.</p><p>What is it? The answer is <strong>State Management</strong>. I don’t want to miss out on anything, so let me first answer what does state management means when it comes to application development.</p><blockquote>State Management is some thing which takes care of the changes in any part of the components/application. In layman term, it is nothing but a management of a data state for event handling inside the application.</blockquote><p>Now, since we have already known this great platform <strong>React</strong>, let us understand what <strong>Redux </strong>is.</p><blockquote>Redux is a predictable state container in Javascript app. What does that mean? Well, Redux helps in state management by storing all the states which needs to be changed through out the app in one place, which we usually call it as <strong>Store.</strong></blockquote><p>You need an example! Well, here you go <strong>[very basic]</strong>: Let’s say we are using an application, having a navigation drawer containing User’s Data. Now when you go to the profile page, and make some changes in your data which is User’s data only, and when you come back to the navigation drawer, it changes the data automatically without even problem! Isn’t it amazing. This is because of <strong>State Management </strong>only, and in React, the famous State Management library is Redux only.</p><p><strong>Disadvantages: </strong>Redux comes with a lot of boilerplate, and believe me many JS developers are not a big fan of this library. And if you don’t follow it properly, chances are, <strong>your application might break or behave inappropriately. </strong>So think before you use. Now, I don’t want to make this blog long enough, but check this link out, which has <strong>Why you don’t wanna use Redux? You might find it funny, but the irony is, the one who developed Redux wrote this article! :D</strong></p><p><a href="https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367">You Might Not Need Redux</a></p><p>Now, since you have made your choice to move further and try to deal with this, I am here to help you understand with some analogies, and not code. [Code] That you will get it on the internet any time, any where.</p><p>First of all let us answer this question, why we really wan to use <strong>React-Redux </strong>in the first place</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FtTETbQa5gUZ2ZBC.png" /><figcaption>Image Source: Google</figcaption></figure><blockquote><strong>React-Redux</strong> as the name and the official documentation says, it binds the <strong>React application </strong>for the <strong>Redux</strong>. Still confusing? Let me break it down for you, so <strong>React-Redux lets you use all the operations from Redux in the React application.</strong></blockquote><p>Here comes the most dreadful part, and understanding what this boilerplates are. But before that we might have some question which needs to be resolved. And here it goes:</p><p><strong>Q1. If Redux can be used in normal JS application, then why to use React-Redux?<br>Answer: </strong>Redux is indeed usable in JS application, but when it comes to using React-Native, we require somethings which can make our component capable of using Redux, and these are <strong>mapStateToProps </strong>and <strong>mapDispatchToProps</strong>. And which makes the aforementioned think work is <strong>connect()</strong>. <strong>Provider (which is provided by React-Redux only) </strong>is the most important thing to be used when it comes to making all things work on your state change throughout your app, which is <strong>keeping your business logic separate from the application logic for state management operation safely</strong>. Now there are other things which are associated to React-Redux, but I assume, you would find in the official documentation.</p><p><strong>Q2. If Hooks have already been introduced in React-Redux, then why use the above connect(), mapStateToProps and mapDispatchToProps?<br>Answer: </strong>React-Redux has introduced the hooks recently, like an year. Now, there are edge cases which are associated to using different hooks which. replaces all the three assets to Redux implementation. Some of them are:</p><ul><li>Dealing with Store Objects which have nested data. For example: User can have complicated data structure, and when you will try to deal with making changes in your state management through object notation, your application might break.</li><li>Interested in reading more? Here is the official link for you.</li></ul><p><a href="https://react-redux.js.org/api/hooks#usage-warnings">Hooks | React Redux</a></p><p>Phew! Feeling tired? Take a quick break and continue reading this blog, cos the cream data is about to come. We are going to be talking about:</p><ul><li>Analogies on the boilerplates used in the <strong>React-Redux</strong></li><li>What is the right approach for using the boilerplates</li></ul><p>I am sure you might have got intrigued by the above pointers. So let us start diving into the main content one by one. So, let us first answer the question, how do we understand the boilerplates in a simple/layman way. I have something for you, with which I also understood these boilerplates. Let us see what it that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aCC5mlKd6KnY9Lm1.png" /><figcaption>Image Source: Google</figcaption></figure><p>The above picture depicts what is the process which is involved during the state management process. Technically speaking, this is what <strong>Redux </strong>is about. Now, the above things which is shown in the blue box are your boilerplates. I know, you will think, are these things needs to be done for playing around with the <strong>Redux</strong>? The answer is yes, and that is why not every developer looks forward to use Redux.</p><p>But don’t worry, I will give you some analogies which will help you understand how to tackle it in a simpler way. And the best way is indeed understanding.</p><p><strong>View</strong>: It is nothing but the front-end of the application, what ever changes happens, it should reflect the same on the application. Now, in an analogy I would say a store which you see from the front. Let us call it as a toy store. You are standing in front of it and looking at it, if somebody purchase, or if the store gets some more toys, you see the changes being done in the shop. This is a <strong>View</strong>, and we will use it further to understand the other boilerplates.</p><p><strong>Store: </strong>If we talk about this, the name depicts every thing. <strong>Store basically keeps all your state management data in one place, </strong>so to understand in an analogy, a toy store which we talked about in the <strong>View</strong> keeps all the toys in it’s store. Some other store keeps other stuffs. Hence stores.</p><p><strong>Action: </strong>In <strong>Redux </strong>term, it has to dispatch an action to the <strong>Reducer</strong>, so that the state management can be done according to the action sent, which will eventually be reflected in the <strong>View</strong> of our application. Now, we have seen two new things, which we need to understand, and these are: <strong>Action </strong>and <strong>Dispatch</strong>. How can we understand both of them, and how are they linked with each other? Well, take <strong>Action </strong>as a thought which comes into your mind, when you enter inside the toy shop, for example, <strong>I want to buy a toy or many toys</strong>. And <strong>Dispatch </strong>is something which comes out of your mouth, basically your voice/command/request, which sends a message to the Shopkeeper on why have you come to the shop.</p><p><strong>Reducer: </strong>In <strong>Redux </strong>language, it is something which makes changes to the the State object in the <strong>Store</strong>, to be reflected in the <strong>View</strong>. Sophisticated, right? Now let us understand it in the analogical way, now you have entered into the store, and asked (<strong>Dispatched</strong>) for buying a toy (<strong>Action</strong>). The request you have raised to a person who would be standing on the other side of the store, we call him/her a shopkeeper, but he/she also is a <strong>Reducer</strong>. Your next question would be how? Then let me tell you how, as soon as you raise a request, the shopkeeper picks up the desired item for you and gives it to you in exchange of money. Now let us neglect the money part for a while, and focus on the toy reduction. So what happened actually in between the process? The shopkeeper (<strong>Reducer</strong>), made changes in the store by reducing the number of toy from the store, and hence the <strong>View </strong>(Toy Shop) is also changed, that is, the number of toys in the shop is changed now.</p><p>You then go to your home happily, without even realizing that you have actually performed a <strong>Redux State Management </strong>in real life. :D Isn’t it amazing. I believe, you might have got the real essence of the boilerplates by now. If not, read it once again, or watch some videos simultaneously, or docs. Whatever source which will make you better understand the things which I have written in the blog.</p><p>Coming to answering the next major question, and that is, <strong>how to approach the boilerplates or Redux in our application</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*6i7cwHsFE2XfKNz4.png" /><figcaption>Image Source: Google</figcaption></figure><p><strong>Disclaimer: </strong>Developers have their own way of coding, structuring the files for Redux. Whatever I am going to tell is my suitable way of doing the <strong>Redux </strong>in the <strong>React </strong>application, feel free to follow your way of doing things which is best for your case.</p><p>The right way of approaching your <strong>React-Redux implementations </strong>are:</p><ul><li><strong>Create your Actions and Action Creators: </strong>Now you might be feeling confused on what Action Creators are. Allow me to explain, Action creators are nothing but an extra step of making your actions defined safely, so that when your code grows, you can always come back to your creator, and make changes. Handling bugs becomes easy and safe. Action Creators, accept the action type which comes from the <strong>Actions file</strong>.<br><strong>==&gt; </strong>Now Action types, are set of constants and you should always maintain a separate file in order to define all your constants, and use it places wherever required. In this way, a single change in the Action types’ file, will make changes in every file. No need to explicitly doing it in every folder. Example: <strong>const</strong> <strong>BUY_TOY = “BUY_TOY”</strong>. Now use the constant BUY_CAKE, and it will be coherent every where. Let us see how you action creator looks like:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRoGJX5OpoQLl03WtaWzkQ.png" /><figcaption>Action Creator JS</figcaption></figure><p>Note that BUY_TOY is coming from another file <strong>./actionTypes </strong>where we have defined the BUY_TOY constant as per the above stated example in bold.</p><ul><li><strong>Create your Reducer: </strong>For reducers, it accepts two arguments, one is <strong>State, </strong>which has to be initialized in the function, and another is <strong>Action</strong>. Again, the action type will come from the <strong>./actionTypes</strong>. So you see how important is structuring of your code. What reducer does is, basically based upon your action performs the action on the States, which eventually make changes in the <strong>View </strong>only. Also, <strong>your state should consist of all the data in object form. </strong>Let us take a look, how our reducer looks like</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hLiGY0EhDpFKy1GwoXl8aw.png" /><figcaption>Reducer JS</figcaption></figure><p>There are certain other things, which are related to <strong>Reducers</strong>, one of them and the most important of all is, it is <strong>immutable </strong>in nature. What is <strong>Immutable</strong>? Immutable means, you can alter the reducer, and to make things possible, we first create/make a copy of our state, and then make changes. Although, there are things present at your disposal of doing the mutable changes for the reducer, but I believe the link which I will share will tell you more about it. Although, there is one library which I want to talk about which handles your <strong>Reducers </strong>efficiently, that is<strong>, ImmerJS</strong>: A beautiful and award winning library that handles the reducers, along with the immutability. Here is the link for you.</p><p><a href="https://immerjs.github.io/immer/docs/introduction">Introduction to Immer · Immer</a></p><ul><li><strong>Creating a Store: </strong>Now that you have successfully created your <strong>Reducers</strong>, it is time to bind all of them in a place, called as store. How will we do that, here is the example.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*haa-f7E0cFTiHe5-i7bZmQ.png" /><figcaption>Store JS</figcaption></figure><ul><li><strong>Final Step =&gt; Providing the store to be available for your whole application: </strong>Now that we have the store, the same has to be provided to your application, so that the application can access the store item’s update any time anywhere. How can we do that, just go to your file in <strong>App.js </strong>or <strong>index.js </strong>and bind your project inside the <strong>Provider</strong>, which is a component of <strong>React-Redux</strong>, accepts a <strong>prop </strong>as <strong>store</strong>, which has to be provided by use, which we created above. Let us see, how it is done:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Ap6frt_2grZeCglxY9t5A.png" /><figcaption>Provider Js</figcaption></figure><p>And voila! You have just handled the boilerplates nicely. Now one more thing which is remaining in order to handle the state change, and that is when you are inside the view and you want to make changes, so that it should reflect. That I will leave it to you, so that you can read, and implement. If you have understood the above content, handling the state management would be not so difficult for you. Let me give you some hints, you must read about <strong>mapStateToProp, mapDispatchToProp</strong>, and <strong>connect. </strong>React-Redux hooks like <strong>useSelector </strong>and <strong>useDispatch</strong>.</p><p>This was a very basic example on how to get started with <strong>State management in React application using Redux, React-Redux</strong>. There are more things for you, but do not start off with that immediately unless you have a better understanding of how to do the basic implementation nicely. Here are the links for you to get more insights on the <strong>Redux, React-Redux</strong>. Do read the docs, it will help you in the long run.</p><ul><li><strong>Redux Documentation:</strong></li></ul><p><a href="https://redux.js.org/introduction/getting-started">Getting Started with Redux | Redux</a></p><ul><li><strong>React-Redux Documentation:</strong></li></ul><ul><li><a href="https://react-redux.js.org/introduction/why-use-react-redux">Why Use React Redux? | React Redux</a></li><li><a href="https://react-redux.js.org/introduction/quick-start">Quick Start | React Redux</a></li><li><a href="https://react-redux.js.org/introduction/basic-tutorial">Basic Tutorial | React Redux</a></li></ul><p>I believe that is it what I can offer for this topic, and I would be grateful if I could help somebody with this information. Pardon me, if I have done some mistakes, do let me know in the comment section. I am also a developer like you who commits mistake, so let us learn from each other, and happy learning.</p><blockquote>Always remember, no one reached to the top in one shot. It took them a lot more struggle and hard work than you can imagine. So strive for knowledge, and keep moving forward. Thank you</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c52d46dd1a04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/understanding-react-redux-and-react-redux-c52d46dd1a04">Understanding React, Redux, and React-Redux</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Important tips on PostgreSQL]]></title>
            <link>https://alokk830.medium.com/important-tips-on-postgresql-ab5b708f0cb?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab5b708f0cb</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Mon, 21 Sep 2020 15:45:34 GMT</pubDate>
            <atom:updated>2020-09-21T15:45:34.215Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FiCxTJIplFzJ-15u.png" /><figcaption>Google Images</figcaption></figure><p>Recently, I have been working on my back-end skills development and before approaching the server side development, I needed to choose the database to do the <strong>transactions</strong>. For that, my team chose <strong>PostgreSQL</strong>, which comes with an <strong>extended</strong> <strong>SQL </strong>to work with the database management system.</p><p>I would like to thank <strong>Nelson </strong>for his amazing YouTube channel, which explains best things about <strong>PosgreSQL </strong>from scratch. Do check his channel out, and give him a medal, if you can. Hahaha!</p><p><a href="https://www.youtube.com/user/djdjalas">Amigoscode</a></p><p><strong>Who can explore this post? </strong>Those who have a basic understanding of how to use PostgreSQL with some basic SQL commands on Command Line Terminal on Windows and Terminal on Mac OS</p><p><strong>Why PostgreSQL? </strong>This question is genuine, but first I would like to tell that, almost every start up company prefers <strong>PostgreSQL</strong>. Now the reasons:</p><p>a) Very professional platform to scale the complex data workloads</p><p>b) It has been almost 30 years, and the working is still commendable</p><p>c) PostgreSQL has earned a strong reputation for its proven architecture, reliability, data integrity, robust feature set, extensibility, and the dedication of the open source community behind the software to consistently deliver performant and innovative solutions.</p><p>And many more. You want to know more about it, please follow this medium post blog: <a href="https://medium.com/we-build-state-of-the-art-software-creating/why-should-i-use-postgresql-as-database-in-my-startup-company-96de2fd375a9#:~:text=%E2%80%9CPostgreSQL%20comes%20with%20many%20features,source%2C%20PostgreSQL%20is%20highly%20extensible.">Why should I use PostgreSQL as Database in my StartUp/Company</a></p><blockquote>Before we proceed, just wanted to tell you that, I am still working on my PostgreSQL skills, but I feel like these pointers will definitely help you making your database scalable :)</blockquote><p>Also, check out this amazing website, if you really wanna refrain from adding a lot data from your side. The website is:</p><p><a href="https://mockaroo.com/">Mockaroo - Random Data Generator and API Mocking Tool | JSON / CSV / SQL / Excel</a></p><p>I <strong>NEED TO SEE THE CONTENTS OF THIS BLOG FIRST: </strong>Here is the list for you. Go to the particular topic, which you would like to explore:</p><ol><li>LIMIT and OFFSET</li><li>IN</li><li>NUMERIC()</li><li>COALESCE(<strong>)</strong></li><li>Cascading NOW() for DATE and TIME</li><li>CHECK</li><li>Resetting the PRIMARY KEY</li><li>PostgreSQL generating UUIDs</li></ol><p>Now let us jump to the part, where we can learn on some important pointers on PostgreSQL to make our development life easier:</p><p><strong>1 LIMIT AND OFFSET: </strong>Frankly speaking, I did not have the conceptual knowledge about both of them, unless I tried doing them. To give you a definition,</p><p><strong>A) LIMIT: </strong>It is the instruction which you give to the SQL query to actually limit the data set. For example, <strong>LIMIT 10</strong>, will give you 10 results <strong>only</strong>, despite of having numerous data</p><p><strong>B) OFFSET: </strong>It is the instruction which you give on top of <strong>LIMIT</strong>, to give out the <strong>starting point</strong> <strong>of the data</strong>. For example, <strong>OFFSET 2 LIMIT 10 </strong>will give out data in the <strong>range starting from 3–10 [Please note: OFFSET number is EXCLUDED]</strong>. <strong>You can also use OFFSET only, to get the data starting from something to your Nth data.</strong> Let us get you some example on the terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0drlX-GMC1gnm1rEBPR8uw.png" /><figcaption>Result of LIMIT and OFFSET</figcaption></figure><p>You can see the data coming up fine in my case, <strong>excluding the OFFSET LIMIT -&gt; LIMIT. </strong>You can try more, do only LIMIT and OFFSET, and check out the result :D</p><p><strong>2 IN: </strong>This doesn’t look very important when we see on the commands perspective, although it adds a great value <strong>when it comes to getting multiple data based upon a particular column</strong>. Like, what if we want to just choose people from a some <strong>country_of_births</strong>. We can use <strong>WHERE </strong>clause, and also use <strong>OR </strong>to get the data, but the problem here is it looks redundant and not a cleaner approach to what we want to do.</p><blockquote><strong>SELECT * FROM person WHERE country_of_birth = ‘China’ OR country_of_birth = ‘France’ OR country_of_birth = ‘Germany’;</strong></blockquote><p>Could you see, every time we had to use <strong>country_of_birth repetitively</strong>? Did not understand? Let me help you by giving an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HMgJrf7g3j-LJzn_KZ597A.png" /><figcaption>Usage of IN query</figcaption></figure><p>You can add as many data you want, but <strong>it must be from the particular column, like here, country_of_birth</strong></p><p><strong>3 NUMERIC(Precision, Scale): </strong>This is also very important when it comes to playing with numerical data. Basically, a <strong>data type </strong>which helps you get the data up to the<strong> Precision [That is total length of the number]</strong> and <strong>Scale [Places of decimal]. </strong>Used while creating a table</p><blockquote><strong>CREATE TABLE table_name (price NUMERIC(8, 2) NOT NULL);</strong></blockquote><p>This will give out the data in column till 8 digits, with 2 place of decimal numbers only. See this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*-cLhRGEZc0pgeVV06gEyTw.png" /><figcaption>Source: <a href="https://learnsql.com/blog/understanding-numerical-data-types-sql/#:~:text=In%20SQL%2C%20numbers%20are%20defined,DECIMAL(p%2Cs)%20.&amp;text=The%20approximate%20numeric%20data%20types,%2C%20REAL%20%2C%20and%20DOUBLE%20PRECISION%20.">LearnSQL</a></figcaption></figure><p>For more information on this, please follow the below link</p><p><a href="https://learnsql.com/blog/understanding-numerical-data-types-sql/#:~:text=In%20SQL%2C%20numbers%20are%20defined,DECIMAL(p%2Cs)%20.&amp;text=The%20approximate%20numeric%20data%20types,%2C%20REAL%20%2C%20and%20DOUBLE%20PRECISION%20.">Understanding Numerical Data Types in SQL</a></p><p>4 <strong>COALESCE: </strong>Some of them might have used it, but I am sure, some beginners like would find it great. <strong>So what is it used for? </strong>It is used for defining the data for the null items. For example, you have some items in your column, which has some null data. Now, by default it would come blank. COALESCE helps you give out something if the data is null.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NX_lOpMjh9FpWqKLzXKPxQ.png" /><figcaption>COALESCE usage in SQL</figcaption></figure><p>5 <strong>Cascading NOW() for DATE and TIME: </strong>I found this really useful, although the header might sound confusing, but, here is the thing, we usually get a data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*kLGQeXfPs-92q04a_RXqvg.png" /><figcaption>NOW() cascading for DATE and TIME</figcaption></figure><p>The cascading element is <strong>:: </strong>which is used with <strong>NOW() </strong>which is a DATE data type function. Here you see the example:</p><p>So can you see the data coming up for only DATE and TIME specifically? Also, we have only <strong>NOW()</strong> being implemented first, which gives the data in timestamp format</p><p>So, if you ever want your data to come in DATE or TIME format specifically, you can use this useful cascading function to get your desired data.</p><p><strong>6 CHECK: </strong>Now, this is also a <strong>SQL Constraint</strong> which can be added if you want to add some extra layer of check on a particular column. For example, in my person table, I want the gender to be only Male and Female, no third gender. Then what we can do, is to add a constraint CHECK for that, and we can do that</p><blockquote><strong>ALTER TABLE table_name ADD CONSTRAINT constraint_name (column_name = condition);</strong></blockquote><p>Now, when you define this, and try to add a data, which gives false for your constraint, you will get the error coming from the database, that it doesn’t satisfy your provided condition. For more information, please follow this</p><p><a href="https://www.w3schools.com/sql/sql_check.asp">SQL CHECK Constraint</a></p><p><strong>7 Resetting the PRIMARY KEY: </strong>Now this is a way where you can go to the command line and reset the Primary Key. But there are certain pre-requisites, which you need to take care before making use of this:</p><p>→ You must have used <strong>BIGSERIAL </strong>in place of <strong>BIGINT </strong>data type. <strong>BIGSERIAL </strong>is a 8-bit signed auto-increment BIGINT data type, but it gives you the ability to take control of the Primary Key, <strong>if you have deleted all the data, and you don’t want to start the id from number other than 1, when you insert</strong>.</p><p>Please read upon <strong>PostgreSQL Data Types to know more about it</strong></p><p><a href="https://www.postgresql.org/docs/12/datatype.html">PostgreSQL: Documentation: 12: Chapter 8. Data Types</a></p><p>You can do this when you create a table <strong>CREATE TABLE table_name (id BIGSERIAL NOT NULL PRIMARY KEY)</strong></p><p>Now when you do this <strong>\d table_name </strong>in your PostgreSQL command line terminal, you get the information like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p2M-3S6tW1X7Q2jl6EMzFQ.png" /><figcaption>Primary Key Sequecne</figcaption></figure><p>You can see that, I have done this command SELECT * FROM sequence_name, which I got from doing <strong>\d table_name </strong>from the column <strong>Default</strong>. Since my <strong>last_value </strong>is already set to 1, but you can do this by doing this command in your <strong>PSQL Terminal</strong></p><blockquote><strong>ALTER SEQUENCE your_sequence_name RESTART WITH your_number;</strong></blockquote><p>And then you can run <strong>SELECT * FROM sequence_name; </strong>And you will get the number which it was set by you.</p><p><strong>8 PostgreSQL Generating UUID</strong>: Now, here is the truth, <strong>Universally Unique Identifier (UUID) </strong>is the safest and most cleaner way of approaching your data storage. It is universally accepted, and it disallow the attackers to really predict the ID for fetching out the data from the hosted Database.</p><p>We will learn how we will achieve this of generating UUIDs. This is bifurcated into the below topics:</p><p><strong>A) Installing UUID generating extension on PostgreSQL using Command Line: </strong>This is important, cos without the installation you won’t be able to use the command <strong>uuid_generate_v4(). <em>V4 is being the random UUID generator</em></strong></p><p>Read more about extensions here:</p><p><a href="https://www.postgresql.org/docs/12/external-extensions.html">PostgreSQL: Documentation: 12: H.4. Extensions</a></p><p>And more about UUIDs here:</p><p><a href="https://en.wikipedia.org/wiki/Universally_unique_identifier">Universally unique identifier - Wikipedia</a></p><p>Now the real deal, how can we install the extension, simply do this in your console <strong>SELECT * FROM pg_available_extensions; </strong>and you will be loaded with extensions. We need to check for <strong>uuid-ossp </strong>is installed, if installed, the column <strong>installed_version </strong>will show you the version of this extension, else blank. <strong>Install it with command</strong>:</p><p><strong>CREATE EXTENSION IF NOT EXISTS “uuid-ossp”;</strong></p><p>The above command is idempotent, that means, you can type the command for N number, but it will only install if it is not installed already.</p><p><strong>B) Generating the UUID: </strong>To generate the UUID, simply type the command <strong>SELECT uuid_generate_v4(); </strong>to see if it is working on your platform. Here is the representation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gQ5aGros9QMJRlNLfi0uag.png" /><figcaption>Generating UUID via terminal</figcaption></figure><p>You can now use the function <strong>uuid_generate_v4() </strong>while inserting the data for your column_name. <strong>You don’t need to make a primary key anymore, cos now it won’t autoincrement, but generate unique data every time you insert the data using uuid_generate_v4()</strong>. Please make sure that you have a column which uses this, so that you can do insert like this</p><blockquote><strong>INSERT INTO table_name (column_name) VALUES (uuid_generate_v4())</strong></blockquote><p><strong>DISADVANTAGE: </strong>A major fallback I saw here is, it doesn’t auto operates, you either need loop to pass the data with <strong>uuid_generate_v4()</strong>, or use <strong>uuid_generate_v4()</strong> every time when you insert the data like the above mentioned command.</p><p>So that’s pretty much from my side. Big shout out to <a href="https://www.youtube.com/channel/UC2KfmYEM4KCuA1ZurravgYw">Nelson</a>, for making awesome contents, which made me capable of writing this blog post. I am really grateful to him. I am sure you might have learnt some thing from that.</p><p>ALL THE BEST! KEEP LEARNING!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab5b708f0cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Video Player & Chewie Player]]></title>
            <link>https://alokk830.medium.com/flutter-video-player-chewie-player-2f8536f2e924?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f8536f2e924</guid>
            <category><![CDATA[video-player]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <category><![CDATA[flutter-plugin]]></category>
            <category><![CDATA[effectivedevelopment]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Thu, 27 Aug 2020 13:23:28 GMT</pubDate>
            <atom:updated>2021-02-22T01:35:06.910Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*GQ3zQ1uln6vVTGB_5VKKHg.jpeg" /></figure><p>For video player development in flutter, one plugin that comes into the developer’s mind is this:</p><p><a href="https://pub.dev/packages/video_player">video_player | Flutter package</a></p><p>This indeed gives power to the developer to make your video player, and use it inside your cross-platform mobile application. Now this comes very handy, but there are certain things which you don’t get on the plate, that is, <strong>more controls over the video player</strong>.</p><p>Everybody wants to work smart, hence, flutter plugins/packages came into the picture. I hope every one knows about this package, but if not, then here it is:</p><p><a href="https://pub.dev/packages/chewie">chewie | Flutter Package</a></p><blockquote><strong>DISCLAIMER: </strong>The video player plugin used by <strong>chewie</strong> is not functional on iOS simulators. <strong>An iOS device must be used during development/testing</strong></blockquote><p>Now, this is a great package, which comes with a lot more power in respect of the below pointers:</p><ul><li>More controls over the video player</li><li>Operating System based Video Player Material UI</li></ul><p>It basically wraps the <strong>video_player</strong> plugin, and add some cool material UI controls to it. Now, I am not here to explain about, how to use the <strong>chewie plugin</strong>, you can find it below only. <em>You can browse more options as per your will.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXP-4BiWsuaQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXP-4BiWsuaQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXP-4BiWsuaQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8264bf1689fdf9f6cca36bc039e967c/href">https://medium.com/media/d8264bf1689fdf9f6cca36bc039e967c/href</a></iframe><p>Now, let us talk about the most important stuff, and that is, <strong><em>how to use this more efficiently</em></strong>.</p><p><strong>WHY?? </strong>It is because, most of the people who have just started their journey with video player or flutter, might ignore some important pointers, and land up seeing a lot of bugs, or inefficient performances in the app, while using this. These are:</p><p><strong>1.Video still plays when we come out of the Activity/View/Page/StatefulWidget, having the video player:</strong></p><p>The answer to that is, many of us often forget about the need to dispose the required controllers, and these are, <a href="https://pub.dev/documentation/video_player/latest/video_player/VideoPlayerController-class.html"><strong>VideoPlayerController</strong></a><strong> </strong>and <a href="https://pub.dev/documentation/controller_chewie/latest/controller_chewie/ChewieController-class.html"><strong>ChewieController</strong></a><strong> </strong>in the <a href="https://api.flutter.dev/flutter/widgets/State/dispose.html"><strong>dispose()</strong></a>.</p><blockquote>Please note that, <strong>to use the chewie player, you need to add video_player plugin as well</strong>. You will find that in the video lecture itself.</blockquote><p><strong>How do you do this? </strong>Well, here is your answer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQOw45Eb0wvfBBYpkgmMOg.png" /></figure><p><strong>What happens when we do it? </strong>It disposes both the controllers, which eventually tells the machine not to use it anymore. Hence, no video will be played, as soon as you will come out of the page.</p><p>2. <strong>Exit Fullscreen is not happening smoothly with auto-rotate on in the mobile device</strong></p><p>This is the second thing which I noticed while working with this plugin, when auto-rotate is on in the mobile device. When you hit on the option to exit the fullscreen mode, it doesn’t changes it’s orientation actually. Not observed when auto-rotate is off, but it might be the case. So, <strong>what is the solution??</strong></p><p>The solution is quite simple, which is hidden in the <strong>ChewieController initialization </strong>itself. See, this player is smart, but you need to add the listeners while initializing it, and tell the controller that, <strong><em>hey!! you need to do this, when I exit the fullscreen mode while I still am on the auto-rotate mode in my mobile device. [Doesn’t matter duh!]</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNnxre4pqleCoOuo1PEAGw.png" /></figure><p>3. <strong>Orientation applies to every pages in the application, even though, the app was set to Portrait mode only</strong></p><p>A bigger and most irritating problem of all the time which a developer will face while developing a video player using <strong>chewie </strong>and <strong>video_player </strong>is, many a times you will see, even though the application was set Portrait mode via this code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zswFU7yJc9SrKYwls5p51w.png" /></figure><p>I can assure you that this code works, but as soon as you use the fullscreen mode option from the controller, it overrides the definition which you have provided via the above code, and the whole app becomes, rotation friendly, <strong>of course when you are on auto-rotate mode</strong>.</p><p><strong>What is the solution?? </strong>The solution is, again not a rocket science. You just need to tell the machine again, that, <strong><em>hey!! please do this while I exit from the full screen and leave this page. Don’t make it rotation friendly, for god sake!!</em></strong></p><p>This can again be done via <strong>dispose(). </strong>While going from the video player page, we define the app principle again, that is, to make it portrait mode.</p><p><strong>How do we do this??</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*epEZX-jNGnbcZiyzvSvxIg.png" /></figure><p>And, if you are going to another page from this page, just define this <strong>SystemChrome.setPrefferedOrientations() before leaving the page</strong>. And that is how, you get yourselves out of this pit of cramming your head on the orientation issues.</p><p>That’s all folks for now!! Your valuable comments are welcome, if you want to state something. Please do, I will learn something from it as well. Till then <strong>HAPPY CODING!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f8536f2e924" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Postman — Some tips and tricks]]></title>
            <link>https://alokk830.medium.com/postman-some-tips-and-tricks-c0cd45c86929?source=rss-f604bf081055------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0cd45c86929</guid>
            <category><![CDATA[postman-collections]]></category>
            <category><![CDATA[technology-trends]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[postman]]></category>
            <dc:creator><![CDATA[Alok Kumar]]></dc:creator>
            <pubDate>Sun, 14 Jun 2020 13:16:31 GMT</pubDate>
            <atom:updated>2021-02-22T01:35:02.015Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*buviaW7wpQ2T4JlK.jpeg" /><figcaption>Postman</figcaption></figure><h3>Postman — Some tips and tricks</h3><p>As million of backend developers are relying on this wonderful tool, I have learnt something new from it, or I must say learnt late if some one knows it already.</p><p>But I firmly believe that, there are people like me who are still figuring something on a daily basis, and want to learn something new even though it is late. So this article is for the developers who want to explore more about Postman tool.</p><p>I will be vividly discussing about few things, which I believe would help you in great extent. If you are comfortable in any of the topics you’re familiar with, you can directly jump to your desired topic anytime</p><p>•<strong> Postman Collections and it’s usage</strong></p><p>•<strong> Environment in Postman</strong></p><p>•<strong> Reusing Environment Variables in Endpoints</strong></p><p>•<strong> Using Tests in Postman for performing different operations</strong></p><h3>(A) Postman Collections And It’s Usage</h3><p>A postman collection is nothing but a way to store your requests in a folder, so that you don’t want to run your requests with the same details again and again.</p><p>It also saves your time, for choosing out the requests for a particular reusable endpoint. I will show you how this looks</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cf78pKHWweSqWPfnk7AKuA.png" /><figcaption><strong>[A1]</strong> Postman Collection and Requests</figcaption></figure><p>As you can see the marked region, <strong>Section 6 </strong>is what we call a <strong>Collection </strong>which contains numerous HTTP Requests Endpoints, like <strong>GET</strong> with <strong>URLs</strong>. Now this enables me directly hit on any one of the requests, and run it, or in Postman terms hit <strong>Send</strong>. As you can see that, on the right hand side, after hitting <strong>GET </strong>of URL <strong>/items</strong>, and that will show the result which you have saved.</p><blockquote>Now the next question arises, how can I make a postman collection and how can I save my Requests?</blockquote><p>It is not that difficult, and can be done via an option which there on top left, if you can see in the image, that is <strong>+ New Collection</strong>. When you hit on it, you get to see an option to create one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*uZ84DHIESKURM2bmc34I4Q.png" /><figcaption><strong>[A2] </strong>Creating Postman Collection</figcaption></figure><p>You get to see this screen, when you hit on <strong>+ New Collection</strong>. You need to enter the name of your collection, and it is always a good idea to have a short description of what your collection is all about, so that at the time of Importing your collection or using your collection in the future time, you will always have a description which will give you a proper insight of why you created this collection in the first place.</p><p>When you are done creating your collection, now it is time to store all your reusable requests. To store one of your requests under your created collection, you have to first open a tab in the right postman console, and make a request using any Methods you like. For instance, let us take the example here of the requests shown in the first picture, that is, <a href="http://127.0.0.1/items,"><strong>http://127.0.01/items</strong>,</a> it is a <strong>GET </strong>request. Now when you want to save it, you just have to hit <strong>Save</strong>, which is present there beside the <strong>Send </strong>field. When you do so, you see this screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*rQ4gcwrywFTBcM6H54I43A.png" /><figcaption><strong>[A3] </strong>Saving postman request</figcaption></figure><p>Save your request name. Again, a description always saves a day so do add it. And at the bottom, you will be able to see your created Collection name, in my case, it is, <strong>REST API Course API</strong>.</p><p><strong>PLEASE NOTE: You will get a lot more Collections under All Collections, if you created multiple Collections. You just have to choose one of them, and hit Save</strong>. Congratulation, you have saved your first request in your collection. You can always come back to your Postman, and you will see your Collection, as soon as you will open up the Collection folder, you will see your request. All you have to do is to click on it, and it will populate the data which was there.</p><blockquote>Also, don’t forget to save your already existing request url, if you want to see’em in the future time, rather than having an old data. It is like a good practice</blockquote><p>That’s is pretty much it about Postman Collection and how to make use of it. You can store multiple requests, and play with it anytime you want. You can refer to the first image, and you will find how many requests I have stored in my <strong>REST API Course API Collection Folder</strong>. If you still feel like stuck somewhere, then I have a link for you, make use of it, and you will be good to go.</p><p><a href="https://learning.postman.com/docs/postman/collections/creating-collections/#:~:text=Postman%20Collections%20are%20a%20group,you%20can%20organize%20into%20folders.">Creating collections</a></p><h3><strong>(B) Environment in Postman</strong></h3><p>Now this is some advanced stuff, but it is indeed an important part of Postman, which I believe you would want to know.</p><p>Environment is nothing but to make the user store some of <strong>variables </strong>and<strong> it’s value </strong>for reusing it in making a postman requests. Like, using same url again and again, or any value which is required every time, and you are sick of providing it again and again. For example, <strong>JWT </strong>token for fetching data for any <strong>JWT Required </strong>requests.</p><p>I know, the above one is quite overwhelming for a learner in Postman, but don’t worry, be with me and I will clarify it with some simpler examples. We will go step by step to learn, where it is, and how to use it.</p><p>For creating an Environment, you need to look at the top-right side <strong>cog-wheel </strong>icon beside an eye. Now you’re are wondering where is it actually. Let me show you where is it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*Cra4Im_f2MQuPaQG6xbykw.png" /><figcaption><strong>[B1] </strong>Manage Postman Environment Icon</figcaption></figure><p>Now, when you hit on it, you get to see an option like to <strong>Add </strong>at the bottom right of the dialog box. If you already have an existing Environment, you will see that there on the dialog box itself. But if you have not, then just a blank box, with options <strong>Globals, Imports, Add </strong>at bottom right. Click on Add, and you will see the below screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*-jLIAr6y_OJmsIZqbNkflg.png" /><figcaption><strong>[B2] </strong>Managing Environment</figcaption></figure><p>You have name your environment, and store your variable(s) and it’s value which will be reused in making your postman requests.</p><p>You can add the value under any one of the following option, i.e., <strong>Initial Value </strong>or <strong>Current Value </strong>or both of them. It is your choice and add it. After that, when you click back on your <strong>cog-wheel </strong>option as shown in the <strong>Image</strong> <strong>B1</strong>, and you will see your Environment there. In order to add more variables, simply click on the already existing environment and add more value to it anytime.</p><h3><strong>(C) Reusing Environment Variables in Endpoints</strong></h3><p>In the previous section we learnt how to store the environment, now we will be learning how to use them, else our efforts will go waste. So now, we have some value for a variable in our Postman. Suppose we have a localhost url, which is <a href="http://127.0.0.1/"><strong>http://127.0.0.1/</strong></a><strong>, </strong>whose occurrence is frequent for using your endpoint, of course, it would be frequent. Like in my case <a href="http://127.0.0.1/items"><strong>http://127.0.0.1/items</strong></a><strong>. </strong>You don’t want to write this long statement again and again. So, we just store a variable <strong>url</strong>, in our freshly created Environment, and store the value, which would be <a href="http://127.0.0.1/"><strong>http://127.0.0.1</strong>.</a> It would look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*R9hhCzBGZdFuW6__x9uh9g.png" /><figcaption><strong>[C1] </strong>Environment Variable Value</figcaption></figure><p>Now you can see that, on the above <strong>Section 6 </strong>is the name o f our environment, and below, there is a variable called as <strong>url</strong>. And has a value to it. Now we will learn how to use it in our postman, and also, we don’t have to type that long url again. Phew!!</p><p>Be with me and we will sail through it.</p><p>So in order to use it, we need to go back to our home page of postman, and then make our environment by clicking on the <strong>dropdown </strong>beside your <strong>cog-wheel setting icon</strong>. When you hit on hit, you get to see your Environment Variable name.</p><blockquote>It is important to make that the Environment is always active, until you are using the stored variable, in our case, it is <strong>url</strong>. You can store n number of variables to it, but make sure it is active, else you will get error</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1yUeP3uxukCPLb1xQH183w.png" /><figcaption><strong>[C2] </strong>Dropdown Containing Postman Environment</figcaption></figure><p>When you select your postman environment, you are now free to use your variable in processing your requests. How can we use that? To use that variable, we simply have to get on to our field where you insert your url, we do it by using <strong>{{variable_name}}</strong>. In our case we will do it like this, <strong>{{url}}/items</strong>.</p><blockquote>Do remember, we need <strong>/</strong>, since we have just used <strong>http://127.0.0.1:&lt;port_number&gt;</strong>, no slash in the last. So always add <strong>/ and then your route name, in this case, items, so it becomes, /items</strong>. I am just telling you, cos we often skip these small things and then land up confusing ourselves.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TGnxhAhEt4AKGS91IYlA7A.png" /><figcaption><strong>[C3] </strong>Image result of using Environment Variable</figcaption></figure><p>The above image, will show three things to be noticed, one, <strong>the usage of variable</strong>, two, <strong>the Environment being active to make use of our variable</strong> and three, <strong>the successful result, which proves that it is working</strong>.</p><p>So, that is how it works, and it is really nice knowing this, as it saves a lot of time there.</p><h3><strong>(D) Using Tests in Postman for performing different operations</strong></h3><p>Last but not the least, and most important thing which I learnt recently is using <strong>TESTS </strong>in Postman <strong>for a particular request</strong>. Why I highlighted, for a particular request, is that, it only runs the test for a particular request, it is like a backend code, which does some extra job for you.</p><p>What is a Test? A test sounds like performing some test on our code, it is actually the same, but somewhat different in way of operation in Postman.</p><p>In postman, there is a place, which is available, and most of the people skip, because it doesn’t seem that important, but lemme tell you something. It is something very important, where you can test your request internally from postman itself, also, perform operations like <strong>storing/updating your environment variable</strong>. We will learn few operations via test like:</p><ul><li>Performing check on the response time</li><li>Performing check on the status code</li><li>To create a variable, and store the value from the response you get from the particular request</li></ul><p>And I am sure rest will be a cake walk for you, cos you are more talented :).</p><p><strong>(1) Performing check on the response time : </strong>Tests are always present there where you have options for <strong>Params, Authorization, Headers, Body etc</strong>. You will find in the image itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXq3YNQo2OXVqXXugO0aGQ.png" /><figcaption><strong>[D1] </strong>Test Option Postman</figcaption></figure><p>When you hit the Test, you get an empty space as well, here you can write your code in <strong>Javascript(JS)</strong>, please note <strong>JS is supported for this type of operation</strong>. Now in order to do the various operations, on the right side, you can see <strong>SNIPPETS</strong>, this will make your job easy, and you don’t have to write the code actually. You just need to select the operation and click on it, and it will populate the code, and then what you have to do is, <strong>Save </strong>and then <strong>Send</strong>. It will run your request as well as the test.</p><p>We’re going to perform the Response Time check, whether it is more than 200 or not. For this, we should simply select <strong>Response time is less than 200 </strong>from <strong>SNIPPETS</strong>. As soon as you do that, you get to see the below data shown in image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JK-c2fPCEdt7wgqWI1pUIw.png" /><figcaption><strong>[D2] </strong>Snippet for Response Test</figcaption></figure><p>Now, don’t forget to <strong>Save </strong>and then <strong>Send</strong>. So, you will get the output as well, here, in the image it will show you the result <strong>under Test Results (N/N)</strong>, by <strong>(N/N) </strong>we mean that, how many test cases you have written and how many passed.</p><blockquote>We can always make us of the test cases to understand the minor details for the request</blockquote><p>The result will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DsKSTHZb3a0sdLrZ78MO_g.png" /><figcaption><strong>[D3] </strong>Test Results Postman</figcaption></figure><p>From the options, that is, <strong>All/Passes/Skipped/Failed</strong> you can check out what is the detailed description. You can perform multiple tests, as said earlier too. I will show how multiple operations results look like.</p><p><strong>(2) Performing check on the status code : </strong>The operation is just the same as the above operation which we performed. Just one difference, that the <strong>Code is different to get the result. Again SNIPPET is there for you, so choose: Status code: Code is 200</strong></p><p>As soon as you hit on it, you will get the result under the <strong>Test Results </strong>section in the Postman, as shown in <strong>D3</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ao3aTjbOtKbL5iO-NQyV9w.png" /><figcaption><strong>[D4] </strong>Another Test Result Postman</figcaption></figure><p>As you can see the response contains the name which the code has mentioned, that is <strong>Response time is less than 200ms </strong>and <strong>Status code is 200</strong>. You can rename it too, but is pre-written, when you select a Snippet from the right hand side.</p><p><strong>(3) To create a variable, and store the value from the response you get from the particular request : </strong>Now this operation is sorta complex, but if you are with me, you will find it very useful. Why we are learning this, because, <strong>when there is a value which gets updated every time we run the request, for example, JWT token, now this value refreshes, and needs to be inserted for the JWT authenticated request like GET /user</strong>. If we provide the expired token, you get authentication error. You don’t want to insert the value again and again while doing this operation <strong>/user</strong>. What you do is, below</p><ol><li>Get the value via Test from the request, like, <strong>/auth</strong>, which gives you a token</li><li>To use the value, we defined the value in the Params, as <strong>{{jwt_token}}</strong></li></ol><p>What will happen now, when we perform <strong>/auth</strong>, it generates the auth_token, by our Test Code, we receive it, and store it into our <strong>Environment</strong>, in our case, it is <strong>Section 6</strong>. It will do that for you automatically via your code Now if we want to get the user details, via <strong>/user</strong>, we use the variable as mentioned in the above <strong>Section</strong> <strong>(C)</strong> of <strong>reusing Environment</strong>.</p><p>Let us quickly see, how do we do that, as mentioned earlier, we define our test case in the request, where we get the auth_token, so that we can fetch it, and save it. So here it goes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rshH6YDEuDZRBPJ16098xQ.png" /><figcaption><strong>[D5]</strong> Saving token via Postman Request</figcaption></figure><p>Now, the code is doing nothing, but getting the value from the request response, and then saving it our current environment. <strong>Make sure, your environment is active [Please refer to Section B and C for more information on this]</strong>. It will check whether which Environment is active, and then stores the value, with a variable name, and it’s value with this code:</p><blockquote>pm.environment.set(“jwt_token”, jsonData.access_token);</blockquote><p>Now, to see whether it has saved successfully, we can <strong>Save </strong>and then <strong>Send </strong>in Postman. After we’re done doing this, we check the <strong>Test Results, </strong>to see for the Status. Once confirmed, than it passed, Hit on the <strong>eye icon, </strong>present <strong>beside the cog-wheel setting icon, </strong>and you will see the data being stored on it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*TmB8sfpge3HqstTTR1zSWg.png" /><figcaption><strong>[D6]</strong> Verification of the variable saved</figcaption></figure><p>See, the environment is active, and the value got saved. Now it has been saved, you can always use it anywhere, by using <strong>{{jwt_token}}</strong>. The variable naming is up to you.</p><p>These are thing which I wanted to share, and hope that it might help a lot of people who are working with the backend, and don’t know about any of the things which I have shared. For any more informations, you can always rely on Postman docs, or Google. Happy learning. This is my first blog on Medium, so pardon me, for any mistakes which I have made while writing this. Show your support, and do share it with your friends, to let them know some cool tips :). Till then, happy coding!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0cd45c86929" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>