<?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 Lakshya Thakur on Medium]]></title>
        <description><![CDATA[Stories by Lakshya Thakur on Medium]]></description>
        <link>https://medium.com/@lakshyathakur?source=rss-ffc0906df621------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*WlWQZqcoGWH3mS4F</url>
            <title>Stories by Lakshya Thakur on Medium</title>
            <link>https://medium.com/@lakshyathakur?source=rss-ffc0906df621------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 18:39:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lakshyathakur/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[Performance Analysis : NextJS Script Component for Google Analytics]]></title>
            <link>https://blog.stackademic.com/performance-analysis-nextjs-script-component-for-google-analytics-2045a541a429?source=rss-ffc0906df621------2</link>
            <guid isPermaLink="false">https://medium.com/p/2045a541a429</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Lakshya Thakur]]></dc:creator>
            <pubDate>Wed, 01 Nov 2023 13:47:44 GMT</pubDate>
            <atom:updated>2023-11-03T01:01:50.103Z</atom:updated>
            <content:encoded><![CDATA[<h3>Performance Analysis: Next.js Script Component for Google Analytics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fydtykvN4UPmWq_ybpFDaA.png" /></figure><h3>Introduction</h3><p>One of the things when using the NextJS ecosystem that hasn&#39;t yet clicked for me is their Script component.</p><p><a href="https://nextjs.org/docs/pages/building-your-application/optimizing/scripts">Optimizing: Scripts</a></p><p>I have been running some experiments on how I can leverage it for the Google Analytics script like gtag.js.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*zMs1SZ5cD8jVm7ga.gif" /></figure><h3>Experiment — The Setup</h3><p>There are two types of deployment involved here:-</p><ul><li><strong>Gtag-Standard</strong> — This one uses the _document.tsx file where we are loading the standard script tags with the async attribute as recommended by <a href="https://developers.google.com/tag-platform/gtagjs/install#add_the_google_tag_to_your_website">Google</a>.</li></ul><pre>  import { Html, Head, Main, NextScript } from &quot;next/document&quot;;<br><br>  const Document = () =&gt; {<br>    return (<br>      &lt;Html&gt;<br>        &lt;Head&gt;<br>          {/* Global site tag (gtag.js) - Google Analytic */}<br>          &lt;script<br>            async<br>            src=&quot;https://www.googletagmanager.com/gtag/js?id=G-2VSQZMZCY6&quot;<br>          &gt;&lt;/script&gt;<br>          &lt;script<br>            dangerouslySetInnerHTML={{<br>              __html: `window.dataLayer = window.dataLayer || []; function gtag()<br>                     {dataLayer.push(arguments)}<br>                     gtag(&#39;js&#39;, new Date()); gtag(&#39;config&#39;, &#39;G-2VSQZMZCY6&#39;);`,<br>            }}<br>          &gt;&lt;/script&gt;<br>        &lt;/Head&gt;<br>        &lt;body&gt;<br>          &lt;Main /&gt;<br>          &lt;NextScript /&gt;<br>        &lt;/body&gt;<br>      &lt;/Html&gt;<br>    );<br>  };<br>  export default Document;</pre><ul><li><strong>Gtag-NextJS</strong> — This one uses the index.tsx file where we are loading the Script tags with the afterInteractive strategy.</li></ul><pre>  import Script from &quot;next/script&quot;;<br><br>  const Home = () =&gt; {<br>    return (<br>      &lt;main className=&quot;h-screen flex items-center justify-center&quot;&gt;<br>        &lt;h1&gt;Google Analytics Test&lt;/h1&gt;<br>        &lt;&gt;<br>          &lt;Script<br>            id=&quot;google-analytics-init&quot;<br>            dangerouslySetInnerHTML={{<br>              __html: `<br>            window.dataLayer = window.dataLayer || []; function gtag()<br>            {dataLayer.push(arguments)}<br>            gtag(&#39;js&#39;, new Date()); gtag(&#39;config&#39;, &#39;G-2VSQZMZCY6&#39;);`,<br>            }}<br>          /&gt;<br>          &lt;Script<br>            id=&quot;google-analytics&quot;<br>            src={`https://www.googletagmanager.com/gtag/js?id=G-2VSQZMZCY6`}<br>          /&gt;<br>        &lt;/&gt;<br>      &lt;/main&gt;<br>    );<br>  };<br><br>  export default Home;</pre><p>Note — Both of the deployments use the pages router setup.</p><p>I referred to the following two resources on how to load the gtag script.</p><ul><li><a href="https://nextjs.org/docs/messages/next-script-for-ga#possible-ways-to-fix-it">NextJS Docs</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_m64JyomtgFLNu6P" /></figure><ul><li>next/third-parties — <a href="https://github.com/vercel/next.js/blob/1caa58087a428666bb14d40dbc159b9a768b075d/packages/third-parties/src/google/gtm.tsx">Google Tag Manager</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0VOaKdQE4u6jh9BB" /></figure><h3>Experiment — The Execution</h3><p>I ran both of the deployments through the webpagetest’s Visual comparison test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s7r46qUNQa5eXwzu" /></figure><p>This was done <strong>10 times</strong> so that we get a good enough sample space.</p><h3>First Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R3dINNgPCjDniIL7" /></figure><h3>Second Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h8hp5_QceZ7Q2hNu" /></figure><h3>Third Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pToEijxrnqJoQo_n" /></figure><h3>Fourth Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r1O-Y8atQhydfMfN" /></figure><h3>Fifth Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YZZOybxxqJ773EOS" /></figure><h3>Sixth Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OZY7QsrGTwbK9zH3" /></figure><h3>Seventh Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ssS41GRio-Zvl3SY" /></figure><h3>Eight Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ymkp6fSwKKaz9K7a" /></figure><h3>Ninth Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0xnymopRNUOmNdpc" /></figure><h3>Tenth Run</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lh9Ryecd3jFSoYPM" /></figure><h3>Observations</h3><p>From all the above runs, there were two interesting bits that I want to highlight specifically:-</p><ul><li><strong>CPU Busy Time </strong>— This has been <strong>consistently lower</strong> for the Gtag-Standard deployment.</li><li><strong>Total Blocking Time (TBT</strong>) — This has been <strong>frequently lower</strong> for Gtag-Standard deployment but maybe with more runs this metric averages out to be the same for both the deployments.</li></ul><h3>Resources</h3><h4>Deployment Urls</h4><ul><li><strong>Gtag-NextJS</strong> — <a href="https://gtag-nextjs-script.vercel.app/">https://gtag-nextjs-script.vercel.app</a></li><li><strong>Gtag-Standard</strong> — <a href="https://gtag-nextjs-script.vercel.app/">https://gtag-standard-script.vercel.app</a></li></ul><h4>Webpagetest runs</h4><ul><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_AiDc17_7QY,231101_BiDc4K_7SX</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_AiDcSM_7YZ,231101_BiDcMY_813</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_BiDcP6_81F,231101_BiDcJ0_81G</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_BiDcQ9_821,231101_BiDcNP_822</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_AiDcTG_80M,231101_AiDcVS_80P</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_BiDcXA_82N,231101_BiDcCV_82P</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_BiDcH0_830,231101_AiDcPV_818</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_AiDc2E_81E,231101_AiDcMT_81F</a></li><li><a href="https://www.webpagetest.org/video/compare.php?tests=231101_BiDcS6_7AR,231101_BiDc6Q_7AV">https://www.webpagetest.org/video/compare.php?tests=231101_AiDcHT_81S,231101_BiDc8G_83C</a></li></ul><h3>Conclusion</h3><p>The whole point of this experiment was to evaluate if <strong>using NextJS Script</strong> tags, we would get better performance scores when loading Google Analytics JavaScript. But that didn’t happen. More or less they are on par with the standard ones. The standard script tag delays the <strong>load</strong> event and the NextJS Script tag starts after the <strong>load</strong> event. In either case, I believe, <a href="https://web.dev/articles/script-evaluation-and-long-tasks#what_is_script_evaluation">Script Evaluation</a> (of gtag.js) contributes to the <strong>TBT</strong> metric. I thought maybe loading the gtag script after the browser load event might result in lower TBT but that&#39;s not how it works.</p><p>Again, I am curious about the best way to load such analytics scripts. They are essential for users but contribute to <strong>poor scores for Mobile</strong> performance audits. Feel free to let me know if there are<strong> incorrect assumptions or gaps</strong> in how the above experiment was done.</p><p>Thank you for your time :)</p><h3>Stackademic</h3><p><em>Thank you for reading until the end. Before you go:</em></p><ul><li><em>Please consider </em><strong><em>clapping</em></strong><em> and </em><strong><em>following</em></strong><em> the writer! 👏</em></li><li><em>Follow us on </em><a href="https://twitter.com/stackademichq"><strong><em>Twitter(X)</em></strong></a><em>, </em><a href="https://www.linkedin.com/company/stackademic"><strong><em>LinkedIn</em></strong></a><em>, and </em><a href="https://www.youtube.com/c/stackademic"><strong><em>YouTube</em></strong></a><strong><em>.</em></strong></li><li><em>Visit </em><a href="http://stackademic.com/"><strong><em>Stackademic.com</em></strong></a><em> to find out more about how we are democratizing free programming education around the world.</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2045a541a429" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/performance-analysis-nextjs-script-component-for-google-analytics-2045a541a429">Performance Analysis : NextJS Script Component for Google Analytics</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[More than just code ]]></title>
            <link>https://lakshyathakur.medium.com/more-than-just-code-4f2a1f5ea3f8?source=rss-ffc0906df621------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f2a1f5ea3f8</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[planning]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Lakshya Thakur]]></dc:creator>
            <pubDate>Fri, 22 Jan 2021 13:13:56 GMT</pubDate>
            <atom:updated>2021-01-22T13:13:56.164Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently I had to implement the following design within 2 days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kduoGmbaTLTK-gza24GQxA.png" /></figure><p>Features to be implemented :-</p><h4>1) List:</h4><p>✓ 20 most popular movies/TV shows. <br>✓ 20 most trending movies/TV shows.<br>✓ 20 newest movies/TV shows.<br>✓ 20 highest rated movies/TV shows.</p><h4>2) Allow:</h4><p>✓ Type of media — movies/TV shows. <br>✓ Genre.<br>✓ Year (from and to).<br>✓ Rating.</p><h4>3) Allow API searching by movie/TV show title.</h4><p>The data needed to be fetched through <a href="https://www.themoviedb.org/"><strong>t</strong></a><strong>hemoviedb</strong> APIs and it was up to me to make this through any UI framework or vanilla JS as I wanted.</p><p>I chose React for this because that’s what I am comfortable with.</p><p>Now the 2 days duration might urge one to straight away dive into coding and start with creating components, layouts and that fancy CSS altogether since we only have to consume APIs right ?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FgnE4FFhtFoLKM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FgnE4FFhtFoLKM%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FgnE4FFhtFoLKM%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b64e69c20806f44be197532ad746d35/href">https://medium.com/media/3b64e69c20806f44be197532ad746d35/href</a></iframe><p>Over the past year and so, in my job, I have been spending some time to plan out requirements, document some stuff, think about design or so before actually implementing it. And that’s what I wanted to bring into my open source project development as well.</p><p>It’s easy to get the things done in development but getting things done in a beautiful way, I think, is an art in itself. I wish to explore and learn more of that art as a software engineer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*J2a_h8h_M4jovkUYZzBqWg.gif" /></figure><p>So for this particular use case, I decided to plan out few things even if I get less time to write code.</p><p>The first step was to understand the API endpoints and the shape of data that they returned. For this, I read the <a href="https://developers.themoviedb.org/3">API documentation</a> and surprisingly , even though there were some categories and filters to take care of, it really boiled down to the following 5 endpoints :-</p><p><strong>- Discover endpoint</strong> : For popular, newest and top rated movies as well as filters for all of them.<br><strong>- Trending endpoint</strong> : For the trending movies. No filters for these one. <br>-<strong> Search endpoint</strong> : To search movies or tv shows. No filters for these one.<br>-<strong> Genre endpoint </strong>: To retrieve the genre list for movie/tv shows.<br>-<strong> Image endpoint </strong>: To retrieve the images for movie/tv shows.</p><p>Now, this identification does help but as I dive into code later, I wouldn’t want to go to the API doc again and again to refer the request endpoints and their query parameters.</p><p>This is where <a href="https://www.postman.com/">Postman</a> comes in. I don’t know all the capabilities it offers but one that I like in particular is the ability to create <a href="https://www.postman.com/collection/">Collections</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ye0_YVa8uJhLUro_YNkNeg.png" /></figure><p>As I ended up grouping all the requests I will be making, inside the <strong>Discover</strong> <strong>Collection</strong>, it became clearer to me that my url formation at the UI side will be very dynamic and change according to category or filter selected.</p><p>The above realization wouldn’t have come had I straight away dived into coding !!</p><p>With the API stuff sorted out now, the next thing was to think about the <strong>state</strong> at the UI side.</p><p>If I dived in without planning, I am sure I would have ended with a lot of <strong>useState</strong> and <strong>prop drilling</strong> scenarios and possibly <strong>if else if else …..</strong> which eventually I would have to refactor but the journey would make me go like :-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*FDyZFoTR4twXNbhDg3StXw.gif" /></figure><p>Good that we planned !!!</p><p>By observing the UI design and the API endpoints, there was this conclusion to have a global state. The structure of which would essentially be this :-</p><pre><br>state: {<br> category: &#39;Popular&#39;,<br> filter: {<br>    genre: &#39;Action&#39;,<br>    mediaType: &#39;movie&#39;,<br>    fromYear: &#39;1900&#39;,<br>    toYear: &#39;2021&#39;,<br>    rating: &#39;5&#39;,<br> },<br> list: []<br>}</pre><p>And this worked because it made sense according to the research until now. The <strong>filter</strong> options apply to 3 <strong>categories</strong> we have and each of the update to either of them really updates the <strong>list</strong> with new data from the API.</p><p>All this effort took half of the first day and I was left with 1 and a half day. Eventually it all worked out (with responsiveness included although it wasn’t the requirement) and with decent code quality I was able to implement the features that were planned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*BgcdFhF3By2_yKrGCjsvKA.gif" /></figure><p>For those interested, here is the source code :-</p><p><a href="https://github.com/lapstjup/discover-tmdb">lapstjup/discover-tmdb</a></p><p>The final UI available at <a href="https://discover-tmdb.netlify.app/">https://discover-tmdb.netlify.app/</a> looks like :-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*i9uOBIoya3O6pFp1vNIAMw.gif" /></figure><p>P.S. — Post the 2 day deadline, I have also implemented some integration tests with APIs which allowed me to explore <a href="https://mswjs.io/">msw</a> which is another cool library which makes testing APIs a lot easier and fun.</p><p>Thank you for your time :D !!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f2a1f5ea3f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 mistakes of my internship]]></title>
            <link>https://lakshyathakur.medium.com/3-mistakes-of-my-internship-893433dae68e?source=rss-ffc0906df621------2</link>
            <guid isPermaLink="false">https://medium.com/p/893433dae68e</guid>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[ownership]]></category>
            <category><![CDATA[mistakes]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Lakshya Thakur]]></dc:creator>
            <pubDate>Mon, 10 Aug 2020 07:02:02 GMT</pubDate>
            <atom:updated>2022-10-13T20:14:02.325Z</atom:updated>
            <content:encoded><![CDATA[<h3>mistakes of my internship</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*1eC1wtk0Ve-Lzyg1XZjjDQ.jpeg" /><figcaption>Well since Dark isn’t going anywhere from my mind, let’s use symbolism!</figcaption></figure><p>Hey everyone!! I hope you’re doing well. Today I felt like sharing something which changed the way I used to think about software engineering and networking in general.</p><p>I learnt at least 3 ways to not do things from my internship experience (2017 from May to July).</p><p>Let’s quickly dive into them:-</p><h4>❌ <strong>Backing out of the given task without giving it my all: —</strong></h4><p>I was asked to make some automation code for headless browser and deploy it using Docker. I was very interested in Python at that time. There was scope of using Python for achieving this whole thing. But I hit a blocker where not much was available on Google. The blocker code was in Perl. My mentor also gave me a dry run of what possibly the code might be doing. But in my mind, I had already quit this task. There was this strong bias to create something which I can show at my college as a full stack project. I communicated my thoughts to my mentor and though he wasn’t happy with my decision he re-assigned me to other person who has done Django and can takeover from there.</p><h4>❌ <strong>Not understanding what software engineering is : —</strong></h4><p>I was asked to create a Kanban Task Manager (this happened iteratively) with following features :-</p><ul><li>User Profiles (Registration, Login and Profiles)</li><li>Task with priority, date, privacy , tagging people/groups etc.</li><li>Three segregations for Todo, In Progress and Done with drag and drop support.</li><li>Editing the task, deleting the task and each task can have comments from users with permissions to view it.</li><li>Connections requests and notifications.</li></ul><p>For a person with no knowledge of web development, this was a lot but thanks to the iterative nature of requirements, I was hooked and in the end developed the project as per requirement.</p><p>Though I regretted backing out from initial task, I was proud of what I achieved in span of 45 days. But I don’t remember a single bit of it now!!!</p><p>And there was a simple reason.</p><p>My process of developing the project was really bad. I did follow tutorials to develop a mock library app and then jumped to make my project from scratch but all the problems I encountered were fulfilled by endless copy paste of code from the Internet with me using stuff as blackbox. There was no real retention of concepts and just ad hoc software development !</p><h4>❌ <strong>Not networking with other people : —</strong></h4><p>I am an introvert. But I am better than before. During that time, I failed to talk to anyone and network with them. This is the dumbest thing I did.</p><h4><strong>Luckily I realized all the above 3 things as mistakes and didn’t repeat them since my career started.</strong></h4><h4><strong>Now I want to have : —</strong></h4><p><strong>✅ Ownership of tasks.</strong></p><p><strong>✅ A defined process of software engineering.</strong></p><p><strong>✅ Networking with people to learn from them and give back whenever possible to the community.</strong></p><p>I am still a work in progress like anyone. I still sometimes struggle on the aspects discussed but I am clear on what not to do if I want to move ahead.</p><h4><strong>My father says : —</strong></h4><blockquote><strong>“You will laugh at few things 3 years from now just like you laugh at your internship experience . Learning is gradual but rewarding experience”.</strong></blockquote><h3>Thank you for your time 😁.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=893433dae68e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[THIS WORKS!!!]]></title>
            <link>https://lakshyathakur.medium.com/this-works-d0c3df773eb0?source=rss-ffc0906df621------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0c3df773eb0</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[side-project]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Lakshya Thakur]]></dc:creator>
            <pubDate>Sun, 21 Jun 2020 11:45:06 GMT</pubDate>
            <atom:updated>2020-06-22T17:29:14.377Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi there!! Hope you’re doing well. Recently, I shared a side project of mine which was very well received by the community at <strong>LinkedIn</strong>.</p><p><a href="https://www.linkedin.com/posts/lakshya-thakur_algorithm-datastructure-javascript-activity-6676518334600740864-L2lv">Lakshya Thakur on LinkedIn: #algorithm #datastructure #javascript | 147 comments</a></p><p>I call it <strong>Graphisual </strong>🤷😅🤔💡🤯😎<strong>.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Ff8ZB_ZW2otw%3Fstart%3D5%26feature%3Doembed%26start%3D5&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Df8ZB_ZW2otw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Ff8ZB_ZW2otw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce5cf13ba3ab1e52313c24cb2d588238/href">https://medium.com/media/ce5cf13ba3ab1e52313c24cb2d588238/href</a></iframe><p>It’s a web application that lets the end users <strong>draw graphs</strong> and <strong>visualize</strong> <strong>algorithms</strong> on them. It’s something I wanted to create for some time after getting inspired from <strong>Clement Mihailescu</strong>, founder of <strong>AlgoExpert</strong> and instigator of visualization based software projects that are a rage now a days 🔥🔥.</p><p>Frankly speaking, the idea was <strong>overwhelming</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*Q7bgqZjf7-ZHg1d2" /></figure><p>And I needed to get past this overwhelming stuff jumbling around in my head. There was only one thing that I could do now…..</p><p><strong>ABANDON THIS IDEA!!!!!!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*KBVkg7NyxBJ9mYni.jpg" /></figure><p>Nope can’t do that. That would be injustice to my idea. So I didn’t do that. Instead I was able to build it. And building it was <strong>unpredictable</strong> and <strong>exciting</strong>.</p><p>So I want to take you through my thought process in the form of a dialogue exchange between my <strong>brain</strong> and my <strong>creativity</strong> for a span of <strong>14 days</strong> which let me bring the idea to realization.</p><p>Here is how it goes:-</p><p><strong>Brain</strong>: So what should we do?</p><p><strong>Creativity</strong>: Well we can always start it.</p><p><strong>Brain</strong>: Start it?? But how??</p><p><strong>Creativity</strong>: Ummm..let’s see. We know required basics of <strong>JavaScript</strong>, <strong>React</strong>, some amount of <strong>CSS</strong> and <strong>HTML</strong>. So the tech stack required to make this is already there. We will skip the configuration part by using <strong>create-react-app</strong> cli and jump to the development directly.</p><p><strong>Brain</strong>: Ok well done!!!! Now what???</p><p><strong>Creativity</strong>: Well, do we know how to draw a circle in a web application? I mean we know it’s possible using <strong>canvas</strong> and <strong>svg </strong>but we have absolutely zero knowledge of those two<strong>. </strong>But I want to draw circles even without them, just to see, if I can utilize the <strong>mouse events</strong> to draw a circle and move it. Yup we can totally do that with <strong>position:relative</strong> and <strong>position:absolute </strong>magic!!!</p><blockquote>After giving this some time, first eureka moment, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Brain</strong>: Okay okay calm down <strong>Einstein!! </strong>That’s just first part of the puzzle and its not even implemented the way it should be.</p><p><strong>Creativity</strong>: I know the dirty css trick is not what we want to carry forward. I am ready now to learn about <strong>svgs</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*_tEyCuXIMg1I2h8v.png" /></figure><p><strong>Creativity</strong>: Let’s combine our knowledge of <strong>mouse events </strong>and <strong>svgs</strong> to get a clear structure of our <strong>graph nodes</strong>.</p><blockquote>After giving this some time, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Creativity</strong>: I am quite satisfied with them now. Let’s move ahead.</p><p><strong>Brain</strong>: What’s ahead???</p><p><strong>Creativity</strong>: EDGES!!!!😭😭😭</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zqrou9J7QtAiVzdv.jpg" /></figure><p><strong>Brain</strong>: Okay breathe in!!!!BREATHE!!DAMN IT!!</p><p><strong>Creativity</strong>: Let’s see what we can do. Let’s go ahead with an ad hoc data structure to achieve the drawing of edges.</p><p><strong>Brain</strong>: But why ad hoc??? Don’t you want to explore the representation of graphs using an appropriate data structure???</p><p><strong>Creativity</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*Q1ioNup1Vpt19KWS.jpg" /></figure><p><strong>Brain</strong>: Okay enough of that. Let’s get to work and draw edges like a boss!!!</p><blockquote>After giving this some time, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Brain</strong>: Well we have something in here. Don’t we??</p><p><strong>Creativity</strong>: YUP YUP YUP!!! We are getting close to our idea.</p><p><strong>Brain</strong>: Okay don’t get so excited!! Even though this works, have you given a thought to whether this data structure can help us achieve our end goal?</p><p><strong>Creativity</strong>: <strong>Absolutely!!!</strong> We are going to nail this. We are going to na.. We are goi.. We.. <strong>WAIT</strong>!!! Nope, this will not work at all. We ought to change this brain!!</p><p><strong>Brain</strong>: Oh thank god for that!! Yes we need something that we studied back in our college days.</p><p><strong>Creativity</strong>: Uhhhhhhhhhhhhhhhhhh…..</p><p><strong>Brain</strong>: <strong>ADJACENCY LIST</strong>!!</p><p><strong>Creativity</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/0*04q6bVJrBg2qR6__.jpg" /></figure><p><strong>Creativity</strong>: Okay let’s do it💪💪!!!</p><blockquote>After giving this some time and realizing that we also need to change our event delegation technique, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Brain</strong>: Good Going there. You made two necessary improvements!!</p><p><strong>Creativity</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*VcyhZk9ZBvmsu0Hg.jpg" /></figure><p><strong>Brain</strong>: Sigh. Okay back to work. Now our nodes move, we can draw edges (<strong>directed and undirected</strong>). Now we need to take care of the coordinates of these edges when the nodes move.</p><p><strong>Creativity</strong>: Ahh you are right. That’s going to be a lot of code and conditions!!</p><p><strong>Brain</strong>: Definitely!!! I won’t wait to think for most optimized solution here. Because I can think of none. Go with your gut and do what’s best to implement it.</p><blockquote>After giving this some time, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Creativity</strong>: Hey brain. Thanks for trusting my instincts back there. I am feeling happy to see parts of our idea come to its realization now.</p><p><strong>Brain</strong>: It surely is a dopamine hit!!! But you know what?? This looks so bland right now. I think it’s time we setup some <strong>CSS</strong> and make this appealing.</p><p><strong>Creativity</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*a4uNyuha05dpMc3v.jpg" /></figure><blockquote>After giving this some time and fixing breaking changes due to css, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Brain</strong>: Wow this doesn’t look so dull now!!</p><p><strong>Creativity</strong>: Totally!! This is getting better and better now. But there is still a lot of visual fixes we need to make. Our node labels are sometimes overlapped by the edges because the edges intersect at center of these nodes.</p><p><strong>Brain</strong>: Yeah I know that sucks!! Frankly speaking, I am not aware of the math required to help us out here and also this svg stuff is very new to me.</p><p><strong>Creativity</strong>: Don’t you worry. I know just the person. The person’s name is <strong>OVERFLOW. STACK OVERFLOW</strong>!!</p><p><strong>Brain</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q8vNOmkxW9afMuG_.png" /></figure><blockquote>After taking help from our beloved Stack Overflow, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Brain</strong>: Man this <strong>Stack Overflow</strong> person is something else alright!!!</p><p><strong>Creativity</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*ow1_zSZLtfuwQ5QH" /></figure><p><strong>Creativity</strong>: So now we can draw nodes, draw edges, move nodes and everything works the way we want. Our data structure and event delegation strategy will ease some of the tasks ahead i.e. <strong>Deletion of nodes and deletion of edges</strong>.</p><p><strong>Brain</strong>: <strong>Alright!!</strong> You’re getting the hang of it now. <strong>Breaking your goal into smaller achievable goals</strong>. Let’s do this!!</p><blockquote>After giving this some time and still struggling with the logic, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Creativity</strong>: Man I am getting all fired up!! Also once we achieve the next thing, basically our graph implementation would be covered.</p><p><strong>Brain</strong>: You’re right. It’s <strong>day 10</strong> today. We now have to take care of <strong>adding</strong> <strong>weights</strong> to our edges. Probably we can click on the edge and something pops up to let us add a weight to it. Are you thinking what I am thinking? MOD…</p><p><strong>Creativity</strong>: MODAL!!!!</p><p><strong>Brain</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/0*ffiFN78bL6TWqZ6n" /></figure><p><strong>Creativity</strong>: Oops sorry!! I get carried away. Okay let’s do it now.</p><blockquote>After giving this some time and struggling lesser than before, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Creativity</strong>: Hey brain, our graph implementation is complete dude!!!!</p><p><strong>Brain</strong>: Great work mate. I am proud of you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*6Bnj8QM_xRWiy-iT" /></figure><p><strong>Creativity</strong>: Awww thanks. I am proud of you too. We will start with visualization tomorrow. I think I am going to let this all sink in!!!</p><p><strong>Brain</strong>: Yeah right!!! Man if only you were less attached to the results. Sigh!</p><blockquote>After a day of feeling accomplished.</blockquote><p><strong>Creativity</strong>: Psst hey brain!! You ready for the next part?</p><p><strong>Brain</strong>: Obviously. It’s visualization time!!</p><p><strong>Creativity</strong>: Since I don’t know much about graph algorithms, I think I am going to implement just the basics for now.</p><p><strong>Brain</strong>: So <strong>BFS Traversal</strong>, <strong>DFS</strong> <strong>Traversal</strong> and <strong>Dijkstra Pathfinding Algorithm </strong>?</p><p><strong>Creativity</strong>: Dijkstra is basic???? Man what a drag!!</p><p><strong>Brain</strong>: Yup we need an algorithm to take advantage of our weighted graphs don’t we?? BFS and DFS will just do for unweighted.</p><p><strong>Creativity</strong>: Ohh yess!! Well then let’s get going.</p><blockquote>After implementing algorithms by getting stuck in infinite loops and debugging and struggling with Dijkstra, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Brain</strong>: Now our algorithms work, we just need to visualize them. Probably let’s take reference from how Clement did it in his pathfinding visualizer tutorial on youtube.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FmsttfIHHkak%3Fstart%3D1773%26feature%3Doembed%26start%3D1773&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DmsttfIHHkak&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FmsttfIHHkak%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b0931cfa73d1b68403b454702c8139c/href">https://medium.com/media/9b0931cfa73d1b68403b454702c8139c/href</a></iframe><p><strong>Creativity</strong>: Yeah this is really helpful. We will just make few tweaks to suit our requirements. Thanks for this Clement. Let’s do it brain. We are so close!!!!</p><blockquote>After taking help from Clement’s code and making few final additions, <strong>THIS WORKS!!!</strong></blockquote><p><strong>Creativity</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*_lK37P6k9wLNPgeu.gif" /></figure><p><strong>Brain</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*pLrHs51tveaOsR_0.gif" /></figure><p>Well as you can see, we finally achieved our end goal here after a span of <strong>14 days</strong>.</p><p>Does building this suddenly make me an expert in algorithms or web applications in general??</p><p><strong>HECK NO!!!</strong></p><p>There always is a lot to learn and I am sure projects much better than this already exist or are coming soon in the future.</p><p>What’s important is that I <strong>STARTED. </strong>I did feel sometimes that this is leading to nowhere but I stood <strong>ADAMANT</strong>.</p><p>And because I started and stood adamant, <strong>THIS WORKS!!!</strong></p><h3><strong>Thank you awesome person who took time to read this!!</strong></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0c3df773eb0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>