<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kavya1205</title>
    <description>The latest articles on DEV Community by kavya1205 (@kavya1205).</description>
    <link>https://dev.to/kavya1205</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F588228%2F6605c937-9002-47f6-b943-6e02fdc867e6.png</url>
      <title>DEV Community: kavya1205</title>
      <link>https://dev.to/kavya1205</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kavya1205"/>
    <language>en</language>
    <item>
      <title>JavaScript Bundling Explained — From Zero to Optimised</title>
      <dc:creator>kavya1205</dc:creator>
      <pubDate>Mon, 22 Jun 2026 08:19:58 +0000</pubDate>
      <link>https://dev.to/kavya1205/javascript-bundling-explained-from-zero-to-optimised-f7p</link>
      <guid>https://dev.to/kavya1205/javascript-bundling-explained-from-zero-to-optimised-f7p</guid>
      <description>&lt;p&gt;Here's your Dev.to article:&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Title:&lt;/strong&gt; &lt;code&gt;JavaScript Bundling Explained — From Zero to Optimised&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;javascript&lt;/code&gt; &lt;code&gt;webdev&lt;/code&gt; &lt;code&gt;performance&lt;/code&gt; &lt;code&gt;beginners&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;You write your React or Angular app across dozens of files. Components, services, utilities, third party libraries — all split up neatly.&lt;/p&gt;

&lt;p&gt;But here's the thing. The browser doesn't care about your neat folder structure. Loading 200 separate files means 200 separate network requests. That's slow. Really slow.&lt;/p&gt;

&lt;p&gt;This is exactly the problem bundlers solve.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is bundling?
&lt;/h2&gt;

&lt;p&gt;A bundler takes all your files your code, your imports, your node_modules and combines them into one (or a few) optimised files that the browser can load efficiently.&lt;/p&gt;

&lt;p&gt;Think of it like packing for a trip. Instead of carrying 50 small bags, you pack everything into one suitcase. Same stuff, much easier to carry.&lt;/p&gt;

&lt;p&gt;That's bundling.&lt;/p&gt;




&lt;h2&gt;
  
  
  What else does a bundler do?
&lt;/h2&gt;

&lt;p&gt;Combining files is just the start. Modern bundlers also:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Minification&lt;/strong&gt; — removes whitespace, comments, and shortens variable names. Your readable &lt;code&gt;userName&lt;/code&gt; becomes &lt;code&gt;a&lt;/code&gt;. Same logic, way smaller file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tree shaking&lt;/strong&gt; — removes code you imported but never actually used. If you imported a utility library but only used one function, the bundler strips the rest out automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code splitting&lt;/strong&gt; — instead of one giant bundle, splits your code into smaller chunks. Only load what the user actually needs right now.&lt;/p&gt;

&lt;p&gt;All of this = smaller files = faster app.&lt;/p&gt;




&lt;h2&gt;
  
  
  Webpack vs Vite — what's the difference?
&lt;/h2&gt;

&lt;p&gt;Both are bundlers but they take very different approaches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Webpack&lt;/strong&gt; came first. It bundles your entire app upfront before serving it — even in development. That means every time you make a change, it rebundles everything. Powerful and highly configurable, but can feel slow in large projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vite&lt;/strong&gt; is the modern alternative. During development, it doesn't bundle at all it serves your files directly using native ES modules in the browser. Only the file you changed gets updated instantly. The result? Near instant hot reload no matter how big your project is.&lt;/p&gt;

&lt;p&gt;For production, Vite uses Rollup under the hood to create optimised bundles.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Webpack&lt;/th&gt;
&lt;th&gt;Vite&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Dev speed&lt;/td&gt;
&lt;td&gt;Slower&lt;/td&gt;
&lt;td&gt;Extremely fast&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Config&lt;/td&gt;
&lt;td&gt;Complex but flexible&lt;/td&gt;
&lt;td&gt;Simple out of the box&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ecosystem&lt;/td&gt;
&lt;td&gt;Very mature&lt;/td&gt;
&lt;td&gt;Growing fast&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Large legacy projects&lt;/td&gt;
&lt;td&gt;New modern projects&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Most new projects today use Vite. If you're creating a new project go with Vite.&lt;/p&gt;




