<?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 Vignesh on Medium]]></title>
        <description><![CDATA[Stories by Vignesh on Medium]]></description>
        <link>https://medium.com/@vigneshnaidu006?source=rss-ec98db916a90------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*szz0d5HkajNSU0hO</url>
            <title>Stories by Vignesh on Medium</title>
            <link>https://medium.com/@vigneshnaidu006?source=rss-ec98db916a90------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 04:51:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vigneshnaidu006/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[The Hidden Problem That Makes Caching So Difficult]]></title>
            <link>https://medium.com/@vigneshnaidu006/the-hidden-problem-that-makes-caching-so-difficult-61c0f2c23df4?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/61c0f2c23df4</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 18:07:48 GMT</pubDate>
            <atom:updated>2026-10-15T18:07:48.012Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Why keeping websites fast across the world makes one simple operation surprisingly difficult.</em></p><p>Imagine changing your profile picture on a website.</p><p>You refresh the page, but the old picture is still there. You try again a few seconds later, and suddenly the new one appears.It seems like a small bug. But behind that delay is one of the most interesting problems in backend engineering: <strong>cache invalidation</strong>.</p><p>Websites use Content Delivery Networks (CDNs) to deliver images, videos, scripts, and other files quickly. But when content changes, every cached copy that matters must eventually stop serving the old version.And when those copies are spread across hundreds or thousands of servers, things become complicated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKaWjdCoqGDtmaujrXoAAA.png" /></figure><h3>1. Why Do We Need a CDN in the First Place?</h3><p>Imagine you open a website from India, but its main server is located in the United States.</p><p>Every time your browser requests an image, the request may need to travel a long distance to reach that server and bring the response back.Now imagine millions of people doing this simultaneously.The result can be slower loading times, more network traffic, and increased pressure on the main server.</p><p>A CDN solves much of this problem by storing copies of content on servers distributed across different locations. These servers are often called <em>edge servers</em>.When you request an image, the CDN can serve it from a nearby edge server instead of fetching it from the original server every time.</p><p>This is called <strong>caching</strong>.</p><p>If the requested content is already available in the cache, it’s a <em>cache hit</em>. If it isn’t available, it’s a <em>cache miss</em>, and the CDN may need to fetch it from the origin.</p><p>Simple enough, right?</p><p>The difficulty begins when the original content changes.</p><h3>2. The Problem: What Happens When Content Changes?</h3><p>Suppose you run a website with users across India, Europe, and the United States.Your website stores a profile picture, profile.jpg, and its CDN has cached copies at multiple edge locations.</p><p>One day, the user uploads a new profile picture.The original server now has the new image. But the CDN might still have the old image stored in its cache.</p><p>Different users could see different versions depending on which cached copy serves their request.This creates a consistency problem.The origin has the latest version, but some edge servers haven’t learned that their copies are outdated.You might think the solution is simple: just delete the old cached image.</p><p>But which copy should you delete?</p><p>And how do you make sure the deletion reaches every relevant cache?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M8zlJ-joWPcSs18RHZrnNA.png" /></figure><h3>3. Why Can’t We Just Delete the Cache Everywhere?</h3><p>In a small application, clearing a cache might be a straightforward operation.</p><p>A global CDN is different.</p><p>Its edge servers may be distributed across many countries and connected through different network paths. They don’t all receive updates at precisely the same moment.When you request a cache purge, the CDN must communicate that change to the relevant systems and prevent old cached content from continuing to be served where the purge applies.</p><p>Now consider a few problems:</p><ul><li><strong>Network delays:</strong> Some edge locations may receive invalidation messages later than others.</li><li><strong>Failures:</strong> A server may temporarily be unreachable when an invalidation is sent.</li><li><strong>Concurrent requests:</strong> A request might fetch the old content while an update is happening.</li><li><strong>Scale:</strong> A purge affecting many cached objects can require substantial coordination.</li></ul><p>There is another problem, too.</p><p>What if the CDN deletes the old copy, but thousands of users request the same file immediately afterward?</p><p>Those requests may all try to fetch the file from the origin.The CDN has removed the stale cache, but it may have created a sudden traffic spike against the main server.</p><p>This is one reason <strong>cache invalidation isn’t simply about deleting data. It’s about coordinating what happens before, during, and after deletion.</strong></p><h3>4. Three Common Ways to Handle Stale Content</h3><p>There isn’t one perfect solution for every application. Different approaches make different trade-offs.</p><h3>A. Time to Live (TTL)</h3><p>A cached object can be given a Time to Live, or TTL.</p><p>For example, a CDN might cache an image for one hour. After that period, the object expires and the CDN can fetch a fresh copy when needed.This is simple and reduces the need for frequent manual purges.</p><p>But it has a limitation: if the image changes five minutes after being cached, users may continue seeing the old version until it expires.</p><p><strong>TTL trades immediate freshness for simplicity and efficiency.</strong></p><p>It’s useful when content doesn’t change frequently or a short delay is acceptable.</p><h3>B. Cache Purging</h3><p>A purge tells the CDN to remove a cached object, or a selected group of objects, before their normal expiration time.</p><p>For example, if a website publishes an incorrect image, it can request that the CDN purge the affected URL.The next request may then cause the CDN to retrieve the current version from the origin.</p><p>Purging is useful when content needs to be updated sooner than its TTL would allow.</p><p>However, purges can be expensive to coordinate at scale, and the exact behavior depends on the CDN’s implementation and configuration.Purging a single URL is also different from purging thousands of URLs or an entire cache.</p><h3>C. Versioned URLs</h3><p>This is one of the simplest and most effective approaches for static assets.</p><p>Instead of replacing the image at the same URL:</p><p>/images/profile.jpg</p><p>You publish the new image at a different URL:</p><p>/images/profile-v2.jpg</p><p>Now the new image has a new cache key, so it can be cached independently of the old image.A more common production approach uses a content hash:</p><p>/images/profile.a83f21.jpg</p><p>When the file changes, its hash changes, creating a new URL.The application can reference the new URL, while the old version remains cached until it expires.This avoids needing to invalidate every copy of the old asset immediately.</p><p><strong>The key idea is simple: instead of forcing every cache to forget the old content, give the new content a different identity.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VNs6RMLII6Dq1rnr8HvwnQ.png" /></figure><h3>5. What If the Origin Gets Overloaded After a Purge?</h3><p>Let’s return to our profile picture.</p><p>Imagine a popular website purges a frequently requested image. Thousands of users request that image shortly afterward.</p><p>If every request independently tries to fetch the missing image from the origin, the origin could receive a large number of duplicate requests.</p><p>This is commonly known as a <strong>cache stampede</strong> when many requests simultaneously attempt to regenerate or retrieve an expired or missing cached value.</p><p>One technique used to reduce this problem is <em>request coalescing</em>.</p><p>Instead of allowing every request to trigger its own origin fetch, a cache can coordinate concurrent requests for the same object so that one fetch supplies the result to multiple waiting requests.</p><p>Another technique is <em>stale-while-revalidate</em>.</p><p>When permitted by the cache policy, the CDN can serve a previously cached response while fetching an updated version in the background.</p><p>This helps reduce waiting time, but it also means some users may temporarily receive stale content.</p><p>That makes it unsuitable for every type of data. An old product image might be acceptable for a short period; stale account balances or private information are a very different matter.</p><p>The important lesson is that cache freshness, origin load, and response speed are connected.</p><p>Improving one can affect the others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6myQfFJDt5u0QoeNqnYEw.png" /></figure><h3>6. So, How Do Large CDNs Keep Everything Working?</h3><p>Large CDNs combine several techniques rather than relying on one solution.</p><p>They can use TTLs for ordinary expiration, targeted purges when content needs to be refreshed, and versioned URLs for assets that change.They can also use layered caching to reduce requests reaching the origin, along with request coordination to avoid duplicate fetches.</p><p>The correct strategy depends on the content.</p><p>For example:</p><ul><li><strong>Images, CSS and JavaScript:</strong> Versioned URLs work particularly well for static assets.</li><li><strong>News pages:</strong> Shorter TTLs or targeted invalidation may help when updates need to appear quickly.</li><li><strong>Personalized content:</strong> Cache keys and access controls must be designed carefully to avoid serving one user’s private response to another.</li><li><strong>Frequently changing data:</strong> The application may need a different caching strategy or may choose not to cache certain responses at all.</li></ul><p>There is no universal rule that says every cached object must be refreshed instantly.</p><p>Instead, engineers decide how fresh the content must be, how much delay is acceptable, and how much infrastructure cost the system can handle.</p><p>That decision is part of the architecture.</p><h3>Final Thoughts</h3><p>Caching sounds easy: store a copy, serve it quickly, and avoid repeatedly accessing the original server.But once content is distributed across a global network, keeping those copies correct becomes a much harder problem.</p><p>A CDN must balance speed, consistency, network traffic, and the risk of overwhelming the origin when cached content expires or is removed.Sometimes the best solution is to delete an outdated copy. Sometimes it’s better to wait for a TTL to expire. And sometimes, the smartest approach is to publish a new version under a different URL.</p><p><strong>The deeper lesson is that distributed systems aren’t just about making data available everywhere. They’re also about deciding when old data should stop being trusted.</strong></p><p>And that’s why one of the hardest problems in caching isn’t storing the data.It’s knowing when to let it go.</p><p><em>Thanks for reading!❤</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61c0f2c23df4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Making Friends Gets Harder as We Grow Older]]></title>
            <link>https://medium.com/@vigneshnaidu006/why-making-friends-gets-harder-as-we-grow-older-ae7234e22dd5?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae7234e22dd5</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[friendship]]></category>
            <category><![CDATA[life-lessons]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Wed, 14 Oct 2026 18:52:02 GMT</pubDate>
            <atom:updated>2026-10-14T18:52:02.031Z</atom:updated>
            <content:encoded><![CDATA[<p><em>When we were children, making a friend took a single conversation. Somewhere along the way, it became much more complicated.</em></p><p>Remember how easy it was to make friends as a child?</p><p>You could sit beside someone in class, share your lunch, or play the same game, and suddenly, you had a new friend. You didn’t worry about whether you had enough in common or whether they liked you as much as you liked them.You simply spent time together.</p><p>But as we grow older, something changes.</p><p>We meet new people in college, at work, and in everyday life. Yet finding someone we can genuinely connect with seems harder than ever.</p><p>Why?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/0*Qpdp9rEB02zJrhql.jpg" /></figure><h3>1. We No Longer Have Time Together by Default</h3><p>Think about childhood friendships. You saw the same people every day. You shared classrooms, lunch breaks, jokes, and countless ordinary moments.Friendship happened naturally because your lives already overlapped.</p><p>As adults, everyone starts moving in different directions. One friend gets a job, another moves to a different city, and someone else becomes busy building their future.</p><p>Meeting now requires planning. Conversations get postponed. Messages receive replies days later.Sometimes, friendships don’t end because people stop caring. They fade because the everyday moments that once kept people close slowly disappear.</p><p><strong>As children, friendship was part of our routine. As adults, we have to make room for it.</strong></p><h3>2. We Start Overthinking Everything</h3><p>As children, we could walk up to someone and start talking without a second thought.As adults, we hesitate.</p><p>What if they find me boring? What if I’m the only one interested in becoming friends? What if I message them and they don’t reply?A simple conversation becomes something we analyze before it even happens.</p><p>The strange thing is that the other person might be thinking exactly the same way.Two people could genuinely enjoy each other’s company, yet neither takes the first step.Sometimes, a potential friendship doesn’t fail because two people aren’t compatible.</p><p>It never gets the chance to begin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7a5Tj_6fFo9e6U94.jpg" /></figure><h3>3. We Want Deeper Connections but Hide Our Real Selves</h3><p>As we grow older, we want more than someone to laugh with. We want people who understand our worries, listen without judging, and stay when life gets difficult.</p><p>But we don’t always make it easy for others to know us.</p><p>We say we’re fine when we’re not. We hide our insecurities because we don’t want to seem vulnerable. We talk about everything except the things that actually matter to us.We want to be understood without explaining ourselves.</p><p>But meaningful friendships require some openness. Sometimes, we have to take the risk of being honest before we can discover whether someone is capable of understanding us.Not everyone will become that person. But nobody can get to know the real us if we never let them see it.</p><h3>4. We Expect Friendship to Happen Naturally</h3><p>Perhaps the biggest mistake we make is expecting adult friendships to happen the way childhood friendships did.We hope to meet someone, instantly connect, and somehow remain close without much effort.</p><p>But many meaningful friendships begin with small things.</p><p>A message after a good conversation. An invitation for coffee. Remembering something someone told you last week. Checking in when they seem quieter than usual.These gestures might seem insignificant, but relationships grow through repeated moments of showing up.</p><p>That doesn’t mean chasing people who don’t reciprocate. It means recognizing that even a good friendship needs time and effort from both sides.Sometimes, we have to stop waiting for friendship to happen and start giving it a chance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/0*HE0IPtT46J6bP5j4" /></figure><h3>Maybe We’re Not Losing Our Ability to Make Friends</h3><p>Growing older means becoming more independent, but it can also mean becoming more hesitant about letting people in.Some friendships fade. Some survive years of distance. Others haven’t even begun because we keep waiting for the perfect moment.</p><p>And perhaps that’s the part worth thinking about.The person waiting for someone to reach out might be sitting right beside us.</p><p>The person who could become a close friend might be someone we already know but have never made the effort to know better.So, the next time you meet someone whose company you enjoy, send that message. Suggest that coffee. Continue the conversation.</p><p>You don’t need to know whether someone will become your closest friend.You only need to be willing to find out.</p><p>Because maybe making friends was never about finding the perfect people. Maybe it was about spending enough time with ordinary people for something meaningful to grow.And somewhere between growing up and figuring out life, perhaps that’s the part we forgot.</p><p><em>Thanks for reading.❤</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae7234e22dd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design Is Confusing Until You Learn It in the Right Order]]></title>
            <link>https://medium.com/@vigneshnaidu006/system-design-is-confusing-until-you-learn-it-in-the-right-order-f835795e90f9?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/f835795e90f9</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 18:15:42 GMT</pubDate>
            <atom:updated>2026-10-13T18:15:42.350Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A beginner-friendly roadmap to understanding system design, what to learn first, and how to prepare for software engineering interviews without feeling overwhelmed.</em></p><p>When I started exploring system design, one thing became clear pretty quickly: there were too many things to learn.</p><p>One article talked about Redis. Another talked about Kafka. Then came load balancers, database sharding, microservices, distributed systems, and many other concepts.Every concept seemed connected to five more, and it was difficult to understand where to begin.If you’re a fresher preparing for software engineering interviews, you might be facing the same problem.</p><p>You want to understand how applications like Instagram, Netflix, and Uber work behind the scenes. But before you even start designing a system, you’re confronted with a huge list of unfamiliar technologies.</p><p>So, instead of learning everything randomly, let’s understand <strong>what to learn, why it matters, and in what order to study it.</strong></p><h3>1. First, Understand What System Design Actually Means</h3><p>Imagine building a simple file-sharing application.</p><p>Initially, one server and one database might be enough. But as more people start uploading and downloading files, the application may become slower. The server might run out of resources, database queries might take longer, and requests might start failing.</p><p>Now you need to answer some questions:</p><ul><li>How can the application handle more users?</li><li>How can data be retrieved faster?</li><li>What happens if the server crashes?</li><li>How can multiple servers work together?</li><li>How do you prevent requests from overwhelming the system?</li></ul><p>Solving these problems is what system design is about.</p><p><strong>System design is the process of deciding how different components of a software system work together to meet its requirements.</strong></p><p>It involves architecture, databases, networking, scalability, reliability, security, and trade-offs.</p><p>You don’t need to know every technology to get started. You need to understand the problems first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l5mIWz_NeSbPfwB2.png" /></figure><h3>2. Learn the Fundamentals Before Anything Advanced</h3><p>Before studying distributed systems, understand how an ordinary web application works.</p><p>Start with these concepts:</p><ul><li><strong>Client-server architecture:</strong> How applications communicate.</li><li><strong>HTTP/HTTPS and REST APIs:</strong> How requests and responses work.</li><li><strong>DNS and TCP/IP:</strong> How systems communicate over a network.</li><li><strong>Latency and throughput:</strong> How quickly a system responds and how much work it handles.</li><li><strong>Monoliths and microservices:</strong> Different ways to organize application components.</li></ul><p>Your goal is to understand what happens when a user clicks a button and a request travels through the system.</p><p>These basics make the advanced topics much easier to understand later.</p><h3>3. Understand Databases and Data Storage</h3><p>Almost every application needs to store information, but different systems have different data requirements.</p><p>Learn these concepts:</p><ul><li><strong>SQL vs. NoSQL:</strong> Choosing between different data models and database capabilities.</li><li><strong>Indexing:</strong> Finding records without scanning an entire table in many common queries.</li><li><strong>Transactions and ACID:</strong> Keeping related database operations reliable.</li><li><strong>Replication:</strong> Maintaining copies of data across database servers.</li><li><strong>Sharding:</strong> Splitting data across multiple database servers.</li><li><strong>Normalization and denormalization:</strong> Organizing data and balancing storage against query performance.</li><li><strong>Consistency:</strong> Understanding when updates become visible across replicas.</li></ul><p>For example, a banking application has different consistency requirements from a social media feed. Knowing the requirements helps you choose the right design.</p><p>Don’t just memorize database definitions. Learn when a particular approach is useful and what trade-offs it introduces.</p><h3>4. Learn How Systems Handle More Traffic</h3><p>A system that works for 100 users might struggle when thousands of users access it simultaneously.</p><p>This is where scalability and performance become important.</p><p>Focus on:</p><ul><li><strong>Vertical and horizontal scaling:</strong> Adding resources to one server versus distributing work across multiple servers.</li><li><strong>Load balancing:</strong> Distributing incoming requests across servers.</li><li><strong>Caching:</strong> Storing frequently accessed data for faster retrieval.</li><li><strong>Cache invalidation and eviction:</strong> Managing outdated data and deciding what to remove.</li><li><strong>CDNs:</strong> Serving content closer to users.</li><li><strong>Connection pooling:</strong> Reusing database or service connections efficiently.</li><li><strong>Stateless and stateful services:</strong> Understanding how services manage client or session state.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKaWjdCoqGDtmaujrXoAAA.png" /></figure><p>The important question is not simply “What is caching?”</p><p>It’s “What problem does caching solve, and when might it create new problems?”</p><p>That mindset will help you understand system design much more deeply.</p><h3>5. Study Distributed Systems and Communication</h3><p>Large applications often have multiple services running on different servers. Those services must communicate, share information, and deal with failures.</p><p>Important concepts include:</p><ul><li><strong>Message queues:</strong> Allowing work to wait until a consumer can process it.</li><li><strong>Asynchronous processing:</strong> Running tasks without making the original request wait for every operation.</li><li><strong>Event-driven architecture:</strong> Letting components respond to events.</li><li><strong>Synchronous vs. asynchronous communication:</strong> Understanding different ways services coordinate work.</li><li><strong>CAP theorem:</strong> Understanding trade-offs involving consistency and availability during network partitions.</li><li><strong>Eventual consistency:</strong> Understanding why replicas may temporarily contain different values.</li><li><strong>Idempotency:</strong> Preventing repeated requests from producing unintended duplicate effects.</li><li><strong>Distributed coordination:</strong> Understanding the challenges of coordinating multiple independent components.</li></ul><p>For example, after a user uploads a file, a background worker might generate a preview while the user continues using the application.</p><p>Not every application needs a message queue or microservices. Learn why they are useful before deciding to use them.</p><h3>6. Understand Reliability, Security, and Failure Handling</h3><p>Real systems don’t always work as expected.</p><p>Servers crash, networks time out, requests get repeated, and databases become overloaded. A good design must account for these situations.</p><p>Learn:</p><ul><li><strong>Timeouts and retries:</strong> Handling requests that take too long, including exponential backoff.</li><li><strong>Rate limiting and throttling:</strong> Controlling request frequency.</li><li><strong>Fault tolerance and failover:</strong> Maintaining service when components fail.</li><li><strong>Redundancy and graceful degradation:</strong> Reducing the impact of failures.</li><li><strong>Authentication and authorization:</strong> Verifying users and controlling access.</li><li><strong>Encryption and secure data handling:</strong> Protecting information.</li><li><strong>Monitoring, logging, and alerting:</strong> Detecting problems and understanding system behavior.</li><li><strong>Backups and disaster recovery:</strong> Recovering from data loss or major failures.</li></ul><p>Whenever you design a system, ask yourself: <strong>What happens if this component fails?</strong></p><p>That question is one of the simplest ways to improve your system design thinking.</p><h3>7. Learn the System Design Interview Process</h3><p>Knowing individual concepts is only half the work. You also need to combine them into a complete design and explain your reasoning.</p><p>Follow this process when solving interview questions:</p><ol><li><strong>Clarify requirements:</strong> Identify the essential features and constraints.</li><li><strong>Estimate capacity:</strong> Roughly calculate traffic, storage, and bandwidth when relevant.</li><li><strong>Design APIs:</strong> Define how clients interact with the system.</li><li><strong>Design the data model:</strong> Choose databases, schemas, and key relationships.</li><li><strong>Draw the high-level architecture:</strong> Connect the main components.</li><li><strong>Identify bottlenecks:</strong> Determine what may become slow or overloaded.</li><li><strong>Discuss trade-offs:</strong> Explain why you chose one solution over another.</li><li><strong>Address failures and scaling:</strong> Explain how the system behaves as demand increases or components fail.</li></ol><p>You don’t have to produce a perfect design immediately. Interviewers want to see how you break down problems, make decisions, and adapt your design as new constraints appear.</p><h3>8. Practise These System Design Problems</h3><p>Once you understand the fundamentals, apply them to familiar applications.</p><p>Start with:</p><ul><li>URL shortener</li><li>Rate limiter</li><li>Pastebin</li><li>File storage and sharing service</li><li>Notification service</li></ul><p>Then move to more complex designs:</p><ul><li>Chat application</li><li>Social media news feed</li><li>Video streaming platforms</li><li>Ride-hailing application</li><li>Distributed task scheduler</li></ul><p>For each problem, ask yourself:</p><p>What are the requirements? How is the data stored? How will the system handle more traffic? What happens when a component fails? What trade-offs am I making?</p><p>You don’t need to build every system completely. Drawing the architecture and explaining your choices is already valuable practice.</p><h3>9. A Simple Four-Week Learning Roadmap</h3><p><strong>Week 1 — Foundations and databases</strong></p><p>Study networking, HTTP, APIs, SQL, NoSQL, indexes, and transactions.</p><p><strong>Week 2 — Performance and scaling</strong></p><p>Study caching, load balancing, CDNs, replication, and horizontal scaling.</p><p><strong>Week 3 — Distributed systems and reliability</strong></p><p>Study queues, consistency, idempotency, rate limiting, retries, and fault tolerance.</p><p><strong>Week 4 — Interview practice</strong></p><p>Design a URL shortener, a rate limiter, and a file-sharing service. Practise capacity estimation, architecture diagrams, bottleneck analysis, and trade-offs.</p><p>Four weeks is a starting plan, not a guarantee of interview readiness. Revisit concepts and practise more problems based on your current level and target roles.</p><h3>Resources to Get Started</h3><ul><li><a href="https://github.com/donnemartin/system-design-primer">System Design Primer</a> — A free, structured learning resource.</li><li><a href="https://blog.bytebytego.com/">ByteByteGo</a> — Visual explanations and system design examples.</li><li><a href="https://netflixtechblog.com/">Netflix TechBlog</a> — Real-world engineering challenges.</li><li><a href="https://www.uber.com/blog/engineering/">Uber Engineering</a> — Articles about large-scale backend systems.</li></ul><p>Start with the fundamentals, then use the company engineering blogs to see how those ideas are applied in practice.</p><h3>Final Thoughts</h3><p>System design can look intimidating when you see all the concepts at once. But you don’t have to learn everything simultaneously.</p><p>Understand how an application works. Learn how it stores data, handles traffic, communicates across services, and responds to failures. Then practise combining those concepts into complete systems.</p><p>The goal isn’t to memorize Redis, Kafka, databases, or every architecture pattern.</p><p>It’s to understand <strong>why a system needs a particular component, when that component is useful, and what trade-offs come with using it.</strong></p><p>Start small. Follow the problems. Practise explaining your decisions.</p><p>That’s how you build a strong foundation in system design.</p><p><em>Thanks for reading!❤</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f835795e90f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Every Time You Scroll Instagram Reels, a Prediction Is Being Made]]></title>
            <link>https://medium.com/@vigneshnaidu006/every-time-you-scroll-instagram-reels-a-prediction-is-being-made-82c38919ba16?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/82c38919ba16</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[instagram]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 15:25:00 GMT</pubDate>
            <atom:updated>2026-10-12T15:25:00.331Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How prefetching, buffering, and smart content delivery make videos feel almost instant.</em></p><p>You open Instagram.</p><p>A Reel starts playing.</p><p>You watch it for a few seconds, swipe up, and the next video appears almost instantly. You swipe again. Another video starts. Then another.You probably never think about what happens between those swipes.</p><p>But here’s an interesting question.</p><p><strong>How does Instagram make the next video ready before you even decide to watch it?</strong></p><p>If the app waited until you swiped to start downloading every video, you would probably see loading screens much more often. Your experience would feel slow, especially on a weak internet connection.</p><p>So, how do apps avoid this?</p><p>One important technique used in video streaming systems is called <em>prefetching</em>. Along with buffering, content delivery networks, and careful resource management, it helps make video playback feel smooth.</p><p>Let’s explore how these ideas work together, what happens when predictions go wrong, and why something as simple as scrolling through Reels involves some interesting engineering problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*4SWQdCDlzQf58Jka" /></figure><h3>1. The App Doesn’t Always Wait for Your Next Swipe</h3><p>Imagine you’re watching a 20-second Reel.</p><p>You’ve watched 10 seconds, and the video is still playing.</p><p>During those 10 seconds, your app has an opportunity to prepare for what might happen next.Instead of waiting for you to swipe, the app can start retrieving information or video data for upcoming content in advance.</p><p>When you finally swipe, some of that work may already be complete.This is the basic idea behind <strong>prefetching</strong>.</p><p>Prefetching means getting something ready before it is actually needed.</p><p>Think about a restaurant preparing popular dishes before customers place their orders during a busy lunch hour. The restaurant doesn’t prepare every possible dish, but it can prepare some things it expects people to order.</p><p>Apps can follow a similar idea.They can prepare likely next items before the user requests them.</p><p>Of course, there is an important detail here: the app cannot know exactly when you will swipe or which video you will watch. It can only make a reasonable prediction based on the content already available and the application’s strategy.</p><p>And that leads to our next question.</p><h3>2. What Actually Happens When You Swipe?</h3><p>Let’s simplify what a short-video app might do.</p><p>Suppose you’re currently watching Reel A.</p><p>The app may already have information about Reel B and may have started fetching some of its video data. The video player is busy playing Reel A while the app prepares the next item.When you swipe, Reel B may already have enough data available to begin playing quickly.</p><p>Here’s a simplified view of the process:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/0*wufj_dmphYzAVwFQ" /></figure><p>The key idea is that several activities can happen at the same time.While one video is playing, another can be getting ready.</p><p>This is an example of <strong>asynchronous work</strong>. The application doesn’t need to finish every task in sequence before continuing with the current one.It can play the current video while preparing the next.That small design decision can make a big difference to how fast an application feels.</p><p>However, prefetching alone doesn’t solve the entire problem.The app also needs to make sure the video has enough data ready to play.</p><h3>3. Downloading a Video Is Not the Same as Playing It</h3><p>Imagine downloading a large video file.Even if the download starts immediately, the entire file may take several seconds or longer to arrive.Should the user have to wait for the whole video before watching it?</p><p>Usually, no.</p><p>Video streaming systems can begin playback once enough of the video data is available. They continue retrieving more data while playback is happening.This is where <strong>buffering</strong> comes in.</p><p>A buffer is a temporary area where data is kept until it is needed.Think of it like filling a glass of water while drinking from it. You don’t need to fill the entire glass before taking the first sip, but you do need enough water to keep drinking without interruption.</p><p>Video playback works on a similar principle.</p><p>If data arrives fast enough, the video continues playing smoothly. If the network slows down and the buffer becomes empty, playback may pause.That’s why a fast internet connection doesn’t automatically guarantee smooth playback. The application also needs to manage how much data is available and how quickly additional data arrives.</p><p>And here’s where things become interesting.<strong>The app is trying to keep enough video ready without downloading more than necessary.</strong></p><p>Too little preparation can lead to buffering. Too much preparation can waste bandwidth.Finding the right balance is an engineering problem.</p><h3>4. Why Not Download the Next 20 Videos?</h3><p>If preparing videos early improves the experience, why not download 20 videos as soon as someone opens Reels?</p><p>Because predictions are often wrong.Imagine you’re watching a cooking video. The next video is already being downloaded, but you swipe away after one second.</p><p>Then you swipe again. And again.You may never watch most of the videos that the app prepared.</p><p>If the app downloads too much content in advance, it can waste:</p><ul><li>Mobile data.</li><li>Network bandwidth.</li><li>Device storage and memory.</li><li>Battery power.</li><li>Resources that could have been used for other tasks.</li></ul><p>Now imagine millions of people doing this simultaneously.A small amount of unnecessary work for one person can become a large amount of wasted work across a massive platform.</p><p>This creates an interesting trade-off.</p><p>The application wants to prepare enough content to make playback fast, but it doesn’t want to prepare so much that it wastes resources.A practical design might prefetch only a limited amount of upcoming content, adjust that amount based on network conditions, and stop unnecessary downloads when the user moves elsewhere.The exact strategy depends on the application and its implementation.</p><p>The goal isn’t to predict everything correctly.</p><p><strong>The goal is to make useful predictions at a reasonable cost.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/0*MeaHZc8x8h63ADoF.jpg" /></figure><h3>5. The Video Might Be Ready, but Where Does It Come From?</h3><p>There is another problem.</p><p>Suppose a user in India wants to watch a video uploaded from another part of the world.If every video request had to travel to one central server and back, the delay could become significant. The server could also become overloaded if it handled every request for every video.</p><p>This is one reason large internet services use <strong>content delivery networks</strong>, commonly called CDNs.A CDN uses a distributed network of servers to deliver content from locations closer to users when possible.</p><p>For example, popular video content may be cached at an appropriate edge location. If a user’s request can be served from that cache, the video data may not need to be retrieved from the original storage location each time.</p><p>Think about a popular book.</p><p>Instead of keeping every copy in one warehouse and shipping each copy across the country, a distributor can keep copies in several regional warehouses.Customers receive their books faster because the copies are already closer to them.</p><p>A CDN follows a similar principle for digital content.</p><p>But CDNs are not magic. Content might not be cached at the location a user needs, a cache might have expired, or the system might need to retrieve a different version of the video.Even so, distributing content can reduce delays and lower the work required from the original servers.</p><p>For a service that delivers enormous amounts of video, this matters.</p><p><strong>Prefetching helps prepare the next video. Buffering helps keep playback running. A CDN helps deliver video data efficiently.</strong></p><p>These techniques solve different parts of the same problem.</p><p>One important clarification: this describes common video-streaming techniques, not a claim that Instagram uses this exact sequence or configuration internally.</p><h3>6. What Happens When the Prediction Goes Wrong?</h3><p>Let’s consider three situations.</p><p><strong>Situation 1: You swipe faster than expected.</strong></p><p>The app has started preparing the next video, but you swipe again before enough data is ready.The player may need to wait for additional data. The prediction was useful, but it wasn’t early enough.</p><p><strong>Situation 2: Your internet connection suddenly becomes slow.</strong></p><p>The app has some video data ready, but the network cannot deliver the next part quickly enough.If the buffer runs out, playback can pause.</p><p>The application might need to reduce video quality, wait for more data, or adjust how much it prepares in advance.</p><p><strong>Situation 3: You stop watching completely.</strong></p><p>The app has started downloading another video, but you close Instagram.That work may no longer be useful.</p><p>A well-designed application should avoid continuing unnecessary downloads when it can safely cancel them.These situations show why building a smooth video experience is not simply about making downloads faster.The application has to respond to changing user behavior, network conditions, and device limitations.</p><p>It must also decide which work deserves resources first.That is where software engineering becomes more interesting than it initially appears.</p><h3>7. Can We Build a Simplified Version of This?</h3><p>Let’s say you wanted to build a basic short-video application yourself.You don’t need Instagram’s infrastructure to experiment with the underlying idea.You could start with three videos and a simple video player.</p><p>First, play the current video.While it is playing, begin fetching the next video’s data. Keep the amount of prefetched content limited so the application doesn’t download everything at once.</p><p>When the user swipes, check whether the next video is ready.If it is, start playback. If it isn’t, continue loading the necessary data.</p><p>Then introduce a few additional rules:</p><ul><li>Stop fetching videos that are no longer needed.</li><li>Limit how many videos can be prepared in advance.</li><li>Avoid starting multiple downloads for the same video.</li><li>Adjust prefetching based on available network information.</li><li>Measure how often playback starts immediately and how often it buffers.</li></ul><p>You could even compare two versions of your application.In the first version, download the video only after the user swipes.In the second version, prepare the next video while the current one plays.Measure the time between a swipe and the next video’s first frame.</p><p>That measurement is often called <strong>time to first frame</strong>.You could also measure startup delay, buffering frequency, and unnecessary bytes downloaded.</p><p>Now you have something more valuable than a theoretical explanation: a small experiment that demonstrates why the design matters.</p><p>The results will depend on your test videos, network, device, and implementation, but the comparison can teach you a lot about real-world performance.</p><h3>8. The Interesting Part Is What the User Never Sees</h3><p>When we use Instagram Reels, we see a video, swipe, and see another video.</p><p>The experience looks simple.</p><p>But behind that experience are several decisions: when to fetch data, how much to prepare, where to retrieve it from, how to manage limited resources, and what to do when the network or the user’s behavior changes unexpectedly.The challenge isn’t just making one video load quickly.</p><p>It’s making the experience feel consistently fast across different devices, connections, and viewing habits.And the application has to do that without wasting too many resources.</p><p>That’s what makes this problem interesting to me.A swipe looks like a simple user action, but it creates a series of engineering decisions that need to happen at the right time.</p><p>The next time you scroll through Reels, think about this:</p><p><strong>The video you are watching is the present. The video being prepared may be the future. And the application is trying to connect the two without making you wait.</strong></p><p>Sometimes, the best engineering is the kind you never notice.</p><p><em>Thanks for reading!❤</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82c38919ba16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[He Is Building His Career, But Sometimes He Still Feels Lost]]></title>
            <link>https://medium.com/@vigneshnaidu006/he-is-building-his-career-but-sometimes-he-still-feels-lost-c16a128543db?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/c16a128543db</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[happiness]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Sun, 11 Oct 2026 15:06:48 GMT</pubDate>
            <atom:updated>2026-10-11T15:06:48.421Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Growing up isn’t always about getting what you wanted. Sometimes, it’s about realizing that even after getting it, you can still feel lonely.</em></p><h3>A Life That Looks Fine From the Outside</h3><p>He is working as an intern in a different location, trying to understand how the professional world works.</p><p>He earns his own money, follows a routine, completes his work, and slowly learns what it means to be independent. From the outside, everything seems to be going in the right direction.This was probably something he looked forward to during his college days.</p><p>Having a job, earning money, experiencing a different place, and taking a step towards the future.</p><p>But there is one thing he didn’t think much about before starting this journey.Loneliness.</p><p>The place where he works is unfamiliar. He doesn’t have his usual group of friends around him. There is no one he can casually call to meet after work, no familiar face to share a random thought with, and no one who understands his everyday routine without needing an explanation.His days are mostly about work. His evenings are often his own.</p><p>And sometimes, having all that time to himself isn’t as peaceful as he imagined it would be.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*7JMDt65cQgOH9i-247vQTw.png" /></figure><h3>When Your Friends Are Still Living the Life You Left Behind</h3><p>His friends are still studying.They attend classes, prepare for exams, hang out on campus, and experience the familiar rhythm of college life.</p><p>Whenever he gets the chance, he visits them.For a little while, everything feels normal again. They talk about random things, laugh about old memories, discuss people they know, and spend time together as if nothing has changed.</p><p>He doesn’t have to explain himself. He can simply be the person he has always been around them.Those moments remind him how much he misses having people around.But eventually, the visit ends.</p><p>His friends return to their classes, assignments, and college routines. He returns to his workplace and his room in a different location.And the contrast hits him.</p><p>They still have one another nearby, while he has to plan his next meeting with them around work, travel, and time.He is happy that his friends are still enjoying their college days. He doesn’t necessarily want to go back and change places with them.</p><p>But a part of him misses the simplicity of being around people without having to schedule everything.</p><p>He misses being able to meet someone just because he feels like talking.Sometimes, the hardest part of growing up isn’t losing people. It’s realizing that the people you love are still there, but life no longer allows you to be together as often as before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*KLW4EEqERCLckTza" /></figure><h3>The Quiet Gives Him Too Much Time to Think</h3><p>When he returns to his room, there is often nothing waiting for him except the usual routine.He eats, checks his phone, perhaps watches something, and prepares for another working day.</p><p>But when everything becomes quiet, his mind starts wandering.He thinks about things he did in the past. Conversations he wishes had gone differently. Decisions he sometimes questions. Opportunities he might have missed, or moments when he could have acted differently.</p><p>Some memories make him smile. Others leave him wondering why he behaved a certain way or whether things might have turned out differently if he had made another choice.</p><p>He knows he cannot change what has already happened.Still, the thoughts return.</p><p>Perhaps the loneliness makes them louder. During college, there were always people around, things to do, and conversations to occupy his mind. Now, with fewer distractions, he has more time to sit with his own thoughts.And sometimes, he mistakes thinking about the past for finding a way to fix it.</p><p>He replays the same moments, hoping to discover an answer that might finally make everything feel settled.But not every memory has a lesson hidden inside it. Sometimes, something happened, we made the best decision we could at the time, and life moved on.</p><p>The difficult part is learning to let ourselves move on too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*fuuWjAUYSNwvIvo6_jfGoQ.png" /></figure><h3>Is Earning Money Enough to Feel Happy?</h3><p>He wanted to start working. He wanted to earn, become independent, and build a future for himself.And he is doing those things.</p><p>But now he is discovering that a career can give you direction without automatically giving you a sense of belonging.A salary can help you pay your bills, but it cannot guarantee that you will have someone to share your day with.</p><p>A job can teach you new skills, but it cannot replace the comfort of familiar friendships.And becoming independent doesn’t mean you will never feel the need for company.</p><p>Maybe he once imagined that getting a job would make him feel like he had finally moved forward in life. Now, he understands that moving forward can come with a few unexpected feelings.</p><p>He can be grateful for his opportunity and still miss his friends.He can be proud of his progress and still feel lonely on a Friday evening.</p><p>He can want a successful career and still wish he had someone nearby to talk to about absolutely nothing.These feelings don’t cancel each other out.</p><p>They can exist together.And perhaps that’s something we need to understand better as we grow older: being grateful for what we have doesn’t mean we must pretend that nothing is missing.</p><h3>Maybe growing up is learning to miss the life you had without forgetting to live the life you have.</h3><p>And if there is one thing I hope he understands, it is this: no matter how lonely a place feels, no matter how far life takes you from the people you love, you will always have someone close to you.</p><p>Sometimes, it is a friend who answers your call even when you have nothing important to say. Sometimes, it is your family, reminding you that you have a place to return to. And sometimes, it is someone who simply listens when you need to let things out.</p><p>You may not always have these people physically beside you, and life may not always give you the time you wish you had with them. But the right people don’t stop mattering just because distance comes between you.</p><p>So, keep working towards your dreams. Make mistakes, learn from your past, and give yourself time to grow. Don’t let a lonely evening convince you that you are alone in life.</p><p><strong>Because even when life takes you somewhere unfamiliar, there will always be someone who cares about you, someone you can turn to, and someone who will remind you that you don’t have to figure everything out on your own.</strong></p><p>And until the next time you meet, remember that being apart doesn’t mean being forgotten.</p><p><em>Thanks for reading. ❤</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c16a128543db" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your API Has a Rate Limiter. So Why Did Both Requests Get Through?]]></title>
            <link>https://medium.com/@vigneshnaidu006/your-api-has-a-rate-limiter-so-why-did-both-requests-get-through-7b2e06b44a0e?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b2e06b44a0e</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Sat, 10 Oct 2026 18:13:13 GMT</pubDate>
            <atom:updated>2026-10-10T18:13:13.684Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The hidden race condition that breaks rate limiters — and how atomic operations fix it.</em></p><p>Imagine you’re building a REST API for an online shopping application.</p><p>To prevent abuse, you decide that each user can make only <strong>100 requests per minute</strong>.You write the logic, test it with a few requests, and everything works perfectly.But when thousands of users start accessing your API simultaneously, something strange happens.Some users manage to send more requests than your limit allows.</p><p>Your rate limiter is running. Your code looks correct. So what went wrong?</p><p>The answer lies in a small but important problem in concurrent programming: <strong>race conditions</strong>.</p><p>Let’s understand how this happens and how atomic operations can fix it.</p><h3>1. First, What Does a Rate Limiter Actually Do?</h3><p>A rate limiter controls how many requests a client can make within a specific period.For example, imagine an API that allows a user to make five requests every minute.RequestResultRequest 1AllowedRequest 2AllowedRequest 3AllowedRequest 4AllowedRequest 5AllowedRequest 6Rejected</p><p>The sixth request is rejected because the user has reached the limit.Rate limiting helps protect APIs from excessive traffic, accidental request loops, abuse, and unnecessary resource consumption.You might have encountered HTTP status code 429 Too Many Requests. That&#39;s a common response when a client exceeds a rate limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OU4LQa7hR0gtbS2CMNpCog.png" /></figure><h3>2. The Code Looks Correct. Until Two Requests Arrive Together.</h3><p>Let’s start with a simple example.Suppose your API allows only one request at a time for a particular user.You maintain a counter that tracks how many requests that user has made.</p><p>Your logic might look like this:</p><pre>if (requestCount &lt; LIMIT) {<br>    requestCount++;<br>    return true;<br>}</pre><pre>return false;</pre><p>It looks perfectly reasonable.If the counter is below the limit, allow the request and increase the counter. Otherwise, reject it.But let’s introduce something that happens constantly in real applications: <strong>two requests arriving at almost the same time</strong>.Imagine the current counter is zero, and the limit is one.Request A checks the counter.It sees zero, so it decides that the request is allowed.Before it increments the counter, Request B checks the same counter.</p><p>It also sees zero.Both requests believe they are allowed!The counter eventually becomes two, even though the limit was one.</p><p>Here is what happened:</p><p>StepRequest ARequest BCounter1Reads 0–02Decides to allow — 03 — Reads 004 — Decides to allow05Increments — 16 — Increments2Both requests passed the check.This is called a <strong>race condition</strong>. The result depends on the timing and order in which concurrent operations execute.</p><p>The important detail is that neither request necessarily did anything wrong individually. The problem is that the overall operation wasn’t protected against concurrent access.</p><h3>3. Why Doesn’t a Normal Counter Solve the Problem?</h3><p>You might think the solution is simply to use a thread-safe counter.In Java, we have classes such as AtomicInteger, which provide atomic operations on individual integer values.</p><p>For example:</p><pre>AtomicInteger counter = new AtomicInteger(0);</pre><pre>counter.incrementAndGet();</pre><p>The increment operation is atomic. Other threads won’t observe it as a partially completed increment.</p><p>But here’s the catch.</p><p>Our rate limiter does three things:</p><ol><li>Reads the current counter.</li><li>Checks whether the limit has been reached.</li><li>Increments the counter if the request is allowed.</li></ol><p>Even if the increment itself is atomic, <strong>the entire check-and-increment sequence is not automatically atomic</strong>.</p><p>Two threads can still read the same value, both pass the check, and then increment it separately.This distinction is easy to miss.Making one operation thread-safe does not automatically make a sequence of operations thread-safe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*7dYqjJn6FMKQLGm4cdOGVA.png" /></figure><h3>4. The Real Fix: Make the Decision Atomic</h3><p>What if checking the counter and updating it happened as one indivisible operation?</p><p>That is the idea behind atomic enforcement.</p><p>For our simple example, Java’s ConcurrentHashMap provides a useful method called compute().</p><p>It allows us to calculate and update a value for a particular key atomically with respect to other updates for that key.</p><p>Let’s use a separate counter for each user.</p><pre>import java.util.concurrent.ConcurrentHashMap;<br>import java.util.concurrent.atomic.AtomicBoolean;</pre><pre>public class RateLimiter {</pre><pre>    private final int LIMIT = 5;</pre><pre>    private final ConcurrentHashMap&lt;String, Integer&gt;<br>            requests = new ConcurrentHashMap&lt;&gt;();</pre><pre>    public boolean allowRequest(String userId) {</pre><pre>        AtomicBoolean allowed = new AtomicBoolean(false);</pre><pre>        requests.compute(userId, (key, count) -&gt; {</pre><pre>            int current = (count == null) ? 0 : count;</pre><pre>            if (current &lt; LIMIT) {<br>                allowed.set(true);<br>                return current + 1;<br>            }</pre><pre>            return current;<br>        });</pre><pre>        return allowed.get();<br>    }<br>}</pre><p>Let’s understand what’s happening.</p><ul><li>Each user gets a separate counter.</li><li>If the user has made fewer than five requests, the counter increases and the request is allowed.</li><li>If the counter has reached five, the value stays unchanged and the request is rejected.</li><li>Concurrent updates to the same user’s map entry are coordinated by compute().</li></ul><p>The key difference is that the check and update now happen inside the same per-key computation.</p><p>If two requests arrive together when the counter is four, one request can increase it to five. The other then sees five and gets rejected.</p><p>Only one request is allowed through.</p><p><strong>One important limitation:</strong> This is a demonstration of atomic per-user counting, not a complete production-ready rate limiter. It doesn’t implement a time window, expiration, or distributed coordination.</p><p>Also, AtomicBoolean here is only a convenient way to return the decision from the map computation. It isn&#39;t what makes the counter update atomic.</p><h3>5. But What Happens When Your API Has Multiple Servers?</h3><p>So far, we’ve solved the problem inside one Java application.But cloud applications rarely stay on a single server forever.Imagine your REST API is running on three instances:</p><ul><li>Server A</li><li>Server B</li><li>Server C</li></ul><p>All three servers handle requests for the same user.</p><p>If each server maintains its own counter, the user could make five requests to Server A, five to Server B, and five to Server C.That’s fifteen requests instead of five.Each server is following the rules correctly. The problem is that they don’t share the same counter.</p><p>This is where distributed rate limiting becomes important.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*POqASXhMsCkoIQxUP6OJ8Q.png" /></figure><h3>6. How Redis Helps Enforce Rate Limits Across Servers</h3><p>Redis is an in-memory data store often used for shared state, caching, and rate limiting.Instead of keeping the counter separately inside each application server, all servers can coordinate through Redis.</p><p>For a simple fixed-window rate limiter, the key might look like this:</p><pre>rate_limit:user123:12:30</pre><p>The key identifies the user and the current time window. The exact format is a design choice.</p><p>When a request arrives, the system needs to:</p><ol><li>Check the current count.</li><li>Reject the request if the limit has been reached.</li><li>Otherwise, increment the count.</li><li>Set an expiration for the window when needed.</li></ol><p>But there’s still a problem.</p><p>If the check and increment are separate Redis commands, two servers can still interleave those commands and both allow a request.</p><p><strong>Moving the counter to Redis alone does not solve the race condition.</strong></p><p>The decision itself must be atomic.</p><p>One common solution is a Redis Lua script that checks the current count and increments it as a single server-side operation. Other designs can use appropriate atomic commands, depending on the algorithm and its requirements.</p><p>Now, even if requests arrive at different application servers, they can coordinate around one shared decision.</p><p>This approach is useful for APIs running across multiple instances, containers, or cloud machines.</p><h3>7. Is Atomic Rate Limiting Enough?</h3><p>Not quite. Atomicity solves one important problem, but rate limiting still has design choices.For example, a fixed-window limiter might allow five requests at the end of one minute and another five immediately after the next minute begins.</p><p>The user could send ten requests within a very short period around the boundary.Other algorithms, such as the token bucket or sliding-window log, handle traffic patterns differently.</p><p>You also need to consider what happens if Redis becomes unavailable, whether rate limits should be applied per user or per IP address, and how clients should be informed when they exceed a limit.</p><p>A REST API can return a response like this:</p><pre>HTTP/1.1 429 Too Many Requests<br>Retry-After: 30</pre><p>The Retry-After header tells the client how long to wait before retrying, in this example 30 seconds.</p><p>The correct value depends on your rate-limiting policy.</p><p>These are separate concerns from atomicity, but they’re essential when moving from a small example to a real system.</p><h3>8. The Takeaway</h3><p>Rate limiting sounds simple: count requests and reject the excess.But concurrent systems make that simple logic surprisingly difficult.</p><p>Two requests can read the same counter, make the same decision, and both pass a limit that should allow only one.The solution is not merely to use a thread-safe counter or move the counter into Redis.</p><p>The key is to make the <strong>check-and-update decision atomic</strong>, and to ensure that all relevant servers coordinate around that decision.That’s the difference between a rate limiter that works in a small test and one that correctly handles concurrent traffic.</p><p>The next time you see a rate limiter in a cloud architecture, remember: counting requests is the easy part. Making the right decision when many requests arrive together is the real engineering challenge.</p><p><em>Thanks for reading!</em></p><p><em>If you enjoy exploring the hidden problems behind backend systems, follow along for more articles that explain complex engineering concepts in simple English.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b2e06b44a0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Design Patterns Every Developer Should Understand (And the Problems They Actually Solve)]]></title>
            <link>https://medium.com/@vigneshnaidu006/5-design-patterns-every-developer-should-understand-and-the-problems-they-actually-solve-1cbaef259a7b?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cbaef259a7b</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 18:15:07 GMT</pubDate>
            <atom:updated>2026-10-09T18:15:07.870Z</atom:updated>
            <content:encoded><![CDATA[<p>Singleton, Factory, Builder, Abstract Factory, and Prototype explained through everyday problems and simple Java examples.</p><p>ave you ever looked at a piece of code and wondered, <em>“Why did the developer write it this way when there was a much simpler option?”</em></p><p>As applications grow, writing code that works is no longer enough. We also need code that is easy to understand, change, and maintain.</p><p>This is where <strong>design patterns</strong> become useful.</p><p>Design patterns are reusable approaches to common software design problems. They are not ready-made code that we can copy into every project. Instead, they give us a way to organize our code when a particular problem appears.</p><p>Let’s understand five useful design patterns and the problems they solve.</p><h3>1. Singleton Pattern: What If Your Application Had Two Bosses?</h3><p>Imagine an application that stores important configuration settings. Different parts of the application need to access those settings.Now imagine each part creates its own configuration manager. One instance has updated settings, while another still has old values.Things can quickly become confusing.</p><p>The Singleton pattern addresses this problem by restricting a class to a single instance within the relevant application context and providing a shared way to access it.</p><p><strong>Simple Java example:</strong></p><pre>class AppConfig {<br>    private static final AppConfig INSTANCE =<br>            new AppConfig();</pre><pre>    private AppConfig() {}</pre><pre>    public static AppConfig getInstance() {<br>        return INSTANCE;<br>    }<br>}</pre><p>Here, the constructor is private, so other classes cannot create new instances directly. They access the shared instance using getInstance().</p><p><strong>When is it useful?</strong></p><p>It can be useful for shared configuration or other resources that genuinely need one instance within a process.</p><p>However, Singleton is not always the best choice. It can make testing harder and introduce hidden dependencies. In a multi-server application, each server can also have its own Singleton.</p><p>The lesson: <strong>One shared instance is useful only when the problem actually requires it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/0*4XjXeogaca8nkHwB.png" /></figure><h3>2. Factory Pattern: Your Code Shouldn’t Know How Objects Are Born</h3><p>Imagine building a payment application that supports credit cards, UPI, and digital wallets.A simple implementation might repeatedly check which payment method the user selected and create the corresponding object.As new payment methods are added, these conditions can spread across the application.The Factory pattern moves the object-creation decision into a separate place.</p><p><strong>Simple Java example:</strong></p><pre>interface Payment {<br>    void pay();<br>}</pre><pre>class UpiPayment implements Payment {<br>    public void pay() {<br>        System.out.println(&quot;Paying using UPI&quot;);<br>    }<br>}</pre><pre>class PaymentFactory {<br>    static Payment create(String type) {<br>        if (type.equalsIgnoreCase(&quot;UPI&quot;)) {<br>            return new UpiPayment();<br>        }</pre><pre>        throw new IllegalArgumentException(<br>            &quot;Unsupported payment type&quot;<br>        );<br>    }<br>}</pre><p>Now the application can request a payment object through the factory instead of creating it directly.</p><pre>Payment payment = PaymentFactory.create(&quot;UPI&quot;);<br>payment.pay();</pre><p>The factory handles the creation, while the rest of the application works with the Payment interface.</p><p><strong>When is it useful?</strong></p><p>Use this approach when object creation involves decisions, multiple implementations, or logic that you want to keep separate from business operations.</p><p>The lesson: <strong>Your application should focus on what an object does, not always on how it is created.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*WPdk3Bx8PcWnaP8Z.jpg" /></figure><h3>3. Builder Pattern: Why Does Your Constructor Have So Many Parameters?</h3><p>Consider creating a user profile with a name, email, phone number, address, and profile picture.Some fields are required, but others are optional.A constructor with many parameters can become difficult to read. You might even pass the correct values in the wrong order.</p><p>The Builder pattern lets us construct an object step by step.</p><p><strong>Simple Java example:</strong></p><pre>class User {<br>    private final String name;<br>    private final String email;<br>    private final String city;</pre><pre>    private User(Builder builder) {<br>        this.name = builder.name;<br>        this.email = builder.email;<br>        this.city = builder.city;<br>    }</pre><pre>    static class Builder {<br>        private final String name;<br>        private final String email;<br>        private String city = &quot;Unknown&quot;;</pre><pre>        Builder(String name, String email) {<br>            this.name = name;<br>            this.email = email;<br>        }</pre><pre>        Builder city(String city) {<br>            this.city = city;<br>            return this;<br>        }</pre><pre>        User build() {<br>            return new User(this);<br>        }<br>    }<br>}</pre><p>Creating a user becomes much easier to read:</p><pre>User user = new User.Builder(<br>    &quot;Alex&quot;, &quot;alex@example.com&quot;<br>).city(&quot;Bengaluru&quot;).build();</pre><p>We specify the required information first and add optional information only when needed.</p><p><strong>When is it useful?</strong></p><p>Builder works well for objects with many optional fields, complex configurations, or a need for immutable objects.</p><p>The lesson: <strong>Building an object should not feel like solving a puzzle of constructor arguments.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7RFoGLgVkfIcAuKisjv9lg.png" /></figure><h3>4. Abstract Factory: What If Your Objects Don’t Belong Together?</h3><p>Imagine developing an application that supports both Windows and macOS.</p><p>Each platform has its own style of buttons, checkboxes, and other interface components.</p><p>You don’t want a Windows-style button accidentally appearing alongside macOS-specific components when the application expects a consistent platform style.</p><p>The Abstract Factory pattern helps create <strong>families of related objects</strong> without requiring the application to know their specific classes.</p><p>For example, you might define a factory that creates buttons and checkboxes for a particular platform.</p><pre>interface Button {<br>    void render();<br>}</pre><pre>interface Checkbox {<br>    void render();<br>}</pre><pre>interface UIFactory {<br>    Button createButton();<br>    Checkbox createCheckbox();<br>}</pre><p>You can then implement separate factories, such as WindowsFactory and MacFactory. Each factory creates components that belong to its platform.</p><p>The application asks the selected factory for its components rather than directly constructing platform-specific classes.</p><p><strong>When is it useful?</strong></p><p>Abstract Factory is helpful when an application supports multiple platforms, themes, or systems that each require compatible sets of objects.</p><p>The lesson: <strong>Sometimes, creating one object isn’t enough. You need a whole family of objects that work well together.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ue2b2c1_cgnHnLzHXzL4oA.png" /></figure><h3>5. Prototype: Why Build From Scratch When You Can Clone?</h3><p>Imagine a game containing hundreds of characters.</p><p>Many characters share similar properties, such as appearance, speed, and abilities. Creating every character from scratch can mean repeating the same setup again and again.</p><p>The Prototype pattern allows us to create new objects by copying existing ones.</p><p>In Java, cloning can be implemented in different ways. Here’s a simple example using a copy constructor:</p><pre>class Character {<br>    String type;<br>    int health;</pre><pre>    Character(String type, int health) {<br>        this.type = type;<br>        this.health = health;<br>    }</pre><pre>    Character(Character original) {<br>        this.type = original.type;<br>        this.health = original.health;<br>    }<br>}</pre><p>Now we can create a character and copy its configuration:</p><pre>Character original =<br>    new Character(&quot;Warrior&quot;, 100);</pre><pre>Character copy = new Character(original);<br>copy.health = 80;</pre><p>Changing the copied character’s health does not change the original character’s health.</p><p>This example works because the fields shown are simple values. If an object contains references to mutable objects, copying requires more care.</p><p>A <strong>shallow copy</strong> can share nested objects with the original, while a <strong>deep copy</strong> duplicates the relevant nested objects too.</p><p><strong>When is it useful?</strong></p><p>Prototype can be useful when creating objects from scratch is expensive or when many objects start with similar configurations.</p><p>The lesson: <strong>Copying an existing object can save repeated setup, but you must understand exactly what gets copied.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WOkkgSf7qYwG6JFArUn3Ow.png" /></figure><h3>Final Thoughts</h3><p>Design patterns are not rules that every developer must follow. They are approaches developed to solve problems that appear repeatedly in software development.</p><p>You don’t need to use Singleton in every application, create a factory for every class, or introduce Builder whenever a constructor has a few parameters.</p><p><strong>The real skill isn’t knowing every design pattern by heart. It’s recognizing when a problem actually needs one.</strong></p><p>Start with the problem, understand the trade-offs, and then choose the simplest design that works.</p><p><em>Thanks for reading!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cbaef259a7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL JOINs Explained: The Algorithms Behind the Query]]></title>
            <link>https://medium.com/@vigneshnaidu006/sql-joins-explained-the-algorithms-behind-the-query-3cd00ff6fcc6?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cd00ff6fcc6</guid>
            <category><![CDATA[sql-joins]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[query-optimization]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Thu, 08 Oct 2026 17:02:22 GMT</pubDate>
            <atom:updated>2026-10-08T17:02:22.194Z</atom:updated>
            <content:encoded><![CDATA[<h4>You write one JOIN. The database may perform hashing, sorting, indexing, or thousands of searches behind the scenes.</h4><p>If you have worked with SQL, you have probably written something like this:</p><pre>SELECT *<br>FROM users u<br>JOIN orders o<br>ON u.id = o.user_id;</pre><p>It looks simple.We are basically saying:</p><blockquote><em>“Find the users and their orders.”</em></blockquote><p>But here is the interesting part.</p><p><strong>The database doesn’t simply read this query and start matching rows one by one.</strong></p><p>Behind that simple JOIN, the database has to decide:</p><ul><li>Which table should it process first?</li><li>Should it use an index?</li><li>Should it build a hash table?</li><li>Should it sort the data?</li><li>Should it compare rows one by one?</li><li>How much memory should it use?</li></ul><p>This is where <strong>JOIN algorithms</strong> come in.</p><p>Three of the most important ones are:</p><ul><li><strong>Nested Loop Join</strong></li><li><strong>Hash Join</strong></li><li><strong>Merge Join</strong></li></ul><p>Let’s see what actually happens behind the query.</p><h3>First, What Are We Trying to Join?</h3><p>Imagine we have two tables.</p><h3>Users</h3><p>idname1Alice2Bob3Charlie</p><h3>Orders</h3><p>order_iduser_idproduct1011Laptop1021Phone1033Keyboard</p><p>And we run:</p><pre>SELECT u.name, o.product<br>FROM users u<br>JOIN orders o<br>ON u.id = o.user_id;</pre><p>The result is:</p><p>nameproductAliceLaptopAlicePhoneCharlieKeyboard</p><p>Simple enough.</p><p>But imagine the tables contain:</p><p><strong>10 million users</strong></p><p>and</p><p><strong>500 million orders.</strong></p><p>Now the question becomes much more interesting:</p><blockquote><strong><em>How does the database find matching rows without doing an insane amount of work?</em></strong></blockquote><p>That’s the job of the JOIN algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/0*bHHcIiBSfQONyTti" /></figure><h3>1. Nested Loop Join — The Simplest Approach</h3><p>Let’s start with the most straightforward idea.Suppose you have a list of students and a list of exam results.</p><p>One way to find matches is:</p><blockquote><em>Take one student and check every exam result.</em></blockquote><p>Then move to the next student.</p><p>In simple terms:</p><pre>For every row in Table A<br>    For every row in Table B<br>        Compare the JOIN condition</pre><p>For our example:</p><pre>Alice    → Order 101<br>Alice    → Order 102<br>Alice    → Order 103</pre><pre>Bob      → Order 101<br>Bob      → Order 102<br>Bob      → Order 103</pre><pre>Charlie  → Order 101<br>Charlie  → Order 102<br>Charlie  → Order 103</pre><p>Whenever:</p><pre>users.id == orders.user_id</pre><p>we have a match.</p><h3>Why is this called a Nested Loop?</h3><p>Because one loop is placed inside another:</p><pre>for each user:<br>    for each order:<br>        compare user.id with order.user_id</pre><p>It is simple.</p><p>But there is an obvious problem.</p><p>If we have:</p><pre>1,000 users<br>×<br>10,000 orders</pre><p>we could potentially perform:</p><pre>10,000,000 comparisons</pre><p>That doesn’t sound great.So why would a database ever use this algorithm?</p><h3>Indexes change the game</h3><p>Suppose orders.user_id has an index.Instead of scanning every order, the database can quickly look up the matching orders.</p><p>Now the process becomes more like:</p><pre>Alice (id = 1)<br>       ↓<br>   Index lookup<br>       ↓<br>Orders for user 1</pre><p>Then:</p><pre>Bob (id = 2)<br>       ↓<br>   Index lookup<br>       ↓<br>Orders for user 2</pre><p>This is commonly known as an <strong>Index Nested Loop Join</strong>.</p><p>So Nested Loop isn’t necessarily “bad.”If one table is small and the other has a useful index, it can actually be an excellent choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*xLaqaimSbIJX7FjN.gif" /></figure><h3>2. Hash Join — Turn the Table Into a Lookup Structure</h3><p>Now let’s try something smarter.Imagine you have 1 million users and millions of orders.Instead of repeatedly searching for users, why not build a structure that makes finding them fast?That’s where <strong>Hash Join</strong> comes in.The database can take one side of the JOIN and build a <strong>hash table</strong>.</p><p>For example:</p><pre>Users</pre><pre>1 → Alice<br>2 → Bob<br>3 → Charlie</pre><p>The database creates something conceptually like:</p><pre>Hash Table</pre><pre>Hash(1) → Alice<br>Hash(2) → Bob<br>Hash(3) → Charlie</pre><p>Now it scans the orders.</p><p>Suppose it finds:</p><pre>Order 101<br>user_id = 1</pre><p>It calculates:</p><pre>Hash(1)</pre><p>and uses that to find Alice.</p><pre>Order 101<br>    ↓<br>user_id = 1<br>    ↓<br>Hash Table<br>    ↓<br>Alice</pre><p>Match found.</p><p>Then:</p><pre>Order 102<br>user_id = 1<br>    ↓<br>Hash Table<br>    ↓<br>Alice</pre><p>Another match.This is much more efficient than comparing every order with every user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*YeD6FHkz7wZDlRJN.gif" /></figure><h3>The Two Steps of a Hash Join</h3><p>A Hash Join can be thought of as two major phases.</p><h3>Build phase</h3><p>The database takes one input and builds a hash table.</p><pre>Users<br>  ↓<br>Hash Table</pre><h3>Probe phase</h3><p>It then scans the other input and looks for matching keys.</p><pre>Orders<br>   ↓<br>Hash lookup<br>   ↓<br>Matching Users</pre><p>That’s why you may hear the terms:</p><p><strong>Build</strong> and <strong>Probe</strong></p><p>when learning about Hash Joins.</p><h3>But Hash Joins Have a Catch</h3><p>Hash tables need memory.If the database is joining huge tables, the hash table can become very large.And if there isn’t enough available memory, things become more complicated.So Hash Join isn’t automatically the winner.The database has to consider:</p><blockquote><em>“Can I afford to build this hash table?”</em></blockquote><p>This is one reason the database optimizer matters so much.</p><h3>3. Merge Join — When Both Sides Are Sorted</h3><p>Now imagine two decks of cards.Both decks are already arranged from smallest to largest.Instead of repeatedly searching through them, you can simply walk through both decks together.</p><p>That’s basically the idea behind a <strong>Merge Join</strong>.</p><p>Suppose we have:</p><h3>Users</h3><pre>1 → Alice<br>2 → Bob<br>3 → Charlie<br>5 → David</pre><h3>Orders</h3><pre>1 → Laptop<br>1 → Phone<br>3 → Keyboard<br>5 → Mouse</pre><p>Both are sorted by the JOIN key.Now the database can use two pointers.</p><pre>Users       Orders</pre><pre>  ↓           ↓<br>  1    ←→     1</pre><p>They match.Move forward.</p><pre>Users       Orders</pre><pre>  ↓           ↓<br>  2           1</pre><p>The order key is smaller, so move the order pointer.</p><pre>Users       Orders</pre><pre>  ↓           ↓<br>  2           3</pre><p>Now the user key is smaller, so move the user pointer.</p><p>Eventually:</p><pre>3 ←→ 3   MATCH<br>5 ←→ 5   MATCH</pre><p>The database can move through both inputs rather than repeatedly comparing everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*2u37aNO6cDWWNdMx.gif" /></figure><h3>Why Is It Called a Merge Join?</h3><p>Because it works similarly to the <strong>merge step of merge sort</strong>.</p><p>You have two sorted sequences:</p><pre>A: 1  3  5  8<br>B: 1  2  5  7</pre><p>You walk through them and find matching values.</p><p>The important part is:</p><blockquote><strong><em>The inputs need to be ordered by the JOIN key.</em></strong></blockquote><p>If they aren’t already sorted, the database may need to sort them first.And sorting millions of rows isn’t free.</p><h3>So Which JOIN Algorithm Is the Fastest?</h3><p>This is where things get interesting.There isn’t one universal winner.A database might choose:</p><p>SituationPossible ChoiceSmall table + useful indexNested LoopLarge unsorted tablesHash JoinBoth inputs already sortedMerge JoinSmall outer table + indexed inner tableNested LoopLarge equality JOINHash JoinSorted data or useful ordered indexesMerge Join</p><p>The database doesn’t simply say:</p><blockquote><em>“Hash Join is faster, so I’ll always use Hash Join.”</em></blockquote><p>Instead, the <strong>query optimizer</strong> looks at the situation and tries to choose a good execution strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ya75KXOCkcOh3AUYb4oDdA.png" /></figure><h3>The Query You Write Isn’t the Query the Database Executes</h3><p>This is probably the most important idea in this entire article.</p><p>When you write:</p><pre>SELECT *<br>FROM users u<br>JOIN orders o<br>ON u.id = o.user_id;</pre><p>you are describing <strong>what you want</strong>.You’re not telling the database exactly <strong>how to get it</strong>.</p><p>The database may internally decide:</p><pre>SQL Query<br>    ↓<br>Query Parser<br>    ↓<br>Query Optimizer<br>    ↓<br>Execution Plan<br>    ↓<br>JOIN Algorithm<br>    ↓<br>Results</pre><p>The optimizer considers information such as:</p><ul><li>Number of rows</li><li>Available indexes</li><li>Estimated result size</li><li>Whether data is sorted</li><li>Available memory</li><li>Table statistics</li><li>Cost of scanning or searching</li></ul><p>Then it chooses an execution plan.</p><h3>Final Thought</h3><p>The next time you write:</p><pre>SELECT *<br>FROM users<br>JOIN orders<br>ON users.id = orders.user_id;</pre><p>don’t just think:</p><blockquote><em>“I’m joining two tables.”</em></blockquote><p>Think:</p><blockquote><strong><em>“I just gave the database a problem. Now it has to figure out the cheapest way to solve it.”</em></strong></blockquote><p>And somewhere underneath that query, it might be building a hash table, walking through two sorted datasets, or repeatedly searching an index.</p><p><strong>The JOIN you write is simple.<br>The algorithm behind it is where the interesting part begins.</strong></p><p><em>thanks for reading….</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cd00ff6fcc6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOLID Isn’t About Writing More Classes]]></title>
            <link>https://medium.com/@vigneshnaidu006/solid-isnt-about-writing-more-classes-eed0c59ce4eb?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/eed0c59ce4eb</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Thu, 08 Oct 2026 08:54:17 GMT</pubDate>
            <atom:updated>2026-10-08T17:09:19.440Z</atom:updated>
            <content:encoded><![CDATA[<h4>The real purpose of SOLID is not creating more files, interfaces, or abstractions. It is making software easier to change.</h4><p>Imagine you join a software project.You open the codebase and find a UserService.java with 1,800 lines.</p><p>It handles:</p><ul><li>User registration</li><li>Login</li><li>Database operations</li><li>Email notifications</li><li>Payments</li><li>Logging</li><li>File uploads</li><li>Reports</li></ul><p>You think:</p><blockquote><em>“This is so complex. Let’s split it into multiple classes.”</em></blockquote><p>So you create:</p><pre>UserService<br>UserValidator<br>UserRepository<br>EmailService<br>PaymentService<br>ReportGenerator<br>...</pre><p>Now you have 15 classes instead of one.You followed what you thought SOLID meant.But did the code actually become better?</p><p><strong>Not necessarily.</strong></p><p>And this is where many developers misunderstand SOLID.</p><h3>SOLID Isn’t a Rule That Says “Create More Classes”</h3><p>When developers first learn SOLID, they usually remember:</p><p><strong>S — Single Responsibility Principle</strong><br><strong>O — Open/Closed Principle</strong><br><strong>L — Liskov Substitution Principle</strong><br><strong>I — Interface Segregation Principle</strong><br><strong>D — Dependency Inversion Principle</strong></p><p>But remembering the names isn’t the difficult part.</p><p>The real question is:</p><blockquote><strong><em>“How can I design my software so that changing one thing doesn’t unnecessarily break ten other things?”</em></strong></blockquote><p>That’s what SOLID is really trying to solve.</p><h3>Let’s Start With a Simple Problem</h3><p>Imagine you’re building a payment system.At first, your application supports only cards:</p><pre>class PaymentService {</pre><pre>    void pay(String type) {</pre><pre>        if (type.equals(&quot;CARD&quot;)) {<br>            // Process card payment<br>        }<br>    }<br>}</pre><p>Then your manager says:</p><blockquote><em>“We also need UPI.”</em></blockquote><p>So you add:</p><pre>if (type.equals(&quot;CARD&quot;)) {<br>    ...<br>}<br>else if (type.equals(&quot;UPI&quot;)) {<br>    ...<br>}</pre><p>Then comes:</p><ul><li>PayPal</li><li>Bank Transfer</li><li>Apple Pay</li><li>Google Pay</li></ul><p>Your class slowly becomes a huge chain of conditions.The problem isn’t simply that the class is getting longer.The problem is that <strong>every new feature requires modifying existing code.</strong>And this is where SOLID becomes useful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6w_Nopplp_r0ujCO5i-0w.png" /></figure><h3>1. Single Responsibility Principle</h3><p>A common explanation of SRP is:</p><blockquote><em>“A class should have only one responsibility.”</em></blockquote><p>But that doesn’t mean:</p><blockquote><em>“A class should have only one function.”</em></blockquote><p>Think about <strong>reasons for change</strong>.</p><p>If UserService handles:</p><pre>Validation<br>Database operations<br>Email<br>PDF generation<br>Logging</pre><p>then a change in any of those areas can force the same class to change.</p><p>A better design separates unrelated responsibilities:</p><pre>UserService<br>    |<br>    ├── UserValidator<br>    ├── UserRepository<br>    ├── EmailService<br>    └── ReportGenerator</pre><p>We didn’t split the class just because SOLID told us to.We split it because <strong>these responsibilities change for different reasons.</strong>That’s the real idea behind SRP.</p><h3>2. Open/Closed Principle</h3><p>Let’s return to our payment system.</p><p>Instead of putting every payment type inside one class, define a common behavior:</p><pre>interface PaymentMethod {<br>    void pay(double amount);<br>}</pre><p>Then:</p><pre>class CardPayment implements PaymentMethod {<br>    public void pay(double amount) {<br>        // Card payment<br>    }<br>}</pre><pre>class UpiPayment implements PaymentMethod {<br>    public void pay(double amount) {<br>        // UPI payment<br>    }<br>}</pre><p>Now adding PayPal means adding another implementation instead of constantly modifying the existing payment logic.This is the <strong>Open/Closed Principle</strong>:</p><blockquote><strong><em>Open for extension, closed for modification.</em></strong></blockquote><p>In general English:</p><p><strong>Add new behavior without repeatedly changing code that already works.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/0*bpSJCvYRbXQMSarf.jpeg" /></figure><h3>3. Liskov Substitution Principle</h3><p>This one sounds complicated, but the basic idea is simple.</p><p>Imagine:</p><pre>class Bird {<br>    void fly() {<br>        ...<br>    }<br>}</pre><p>Then:</p><pre>class Penguin extends Bird {<br>    void fly() {<br>        throw new UnsupportedOperationException();<br>    }<br>}</pre><p>A Penguin is a bird, but it cannot fly.So code expecting a Bird can unexpectedly break when it receives a Penguin.The problem is that the child doesn’t behave according to the expectations of the parent.</p><p>That’s the <strong>Liskov Substitution Principle</strong>.</p><p>In simple words:</p><blockquote><strong><em>If something promises to behave like another thing, it should keep that promise.</em></strong></blockquote><p>This matters in systems using different implementations of payments, storage, databases, notifications, and other services.</p><h3>4. Interface Segregation Principle</h3><p>Imagine an interface with 20 methods.Your class needs only two of them.Why should it depend on the other 18?That’s what ISP tries to prevent.Instead of one giant interface:</p><pre>Employee</pre><p>you can have smaller, meaningful interfaces:</p><pre>Developer<br>Manager<br>ExpenseApprover</pre><p>The idea is:</p><blockquote><strong><em>Don’t force classes to depend on things they don’t need.</em></strong></blockquote><p>ISP isn’t saying:</p><blockquote><em>“Create lots of interfaces.”</em></blockquote><p>It’s saying:</p><blockquote><strong><em>“Avoid unnecessary dependencies.”</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*NE2nv4Zge3M-0Uj4g0yt-g.png" /><figcaption>A huge remote control with 50 buttons vs a simple remote with only the required buttons.</figcaption></figure><h3>5. Dependency Inversion Principle</h3><p>This is especially important in backend development.</p><p>Imagine:</p><pre>OrderService<br>      ↓<br>    MySQL</pre><p>Your business logic is directly tied to one database.If you move from MySQL to PostgreSQL, you may have to change a lot of code.</p><p>Instead:</p><pre>OrderService<br>             ↓<br>      OrderRepository<br>         ↙       ↘<br>      MySQL    PostgreSQL</pre><p>The business logic depends on an abstraction rather than a specific implementation.</p><p>That’s the <strong>Dependency Inversion Principle</strong>.</p><p>In simple words:</p><blockquote><strong><em>Important business logic should depend on what something does, not exactly how it does it.</em></strong></blockquote><p>This idea appears in:</p><ul><li>Databases</li><li>Cloud storage</li><li>Payment providers</li><li>Message queues</li><li>Authentication</li><li>External APIs</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/0*va-x3kxbgtN8X_Tm.png" /></figure><h3>But Here’s the Part People Don’t Talk About</h3><p>At this point, you might think:</p><blockquote><em>“So I need interfaces everywhere.”</em></blockquote><p><strong>No.</strong></p><p>Imagine you create:</p><pre>UserService<br>UserServiceInterface<br>UserServiceImpl<br>UserServiceFactory<br>UserServiceFactoryImpl<br>UserServiceProvider</pre><p>…for something that has one implementation and probably won’t have another.You’ve created more things to understand without necessarily improving the design.</p><h3>More Abstraction Doesn’t Automatically Mean Better Design</h3><p>There are two extremes.</p><h3>Too little structure</h3><pre>1 giant class<br>5000 lines<br>20 responsibilities</pre><p>Hard to change.</p><h3>Too much structure</h3><pre>30 interfaces<br>50 classes<br>10 factories</pre><p>Now even a simple feature requires a treasure map.Neither is good.The goal isn’t <strong>maximum abstraction</strong>.The goal is <strong>meaningful boundaries</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/0*SnkwhCnOyCUwpgcM.png" /></figure><h3>So What Is SOLID Actually Trying to Achieve?</h3><p>Imagine tomorrow your manager says:</p><blockquote><em>“We need another payment provider.”</em></blockquote><p>You shouldn’t have to modify half the application.</p><p>Next week:</p><blockquote><em>“We’re changing our database.”</em></blockquote><p>Your business logic shouldn’t need to be rewritten.</p><p>Next month:</p><blockquote><em>“We need SMS notifications.”</em></blockquote><p>That shouldn’t require changing unrelated code.</p><p>The real goal is:</p><h3>Make changes stay local.</h3><h3>SOLID Is Really About the Cost of Change</h3><p>Software isn’t difficult because we write it once.Software becomes difficult because <strong>requirements keep changing.</strong></p><p>Today:</p><pre>Card payments</pre><p>Tomorrow:</p><pre>Card + UPI</pre><p>Later:</p><pre>New database<br>New notification provider<br>New authentication system</pre><p>Good software design makes these changes easier to handle.That’s why SOLID isn’t really about the number of classes.It’s about <strong>responsibility, dependencies, and change.</strong></p><h3>The Real Meaning of SOLID</h3><p>If I had to explain all five principles without textbook definitions:</p><p><strong>S — SRP</strong><br>Don’t make one piece of code responsible for unrelated things.</p><pre>class UserService {<br>    private final UserRepository repository;<br>    private final EmailService emailService;<br><br>    void register(User user) {<br>        repository.save(user);<br>        emailService.sendWelcomeEmail(user);<br>    }<br>}<br>/*The UserService coordinates the operation, while database and <br>email responsibilities belong to their own components.*/</pre><p><strong>O — OCP</strong><br>Add behavior without constantly rewriting stable code.</p><pre>interface PaymentMethod {<br>    void pay(double amount);<br>}<br><br>class CardPayment implements PaymentMethod {<br>    public void pay(double amount) {<br>        System.out.println(&quot;Paid by card&quot;);<br>    }<br>}<br><br>class UpiPayment implements PaymentMethod {<br>    public void pay(double amount) {<br>        System.out.println(&quot;Paid by UPI&quot;);<br>    }<br>}<br>/*Adding another payment method means adding another implementation<br> instead of filling the existing code with more if-else statements.*/</pre><p><strong>L — LSP</strong><br>Implementations should keep the promises made by their abstractions.</p><pre>interface PaymentMethod {<br>    void pay(double amount);<br>}<br><br>class CardPayment implements PaymentMethod {<br>    public void pay(double amount) {<br>        System.out.println(&quot;Card payment processed&quot;);<br>    }<br>}<br><br>class UpiPayment implements PaymentMethod {<br>    public void pay(double amount) {<br>        System.out.println(&quot;UPI payment processed&quot;);<br>    }<br>}<br>//Both implementations can safely be used wherever PaymentMethod is expected.</pre><p><strong>I — ISP</strong><br>Don’t force code to depend on things it doesn’t need.</p><pre>interface Developer {<br>    void code();<br>}<br><br>interface Manager {<br>    void manage();<br>}<br><br>interface ExpenseApprover {<br>    void approveExpenses();<br>}<br>//Classes only implement what they actually need.</pre><p><strong>D — DIP</strong><br>Keep important business logic independent from replaceable implementation details.</p><pre>interface OrderRepository {<br>    void save(Order order);<br>}<br><br>class OrderService {<br>    private final OrderRepository repository;<br><br>    OrderService(OrderRepository repository) {<br>        this.repository = repository;<br>    }<br>}<br>/*OrderService doesn&#39;t care whether the data is stored in MySQL,PostgreSQL, <br>or somewhere else.That&#39;s the important part of dependency inversion.*/</pre><p>Notice something?</p><p>None of these principles says:</p><blockquote><strong><em>“Create more classes.”</em></strong></blockquote><p>They are all really about <strong>how your code handles change.</strong></p><h3>Final Thought</h3><p>You don’t become a better developer because your project has 100 classes instead of 20.You become a better developer when you can look at a system and ask:</p><p><strong>What is responsible for what?</strong></p><p><strong>What depends on what?</strong></p><p><strong>What happens when this changes?</strong></p><p>And most importantly:</p><blockquote><strong><em>“Can I change this part without being afraid of breaking everything else?”</em></strong></blockquote><p>That’s the real goal of SOLID.</p><p>Not more classes.</p><p>Not more interfaces.</p><p>Not more abstraction.</p><p><strong>Just better boundaries around change.</strong></p><p><em>thanks for reading…..</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eed0c59ce4eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Friendships That Started Because Someone Sat Beside You]]></title>
            <link>https://medium.com/@vigneshnaidu006/the-friendships-that-started-because-someone-sat-beside-you-ff3805bb4a5c?source=rss-ec98db916a90------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff3805bb4a5c</guid>
            <category><![CDATA[friendship]]></category>
            <category><![CDATA[best-friend]]></category>
            <dc:creator><![CDATA[Vignesh]]></dc:creator>
            <pubDate>Wed, 07 Oct 2026 16:35:09 GMT</pubDate>
            <atom:updated>2026-10-07T16:35:09.633Z</atom:updated>
            <content:encoded><![CDATA[<h4>Some of the most important people in our lives were never people we planned to meet.</h4><p>There was no introduction.</p><p>No “Hi, I’m vignesh.”</p><p>No decision to become friends.Someone simply sat beside you.And somehow, that was enough.</p><h3>It Usually Started With Something Completely Ordinary</h3><p>Maybe they sat next to you in class.Maybe the teacher changed the seating arrangement.Maybe there was one empty seat left on the bus.Maybe you ended up beside the same person in the library every afternoon.You probably didn’t think anything of it.They were just another person sitting next to you.Then one day, they asked:</p><p><strong>“Did you understand what she just said?”</strong></p><p>You laughed.You shared a notebook.You borrowed a pen.You complained about the same teacher.And without realizing it, a stranger slowly became familiar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/0*Ta2TwrP8FHwGOQKN.jpg" /></figure><h3>There Was No Moment When You Became Friends</h3><p>That’s the strange thing about some friendships.You can’t remember when they started.You can remember your first conversation.You can remember some ridiculous joke.You can remember the first time you went somewhere together.But there isn’t a specific moment when you can say:</p><p><strong>“That’s when we became friends.”</strong></p><p>It happened somewhere between ordinary days.One conversation became another.Then another.Eventually, you stopped asking whether the seat beside you was free.You just expected them to be there.</p><h3>The Best Friendships Were Built Out of Small Things</h3><p>It wasn’t always the big moments.It was the small things.Saving a seat.Sharing food.Waiting for each other after class.Walking the same route home.Looking at each other when something funny happened because you already knew what the other person was thinking.Sometimes you didn’t even talk.You just sat there.And somehow, that silence wasn’t uncomfortable.For people who aren’t naturally talkative, that kind of friendship is rare.You don’t have to constantly perform.You don’t have to think of something interesting to say.You can simply exist beside someone.And they are completely comfortable with that.</p><h3>Then Life Slowly Changes the Seating Arrangement</h3><p>This is probably the saddest part.Not every friendship ends with an argument.Sometimes life simply changes where everyone sits.Different classes.Different colleges.Different jobs.Different cities.Different routines.One person becomes busy.Then the other becomes busy.The messages become less frequent.The jokes become less frequent.Eventually, you realize you haven’t spoken in months.And the strange thing is…</p><p><strong>nothing actually happened.</strong></p><p>You just stopped sitting beside each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*8XDBL97rAbYvmU46" /></figure><h3>Sometimes You Don’t Miss the Person. You Miss the Proximity.</h3><p>Maybe that’s why old friendships can feel so strange.You don’t necessarily miss having long conversations with them.You miss having them there<strong>.</strong>You miss turning your head and knowing they would understand the joke.You miss having someone to look at when the teacher said something ridiculous.You miss the automatic “come on” after class.You miss knowing that if you walked into a room, there would probably be one familiar face somewhere inside it.We often think friendship is built through conversations.Maybe some friendships are built through <strong>presence</strong>.Just repeatedly being there.</p><h3>There Are People Who Know a Version of You That No Longer Exists</h3><p>Your childhood friend might remember the version of you who was obsessed with something ridiculous.Your school friend remembers your awkward phase.Your college friend knows the person you became later.And sometimes, meeting an old friend feels strange because they remember things about you that you completely forgot.They remember the jokes you used to make.The things you used to worry about.The person you used to be.For a few hours, you aren’t just meeting them.</p><p>You’re meeting an older version of yourself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/0*93G82_UHm6IP_w-6.jpg" /></figure><h3>Maybe That’s Why Sitting Beside Someone Matters</h3><p>We spend so much time trying to meet the right people.At events.Through introductions.Through social media.Through networking.But some of the most meaningful friendships in our lives happened without any of that.Someone simply happened to be sitting beside us.And we happened to stay.Maybe friendship doesn’t always begin with finding someone.Sometimes it begins with <strong>not moving away.</strong></p><h3>And Somewhere, Someone Is Still Sitting Beside You</h3><p>Maybe you’re still sitting beside them.Maybe you haven’t spoken to them in years.Maybe you don’t even remember their last name anymore.But somewhere in your memory, there is probably a seat.A classroom.A library.A staircase.A bench.And someone sitting beside you.At the time, it was completely ordinary.You didn’t know you were making a memory.You were just sitting there.</p><p><strong>And perhaps that’s what makes those friendships so special.</strong></p><p>The most important people sometimes enter our lives without an introduction.They just take the empty seat beside us.And stay there long enough to become part of the story.</p><p><em>Thanks for reading.</em></p><p>If this reminded you of someone, maybe send them a message.</p><p>You don’t need a reason.</p><p>Sometimes <strong>“Hey, remember when we used to sit together?”</strong> is enough.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff3805bb4a5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>