<?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 Devansu Yadav on Medium]]></title>
        <description><![CDATA[Stories by Devansu Yadav on Medium]]></description>
        <link>https://medium.com/@devansuyadav?source=rss-e22c3b1419d3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*G3dOKChjWl1InDIPwG7qqg.jpeg</url>
            <title>Stories by Devansu Yadav on Medium</title>
            <link>https://medium.com/@devansuyadav?source=rss-e22c3b1419d3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 17 Jul 2026 05:26:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devansuyadav/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[What the Heck is a ‘Thunk’ and What’s ‘Currying’ in JavaScript?]]></title>
            <link>https://javascript.plainenglish.io/what-the-heck-is-a-thunk-and-what-s-currying-5b166c8a25a9?source=rss-e22c3b1419d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b166c8a25a9</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Devansu Yadav]]></dc:creator>
            <pubDate>Thu, 30 Jun 2022 12:42:46 GMT</pubDate>
            <atom:updated>2022-07-07T08:26:07.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*u_RIWl_ZAYLta9G9QtBbsA.png" /></figure><h4>Demystifying Thunks and Currying — some of the most important functional programming concepts in JavaScript!</h4><p>I’m quite sure the first time you heard of terms like <strong>thunks</strong> or <strong>currying</strong> in programming, your reaction would have been something similar to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*pgVEo6kDkCq0BiqW.gif" /></figure><p>Well, don’t worry, I felt the same way when I heard about these terms the first time, especially from the programming aspect, until I realized how useful they are!</p><p>Before we start, this blog post assumes that you have a basic knowledge of JavaScript and asynchronous programming using Promises and callbacks. Some knowledge about functional programming in JavaScript would also be quite helpful to understand both these concepts better. <strong>Thunks</strong>, along with <strong>currying</strong>, are quite useful concepts when it comes to <strong>functional programming</strong> in JavaScript.</p><p>Let’s dive deeper into these concepts and understand what they are, and how we can use them!</p><h3>All about thunks in JavaScript</h3><p>We have been using <strong>callbacks</strong> in JavaScript almost everywhere for various use cases like <strong>asynchronous programming</strong>, <strong>listening to events</strong>, <strong>handling errors</strong>, and much more. Thunks basically <em>extend the capabilities of callbacks</em> and are quite useful when it comes to async programming in JavaScript, though they are still quite useful in certain scenarios involving synchronous programming.</p><h3>What is a thunk?</h3><p>A <strong>thunk</strong> is just a function that delays the computation of a value or some logic.</p><blockquote><em>The word “thunk” is a programming term that means “a piece of code that does some delayed work”.</em></blockquote><p>Rather than executing some logic <em>now, we can write a function body or code that can be used to perform the work later</em>. Many of you working with React probably know an awesome and plain simple library called redux-thunk which, as the name suggests, is based on thunks, and is useful while doing state management using Redux.</p><p>There are two perspectives in which you can use thunks: <strong>synchronous</strong>, and <strong>asynchronous</strong>.</p><h3>Synchronous way of using thunks</h3><p>Let’s talk about how you can use a <strong>synchronous thunk</strong>,</p><pre>const power = (base, exponent) =&gt; {<br>  return Math.pow(base, exponent);<br>};<br><br>// `power` function is evaluated<br>// and the result is returned immediately<br>console.log(power(99, 9)); // 913517247483640800<br><br>// This is a thunk<br>const powerThunk = () =&gt; {<br>  return power(99, 9);<br>};<br><br>// Returns the same result as calling the `power` function<br>console.log(powerThunk()); // 913517247483640800</pre><p>The above code snippet power is a simple function that calculates the power of a number and returns the calculated value immediately. powerThunk is a <strong>synchronous thunk</strong> that delays this result until we call it. As you might have noticed, powerThunk uses the power function internally to calculate and return the calculated value.</p><p>The important part is that this thunk has become a wrapper around some particular state. In this case, it is a result of a potentially expensive operation. This pattern allows us to hide the internal details of the computation similar to the principle of <a href="https://www.sumologic.com/glossary/encapsulation/#:~:text=What%20does%20encapsulation%20mean%3A%20In,in%20the%20form%20of%20classes.">Encapsulation</a> of the <strong>Object-Oriented Programming</strong> paradigm.</p><p>Now let’s talk about how you can use thunks from the async programming perspective.</p><h3>Async thunks</h3><p>So how can we describe an <strong>async thunk</strong>? It’s just a simple function that doesn’t need any additional parameters except for a <strong>callback function</strong>. In the case of async thunks, we can introduce a delay to process a synchronous function like the power function from the previous example or use it to handle asynchronous API calls.</p><p>Let’s have a look at both cases. We can modify the previous example for <strong>synchronous thunk</strong> to understand this better.</p><pre>const powerAsync = (base, exponent, callback) =&gt; {<br>  return setTimeout(() =&gt; callback(Math.pow(base, exponent)), 1000);<br>};<br><br>// This is an async thunk<br>const powerAsyncThunk = (callback) =&gt; {<br>  return function () {<br>    powerAsync(99, 9, callback);<br>  };<br>};<br><br>// This async thunk now returns a function that <br>// can be called later on to calculate power.<br>const calculatePower = powerAsyncThunk((result) =&gt; console.log(result));<br>calculatePower();</pre><p>In the above code snippet, we modified the power function to powerAsync function that <strong>fakes an asynchronous function</strong> using setTimeout and takes an additional parameter callback. Now, our async thunk powerAsyncThunk delays the execution of powerAsync function by returning a function. This makes it really useful as we can now just call this function returned by powerAsyncThunk whenever we want in our code later on.</p><p>Now, let’s talk about how we can deal with <strong>asynchronous API calls</strong> using <strong>async thunks</strong>.</p><pre>const fetchCurrenciesData = (callback) =&gt; {<br>  fetch(&quot;https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json&quot;)<br>  .then(res =&gt; res.json())<br>  .then(res =&gt; callback(res));<br>}<br><br>// This is an async thunk<br>const asyncThunk = (callback) =&gt; {<br>  return function () {<br>    fetchCurrenciesData(callback);<br>  }<br>}<br><br>// This async thunk now returns a function that <br>// can be called later on to fetch data from the API.<br>const fetchCurrencies = asyncThunk((res) =&gt; console.log(res));<br>fetchCurrencies();</pre><p>The fetchCurrenciesData function makes an API call to fetch all the currencies of different countries and also takes a callback function as a parameter. The async thunk asyncThunk returns a function that can be called later on to fetch the data from the API whenever we want in our code.</p><p>The data after calling fetchCurrencies function looks something like this:</p><pre>{<br>aave: &quot;Aave&quot;<br>ada: &quot;Cardano&quot;<br>aed: &quot;United Arab Emirates Dirham&quot;<br>afn: &quot;Afghan afghani&quot;<br>algo: &quot;Algorand&quot;<br>doge: &quot;Dogecoin&quot;<br>dop: &quot;Dominican peso&quot;<br>dot: &quot;Dotcoin&quot;<br>dzd: &quot;Algerian dinar&quot;<br>egld: &quot;Elrond&quot;<br>egp: &quot;Egyptian pound&quot;<br>enj: &quot;Enjin Coin&quot;<br>eos: &quot;EOS&quot;<br>ern: &quot;Eritrean nakfa&quot;<br>etb: &quot;Ethiopian birr&quot;<br>ils: &quot;Israeli New Shekel&quot;<br>imp: &quot;CoinIMP&quot;<br>inj: &quot;Injective&quot;<br>inr: &quot;Indian rupee&quot;<br>iqd: &quot;Iraqi dinar&quot;<br>irr: &quot;Iranian rial&quot;<br>isk: &quot;Icelandic króna&quot;<br>jep: &quot;Jersey Pound&quot;<br>jmd: &quot;Jamaican dollar&quot;<br>jod: &quot;Jordanian dinar&quot;<br>jpy: &quot;Japanese yen&quot;<br>kava: &quot;Kava&quot;<br>kcs: &quot;Kucoin&quot;<br>kda: &quot;Kadena&quot;<br>kes: &quot;Kenyan shilling&quot;<br>...<br>} </pre><h3>Where exactly are thunks used? 💡</h3><p>Now that you have learned quite a lot about thunks, you might be wondering where exactly are <strong>thunks</strong> used.</p><ul><li><strong>Promises</strong> in JavaScript are based on the concept of <strong>thunks</strong> and under the hood, it uses thunks. Have a look at this <a href="https://youtu.be/EhyuWntGA8s">video</a> which talks about how <strong>thunks</strong> can be used to sequence async function calls.</li><li>The <a href="https://github.com/reduxjs/redux-thunk">redux-thunk</a> middleware widely <strong>uses thunks internally</strong>. This enables us to use <strong>thunks</strong> with async logic inside, that can <strong>interact with a Redux store’s</strong> dispatch and getState methods for React apps using <strong>Redux</strong> for state management.</li></ul><h3>All about Currying in JavaScript</h3><p>Let’s look at another quite useful concept within functional programming in JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*YAzCood4uEqML5X7.gif" /></figure><p><strong>Currying</strong> is an advanced technique for working with functions. It’s used not only in JavaScript but in other languages as well!</p><h3>What is Currying?</h3><blockquote><strong><em>Currying</em></strong><em> is a transformation of functions that converts a function from callable as </em><em>f(a, b, c) into callable as </em><em>f(a)(b)(c).</em></blockquote><p>We are <strong>transforming</strong> the function by <strong>breaking it down</strong> in such a way that it can be called in a <strong>step-by-step manner</strong> instead of calling it with all the arguments immediately. This technique is very useful, particularly when you <strong>don’t have access to all the required parameters at an instant</strong> to be able to execute the logic inside your function.</p><p>Let’s look at an example to understand this better. Suppose, we create a simple function multiplyTwoNos that multiplies two nos and returns the calculated value.</p><pre>const multiplyTwoNos = (no1, no2) =&gt; {<br>  return no1 * no2;<br>};<br><br>console.log(multiplyTwoNos(3, 5)); // 15<br><br>// A curried function to multiple two nos<br>const curriedMultiplyTwoNos = function (no1) {<br>  return function (no2) {<br>    return no1 * no2;<br>  };<br>};<br><br>console.log(curriedMultiplyTwoNos(3)(5)); // 15</pre><p>In the above code snippet, curriedMultiplyTwoNos is a function that uses <strong>currying</strong> to transform multiplyTwoNos(3, 5) function call into a function call something like this - curriedMultiplyTwoNos(3)(5). The output is basically the same, but <strong>currying</strong> gives us more flexibility to calculate the multiplication of two numbers whenever we have access to both numbers.</p><h3>Advanced Currying Implementation</h3><p>Now, let’s have a look at a bit more <strong>advanced implementation</strong> of <strong>currying</strong> for multi-argument functions. We’ll first create a generic <strong>currying</strong> function and then use the above example of multiplying some numbers and getting the calculated value.</p><pre>// A function that takes a callback function `func` <br>// that defines the kind of operation that will be curried.</pre><pre>const curry = function (func) {<br>  return function curried (...args) {<br>    // Ensure that we apply the operation defined by `func` <br>    // with the max number of arguments supported by `func`.</pre><pre>    if(args.length &gt;= func.length) {<br>      return func.apply(this, args);<br>    } else {<br>      // If number of parameters are insufficient to call `func` to <br>      // perform the operation, recursively call `curried` with previously passed<br>      // parameters as well as new parameters. <br>      return function (...args2) {<br>        return curried.apply(this, args.concat(args2));<br>      }<br>    }<br>  }<br>}</pre><p>There are a lot of things happening in the above code! 😅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*yO3B7mMoWDhlVzZJ.gif" /></figure><p>But, don’t get overwhelmed by seeing the above code, it’s actually quite straightforward! Let’s see how it works with an example and then we’ll understand it properly.</p><pre>const multiplyThreeNos = (no1, no2, no3) =&gt; {<br>  return no1 * no2 * no3;<br>};<br><br>let curriedMultiplication = curry(multiplyThreeNos);<br><br>console.log(curriedMultiplication(4, 5, 6)); // 120, still callable normally<br>console.log(curriedMultiplication(4)(5, 6)); // 120, currying of 1st arg<br>console.log(curriedMultiplication(4)(5)(6)); // 120, full currying</pre><p>The result of curry(func) call is the wrapper curried that looks like this:</p><pre>function curried(...args) {<br>    // Ensure that we apply the operation defined by `func`<br>    // with the max number of arguments supported by `func`.</pre><pre>    if (args.length &gt;= func.length) {<br>      return func.apply(this, args);<br>    } else {<br>      // If number of parameters are insufficient to call `func` to<br>      // perform the operation, recursively call `curried` with previously passed<br>      // parameters as well as new parameters.<br>      return function (...args2) {<br>        return curried.apply(this, args.concat(args2));<br>      };<br>    }<br>  };</pre><p>In the above code, we are using some of the concepts like <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters">rest parameters</a>, <strong>Recursions</strong>, and <a href="https://www.freecodecamp.org/news/understand-call-apply-and-bind-in-javascript-with-examples/">.apply()</a>.</p><p>There are basically two branches of code out of which one of them could get executed within the curried function because of the if statement.</p><ul><li>If the number of arguments passed to curried is <strong>greater than or equal to</strong> the no of arguments defined for func, then just pass the call to func.apply(this, args); which will execute ignore the extra arguments passed if any.</li><li>Else if the no of arguments passed to curried is less, then we recursively call curried with <strong>previously passed arguments</strong> as well as the <strong>new arguments</strong> by using the .concat() method until the number of arguments for curried is not sufficient as per the definition of func.</li></ul><blockquote><strong><em>Note</em></strong><em>: </em><strong><em>Currying</em></strong><em> requires the function to have a </em><strong><em>fixed number of arguments</em></strong><em>. A function that uses rest parameters, such as </em><em>f(...args), can&#39;t be curried this way as implemented above.</em></blockquote><h3>When and Why to use Currying? 💡</h3><p>Currying can be useful for:</p><ul><li>Currying can be used when you want to create a function that will receive only single arguments or will receive arguments later on in your code.</li><li>It can be used to trigger event listeners.</li></ul><p>Let’s look at some of the reasons why you may need to use Currying:</p><ul><li>Currying provides a way to make sure that your function receives all the arguments before you proceed with executing the core logic of your function.</li><li>It divides your function into multiple smaller functions that can handle one responsibility. This makes your function pure and less prone to errors and side effects.</li><li>It is used in the functional programming paradigm to create <a href="https://dmitripavlutin.com/javascript-higher-order-functions/">higher-order functions</a>.</li></ul><h3>Conclusion</h3><p>In this blog, we learned about <strong>thunks</strong> and <strong>currying</strong>, some of the most useful yet a bit advanced concepts of functional programming in JavaScript. We talked about <strong>thunks</strong> in detail like what are <strong>thunks</strong>, how can you use them, when to use them, and where are they used. Similarly, we learned about <strong>currying</strong>, how to implement <strong>currying</strong>, <strong>advanced implementation</strong> of <strong>currying</strong>, and when to use it.</p><p>That’s it from me folks, thank you so much for reading this blog! 🙌 <br>I hope this blog was helpful and gave you an insight about <strong>thunks</strong> and <strong>currying</strong> and how you could use these very useful concepts of the functional programming paradigm in your JavaScript apps. 😄</p><p>Before we end,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*HeoLTq1noQPUanwM.gif" /></figure><blockquote><em>Feel free to reach out to me:<br></em><a href="https://twitter.com/DevanshYtweets"><em>Twitter</em></a><em><br></em><a href="https://www.linkedin.com/in/devansu-yadav/"><em>Linkedin</em></a><em><br></em><a href="https://github.com/Devansu-Yadav"><em>GitHub</em></a></blockquote><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Check out our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Community Discord</em></strong></a><em> and join our </em><a href="https://inplainenglish.pallet.com/talent/welcome"><strong><em>Talent Collective</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b166c8a25a9" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/what-the-heck-is-a-thunk-and-what-s-currying-5b166c8a25a9">What the Heck is a ‘Thunk’ and What’s ‘Currying’ in JavaScript?</a> was originally published in <a href="https://javascript.plainenglish.io">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make Your React Apps More Performant using Debouncing & Throttling ]]></title>
            <link>https://javascript.plainenglish.io/make-your-react-apps-more-performant-using-debouncing-throttling-f90bb4c36855?source=rss-e22c3b1419d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f90bb4c36855</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Devansu Yadav]]></dc:creator>
            <pubDate>Tue, 28 Jun 2022 14:56:49 GMT</pubDate>
            <atom:updated>2022-07-05T05:46:50.274Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*KCHKlzzm0GFeYpVKPwmRvA.png" /><figcaption>Learn Debouncing &amp; Throttling to improve web app performance</figcaption></figure><h4>A simple guide to optimizing your React Apps performance using Debouncing &amp; Throttling.</h4><p>Well, hello there! 👋 I see you have come here to learn more about how to make your React apps performant and optimize them using Debouncing and Throttling, which is great because that means you really do care about your app’s performance. Kudos for that! 👏</p><p>Do note that this blog assumes that you have a <strong>basic understanding of how React works</strong> and that you are familiar with <strong>React Hooks</strong>.</p><p>Before we jump in, let’s understand why would you want to optimize your React app’s performance?</p><p>Suppose you have a very simple React app with an input bar to search cities like the below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2hYadxfY-23pSyQY8llg-w.gif" /><figcaption>A laggy and poorly performant React app</figcaption></figure><p>As you can see, this app is super laggy and the UX of this app is 💩. We are just making a very simple search that filters cities from a list of cities based on user input.</p><p>PS:- You can give it a try if you want (Please do it at your own risk, you don’t wanna hang your computer!) — <a href="https://codesandbox.io/s/debouncing-example-demo-0dyb16?file=/src/App.jsx">codesandbox.io/s/debouncing-example-demo-0d..</a></p><h3>Now, you might ask why’s this React app so laggy?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*9gbeoWcdmDi4CGwE.gif" /></figure><p>If you would have noticed carefully from the above demo of the app, we are filtering the cities from the list of cities that we have on every keystroke made by the user (notice the keystrokes on the Virtual keyboard in the demo).</p><p>See now, that’s not a performant app at all and needs to be optimized to provide a better user experience.</p><p>Let’s have a look at two ways to optimize such apps and make them better!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*dnQV6qF5-jbRdsVV.gif" /><figcaption>Let’s understand Debouncing &amp; Throttling</figcaption></figure><h3>What is Debouncing &amp; Throttling?</h3><p>There are many scenarios that make your app less performant like making API calls on each user keystroke on an input search bar, performing compute-heavy operations on button clicks, window resizing, or frequent scrolls on a scrollbar.</p><p>Basically, any scenario in which you are making expensive (in terms of computing or execution time) function calls on events or user actions that can hamper the performance of your apps.</p><p>Now, let’s understand <strong>Debouncing</strong> &amp; <strong>Throttling</strong>.</p><p><strong>Debouncing</strong>: In debouncing, we try to reduce the number of expensive function calls by calling them <strong>only if the time difference between two consecutive event triggers</strong> (user actions) is <strong>greater than or equal</strong> to a <strong>specified delay</strong>. This <strong>delay</strong> can be adjusted depending on the <strong>use case</strong> or the kind of <strong>user experience</strong> you are trying to design for your app.</p><p><strong>Throttling</strong>: In throttling, we try to <strong>rate-limit</strong> the number of expensive function calls by calling them every time <strong>only after a certain time limit</strong> has passed from the <strong>last function call</strong>. Again, this time limit can be adjusted depending on your use case.</p><p>Debouncing &amp; Throttling can be very useful to handle <strong>rate-limit errors</strong> caused by <strong>rate-limiting</strong> on certain APIs that your apps might be consuming, as we are trying to reduce the number of such expensive function calls using these optimizations.</p><p>Now that you have some idea about Debouncing &amp; Throttling, let’s dive deeper into each concept using a simple example that illustrates some of their common use cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/0*ptqcPGa8MEboYrFQ.gif" /><figcaption>Are you ready?</figcaption></figure><h3>Optimizing apps using Debouncing</h3><p>Let’s go back to the very first example that we saw, where we had a simple search bar that filters the cities from a list of cities based on the user input.</p><p>We can use <strong>debouncing</strong> in this case to reduce the number of function calls to filter the cities from the list.</p><p>But first, let’s look at the initial code from the demo.</p><p><strong>Initial Code</strong> -</p><pre>import &quot;./styles.css&quot;;<br>import React, { useState } from &quot;react&quot;;<br>import cities from &quot;cities-list&quot;;<br>import { v4 as uuidv4 } from &quot;uuid&quot;;<br><br>// An array of city names<br>const citiesArray = Object.keys(cities);<br><br>export default function App() {<br>  const [cityInput, setCityInput] = useState(&quot;&quot;);<br>  const [filteredCities, setFilteredCities] = useState([]);<br><br>  // Function that filters cities from the list based on user input<br>  const cityFilter = (query) =&gt; {<br>    console.log(query);<br>    if (!query) return setFilteredCities([]);<br><br>    setFilteredCities(<br>      citiesArray.filter((city) =&gt;<br>        city.toLowerCase().includes(query.toLowerCase())<br>      )<br>    );<br>  };<br><br>  return (<br>    &lt;div className=&quot;App&quot;&gt;<br>      &lt;h1 className=&quot;app-header&quot;&gt;Find cities&lt;/h1&gt;<br>      &lt;div className=&quot;city-input&quot;&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          value={cityInput}<br>          onChange={(e) =&gt; {<br>            setCityInput(e.target.value);<br>            cityFilter(e.target.value);<br>          }}<br>        /&gt;<br>      &lt;/div&gt;<br>      &lt;div&gt;<br>        {filteredCities.map((city) =&gt; {<br>          return &lt;div key={uuidv4()}&gt;{city}&lt;/div&gt;;<br>        })}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>The above code snippet represents a <strong>simple React component</strong> with an <strong>input search bar</strong> and a <strong>container that displays the filtered cities</strong>.</p><pre>// Function that filters cities from the list based on user input<br>  const cityFilter = (query) =&gt; {<br>    console.log(query);<br>    if (!query) return setFilteredCities([]);<br><br>    setFilteredCities(<br>      citiesArray.filter((city) =&gt;<br>        city.toLowerCase().includes(query.toLowerCase())<br>      )<br>    );<br>  };</pre><p>The function cityFilter takes a <strong>user search query</strong> as an input parameter and filters the cities from a list of cities (fetched from an npm package called cities-list). Currently, this function runs on every single keystroke made by the user on the search bar.</p><p>Now, let’s write a <strong>debounced version</strong> of the above cityFilter function to make it more optimal. We will be using setTimeout in JavaScript to achieve this.</p><pre>// `timer` to help while clearing setTimeout <br>// inside `debouncedCityFilter` function<br>let timer;<br><br>// Debounced version of the `cityFilter` func to filter cities <br>// based on user search query<br>  const debouncedCityFilter = (query) =&gt; {<br>    clearTimeout(timer);<br>    if (!query) return setFilteredCities([]);<br><br>    timer = setTimeout(() =&gt; {<br>      console.log(query);<br><br>      setFilteredCities(<br>        citiesArray.filter((city) =&gt;<br>          city.toLowerCase().includes(query.toLowerCase())<br>        )<br>      );<br>    }, 500);<br>  };</pre><p>According to the concept of debouncing, we make function calls only if the <strong>time difference between two consecutive event triggers</strong> (user actions) is <strong>greater than or equal</strong> to a specified delay.</p><p>In the above code snippet, we set the state to get the filtered cities using setFilteredCities() which is called inside a setTimeout with a delay of 500ms(this delay can be adjusted according to the use case). So whenever a user keystroke is recorded on the input search bar, the debouncedCityFilter function is called which triggers setTimeout and sets the state using setFilteredCities() after 500ms.</p><p>However, if another keystroke made by the user is recorded just within this time delay of 500ms, the previous setTimeout needs to be cleared to avoid filtering the cities and setting the state. For this, we use clearTimeout that takes the id returned by the setTimeout function.</p><p>Now, this id needs to be preserved so that it is available whenever we need to use clearTimeout to clear the timer. We use a quite popular concept called <a href="https://www.freecodecamp.org/news/lets-learn-javascript-closures-66feb44f6a44/">Closures</a> in JavaScript to be able to access this id inside the debouncedCityFilter function. Hence, if you&#39;d have noticed we have defined a timer variable outside the debouncedCityFilter function for use inside this function.</p><p>By simply debouncing the cityFilter function, we are able to reduce the number of function calls and hence able to improve the performance significantly of our React app.</p><p>Let’s have a look at what our React component code looks like after making these changes.</p><p><strong>Final Code</strong> -</p><pre>import &quot;./styles.css&quot;;<br>import React, { useState } from &quot;react&quot;;<br>import cities from &quot;cities-list&quot;;<br>import { v4 as uuidv4 } from &quot;uuid&quot;;<br><br>// An array of city names<br>const citiesArray = Object.keys(cities);<br><br>// `timer` to help while clearing setTimeout <br>// inside `debouncedCityFilter` function<br>let timer;<br><br>export default function App() {<br>  const [cityInput, setCityInput] = useState(&quot;&quot;);<br>  const [filteredCities, setFilteredCities] = useState([]);<br><br>  // Function that filters cities from the list based on user input<br>  const cityFilter = (query) =&gt; {<br>    console.log(query);<br>    if (!query) return setFilteredCities([]);<br><br>    setFilteredCities(<br>      citiesArray.filter((city) =&gt;<br>        city.toLowerCase().includes(query.toLowerCase())<br>      )<br>    );<br>  };<br><br>  // Debounced version of the `cityFilter` func to filter <br>  // cities based on user search query<br>  const debouncedCityFilter = (query) =&gt; {<br>    clearTimeout(timer);<br>    if (!query) return setFilteredCities([]);<br><br>    timer = setTimeout(() =&gt; {<br>      console.log(query);<br><br>      setFilteredCities(<br>        citiesArray.filter((city) =&gt;<br>          city.toLowerCase().includes(query.toLowerCase())<br>        )<br>      );<br>    }, 500);<br>  };<br><br>  return (<br>    &lt;div className=&quot;App&quot;&gt;<br>      &lt;h1 className=&quot;app-header&quot;&gt;Find cities&lt;/h1&gt;<br>      &lt;div className=&quot;city-input&quot;&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          value={cityInput}<br>          onChange={(e) =&gt; {<br>            setCityInput(e.target.value);<br>            debouncedCityFilter(e.target.value);<br>          }}<br>        /&gt;<br>      &lt;/div&gt;<br>      &lt;div&gt;<br>        {filteredCities.map((city) =&gt; {<br>          return &lt;div key={uuidv4()}&gt;{city}&lt;/div&gt;;<br>        })}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>Now, have a look at how debouncing has improved the performance of this component significantly! 🚀</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2F0dyb16&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2F0dyb16&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2F0dyb16%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/45afa54f1e0aa480d97618dd12f0c5e6/href">https://medium.com/media/45afa54f1e0aa480d97618dd12f0c5e6/href</a></iframe><p>If you want to handle more edge cases for debouncing such functions, then you can check out <a href="https://lodash.com/">Lodash</a> which has a debounce method that covers most of the edge cases involved to make such functions more optimal.</p><p>Now, let’s look at a simple example that uses Throttling to make it more performant.</p><h3>Optimizing apps using Throttling</h3><p>Let’s suppose, you have a simple React component consisting of a button that on clicking <strong>calls an API</strong> to fetch some data related to all the currencies of different countries.</p><p><strong>Initial Code</strong> -</p><pre>import &quot;./styles.css&quot;;<br>import React, { useState } from &quot;react&quot;;<br>import axios from &quot;axios&quot;;<br>import { v4 as uuid } from &quot;uuid&quot;;<br><br>export default function App() {<br>  const [currencyData, setCurrencyData] = useState({});<br>  const [clickCounter, setClickCounter] = useState(0);<br><br>  const getCurrencyData = async () =&gt; {<br>    console.log(&quot;Fetching data ....&quot;);<br><br>    const { data } = await axios.get(<br>      &quot;https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json&quot;<br>    );<br><br>    // Fetching only 15 currencies for now<br>    const countryCurrencies = {};<br>    const currencyObjKeys = Object.keys(data).slice(0, 15);<br><br>    currencyObjKeys.forEach((key) =&gt; {<br>      countryCurrencies[key] = data[key];<br>    });<br><br>    setCurrencyData({ ...countryCurrencies });<br>  };<br><br>  return (<br>    &lt;div className=&quot;App&quot;&gt;<br>      &lt;h1&gt;Currencies of different Countries&lt;/h1&gt;<br>      &lt;button<br>        className=&quot;currency-btn&quot;<br>        onClick={() =&gt; {<br>          setClickCounter((clickCount) =&gt; clickCount + 1);<br>          getCurrencyData();<br>        }}<br>      &gt;<br>        Click to get all currencies<br>      &lt;/button&gt;<br>      &lt;span&gt;Btn clicked - {clickCounter} times&lt;/span&gt;<br>      &lt;div className=&quot;currencies&quot;&gt;<br>        {Object.keys(currencyData).map((currency) =&gt; {<br>          return (<br>            &lt;div key={uuid()}&gt;<br>              {currency}: {currencyData[currency]}<br>            &lt;/div&gt;<br>          );<br>        })}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>The code snippet above is our simple component with two states — currencyData &amp; clickCounter. On button click, we update the clickCounter state to reflect the total number of button clicks made so far and also call the getCurrencyData() function to make an API call to fetch the currency data.</p><p>Let’s look at what this component looks like!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F724899794%3Fh%3D4f52f42f61%26app_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F724899794&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1459486220-cafe9507ecad778adde78c853732e68cb91e9bcf3dd7e57902e6105c82a5cac0-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1904" height="876" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6f27a05fc1cbd59706eca8cdda84d4f/href">https://medium.com/media/b6f27a05fc1cbd59706eca8cdda84d4f/href</a></iframe><p>As you might have noticed above, each button click triggers an API call. Now, imagine that your app was used by hundreds or thousands of users, the number of API calls would be humongous! Your Back-End servers could face a huge pool of requests coming from each user due to so many clicks. Also, if you are consuming any external paid API or service, then the endpoints might start throwing errors because of <strong>rate-limiting</strong> on the API endpoints.</p><p>Even if say you were not making any API calls on such button clicks but rather performing some <strong>compute-heavy</strong> operation, it would hamper your app’s performance severely!</p><p>Now, that’s a bit of a problem 😅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/0*i79vVcBEUPSGuK_M.gif" /></figure><p>Let’s try and solve this problem using Throttling! ✨</p><p>We will throttle the getCurrencyData function that makes an API call on each button click.</p><p>Currently, the code for getCurrencyData looks like this,</p><pre>const getCurrencyData = async () =&gt; {<br>    console.log(&quot;Fetching data ....&quot;);<br><br>    const { data } = await axios.get(<br>      &quot;https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies.json&quot;<br>    );<br><br>    // Fetching only 15 currencies for now<br>    const countryCurrencies = {};<br>    const currencyObjKeys = Object.keys(data).slice(0, 15);<br><br>    currencyObjKeys.forEach((key) =&gt; {<br>      countryCurrencies[key] = data[key];<br>    });<br><br>    setCurrencyData({ ...countryCurrencies });<br>  };</pre><p>Now, we will write a function throttledGetCurrencyData that will throttle and use the getCurrencyData function to reduce the number of calls made to it.</p><pre>// A flag to control the function calls to the `getCurrencyData` function<br>let shouldFuncBeCalled = true;<br><br>const throttledGetCurrencyData = async () =&gt; {<br>    if (shouldFuncBeCalled) {<br>      await getCurrencyData();<br>      shouldFuncBeCalled = false;<br><br>      setTimeout(() =&gt; {<br>        shouldFuncBeCalled = true;<br>      }, 500);<br>    }<br>  };</pre><p>The throttledGetCurrencyData function calls the getCurrencyData function only if the shouldFuncBeCalled flag is set to true. Once this function is called, we delay the next function call to the getCurrencyData function by using setTimeout with some specific delay (This delay limit can be adjusted as per your use case).</p><p>This way we only allow function calls to happen after a certain amount of time has passed from the last function call. This way we can avoid making the UI slow or crossing the rate limits defined for any API that your app might be consuming.</p><p>Let’s look at how the app is working now.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F724905698%3Fh%3Dc4ae5c6eac%26app_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F724905698&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1459496495-8fd062002648837d51f02259795813b8a0515b5ec9c955f677da1d881971394b-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1904" height="876" frameborder="0" scrolling="no"><a href="https://medium.com/media/2aec3ed93083be0ee12157554a9dd119/href">https://medium.com/media/2aec3ed93083be0ee12157554a9dd119/href</a></iframe><p>As you can see from the console, the number of API calls has been reduced quite significantly even after clicking the button so many times!</p><p>Check out the CodeSandbox below to see what the code for our component looks like after using Throttling.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodesandbox.io%2Fembed%2F70o8ig&amp;display_name=CodeSandbox&amp;url=https%3A%2F%2Fcodesandbox.io%2Fs%2F70o8ig&amp;image=https%3A%2F%2Fcodesandbox.io%2Fapi%2Fv1%2Fsandboxes%2F70o8ig%2Fscreenshot.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codesandbox" width="1000" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/88d9371257546c5065b3b447007d442b/href">https://medium.com/media/88d9371257546c5065b3b447007d442b/href</a></iframe><p>If you want to handle more edge cases for throttling such functions, then you can check out <a href="https://lodash.com/">Lodash</a> which has a throttle method that covers most of the edge cases involved to make such functions more optimal.</p><h3>Debouncing vs Throttling, when to use which?</h3><p>Now that we understand how Debouncing and Throttling work, let’s understand some of the differences and when to use Debouncing or Throttling.</p><p><strong>Throttling</strong> enforces that a function must be called every time after a certain amount of time (or delay) has passed from the last function call.</p><p>Whereas, <strong>Debouncing</strong> enforces that a function must only be called if a certain amount of time (or delay) has passed without it being called. If this time has not been passed the <strong>debounce timer</strong> keeps <strong>resetting</strong> and the <strong>function call is avoided</strong>.</p><h3>When to use what?</h3><ul><li><strong>Search bar</strong>: Use <strong>debouncing</strong> to avoid searching every time a user hits a keystroke. <strong>Throttling</strong> is not convenient here to use in this scenario, as you don’t want to make your user wait too long for fetching the search results (in the worst case if the previous function call was made just when the user stops typing).</li><li><strong>Shooting game</strong>: Use <strong>throttling</strong> on mouse click as shooting a pistol takes a few secs to register and it helps in avoiding the user to shoot until the previous shot has been registered. <strong>Debouncing</strong> will not shoot a bullet until a certain amount of time has passed when the pistol was not fired.</li></ul><p>You can also check out this amazing <a href="https://stackoverflow.com/questions/25991367/difference-between-throttling-and-debouncing-a-function">Stackoverflow post</a> to understand the differences between <strong>Debouncing</strong> &amp; <strong>Throttling</strong> and when to use what.</p><h3>Conclusion</h3><p><strong>Debouncing</strong> &amp; <strong>Throttling</strong> are just a few ways you can make your React apps more performant &amp; each technique has its own set of pros and cons depending on the use cases. In this blog, we first talked about <strong>Why should we care about our React app’s performance</strong>, then we understood <strong>how we can use Debouncing &amp; Throttling</strong> to optimize our app’s performance, and finally saw a <strong>major difference between the two techniques</strong> and <strong>when we to use which technique</strong>.</p><p>That’s it from me folks, thank you so much for reading this blog! 🙌 I hope this blog was helpful and gave you an insight on how you can make your React apps more performant. Now, go ahead and make your apps even more amazing! 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*TPy9mfOg6-B0LulW.gif" /></figure><blockquote><em>Feel free to reach out to me: <br></em><a href="https://twitter.com/DevanshYtweets"><em>Twitter</em></a><em> <br></em><a href="https://www.linkedin.com/in/devansu-yadav/"><em>Linkedin</em></a><em> <br></em><a href="https://github.com/Devansu-Yadav"><em>GitHub</em></a><em> <br> You can also reach out to me over mail: </em><a href="mailto:devansuyadav@gmail.com"><em>devansuyadav@gmail.com</em></a></blockquote><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Check out our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Community Discord</em></strong></a><em> and join our </em><a href="https://inplainenglish.pallet.com/talent/welcome"><strong><em>Talent Collective</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f90bb4c36855" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/make-your-react-apps-more-performant-using-debouncing-throttling-f90bb4c36855">Make Your React Apps More Performant using Debouncing &amp; Throttling 🔥🚀</a> was originally published in <a href="https://javascript.plainenglish.io">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My experience so far contributing to CheckStyle OSS — (Part 1)]]></title>
            <link>https://devansuyadav.medium.com/my-experience-so-far-contributing-to-checkstyle-oss-part-1-283673cb989d?source=rss-e22c3b1419d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/283673cb989d</guid>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[checkstyle]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Devansu Yadav]]></dc:creator>
            <pubDate>Wed, 05 May 2021 09:10:32 GMT</pubDate>
            <atom:updated>2021-05-06T05:15:22.415Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7B7Ntq8RNr0cy2XJWqcBvw.png" /></figure><p>In this article, I will be sharing <strong>my experience</strong> so far contributing to the <strong>CheckStyle</strong> Project.</p><p>I will be talking a little bit about <em>what I have learned</em> +<em> what I am working</em> on right now and <strong>how I started getting involved in the community</strong>. I will also be sharing <em>how you can get involved</em> and <em>start contributing</em> to the Project.</p><p>First of all, let me introduce you to the <strong>CheckStyle</strong> Project, <em>what is it all about, how it works, and what technology stack </em>is being used in the Project.</p><h3>Intro to the CheckStyle Open Source tool</h3><blockquote>Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task.</blockquote><p><strong>Checkstyle</strong> is also <em>highly configurable</em> and can be used to support any coding style(for Java).</p><p>I believe that style of code becomes <em>significantly important</em> when it comes to working on a team project.</p><p><strong>Checkstyle</strong> helps <strong>maintain consistent</strong> and <strong>proper code style</strong> for <em>projects build in Java</em> by providing different <strong>Checks</strong> for <em>layout</em>, <em>code formatting</em>, <em>class design</em>, <em>method design</em>, <em>type checking</em>. So, if the source code is <em>not following a proper style or has incorrect syntax</em>, then this tool shows <strong>violations</strong> on <strong>specific lines in those files</strong> which you can then easily rectify.</p><p>You can explore the project repository on <a href="https://github.com/checkstyle/checkstyle"><strong>Github</strong></a>. You can check out the documentation of the Project <a href="https://checkstyle.org/index.html"><strong>here</strong></a> to learn more about these checks.</p><h3>Tech Stack</h3><p>Checkstyle is mainly built in<strong> Java</strong> and it uses <strong>Maven/Gradle</strong> as a <strong>build tool</strong>, <strong>JUnit framework</strong> for <strong>testing</strong>, <strong>ANTLR</strong> for <strong>grammar</strong>, and <strong>parsing of Java code as AST(Abstract Syntax Tree)</strong>, and many <em>other tools/utilities</em> that make up this amazing tool. <br>You can know more about the <em>Project dependencies</em> <a href="https://checkstyle.sourceforge.io/dependencies.html"><strong>here</strong></a>.</p><h3><strong>My Open Source Journey</strong></h3><p>If I talk about <strong>my Open Source journey</strong>, I started <em>exploring Open Source</em> a <em>few months back</em> and I <em>made a few contributions</em> by participating in a <em>University level </em><strong>Open Source program</strong>(was one of the top 50 contributors) and I really started enjoying it.</p><p>I realized that I can literally learn a lot of different technologies by contributing and get hands-on experience too!!</p><p>Currently, I am also participating in <a href="https://gssoc.girlscript.tech/"><strong>Girlscript Summer Of Code</strong></a><strong> 2021</strong> which is a 3-month <em>Open Source Program</em> held in India to promote Open Source culture amongst young programmers. I am contributing to different projects related to <strong>web development in Python</strong> and some <strong>projects using Java</strong>.</p><h3>My Experience and Learnings</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YvdJBFBAvblwTB-UbgqE1A.jpeg" /></figure><p>I came to know about the Checkstyle project just a few months back, while looking for <em>organizations </em>on the <strong>GSoC 2020</strong>(Google Summer Of Code) website. I was mostly looking for <em>projects/organizations using Java</em> since I had been learning Java and was more comfortable with it.</p><p>I found the <strong>Checkstyle organization’s website</strong> and I really loved the idea of this project and how it can a <em>very useful tool </em>while <strong>working on projects in a team</strong> since it becomes really <strong>easy to maintain code quality</strong>.</p><p>I soon <em>started exploring this tool </em>and started <em>getting involved</em> in the <strong>community’s mailing list</strong> and<strong> Gitter channel</strong>(You can find these on the official GSoC website <a href="https://summerofcode.withgoogle.com/organizations/5553288004501504/"><strong>here</strong></a>). I also started contributing to <em>beginner-friendly issues</em>.</p><h4>My First Contribution</h4><p>Talking about <strong>my first contribution</strong>, it was to update the example of <strong>AST</strong>(<em>Abstract Syntax Tree</em>) in the Javadoc documentation. <br><em>Don’t worry, it might seem a little overwhelming at first, but you will get a little familiarized with the codebase!</em></p><p>I worked on a couple of these issues and it helped me <strong>understand how to use CheckStyle</strong> on any project <strong>from the CLI</strong>. It helped me <strong>understand the Project structure</strong> and I also <strong>learned about ASTs</strong>(<em>Abstract Syntax Tree</em>).</p><blockquote>An <strong>AST</strong> is a tree representation of the syntax of the source code in a programming language. You can learn more about them <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">here</a>.</blockquote><p>Next, I went a level-up and <em>worked on some of the GSoC second issues</em>. <br>Now, <strong>Checkstyle</strong> is a <strong>very well-tested tool</strong> with <strong>Unit Tests</strong>, <a href="https://pitest.org/quickstart/mutators/"><strong>pitests</strong></a>, <strong>regression checking </strong>written for each check and <strong>CI tests</strong> (used to <em>analyze its source code by running Checkstyle itself!</em>).</p><p>As I had mentioned previously, <strong>CheckStyle</strong> has <em>different checks implemented (like indentation, header, import, block checks, type checks, etc)</em> for <em>checking the source code(written in Java) of any project</em>.</p><p>So, for this issue, I had to <em>update a specific Test for a check</em> to have it <strong>use unique input files</strong>(<em>these files are used to test each of the check’s functionality</em>) for <em>every method in the Test</em>.</p><h4>What I learned after resolving these issues</h4><p>By resolving this issue, I <strong>learned a little bit about Unit testing</strong> and <strong>TDD using the JUnit framework</strong>.</p><blockquote>I learned that in <strong>TDD</strong>, we write tests to test the functionality of code(for eg:- an instance method) and compare the expected and actual cases of output to determine whether the code does what it should do in the first place.</blockquote><p>I also <em>learned about different </em><strong>properties</strong> and <strong>configurations</strong> based on which the checks actually verify source code and <strong>report violations</strong>.</p><h3>What am I working on right now/current learnings?</h3><p>Currently, I have started <strong>working on different variety of issues</strong> and <strong>getting a little deeper understanding of this tool</strong>, the <strong>different checks that Checkstyle provides</strong>, and also <strong>how to properly test your code for different edge cases</strong>.</p><p>I am currently <em>learning about the different tools</em> used in the Project like <a href="https://t.co/9lN3BgkYUa?amp=1"><strong>XPath</strong></a>(syntax used to navigate <strong>XML elements/nodes</strong>), <a href="https://pitest.org/quickstart/mutators/"><strong>pitests</strong></a>, <strong>Unit testing</strong> with <strong>JUnit.</strong></p><p>So, <strong>pitests</strong> are basically <strong>mutation tests</strong> used to check <em>how good the test coverage is</em>, and it <em>creates mutations in the code</em> (deliberately break the code).</p><p>By doing this, we ensure that <em>all tests cover our code completely</em> and that <em>certain redundant cases could be removed</em> to keep the <strong>source code clean and precise</strong>.</p><p>This might seem a little overwhelming but trust me it gets very interesting as you deeply explore the project. I am also learning about <strong>how I could configure this tool and use it in my own projects</strong>.</p><p>Currently, I am <em>looking to get a deeper understanding</em> of what <strong>each check does</strong>, <strong>understand their code</strong>, and <strong>resolve bugs related to specific checks</strong>(<em>like indentation, Javadoc, block checks,</em> etc). I will also be looking to <em>add tests while resolving these bugs</em>.</p><h3>How you can get involved and start contributing to Checkstyle?</h3><ol><li>Before getting started, you should <strong>first set up your development environment</strong> and <strong>clone the Project locally</strong>. You can follow this<a href="https://checkstyle.org/beginning_development.html"> <strong>documentation</strong></a>. You can clone the project from the <a href="https://github.com/checkstyle/checkstyle"><strong>Github repository</strong></a>. Also, join the <strong>community channel on Gitter</strong> and <strong>the mailing list</strong>, as you can <strong>ask for help if you face issues</strong> while contributing.</li><li><strong>After you set up the project</strong>, I would suggest you<strong> either install the jar file for Checkstyle</strong> from <a href="https://checkstyle.org/cmdline.html#Download_and_Run"><strong>here</strong></a> or you can <strong>install the Checkstyle extension for your IDE</strong>(check <a href="https://checkstyle.org/index.html#Related_Tools_Active_Tools"><strong>this</strong></a><strong> </strong>out). <br><strong>If you install the jar file</strong> then you can <em>play around</em> with this Project using the <strong>CLI</strong>(<em>which is easier</em>)or if you <strong>installed the IDE extension</strong> then you can use it in your IDE.</li><li>Read the <a href="https://checkstyle.org/index.html"><strong>documentation</strong></a>(<em>to know more about the tool and also you can get answers to your questions/doubts there most of the time</em>) and go through some <strong>beginner-friendly issues</strong> by filtering issues according to <em>issue labels</em> on Github.</li><li><strong>Keep contributing</strong> and <strong>exploring the tool</strong> by picking up different types of issues.</li><li><strong>Checkstyle </strong>has<strong> </strong>a number of <strong>CI tests</strong> that <strong>run tests</strong> on your <strong>PR branch</strong>. So, <em>if some of these tests fail</em>, you can have a <strong>look at the logs</strong> that are generated or you can also <strong>ask for help</strong> on the <strong>Gitter channel</strong>.</li></ol><p>Another thing that I would suggest is to <em>look up similar issues to what you are working on</em> and have a <em>look at the PRs for those issues</em>. This would <em>help you a lot to understand</em> what you have <strong>to do in those issues</strong>. The <em>mentors/maintainers</em> of the organization are <em>super helpful</em> and <em>supportive</em> and have been maintaining this Project actively.</p><p>You can also watch this <a href="https://youtu.be/bc9lLJ2opxg"><strong>video</strong></a>, to understand more about <strong>how to get started</strong> and <strong>contribute to Checkstyle.</strong></p><p>This was all about my <strong>journey so far</strong> contributing to <strong>Checkstyle</strong> and I am going to share more about it as <strong>I keep contributing and learning different stuff</strong>, in the <strong>next part of this blog post</strong>.</p><p>So stay tuned for this!!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F12062047&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fback-to-the-future-to-be-continued-goodbye-bye-later-gif-12062047&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2F24b9673bbfad3b29df0afe5dd0f6b1ca%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8d268f8a3cf141514f13554219e5b64/href">https://medium.com/media/a8d268f8a3cf141514f13554219e5b64/href</a></iframe><p>Thanks for reading and feel <strong>free to share this post</strong> with others if they want to <strong>get started contributing to Open-source</strong>.</p><blockquote><em>Feel free to reach out to me:<br></em><a href="https://twitter.com/DevanshYtweets"><strong><em>Twitter</em></strong></a><strong><em><br></em></strong><a href="https://www.linkedin.com/in/devansu-yadav/"><strong><em>Linkedin</em></strong></a><strong><em><br></em></strong><a href="https://github.com/Devansu-Yadav"><strong><em>Github</em></strong></a><strong><em><br></em></strong><a href="https://studentambassadors.microsoft.com/en-US/profile/101972"><strong><em>Student Ambassador Profile</em></strong></a><strong><em><br></em></strong><em>Or if you feel more comfy to mail, I am glad you can write here too<br></em><a href="mailto:Devansu.Yadav@studentambassadors.com"><strong><em>Devansu.Yadav@studentambassadors.com</em></strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=283673cb989d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple Guide to Publishing and maintaining a Python Package on PyPI]]></title>
            <link>https://medium.com/theleanprogrammer/a-simple-guide-to-publishing-and-maintaining-a-python-package-on-pypi-f36d45917c14?source=rss-e22c3b1419d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f36d45917c14</guid>
            <category><![CDATA[python-packages]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Devansu Yadav]]></dc:creator>
            <pubDate>Wed, 21 Apr 2021 05:39:36 GMT</pubDate>
            <atom:updated>2021-04-21T05:39:36.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D3DxNsb0VYM5dhDE0466pg.png" /></figure><p>Python has a lot of built-in libraries which we use so frequently.</p><blockquote>According to me, the best thing about Python is that it is built as an Open Source Software and many of the Python libraries/packages are also Open source, which means anyone can view the source code and contribute to these libraries.</blockquote><h4><strong>What if you wanted to contribute your Python Package so that everyone can use it?</strong></h4><p>Well, it’s simple and that’s what I am going to share with you in this Blog.</p><p>First of all,</p><h3><strong>What is PyPI?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kYZj9IwMLFN9SxEh_ho2bA.png" /></figure><p>The <strong>Python Package Index</strong> (<strong>PyPI</strong>) is a repository of software for the Python programming language. <strong>PyPI</strong> helps you find and install software developed and shared by the Python community.</p><p>You might be familiar with the <strong>‘pip’</strong> command in Python. It is basically used to install different libraries created by the community from PyPI, which you can use in your Python apps.</p><p>For Eg:-</p><pre>pip install tensorflow</pre><h3><strong>What is a Package in Python?</strong></h3><p>A Package in Python is nothing but a <strong>Library</strong> consisting of <em>different modules (files) and other sub-packages</em>.</p><p>Now let’s look at the steps for publishing your Python Package on PyPI -</p><h3><strong>STEP 1: Creating all the files for your Package</strong></h3><p>In this blog, I am going to take my Package ‘<strong>turtle_conics</strong>’ as an example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9wZY5J8S7UQACz-RbWfWw.png" /><figcaption>Files for my Package</figcaption></figure><p>First, we will have to create a folder (You can create one anywhere but here I have created it on Desktop for my convenience) (for <strong>Windows/Mac/Linux distros</strong>) with <strong>the same name as you want for your Package</strong>. So for me, it’s ‘<strong>turtle_conics</strong>’. Next, create a folder inside this folder with the exact same name that you gave to the Folder created just now.</p><p>List of Files required to be created:</p><p><em>1) __init__.py file<br>2) Source Code Files<br>3) setup.py file<br>4) License.txt file<br>5) README.md</em></p><p>Project structure for my Package</p><pre>turtle_conics/<br>│<br>├── turtle_conics/<br>│   ├── __init__.py<br>│   ├── all_curves.py<br>│<br>├── LICENSE.txt<br>├── README.md<br>└── setup.py</pre><p><strong>1) __init__.py file:</strong></p><p>The <strong>__init__.py</strong> file is required to make Python treat directories with this file as a <strong>Package</strong>.</p><p>So now inside the folder that we just created inside my Desktop folder(for you it can be in a different location), we need to put the<strong> __init__.py</strong> file. You can keep this file empty as I did.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0-yrF0GekCFrKK1NqE0asw.png" /></figure><p><strong>2) Source Code files:</strong></p><p>Now inside the same folder where we placed our __init__.py file, we can place all the source code files (Python Files).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EgiDsGWLJr2ltb3AIHlWzQ.png" /></figure><p><strong>3) setup.py file</strong>:</p><p>The setup.py file contains information about your package that <strong>PyPi</strong> needs, like its <strong>name</strong>, a <strong>description</strong>, the <strong>current version</strong>, etc. We will look directly into a real simple setup.py here:</p><pre>import setuptools<br><br><br>with open(&quot;README.md&quot;, &quot;r&quot;) as fh:<br><br>    long_description = fh.read()<br><br><br>setuptools.setup(<br><br>    name=&quot;Your Package name&quot;, # Replace with your package name<br><br>    version=&quot;version_no&quot;,<br><br>    author=&quot;Your name&quot;,<br><br>    author_email=&quot;Your email id&quot;,<br><br>    description=&quot;Description of your Python package&quot;,<br><br>    long_description=long_description,<br><br>    long_description_content_type=&quot;text/markdown&quot;,<br><br>    url=&quot;Link to your Github repo for your Package&quot;,<br><br>    packages=setuptools.find_packages(),<br><br>    classifiers=[<br><br>        &quot;Programming Language :: Python :: 3&quot;,<br><br>        &quot;License :: OSI Approved :: MIT License&quot;,<br><br>        &quot;Operating System :: OS Independent&quot;,<br><br>    ],<br><br>    python_requires=&#39;&gt;=3.6&#39;,<br><br>)</pre><p>Most of the options are self-explainable, you can just copy the content of <strong>setup.py</strong> above and modify it as you need.</p><blockquote>Please remember to list all <strong>dependencies of your package</strong> in a list and place it below ‘classifiers’ [just like there is the requirement for Python version there] or click <a href="https://python-packaging.readthedocs.io/en/latest/dependencies.html#packages-not-on-pypi"><strong>here</strong></a>, so that these requirements can be installed automatically while your package is being installed.</blockquote><p><strong>4) License File</strong></p><p>A License File is highly recommended for any <strong>Open source project</strong> so you can choose any <strong>License</strong> according to you and save the file as <strong>License.txt</strong>.</p><p>For licenses check <a href="https://choosealicense.com/"><strong>here</strong></a>.</p><p><strong>5) README.md File</strong></p><p>Almost every Open-source Project has a <strong>README.md</strong> file explaining the <em>Package/Project</em>. Hence this file is highly recommended if you want other people to understand your Project. It can be used to describe all the <strong>features/functionalities</strong> or implementation of your Project.</p><p>This is how the README for my package looks like on <strong>PyPI </strong>-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2EkRMO99iQuwQIJLQKgTHQ.png" /></figure><p><strong>NOTE</strong>:- Save the file as <strong>README.md</strong> and not as .txt.</p><p>For creating this file you can use text editors like <a href="https://code.visualstudio.com/docs/languages/markdown#_markdown-preview"><strong>Visual Studio Code</strong></a> or you can use other Online text editors.</p><p>Now after you are ready with the <strong>License.txt file</strong>, <strong>README.md</strong>, and <strong>setup.py</strong> file, place all the three files inside the Desktop folder(for you it may be some other folder).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9wZY5J8S7UQACz-RbWfWw.png" /></figure><h3><strong>Step 2. Create a PyPi account</strong></h3><p>If you already have a <strong>PyPi</strong> account (and still remember your username/password, of course), you can skip this step. Otherwise, please go to the <a href="https://pypi.org/">PyPi homepage</a> and register a new account instantly (for free, of course).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iswby37M8IJc_DMlg_wtKA.png" /></figure><h3><strong>STEP 3: Time to upload your Package on PyPI</strong></h3><p><strong>Generating Distribution archives(wheel file): </strong>These are archives to be uploaded on PyPI for uploading the Package.</p><p>Make sure you have the latest versions of setuptools and wheel installed:</p><pre>python3 -m pip install — user — upgrade setuptools wheel</pre><p>Now for <strong>Windows OS</strong> open the <strong>Folder</strong> for your Package and click on the <strong>Top address bar</strong> and type <strong>cmd</strong>. This will open the Windows Command Prompt at that Folder path.</p><p>If you are on <strong>Mac/Linux</strong> just open the <strong>Desktop folder</strong> for the Package and <strong>Right-click</strong> and Select -&gt; <strong>New Terminal at Folder</strong> or just open your <strong>Terminal</strong> on <strong>Mac/Linux</strong> and using cd provide the path to this folder.</p><p>Now, if you are on <strong>Windows,</strong> type the following command on cmd :-</p><pre>python setup.py sdist bdist_wheel</pre><p>Else if you are on <strong>Mac/Linux,</strong> type the following command:-</p><pre>python3 setup.py sdist bdist_wheel</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xc2Kfw5wjDFLljCtzgz6tQ.png" /><figcaption>Generating distribution archives for my Package (on Windows)</figcaption></figure><p>This command should output a lot of text and once completed should generate two files in the dist directory, among others in build and *.egg-info folder:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tVpVk0CMzUmB47fPYjK--g.png" /><figcaption><strong>The “dist” Folder</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUOhvmWRdMlyHfu_FWrYpw.png" /><figcaption><strong>The “build” folder</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZ9YHItYysTYNU0-Ut75_Q.png" /><figcaption><strong>The “*.egg-info” folder</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8_fqxDZIrTh0UxhHxGPP4w.png" /><figcaption><strong>Check Package availability for different Python versions</strong></figcaption></figure><blockquote><strong>Note:-</strong> Make sure that the correct version of python “<strong>py3</strong>” is mentioned in this line in the output when you run python setup.py sdist bdist_wheel (for Windows) or python3 setup.py sdist bdist_wheel (for Mac/Linux distros). If it&#39;s “<strong>py2</strong>” then the module will install only in <strong>python2.x</strong> and not in <strong>python3.x.</strong></blockquote><p><strong>Uploading Distribution archives:</strong></p><p>Now it’s time to upload the distribution archives that we generated in the previous step.</p><p>For this open <strong>cmd</strong>(<strong>For Windows</strong>) and <strong>Terminal</strong>(<strong>for Mac/Linux</strong>) at the same Folder path as we did in the <strong>previous step</strong> and type the following command:-</p><pre>twine upload dist/*</pre><blockquote><strong>NOTE</strong>:-Make sure to install twine using pip install twine , as we will be uploading our package distribution archives using this tool.</blockquote><p>Then enter the <strong>username</strong> and then <strong>password</strong>, the password will not show as you type. so just type it and hit enter,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkgJJBjFTdzlnu2UtE7_-w.jpeg" /></figure><p>Great!👏 Now we have uploaded the Package on PyPI so now go to the website and under your projects check your Package.</p><h3><strong>Installing your package:</strong></h3><p>Now that we have uploaded our package on PyPI, let’s try to install it using pip just like we do for installing other <strong>modules/packages</strong>.</p><pre>pip install &lt;<strong>your package name&gt;</strong></pre><p>**Replace &lt;your package name&gt; with the name of the Python package that you just uploaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IGbCii5k0ltuQ_xHsO5SuA.png" /><figcaption>Installing the Package:)</figcaption></figure><h3><strong>Updating your Package</strong></h3><p>If you want to release a <strong>new version</strong> for your package where you may have made some changes to your code, then first change the <strong>version</strong> for your package in the <strong>setup.py</strong> file. Now your setup.py file should look like this:-</p><pre>import setuptools<br><br><br>with open(&quot;README.md&quot;, &quot;r&quot;) as fh:<br><br>    long_description = fh.read()<br><br><br>setuptools.setup(<br><br>    name=&quot;Your Package name&quot;, # Replace with your package name<br><br>    version=&quot;latest_version_no&quot;, <strong>&lt;-</strong> <strong>#Enter latest version no</strong><br><br>    author=&quot;Your name&quot;,<br><br>    author_email=&quot;Your email id&quot;,<br><br>    description=&quot;Description of your Python package&quot;,<br><br>    long_description=long_description,<br><br>    long_description_content_type=&quot;text/markdown&quot;,<br><br>    url=&quot;Link to your Github repo for your Package&quot;,<br><br>    packages=setuptools.find_packages(),<br><br>    classifiers=[<br><br>        &quot;Programming Language :: Python :: 3&quot;,<br><br>        &quot;License :: OSI Approved :: MIT License&quot;,<br><br>        &quot;Operating System :: OS Independent&quot;,<br><br>    ],<br><br>    python_requires=&#39;&gt;=3.6&#39;,<br><br>)</pre><p>Now recreate the <strong>wheel file</strong> by:</p><p><strong>For Windows:-</strong></p><pre>python setup.py sdist bdist_wheel</pre><p><strong>For Mac/Linux:-</strong></p><pre>python3 setup.py sdist bdist_wheel</pre><p>And then type the following command:</p><pre>twine upload --skip-existing dist/*</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1dfShPlp-elmrcQThhu8aQ.jpeg" /><figcaption>Uploading latest Package distribution archive by skipping older versions</figcaption></figure><p>And that’s it!! I hope this was helpful and be sure to ask in the comments if you have any doubts.</p><p>You can check out my <strong>Python Package</strong> <a href="https://pypi.org/project/turtle-conics/"><strong>here</strong></a><strong>.</strong></p><p>Also, I would love to hear about your suggestions on my blog posts or any improvements that I can make.</p><blockquote>Feel free to reach out to me:<br><a href="https://twitter.com/DevanshYtweets"><strong>Twitter</strong></a><strong><br></strong><a href="https://www.linkedin.com/in/devansu-yadav/"><strong>Linkedin</strong></a><strong><br></strong><a href="https://github.com/Devansu-Yadav"><strong>Github</strong></a><strong><br></strong><a href="https://studentambassadors.microsoft.com/en-US/profile/101972"><strong>Student Ambassador Profile</strong></a><strong><br></strong>Or if you feel more comfy to mail, I am glad you can write here too<br><a href="mailto:Devansu.Yadav@studentambassadors.com"><strong>Devansu.Yadav@studentambassadors.com</strong></a></blockquote><p>Happy Coding :)</p><p>Don’t forget to follow <a href="https://medium.com/theleanprogrammer">The Lean Programmer Publication</a> for more such articles, and subscribe to our newsletter <a href="https://tinyletter.com/TheLeanProgrammer">tinyletter.com/TheLeanProgrammer</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f36d45917c14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theleanprogrammer/a-simple-guide-to-publishing-and-maintaining-a-python-package-on-pypi-f36d45917c14">A Simple Guide to Publishing and maintaining a Python Package on PyPI</a> was originally published in <a href="https://medium.com/theleanprogrammer">TheLeanProgrammer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Learn by Doing” | My Crio.do Experience]]></title>
            <link>https://devansuyadav.medium.com/learn-by-doing-my-crio-do-experience-5ca00116bbc5?source=rss-e22c3b1419d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ca00116bbc5</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[learn-by-doing]]></category>
            <dc:creator><![CDATA[Devansu Yadav]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 12:53:22 GMT</pubDate>
            <atom:updated>2021-01-26T12:53:22.454Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7MWQJ5ijrh9N1OXwZF6K4w.png" /></figure><p>If you have just started to learn <strong>Technology</strong>, then you might have heard this from a lot of developers:</p><blockquote>Learn by Doing! Build what you learn! Build projects/ make an Open Source contribution!</blockquote><p>And it&#39;s <strong>absolutely true</strong>! Learning without <strong>practicing</strong> or without <strong>implementing</strong> can only give you some <strong>theoretical knowledge</strong> and you would not gain <strong>practical knowledge</strong> which is very crucial if you want to become a Developer👨‍💻!</p><h4>Let me share with you something about myself:-</h4><blockquote>I am a CS Undergrad and I am really interested in Web and Mobile Development. I have worked with Python(absolutely ❤ it ) and built projects using Python.</blockquote><p>Since I was looking to learn different technologies that are used for Web development I came across this amazing program called “<strong>Crio Winter of Doing</strong>” organized by <strong>Crio.do</strong>. I got really excited about this opportunity and decided to register for this program.</p><blockquote>It is India’s largest Tech Externship Program for developers!<br>It is a one-of-a-kind program focussed onbringing together budding engineering talent to work on challenging projects for the most exciting startups in the country.</blockquote><p>This program has <strong>3</strong> stages: <strong>Warm-Up</strong>, <strong>Preparation</strong>, and <strong>Externship</strong><br>You can check out more about this program <a href="https://www.crio.do/crio-winter-of-doing/"><strong>here</strong></a><strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i2LX17mCfjAebxtS8bnKrw.png" /></figure><p>Recently, we completed the <strong>1st</strong> stage of this program: <strong>Warm-Up</strong>.<br>Since this was the first stage we started learning about the pre-requisites needed for <strong>Web Development</strong> like <strong>HTTP</strong>, some basic understanding of <strong>REST APIs</strong>. We also learned about essential <strong>Linux commands</strong>, <strong>Version Control using Git</strong>, and hosting websites/applications on <strong>AWS</strong> through <em>hands-on</em> learning modules called <strong>“Bytes”</strong> which were provided to us by <strong>Crio</strong>.</p><p>Let me share with you some of the things that I learned in Stage-1!</p><h3><strong>1. HTTP</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_-1GEyzpIi5COw4eSiNfg.jpeg" /></figure><p>We know that <strong>HTTP</strong> stands for <strong>HyperText Transfer Protocol</strong>. <br>But what exactly is <strong>HTTP</strong>? It is a <strong>set of rules</strong> for querying the web🤓. <br>Next up, we learned about what are <strong>HTTP requests</strong>.</p><p><strong>HTTP requests</strong> are requests made by our <strong>browser</strong> to <strong>access web pages</strong> or to <strong>fetch some content</strong> like <strong>images</strong>, <strong>text</strong>(content on a web page). So when you enter a <strong>website URL</strong>, the browser creates an <strong>HTTP Request</strong> on your behalf and sends it to the server on which the website is hosted.</p><p>The HTTP response from the server is read by the <strong>browser</strong> and rendered for us beautifully as <strong>web pages</strong> instead of the raw HTML returned.</p><p>Here’s an example:-</p><ol><li>Visit a website using its <strong>URL</strong> and <strong>Open the Chrome Developer Tools</strong>(<em>Right-click and Inspect/Ctrl + Shift + i</em>).</li><li>Now select the <strong>Network tab</strong> and refresh the web page to start recording Network activity for that page.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*6FPPUJSjynxyFwbfesw8wg.png" /><figcaption><strong>List of HTTP Requests</strong></figcaption></figure><p>As you can see these are some of the <strong>HTTP requests</strong> that your browser makes for fetching the content of a website.</p><p>Now, when you click on one of these requests, you can see different parts of that HTTP request like <strong>Request URL</strong>, <strong>Request</strong> and <strong>Response Headers</strong>, <strong>HTTP method</strong> for the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*6z4yDmkLL_Maw5d6kB-CGQ.png" /><figcaption><strong>Details of an HTTP Request</strong></figcaption></figure><p>Some of the <strong>HTTP methods</strong> that we learned:-</p><blockquote><strong>GET</strong>:- <strong>GET</strong> requests are used to <strong>“get”</strong> resources from a <strong>server</strong> and <strong>not modify any data</strong> on the server.<br><strong>POST</strong>:- <strong>POST</strong> requests are used to <strong>send some data</strong> to the <strong>server</strong>. For eg: Submitting a form, making a post on Linkedin/Facebook.<br><strong>PUT</strong>:- <strong>PUT</strong> requests are used to <strong>update data</strong> on the <strong>server-side</strong>. For eg: Updating profile data on Linkedin/Twitter.<br><strong>DELETE</strong>:- <strong>DELETE</strong> requests are used to <strong>delete</strong> some data on <strong>servers</strong>. For eg: Deleting a post/comment.</blockquote><p><strong>HTTP Status Codes</strong>:-<br><strong>HTTP Status codes</strong> are a part of the <strong>HTTP Response</strong>. It helps the <strong>client</strong>(browser) understand what happened to the request.</p><p>Some of the <strong>HTTP status codes</strong> include:-</p><blockquote><strong>2xx family</strong>:- The status codes <strong>200–299</strong> signifies the <strong>HTTP request</strong> was successfully received &amp; understood by the server. For eg:- <strong>200</strong> (Successful request)<br><strong>3xx family</strong>:- This family of status codes <strong>denotes that further action</strong> must be taken to complete the <strong>HTTP request</strong> made.<br><strong>4xx family</strong>:- This family of <strong>status codes</strong> tell us that there was an <strong>error</strong> in the HTTP request sent by the <strong>browser</strong>(client).</blockquote><h3><strong>curl and Postman</strong>:-</h3><p><strong>curl</strong> is like a <strong>web-browser</strong>, but for the <strong>command line</strong>. Using curl we can make <strong>HTTP requests</strong> just like our browser does! You can also get information about the <strong>HTTP requests</strong> just like how we use the <strong>Chrome Developer Tools</strong>.</p><p><a href="https://www.postman.com/"><strong>Postman</strong></a> is an awesome tool used to test or build your <strong>APIs</strong>/<strong>HTTP requests</strong>. At the end of the <strong>HTTP module</strong>, we created a simple <strong>HTTP request</strong> over a <strong>TCP connection</strong>(using <strong>Telnet</strong>).</p><h3>2. <strong>REST API</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*naGgW8et5rF1sqJSkqBM5g.jpeg" /><figcaption><strong>API- Application Programming Interface</strong></figcaption></figure><p>First of all, what is an <strong>API</strong>?<br>- <strong>API</strong> stands for <strong>Application Programming Interface</strong>.<br>- <strong>APIs</strong> are basically some <strong>functionality</strong>/<strong>data</strong>/<strong>feature</strong> that you want in your <strong>application</strong>/<strong>code</strong> that you have built. For this, you make an <strong>API call</strong>/<strong>request</strong> to fetch that data/use that functionality/feature in your code.</p><p>A <strong>REST API</strong> is an <strong>API</strong> that follows the <strong>REST</strong> architecture and follows a <strong>client-server</strong> model. (You can read more about the <strong>REST</strong> architecture<strong> </strong><a href="https://www.geeksforgeeks.org/rest-api-architectural-constraints/"><strong>here</strong></a><strong>.</strong>)</p><blockquote>The various components of a <strong>REST API</strong> request include the <strong>Request URL</strong>(using which the browser makes the request), <strong>Request Method</strong>(like <strong>GET</strong>, <strong>POST</strong>, <strong>PUT</strong>), <strong>Request Headers</strong>(eg:- <strong>accept</strong>, <strong>accept-encoding</strong>), <strong>Request Body</strong>.</blockquote><p>Now, after completing this Byte, we learned how to make an <strong>API request</strong> and I actually made a tweet on Twitter using my Linux Terminal by making an API request to <strong>Twitter’s API</strong> (which was super awesome!). (Here’s a link to the tweet I made using the <a href="https://twitter.com/DevanshYtweets/status/1349617077506760704"><strong>terminal</strong></a>!)</p><h3>3. <strong>LINUX</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*TqTCIw7Z3WOFQD1gG35OfA.jpeg" /></figure><p><strong>Linux</strong> runs almost everything these days from smartwatches, laptops, Cars to <strong>servers in Cloud</strong>, anything, you name it.</p><p>The <strong>Linux Terminal</strong> is a really powerful and productive tool for a developer if you are working with <strong>different files</strong>, <strong>navigating files</strong>/<strong>CRUD operations</strong>, <strong>data analysis</strong>, <strong>running/creating scripts</strong> for different tasks like automation, working with <strong>curl</strong>, and much more!</p><blockquote>In this byte, we learned about the <strong>power of Linux</strong> by learning about different Linux commands to <strong>navigate</strong>, <strong>create</strong>, <strong>copy</strong>, <strong>rename</strong>, <strong>read</strong>, <strong>write</strong>, <strong>update</strong> and <strong>delete</strong> files and directories in Linux.</blockquote><p>We also learned about some utility commands like “<strong>grep</strong>”, “<strong>awk</strong>” and different operators like the Pipe operator “<strong>|</strong>”, the redirection operator “<strong>&gt;</strong>”.</p><p>We also learned about “<strong>cron</strong>” jobs which are used to schedule the execution of a script. I also learned about <strong>Bash scripts</strong> and created a simple Bash script to analyze data from the logs generated by an app through a Fun activity which was conducted during this program by Crio.</p><h3>4. <strong>AWS and Git</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*kHu1UqhK0lTbZnXGtgjyRA.png" /></figure><p>The <strong>Amazon Web Service</strong> or <strong>AWS</strong> is a <strong>cloud hosting platform</strong> for hosting websites or apps using a <strong>virtual private server</strong>.</p><p>We learned <strong>how to host an app</strong> on <strong>AWS</strong> by hosting a Food delivery app(QEATS) on the <strong>AWS ec2 server</strong> by creating an <strong>ec2 instance</strong>, <strong>deploying the backend server</strong> for the app, and then connecting it to the ec2 instance. (You can check out AWS <a href="https://aws.amazon.com/"><strong>here</strong></a><strong>.</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*O6Ctpj-GYyLCsdbVNQ2cxw.png" /></figure><p><strong>Git</strong> is a <strong>Local Version Control System</strong> used to <strong>manage</strong>/<strong>track files</strong> while working on a project. (You can check out my Blog on different Git commands <strong>here</strong>)</p><p>Next up, we learned about <strong>cloning a Git repo</strong>, <strong>adding changes</strong>, <strong>pushing</strong>, and <strong>pulling changes</strong> using different Git commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*tfZNHRVv4F37lGJhsoi3gg.png" /><figcaption><strong>Git Architecture and different commands</strong></figcaption></figure><p>We also learned about <strong>merge conflicts</strong> that occur when you are trying to <strong>push changes</strong> to a <strong>branch</strong> that is not in <strong>sync with your forked repo</strong>. We learned about how to handle these conflicts as well!</p><h3>5. <strong>HTML and CSS</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CrKCqZQB6yQ2Sh-GtdGzqA.jpeg" /></figure><p><strong>HTML</strong>, <strong>CSS</strong>, and <strong>Javascript</strong> are the key components for building the <strong>Front-End</strong> or the <strong>UI</strong> of any website.</p><p>The content that you see on any webpage is displayed using <strong>HTML</strong> and is styled using <strong>CSS</strong> to make a webpage look beautiful and attractive! <br><strong>Javascript</strong> is used to make <strong>webpages responsive</strong> and <strong>dynamic</strong> by accessing <strong>HTML elements</strong> and rendering them in a specific way.</p><p>In the HTML byte, we learned about basic <strong>HTML</strong> tags like <strong>&lt;head&gt;</strong>, <strong>&lt;body&gt;</strong>, <strong>&lt;p&gt;</strong>, <strong>&lt;i&gt;</strong>, <strong>&lt;a&gt;</strong>.</p><p>Next up, we learned how to style <strong>HTML elements</strong> using CSS.</p><p>We also learned about the <strong>CSS Box model</strong> which is how we visualize an <strong>HTML element</strong> as a <strong>rectangular region</strong> and different properties like <strong>margin</strong>, <strong>padding</strong>, <strong>border</strong>, <strong>height,</strong> and <strong>width</strong> for that element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*00ATxRpHqnHRiqB1fCU5Jg.png" /><figcaption><strong>CSS Box Model</strong></figcaption></figure><p>We can automatically arrange HTML elements according to the <strong>screen size</strong>(for <strong>mobile</strong> or <strong>desktop</strong>) using <strong>CSS Flexbox</strong>. We make an element a “<strong>flex container</strong>” and then set different properties like “<strong>flex-wrap</strong>”, “<strong>flex-direction</strong>”, “<strong>justify-content</strong>” for arranging elements in a specific manner.</p><p>We also learned how to <strong>position elements</strong> in CSS using the “<strong>position</strong>” property.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FXypz32SSqmZDY2cKBMxgA.png" /><figcaption><strong>Full-stack Development</strong></figcaption></figure><blockquote>After completing these Bytes we also got to experience <strong>Full-stack web development</strong> by working on a guided project where we got to learn different aspects of a Full-stack web application like <strong>Front-End</strong>, <strong>Back-End</strong>, deploying each component on different platforms like <strong>Netlify</strong> and <strong>Heroku</strong>, and then connecting the <strong>two components</strong> i.e <strong>Front-End</strong> and <strong>Back-End</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*ns22IcY0yTL_wj0atDWQwQ.png" /><figcaption><strong>Heroku and Netlify</strong></figcaption></figure><p>I got to learn a lot about these different technologies by implementing the knowledge in the 1st stage of this program. I thoroughly enjoyed the “learn by doing” approach and I am really excited about the 2nd stage of this program!</p><p>Do follow me on <a href="https://medium.com/@devansuyadav"><strong>Medium</strong></a> where I will be talking about <strong>Mobile</strong> and <strong>Web Development</strong>, Machine Learning, Computer Vision, and much more!</p><p>You can connect with me:- <a href="https://www.linkedin.com/in/devansu-yadav/"><strong>Linkedin</strong></a><strong> </strong>or<strong> </strong><a href="https://twitter.com/DevanshYtweets"><strong>Twitter</strong></a><br>Check out my projects on -<strong> </strong><a href="https://github.com/Devansu-Yadav"><strong>Github</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ca00116bbc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Useful Git Commands that can help you in your Open Source Journey‍]]></title>
            <link>https://medium.com/techphantoms/useful-git-commands-that-can-help-you-in-your-open-source-journey-905535306c3e?source=rss-e22c3b1419d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/905535306c3e</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Devansu Yadav]]></dc:creator>
            <pubDate>Tue, 06 Oct 2020 04:55:14 GMT</pubDate>
            <atom:updated>2020-10-06T04:55:14.595Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*zlheUdnbPhfQYOb2bs45ew.png" /></figure><p>It’s almost that time of the year when Open Source enthusiasts, Developers, and Tech enthusiasts from different communities from all over the world participate in a month-long Open Source Fest. Yes I am talking about the Hacktoberfest 🤩</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pefZhp9ZI-89sE2wvnn_fQ.jpeg" /></figure><p>The <a href="https://hacktoberfest.digitalocean.com/"><strong>Hacktoberfest</strong></a> is an amazing platform for everyone, whether you are a Developer, an Open Source Enthusiast, or if you are a Beginner who wants to begin his Open Source journey👨‍💻.</p><p>Now if you are looking to contribute to Open Source😍 then you must have some working knowledge about <strong>Git/Github</strong>.</p><p>You might have heard about Git but if you haven’t it is a <strong>Version Control System</strong> that is used to manage/track your files in a Project that you are working on or if you are contributing to one.</p><p><em>So using Git and Github we can easily manage files, track changes to different files, manage workflows in a Project, and much more. That’s why they are such an important tool when working on Open Source Projects.</em></p><h3>Setting up our Git Repository</h3><p>Let’s make a Git Repository and learn about some useful Git commands😀.</p><p>Let’s start by creating a folder where we can have different files like a text file, an Excel Database file, a Markdown File, a Folder consisting of Source Code files(An actual Project may have many different files).</p><p>But right now for simplicity&#39;s sake let’s keep these files empty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TrKE-26eqD8pVlcoYPKt9w.png" /></figure><p>We can use Git Bash to write Git commands or we can also use VS Code which has built-in support for Git. You can install Git <a href="https://git-scm.com/downloads"><strong>here</strong></a> or you can check out this <a href="https://code.visualstudio.com/docs/editor/versioncontrol#:~:text=You%20can%20create%20and%20checkout,tags%20in%20the%20current%20repository."><strong>link</strong></a> to know how to work with Git in Vs Code. If you are using Git for the first time do <a href="https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup"><strong>check this</strong></a> out to know how to set up Git Bash.</p><p>Now let’s open Git Bash by Right-clicking and selecting “Git Bash here”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idcMBIDPlC47Zu9B82D3ZA.jpeg" /></figure><ol><li><strong>Initializing our Git Repository</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8iq4d4WL_NC6CPQmUY2sw.png" /></figure><p>Here we are initializing our Git Repository or you can say we are making our directory a Git Repository.</p><blockquote><strong>NOTE:-</strong>If you already have made a Git Repository then don’t use this command again else all the changes that you have made to this Repository will get re-initialized.</blockquote><p>2.<strong> Staging Files Initially</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eftmn5H0tEEnoBrBm7brFw.jpeg" /></figure><p>We are staging these files initially so that now we can now track them using Git.</p><p>3.<strong> Creating Initial Commit</strong></p><p>Let’s make our Initial Commit to our Repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*Nb2D7iKygLM3PJvH5t7F9w.jpeg" /></figure><p>Now let’s take a look at some of the useful Git commands for merging branches, forking a Repository, Renaming, and Deleting files using the command line, and much more.</p><h3><strong>Git Commands</strong></h3><ol><li><strong>git diff</strong></li></ol><p>We had already staged our files initially <strong>above</strong> and made our initial commit.</p><p>Now suppose I modify a file say “Test.txt” and save it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Zk48_Su0VsERtSkymdVlg.png" /></figure><p>Let’s run the “<strong>git status”</strong><em> </em>command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*lGWfDOjTClfGlzyBxJP6Pg.jpeg" /></figure><p>As you can see it shows that we have modified that file. Now let’s run the <strong><em>“git diff ”</em></strong> command and see what happens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*OKplBgI6P_-5te1wyJEW7g.jpeg" /></figure><p>Here using the <strong><em>“git diff ”</em></strong> command we are actually comparing this file “Test.txt”(modified file) which is in our <strong>current working directory</strong> with the same file which we had staged earlier(i.e in the <strong>Staging Area</strong>).</p><h4>So using this command we can come to know what modifications did we do in any file in our current Working Directory with the same file in Staging Area.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m5oC0TiNPPmEyjA6Dfs_CA.png" /></figure><blockquote>Here as you can see the ‘+’ symbol denotes the changes that we made in that file(in our Working Directory) and ‘-’ denotes the content in the file in the Staging Area.</blockquote><h4>This command is not just limited to comparing two files, we can compare two branches as well.</h4><p>2.<strong> git diff — staged</strong></p><p>This command is used to know the difference between the files in the previous commit and the current Staging Area.</p><p>To understand this in detail let’s modify a few files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2u1O5DztMVRMFHCCpWpSjg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fr9FY8yTpZzfmBvnbbmcdw.png" /></figure><p>Now let’s stage these files and run the <strong><em>“git diff — staged ”</em></strong> command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*9MkEhR70zjK545PM9wfbHA.jpeg" /></figure><blockquote><em>As you can see it shows us the difference between these files in the previous commit and the changed version of these files in the staging area(currently staged but committed).</em></blockquote><p>This can be helpful to review the previous commit and make necessary changes to any file.</p><p>3.<strong> Renaming and Deleting any file using Git Bash</strong></p><blockquote><em>Deleting/Renaming files can be a bit confusing and sometimes tedious especially if your Git Repository has a lot of files and folders because you would have to then stage all the files as well😥.</em></blockquote><p>A cleaner and efficient way 😊to do this would be to use the following Git commands:-</p><p><strong>Renaming a File</strong></p><pre><strong>git mv &lt;filename&gt; &lt;newfilename&gt;</strong><br># &lt;filename&gt; is name of your file you want to rename.<br># &lt;newfilename&gt; is name you want to give to your file.</pre><p><strong>Deleting a file</strong></p><pre><strong>git rm &lt;filename&gt;</strong></pre><p>Using these commands we can easily <strong>Rename/Delete</strong> any file in our Repository and the changes would also be <strong>staged automatically by Git</strong> so you wouldn’t have to worry about staging these changes😍.</p><p>4.<strong> Syncing Forks in Git and Github</strong></p><blockquote>The World of Open Source Development is really active because so many developers contribute to different Open Source Projects.</blockquote><p>So if you are contributing to an Open Source Project then Syncing your forked Repository with the Original Repository becomes really important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SCjxyg0kE2Zz0jdmvUQx2Q.png" /><figcaption><strong>Git Workflow for syncing Forks</strong></figcaption></figure><p>Suppose you already have a <strong>Forked Repository</strong>(on <strong>Github</strong>) which you want to sync with the <strong>Original Repository</strong>(from which you forked).</p><p>If you haven’t cloned the Forked Repo on your Local machine then just use the following command:-</p><pre><strong>git clone https://github.com/&lt;Username&gt;/&lt;Repository-name&gt;.git &lt;filename&gt;</strong><br># filename: It is the name of file/folder for the Cloned Repository on your Local Machine.</pre><p>Now we will add the Original repository as a <strong>remote repository(upstream)</strong>:-</p><pre><strong>git remote add upstream</strong> <strong>https://github.com/&lt;Owner&gt;/&lt;Repository&gt;.git<br></strong># add the original repository as remote repository called &quot;upstream&quot;</pre><p>Now we will fetch the changes from the<strong> upstream repository</strong>:-</p><pre><strong>git fetch upstream<br></strong>#<strong> </strong>Fetch the branches and their respective commits from the upstream repository.</pre><p>We will now switch to the <strong>master </strong>branch of the <strong>fork’s local repo</strong> and merge the changes in the <strong>upstream repo</strong> to the <strong>local repo’s master branch</strong>:-</p><pre><strong>git checkout master<br></strong># switch to the master branch of your fork&#39;s local repo</pre><pre><strong>git merge upstream/master<br></strong># Merge the changes from <strong>upstream/master</strong> into your local <strong>master</strong> branch.</pre><p>This brings your <strong>fork’s local repo</strong> in sync with the<strong> Original repository😄</strong>.</p><p><strong>However, if you also want to update the forked repo on Github then you would have to push the master branch (or the branch in which you merged the changes of the upstream repo).</strong></p><pre><strong>git push origin master<br></strong># origin: forked repository on Github</pre><p>And boom!! Your Forked Repo on Github is also now synced with the Original Repo😄.</p><p>That’s it from me guys, hope I was able to make it simple for everyone😃 and be sure to ask in the comments if you have any doubt. I’d love to answer them!😊</p><p>Do share the post if you like it👍</p><p>Feel free to reach me out!</p><p><a href="https://www.linkedin.com/in/devansu-yadav/">LinkedIn</a><br><a href="https://github.com/Devansu-Yadav">GitHub</a></p><p>Happy Coding!!😊</p><p>All the Best for the Hacktoberfest👍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=905535306c3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/techphantoms/useful-git-commands-that-can-help-you-in-your-open-source-journey-905535306c3e">Useful Git Commands that can help you in your Open Source Journey👨‍💻</a> was originally published in <a href="https://medium.com/techphantoms">TechPhantoms</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>