<?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 Kunal Yadav on Medium]]></title>
        <description><![CDATA[Stories by Kunal Yadav on Medium]]></description>
        <link>https://medium.com/@yadavkunal780?source=rss-dabe4b4308e5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JT6Qh_BGxGd_wTwpMIBMWA.jpeg</url>
            <title>Stories by Kunal Yadav on Medium</title>
            <link>https://medium.com/@yadavkunal780?source=rss-dabe4b4308e5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 00:38:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yadavkunal780/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[Code is a Liability: Why My Best Work Is What I Delete]]></title>
            <link>https://medium.com/@yadavkunal780/code-is-a-liability-why-my-best-work-is-what-i-delete-142c7bc00e72?source=rss-dabe4b4308e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/142c7bc00e72</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Sun, 26 Jul 2026 17:06:46 GMT</pubDate>
            <atom:updated>2026-07-26T17:06:46.953Z</atom:updated>
            <content:encoded><![CDATA[<p>I used to equate productivity with lines of code. If a Pull Request had 500 lines changed, I felt productive. If it had 50, I felt like I hadn’t done enough.</p><p>I was wrong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JpXrF9mImlryIL3ntemKRA.png" /><figcaption>It illustrates the difference between “bloated” infrastructure and a “clean” system, incorporating elements like GCP, Terraform, and a decreasing maintenance cost curve.</figcaption></figure><p>In enterprise environments, where complexity is the default, code is a liability, not an asset. Every function, every if/else block, and every infrastructure resource you provision is a tax you pay in future maintenance, testing, and debugging.</p><p>Over the last few months, I’ve shifted my focus from building to <em>deleting</em>. Here is how I’m applying the principle of “less is more” across both infrastructure (Terraform) and application code (Java).</p><h3>1. Infrastructure: From “Conditional Chaos” to “Map Logic”</h3><p>In GCP, I used to struggle with managing environment-specific configurations. I had nested conditionals for every bucket, service account, and API URL. It was fragile and a nightmare to update.</p><p>The Before:</p><pre># This creates clutter and is hard to scale<br>resource &quot;google_storage_bucket&quot; &quot;dev_bucket&quot; {<br>  count = var.env == &quot;DEV&quot; ? 1 : 0<br>  name  = &quot;dev-data-bucket&quot;<br>}<br><br>resource &quot;google_storage_bucket&quot; &quot;prod_bucket&quot; {<br>  count = var.env == &quot;PROD&quot; ? 1 : 0<br>  name  = &quot;prod-data-bucket&quot;<br>}</pre><p>The After (The Deletion): I refactored this into a simple map structure. By deleting the conditional bloat, the logic became declarative and infinitely scalable.</p><pre>variable &quot;function_enabled&quot; {<br>  type    = map(number)<br>  default = {<br>    DEV  = 1<br>    IACC = 1<br>    EACC = 0<br>    PROD = 1<br>  }<br>}<br><br>resource &quot;google_storage_bucket&quot; &quot;this&quot; {<br>  for_each = { for k, v in var.function_enabled : k =&gt; v if v == 1 }<br>  name     = &quot;${lower(each.key)}-data-bucket&quot;<br>}</pre><p>Result: I deleted 30+ lines of redundant code and replaced them with a single, readable resource block.</p><h3>2. Java Application: Eliminating Hardcoded Configuration</h3><p>In our Java microservices, I often see developers hardcoding environment variables or API endpoints deep within the business logic. It makes the application rigid and creates huge obstacles for cross-environment deployments.</p><p>The Before:</p><pre>// Inside the Service class<br>public String getHvpApiUrl() {<br>    if (environment.equals(&quot;DEV&quot;)) {<br>        return &quot;https://dev-api.worldline.com&quot;;<br>    } else if (environment.equals(&quot;IACC&quot;)) {<br>        return &quot;https://iacc-api.worldline.com&quot;;<br>    }<br>    // ... more lines of rigid checks<br>}</pre><p>The After (The Deletion): I removed the if/else logic entirely. By leveraging Spring Boot’s @Value annotation or externalized configuration (injected via GKE ConfigMaps/Secrets), I pushed the environment awareness to the <em>runtime configuration</em>, not the code.</p><pre>@Service<br>public class HvpService {<br>    @Value(&quot;${HVP_ADAPTOR_SERVICE_API_URL}&quot;)<br>    private String apiUrl;<br><br>    public void callApi() {<br>        // Use apiUrl directly. No logic, no branches, just injection.<br>    }<br>}</pre><p>Result: The code doesn’t care which environment it’s in. The logic is now agnostic, clean, and requires zero code changes when moving from DEV to PROD.</p><h3>The Takeaway</h3><p>The most senior thing you can do is not to write a clever algorithm, but to identify where your code is doing “work” that shouldn’t be there.</p><ul><li>Infrastructure: If you see count or if statements in your Terraform, replace them with for_each and maps.</li><li>Application: If you see hardcoded configurations, externalize them.</li></ul><p>Stop asking, “How can I make this function handle all these cases?” Start asking, “How can I remove the need for these cases to exist in the code at all?”</p><p>Code is a liability. Your goal is to keep the balance sheet as close to zero as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=142c7bc00e72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Curbside Intelligence: How Cab Apps Pick the Perfect Gate (and Why It Feels Like Magic)]]></title>
            <link>https://medium.com/@yadavkunal780/curbside-intelligence-how-cab-apps-pick-the-perfect-gate-and-why-it-feels-like-magic-b63a95e8ee66?source=rss-dabe4b4308e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b63a95e8ee66</guid>
            <category><![CDATA[curbside]]></category>
            <category><![CDATA[dsa-problem]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Wed, 01 Oct 2025 07:22:03 GMT</pubDate>
            <atom:updated>2025-10-01T07:22:03.019Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Uq8rkUbVhYEKjwsYE6MpgA.png" /></figure><p>Ever tapped your pin inside a mall or office tower and wondered how the app instantly suggests “Gate 3” or “West Entrance” instead of the main lobby? That moment feels magical because a lot of smart mapping, algorithms, and learning are working behind the scenes to pick gates where cars can legally and safely meet you.</p><p>Here’s the simple, human-friendly tour of how it all works — and why classic data structures and algorithms (DSA) are the secret sauce.</p><p>The problem (in one line) Buildings aren’t car-friendly at their center; cars need curbside entrances that are reachable, legal, and efficient.</p><p>The data that makes it possible</p><ul><li>Building footprints and outlines (from sources like OSM, city datasets, and partners)</li><li>Entrance points: doors, gates, lobbies, valet areas</li><li>Curb segments and road network: where cars can stop and move</li><li>Rules and safety: no-stopping zones, private roads, event closures</li><li>History: where pickups succeeded over time, by time of day or event</li><li>Real-time signals: traffic, police barricades, construction, congestion near entrances</li></ul><p>From your pin to a gate: the pipeline</p><p>Diagram (flowchart)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8efuiVec8gq8kUfctZfZ8A.png" /></figure><p>How the app finds entrances</p><ul><li>Geofences: If your pin lands inside a known building, the app treats it as “indoor” and looks outward for car-facing edges.</li><li>Spatial indexing: Entrances are indexed in structures like R-trees and geohash grids for fast nearby lookups.</li><li>Curb linkage: Each candidate entrance is snapped to the nearest car-touchable curb or road segment, not the building centroid.</li><li>Map-matching: Your location and the driver’s location are aligned to the road network using a Hidden Markov Model (HMM), fixing GPS drift and ensuring routes are realistic.</li><li>Legality and safety: Entrances are filtered using rules — no-stopping zones, restricted lanes, event closures, time-based regulations.</li><li>Travel feasibility: The app estimates real travel time (not straight-line distance) via A*/Dijkstra or faster preprocessed methods like Contraction Hierarchies.</li></ul><p>Ranking: choosing the best gate</p><ul><li>Fastest ETA for both you and the driver (two-sided cost)</li><li>Legal and safe stopping zones</li><li>Historical success at that gate (did rides there go smoothly?)</li><li>Real-time congestion and queuing (long valet lines? blocked curb?)</li><li>Time-of-day patterns (weekday office rush vs. weekend mall traffic)</li><li>Contextual signals (rain, major events, airport schedule waves)</li></ul><p>Learning over time</p><ul><li>Clustering: The system uses DBSCAN/HDBSCAN to cluster actual pickup locations near building edges. Stable clusters become “preferred gates.”</li><li>Feedback: If riders/partners frequently reject an entrance, it’s down-ranked.</li><li>Personalization: Over time, the app can learn which gates you prefer for recurring places (home, office, favorite mall).</li></ul><p>What you see in the app (UX choices)</p><ul><li>Clear labels: “Gate 2 (West), covered curb” instead of vague pins in the middle of a building</li><li>Fewer, better options: One top suggestion plus two backups</li><li>Explainability: Badges like “fastest,” “safest,” or “accessible ramp”</li><li>Live updates: If a gate gets congested, you’ll see an alternative in real time</li></ul><p>Edge cases the system handles</p><ul><li>Large campuses (universities, tech parks): Multiple rings of gates; internal roads vs. public ones</li><li>Airports: Dynamic signage, lanes, and time-based restrictions; heavy use of geofences and operational feeds</li><li>Hospitals and malls: Complex footprints with private roads and varying curb legality</li><li>Events and closures: Temporary rules override historical preferences</li></ul><p>A simple sequence of what happens</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eBtaSgTxmESR96-mYGDa0A.png" /></figure><p>Diagram (sequence)</p><p>Why DSA matters here</p><ul><li>Spatial indexes (R-tree, KD-tree, geohash grids) make nearby entrance lookups fast.</li><li>Graph algorithms (A*, Dijkstra, Contraction Hierarchies) power realistic routing and ETA.</li><li>Probabilistic models (HMM) fix noisy GPS by snapping to plausible roads.</li><li>Clustering (DBSCAN/HDBSCAN) turns raw pickup points into durable, trustworthy gates.</li><li>Caching and grid tiles keep responses snappy at city scale.</li><li>Streaming updates handle closures and events without lag.</li></ul><p>Putting it all together (the mental model)</p><ul><li>Your pin marks intent. The app treats it as “find a curb-facing entrance near here.”</li><li>It retrieves entrances fast via spatial indexes, then uses the road graph to test which ones cars can reach.</li><li>It scores candidates with legality, travel time, and historical success.</li><li>A lightweight ML model blends these signals to rank gates.</li><li>The UI shows a small set of great choices, and keeps adapting if the street picture changes.</li></ul><p>Bonus: a tiny conceptual flow</p><ul><li>Sense: pin, GPS, time, map state</li><li>Think: search entrances, snap to roads, score options</li><li>Learn: update clusters and ranks from outcomes</li><li>Act: suggest gates, monitor, adapt</li></ul><p>Takeaway That “Gate 3” suggestion isn’t a guess. It’s curated by spatial math, road graphs, and learned patterns from countless successful pickups — delivered in milliseconds. The next time your app recommends a gate that just works, you’ll know the curbside intelligence behind the curtain.</p><p><strong>Hands-on: try the code</strong></p><ul><li>GitHub</li></ul><blockquote>Repo: <a href="https://github.com/kunal-yadav-404/Curbside-Intelligence">https://github.com/kunal-yadav-404/Curbside-Intelligence</a></blockquote><blockquote>Files: curbside_demo.py, README.md (image is generated after run)</blockquote><p><a href="https://github.com/kunal-yadav-404/Curbside-Intelligence">GitHub - kunal-yadav-404/Curbside-Intelligence: How Cab Apps Pick the Perfect Gate (and Why It Feels Like Magic)</a></p><ul><li>Quick run (Python)</li></ul><blockquote>pip install networkx matplotlib</blockquote><blockquote>python curbside_demo.py</blockquote><blockquote>Output: ranked gates in terminal + curbside_demo.png (the route to the best gate)</blockquote><figure><img alt="Building outline, curb roads, rider pin, driver start, path to top gate." src="https://cdn-images-1.medium.com/max/1024/1*65q6yJv8OESAYyY5DLftBA.png" /><figcaption>Route to best gate</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b63a95e8ee66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying React App to Github Pages]]></title>
            <link>https://medium.com/@yadavkunal780/deploying-react-app-to-github-pages-293d93834a69?source=rss-dabe4b4308e5------2</link>
            <guid isPermaLink="false">https://medium.com/p/293d93834a69</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Kunal Yadav]]></dc:creator>
            <pubDate>Wed, 05 Jul 2023 17:12:17 GMT</pubDate>
            <atom:updated>2023-07-05T17:12:17.118Z</atom:updated>
            <content:encoded><![CDATA[<p>React App can be directly hosted from Git Repo to Github Pages.</p><p>Direct and Simple Explanation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZxl_0iuFa6L5qQ_b-Q9EA.png" /></figure><p><strong>Step 1. Push your Code to GitHub Repository</strong></p><ul><li>In your local terminal run the command</li></ul><pre>git init</pre><ul><li>Create a new GitHub repository<strong> </strong>and copy the link (follow the below snaps)</li></ul><p>Click on the below link</p><p><a href="https://github.com/new">Build software better, together</a></p><p>Give a name to your repo ex. ReactApp</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*cHeqrQFMy8WzTnPQ0ovCrQ.png" /></figure><p>Click on Create repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*-hK-hL0x4qZ1AC2Z50fYbA.png" /></figure><p>Now you will see a section named &lt;<strong>….or create a new repository on the command line &gt; </strong>one by one run all commands in your command line</p><p>Ex.</p><pre>git init<br>git add README.md<br>git commit -m &quot;first commit&quot;<br>git branch -M main<br>git remote add origin https://github.com/kunal-yadav-404/ReactApp.git<br>git push -u origin main</pre><p><strong>Step 2. Now add the GitHub Pages dependency package</strong></p><p>In your local terminal itself run the below command</p><pre>npm install gh-pages --save-dev</pre><p><strong>Step 3. Make mentioned changes in package.json file</strong></p><p>In order to bundle the react application and deploy the bundled file, in the <strong>package.json</strong> file, scroll down to the <strong>scripts</strong> property and add the following commands:</p><pre>&quot;predeploy&quot; : &quot;npm run build&quot;,<br>&quot;deploy&quot; : &quot;gh-pages -d build&quot;,</pre><p>now add a <strong>homepage</strong> property</p><pre>homepage&quot;: &quot;http://kunal-yadav-404.github.io/Calculator-React&quot;</pre><p>which follows &gt; <a href="http://{github-username}.github.io/%7Brepo-name%7D">http://{github-username}.github.io/{repo-name}</a></p><p><strong>Refer below snaps</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*2BISOemBADKjPa-_UhR-iA.png" /><figcaption>homepage property</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*bxmVazMY-wjRnJ8aqtkYUw.png" /><figcaption>predeploy and deploy</figcaption></figure><p>Now that we have made all the necessary changes, let&#39;s push the code to GitHub.</p><p>Run below commands</p><pre>git add .<br>git commit -m &quot;setup gh-pages&quot;<br>git push</pre><p><strong>Step 4. Hurray </strong>☺ ️<strong>Let’s Deploy It</strong></p><pre>npm run deploy</pre><p>Within a few minutes, you will see your deployed GitHub page link on your repository page in the Environments section</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*YZw5wJ2rprEuBQENCR0IrQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=293d93834a69" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>