&lt;h2&gt;
  
  
  How bundlers work internally
&lt;/h2&gt;

&lt;p&gt;At a high level, every bundler does the same 3 things:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Build a dependency graph&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Starting from your entry file (usually &lt;code&gt;main.js&lt;/code&gt; or &lt;code&gt;main.ts&lt;/code&gt;), the bundler follows every import and maps out which file depends on which. This is called the dependency graph.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Transform the code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each file gets transformed TypeScript gets compiled to JavaScript, JSX gets converted to plain JS, modern syntax gets converted for older browsers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Output the bundle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Everything gets combined, minified, and written to an output folder usually &lt;code&gt;/dist&lt;/code&gt;. That's what gets deployed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bundle size optimisation tips
&lt;/h2&gt;

&lt;p&gt;A bloated bundle = slow app. Here's how to keep it lean:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lazy loading&lt;/strong&gt; — don't load everything upfront. Load components only when the user navigates to them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// React lazy loading&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Dashboard&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lazy&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Dashboard&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Avoid importing entire libraries&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Imports the entire lodash library&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;_&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lodash&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ✅ Import only what you need&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lodash/debounce&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analyse your bundle&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use tools like &lt;code&gt;webpack-bundle-analyzer&lt;/code&gt; or Vite's &lt;code&gt;rollup-plugin-visualizer&lt;/code&gt; to see exactly what's taking up space. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use production builds&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Always deploy the production build. Development builds include debugging tools that add significant size.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# React&lt;/span&gt;
npm run build

&lt;span class="c"&gt;# Angular&lt;/span&gt;
ng build &lt;span class="nt"&gt;--configuration&lt;/span&gt; production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Bundling isn't magic it's a practical solution to a real problem. The browser needs fewer, smaller files. Bundlers make that happen automatically.&lt;/p&gt;

&lt;p&gt;Start with Vite for new projects. Keep an eye on your bundle size as your app grows. And use lazy loading early — it's one of the easiest wins in frontend performance.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>performance</category>
      <category>beginners</category>
    </item>
    <item>
      <title>We Need to Talk About How We're Using AI for Development</title>
      <dc:creator>kavya1205</dc:creator>
      <pubDate>Thu, 18 Jun 2026 04:39:14 +0000</pubDate>
      <link>https://dev.to/kavya1205/we-need-to-talk-about-how-were-using-ai-for-development-23hg</link>
      <guid>https://dev.to/kavya1205/we-need-to-talk-about-how-were-using-ai-for-development-23hg</guid>
      <description>&lt;p&gt;Something weird is happening in the developer community.&lt;/p&gt;

&lt;p&gt;Developers are opening their IDEs, hitting a problem, and immediately asking AI before spending even 30 seconds thinking about it.&lt;/p&gt;

&lt;p&gt;Not Googling.&lt;/p&gt;

&lt;p&gt;Not reading the documentation.&lt;/p&gt;

&lt;p&gt;Not debugging.&lt;/p&gt;

&lt;p&gt;Not thinking.&lt;/p&gt;

&lt;p&gt;Straight to AI.&lt;/p&gt;

&lt;p&gt;And honestly, it's starting to show.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Shortcut That Costs You
&lt;/h2&gt;

&lt;p&gt;AI gives you an answer instantly. That feels great in the moment.&lt;/p&gt;

&lt;p&gt;But something important happens when you wrestle with a problem yourself even for just five minutes.&lt;/p&gt;

&lt;p&gt;Your brain builds a mental map.&lt;/p&gt;

&lt;p&gt;You start understanding &lt;strong&gt;why&lt;/strong&gt; a solution works, not just &lt;strong&gt;what&lt;/strong&gt; the solution is.&lt;/p&gt;

&lt;p&gt;When AI gives you the answer immediately, you skip that map building process entirely.&lt;/p&gt;

&lt;p&gt;You got the output.&lt;/p&gt;

&lt;p&gt;But you didn't get the understanding.&lt;/p&gt;

&lt;h2&gt;
  
  
  When It Becomes a Problem
&lt;/h2&gt;

&lt;p&gt;At first, it doesn't feel like a problem.&lt;/p&gt;

&lt;p&gt;Everything works.&lt;/p&gt;

&lt;p&gt;You're shipping features faster.&lt;/p&gt;

&lt;p&gt;Life is good.&lt;/p&gt;

&lt;p&gt;Then one day something breaks in production.&lt;/p&gt;

&lt;p&gt;Not a simple bug. Something strange. Something that requires understanding how the system actually works under the hood.&lt;/p&gt;

&lt;p&gt;No prompt can save you because the issue isn't about generating code  it's about reasoning through complexity.&lt;/p&gt;

&lt;p&gt;And that's when you realize something uncomfortable:&lt;/p&gt;

&lt;p&gt;You've been on autopilot for months.&lt;/p&gt;

&lt;p&gt;That's when it becomes a problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Is Genuinely Great: For the Right Things
&lt;/h2&gt;

&lt;p&gt;Let's be clear: AI is not the enemy.&lt;/p&gt;

&lt;p&gt;It's an incredible tool.&lt;/p&gt;

&lt;p&gt;It's great for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Boilerplate and repetitive code&lt;/li&gt;
&lt;li&gt;Looking up syntax you rarely use&lt;/li&gt;
&lt;li&gt;Generating test cases&lt;/li&gt;
&lt;li&gt;Rubber duck debugging&lt;/li&gt;
&lt;li&gt;Exploring alternative approaches&lt;/li&gt;
&lt;li&gt;Speeding up tasks you already understand&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point is the important one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tasks you already understand.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AI is a multiplier.&lt;/p&gt;

&lt;p&gt;But you need something to multiply first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where I Draw the Line
&lt;/h2&gt;

&lt;p&gt;A simple rule has helped me:&lt;/p&gt;

&lt;p&gt;If you don't understand the problem yet, think first. AI second.&lt;/p&gt;

&lt;p&gt;Spend 5–10 minutes genuinely attempting the problem yourself.&lt;/p&gt;

&lt;p&gt;Read the documentation.&lt;/p&gt;

&lt;p&gt;Search for related issues.&lt;/p&gt;

&lt;p&gt;Experiment.&lt;/p&gt;

&lt;p&gt;Fail.&lt;/p&gt;

&lt;p&gt;Then, if you're still stuck, bring in AI.&lt;/p&gt;

&lt;p&gt;Now you'll actually understand the answer because you have context.&lt;/p&gt;

&lt;p&gt;The difference is huge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fundamentals Don't Expire
&lt;/h2&gt;

&lt;p&gt;Frameworks change.&lt;/p&gt;

&lt;p&gt;Libraries come and go.&lt;/p&gt;

&lt;p&gt;AI tools will continue evolving.&lt;/p&gt;

&lt;p&gt;But fundamentals don't expire.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript fundamentals&lt;/li&gt;
&lt;li&gt;Data structures and algorithms&lt;/li&gt;
&lt;li&gt;Browser internals&lt;/li&gt;
&lt;li&gt;Networking and APIs&lt;/li&gt;
&lt;li&gt;Debugging techniques&lt;/li&gt;
&lt;li&gt;System design principles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No AI tool can build those foundations for you.&lt;/p&gt;

&lt;p&gt;They come from repetition, curiosity, mistakes, and experience.&lt;/p&gt;

&lt;p&gt;The developers who remain valuable over the long term won't be the ones who use AI instead of thinking.&lt;/p&gt;

&lt;p&gt;They'll be the ones who have strong fundamentals and use AI on top of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Small Challenge
&lt;/h2&gt;

&lt;p&gt;The next time you hit a problem, give yourself &lt;strong&gt;10 minutes&lt;/strong&gt; before opening AI.&lt;/p&gt;

&lt;p&gt;Just 10 minutes.&lt;/p&gt;

&lt;p&gt;Think.&lt;/p&gt;

&lt;p&gt;Try.&lt;/p&gt;

&lt;p&gt;Fail if needed.&lt;/p&gt;

&lt;p&gt;Then use AI.&lt;/p&gt;

&lt;p&gt;You'll notice the difference immediately.&lt;/p&gt;

&lt;p&gt;Instead of copying the answer, you'll actually understand it.&lt;/p&gt;

&lt;p&gt;And that's where real growth happens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about you?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do you think developers are reaching for AI too quickly, or is this simply the new way of working?&lt;/p&gt;

&lt;p&gt;I'd love to hear where you draw the line.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>career</category>
      <category>discuss</category>
    </item>
    <item>
      <title>User Double Clicked a Button — Now You Have 2 API Calls. How Do You Fix It?</title>
      <dc:creator>kavya1205</dc:creator>
      <pubDate>Fri, 12 Jun 2026 06:41:39 +0000</pubDate>
      <link>https://dev.to/kavya1205/user-double-clicked-a-button-now-you-have-2-api-calls-how-do-you-fix-it-1b0i</link>
      <guid>https://dev.to/kavya1205/user-double-clicked-a-button-now-you-have-2-api-calls-how-do-you-fix-it-1b0i</guid>
      <description>&lt;p&gt;&lt;strong&gt;Approach 1 — Disable the button (simplest)&lt;/strong&gt;&lt;br&gt;
Set a loading flag. Disable the button the moment the first click fires.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsmanzu1kpjpelyg2z2pc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsmanzu1kpjpelyg2z2pc.png" alt=" " width="682" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When to use: Form submissions, payment buttons, any action that should fire exactly once.&lt;br&gt;
Limitation: If the user navigates away and back — the state resets. Use a ref for more reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach 2 — Debounce&lt;/strong&gt;&lt;br&gt;
Wait for the user to “stop clicking” before firing the request.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F617gafl4c6dqq3bt6f01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F617gafl4c6dqq3bt6f01.png" alt=" " width="672" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Double click within 300ms? Only the last click fires.&lt;br&gt;
When to use: Search inputs, filter buttons, anything where you want the “last intent” to win.&lt;br&gt;
Limitation: Adds a 300ms delay not suitable for instant actions like payments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Approach 3 — AbortController (most powerful)&lt;/strong&gt;&lt;br&gt;
Cancel the previous in-flight request when a new one fires.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9abt7y59pxv9mmhhhdo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9abt7y59pxv9mmhhhdo.png" alt=" " width="772" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Previous request gets cancelled at the network level. Only the latest request completes.&lt;br&gt;
When to use: Search-as-you-type, filter changes, any scenario where only the latest result matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick decision guide&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Form submit / Payment: Disable button&lt;/li&gt;
&lt;li&gt;Search input: Debounce or AbortController&lt;/li&gt;
&lt;li&gt;Rapid filter changes: AbortController&lt;/li&gt;
&lt;li&gt;General safety net: Disable button (always safe default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lastly,&lt;br&gt;
The disable button approach covers 80% of real-world cases it’s the right default. Add AbortController when you’re dealing with fast repeated requests like search.&lt;br&gt;
Next time you see a duplicate entry in your database you know exactly where to look.&lt;/p&gt;

&lt;p&gt;Drop a reaction if this helped. More real-world frontend fixes every week 🚀&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>How Does Amazon Stop Two People from Booking the Same Seat?</title>
      <dc:creator>kavya1205</dc:creator>
      <pubDate>Wed, 10 Jun 2026 05:19:08 +0000</pubDate>
      <link>https://dev.to/kavya1205/how-does-amazon-stop-two-people-from-booking-the-same-seat-54pe</link>
      <guid>https://dev.to/kavya1205/how-does-amazon-stop-two-people-from-booking-the-same-seat-54pe</guid>
      <description>&lt;p&gt;You're on BookMyShow or Amazon. You see 1 seat left. You click it. Someone else clicks it at the exact same moment.&lt;br&gt;
The Problem&lt;br&gt;
Imagine 1000 people are staring at the same "1 seat left" screen. When multiple people click Book Now at the same time, the server receives all those requests together.&lt;br&gt;
Without any protection — all of them could "successfully" book the same seat. That's a disaster.&lt;/p&gt;

&lt;p&gt;How it's actually solved:-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Locking the seat temporarily (Optimistic / Pessimistic Lock)
When you click a seat, the system locks it for you for ~10 minutes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"Seat 12A is reserved for this session. Complete payment in 9:45"&lt;/p&gt;

&lt;p&gt;You've seen this countdown on BookMyShow. That's a temporary lock in the database. No one else can book it while you're paying.&lt;br&gt;
If you don't complete payment → lock expires → seat goes back to available.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Database-level constraint
The database has a rule:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;"Only ONE booking record can exist per seat per show."&lt;/p&gt;

&lt;p&gt;Even if 500 requests hit the server at the same time, the database only allows one of them to win. The rest get an error — and the user sees "Sorry, seat just got booked."&lt;br&gt;
This is called a unique constraint.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Queue the requests
Instead of handling 1000 requests at the same time, Amazon puts them in a line (queue).
First come, first served. Each request is processed one at a time for that seat. Simple and fair.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🎯 Real world analogy&lt;br&gt;
Think of it like a token system at a restaurant&lt;/p&gt;

&lt;p&gt;You take token #47&lt;br&gt;
Only token #47 is called at the counter at a time&lt;br&gt;
No two people handle the same counter simultaneously&lt;/p&gt;

&lt;p&gt;Same idea.&lt;br&gt;
🔑 Key terms&lt;br&gt;
Pessimistic Lock : Lock the seat the moment someone clicks it&lt;br&gt;
Optimistic Lock: Allow clicks, but only first one wins at save time&lt;br&gt;
Unique Constraint: Database rule — no duplicates allowed&lt;br&gt;
Queue: Process one request at a time, in order&lt;/p&gt;

&lt;p&gt;Wrapping up&lt;br&gt;
Next time you see that countdown timer on a booking site — you know exactly what's happening behind the scenes. The system locked that seat just for you, and is racing against your payment.&lt;br&gt;
Pretty cool, right?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Javascript Coding Problem 1: Chunk an Array into N size</title>
      <dc:creator>kavya1205</dc:creator>
      <pubDate>Sat, 28 Jun 2025 07:35:04 +0000</pubDate>
      <link>https://dev.to/kavya1205/javascript-coding-problem-1-chunk-an-array-into-n-size-jg</link>
      <guid>https://dev.to/kavya1205/javascript-coding-problem-1-chunk-an-array-into-n-size-jg</guid>
      <description>&lt;p&gt;&lt;strong&gt;Chunk an Array into Size N&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let arr = [1,2,3,4,5]
let n = 3

function chunkArray(arr, n){
    let res=[]
    for(let i=0;i&amp;lt;arr.length;i+=n){
        res.push(arr.slice(i, i+n))
    }
    return res;
}
const d = chunkArray(arr, n)
console.log(d)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>programming</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>coding</category>
    </item>
    <item>
      <title>Batch API Calls in Javascript</title>
      <dc:creator>kavya1205</dc:creator>
      <pubDate>Sat, 28 Jun 2025 07:20:55 +0000</pubDate>
      <link>https://dev.to/kavya1205/batch-api-calls-in-javascript-1i8i</link>
      <guid>https://dev.to/kavya1205/batch-api-calls-in-javascript-1i8i</guid>
      <description>&lt;p&gt;Hi Everyone,&lt;br&gt;
This was one of the javascript question that was asked during an interview - Batch api call&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const urls = [
  'https://jsonplaceholder.typicode.com/posts/1',
  'https://jsonplaceholder.typicode.com/posts/2',
  'https://jsonplaceholder.typicode.com/posts/3',
  'https://jsonplaceholder.typicode.com/posts/4',
  'https://jsonplaceholder.typicode.com/posts/5',
  'https://jsonplaceholder.typicode.com/posts/6',
  'https://jsonplaceholder.typicode.com/posts/7',
  'https://jsonplaceholder.typicode.com/posts/8',
  'https://jsonplaceholder.typicode.com/posts/9',
  'https://jsonplaceholder.typicode.com/posts/10'
];


async function limitAPICalls(urls, limit = 3) {
  for (let i = 0; i &amp;lt; urls.length; i += limit) {
    const batch = urls.slice(i, i + limit);

    const responses = await Promise.all(
      batch.map(url =&amp;gt; fetch(url).then(res =&amp;gt; res.json()))
    );

    responses.forEach((res, index) =&amp;gt; {
      console.log(`Response ${i + index + 1}:`, res);
    });
  }
}
const limitApis = limitAPICalls(urls)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
