<?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: Hari </title>
    <description>The latest articles on DEV Community by Hari  (@harishankarr7).</description>
    <link>https://dev.to/harishankarr7</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2860409%2F55f2ee04-db32-4e80-8c31-0cb86ba7b65b.jpg</url>
      <title>DEV Community: Hari </title>
      <link>https://dev.to/harishankarr7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harishankarr7"/>
    <language>en</language>
    <item>
      <title>How Claude Code's entire source code leaked, and it wasn't a hack</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Sat, 04 Apr 2026 00:59:39 +0000</pubDate>
      <link>https://dev.to/harishankarr7/how-claude-codes-entire-source-code-leaked-and-it-wasnt-a-hack-4d5c</link>
      <guid>https://dev.to/harishankarr7/how-claude-codes-entire-source-code-leaked-and-it-wasnt-a-hack-4d5c</guid>
      <description>&lt;p&gt;Last week, March 31, 2026, &lt;strong&gt;Anthropic&lt;/strong&gt;, the company behind Claude, accidentally leaked the full source code of their product Claude Code.&lt;/p&gt;

&lt;p&gt;Here's the full story, explained so anyone can follow it.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, what is Claude Code?
&lt;/h2&gt;

&lt;p&gt;Claude Code is a tool that developers install on their laptops to use Claude directly from their terminal - their command line. Think of it like an app, but instead of downloading it from an app store, developers install it from a place called npm.&lt;/p&gt;

&lt;p&gt;npm is basically the App Store for developer tools. When a company like Anthropic wants to ship a tool that developers can install with one command, they publish it to npm. It's public, open, and anyone in the world can download any package from it — no account, no password, no fee. That's by design. It's how the whole ecosystem works.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you write C#&lt;br&gt;
npm is NuGet. &lt;br&gt;
Publishing to npm is exactly like publishing a package to nuget.org, &lt;br&gt;
except every single package on npm is public by default. &lt;br&gt;
When Anthropic published Claude Code, it was like pushing a NuGet package to a public feed that the entire world can browse.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When engineers write code for an application, they need to debug it, run it locally, see how it behaves, and figure out which line caused a crash. During this process, a file gets generated automatically called a map file. It's basically a breadcrumb trail that points back to the exact line of code that broke something. Someone published this to the world by mistake while publishing their feature update for Claude Code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A 59.8 MB JavaScript source map file (.map),
intended for internal debugging, 
was accidentally included in version 2.1.88 
of the @anthropic-ai/claude-code package 
on the public npm registry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If you write C#&lt;br&gt;
This is your .pdb file&lt;br&gt;
The Program Debug Database. &lt;br&gt;
When you compile in Debug mode, the compiler generates a .pdb alongside your .dll. &lt;br&gt;
It maps compiled IL back to your original source lines, your variable names, your method names. &lt;br&gt;
It's what makes your stack traces say "crashed on line 47 of OrderService.cs" instead of a memory address. &lt;br&gt;
You never ship the .pdb to end users, and you'd never bundle it into a NuGet package.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Here's a real snippet of what it looked like:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sources"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"src/utils/undercover.ts"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"src/tools/BashTool.ts"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"src/memory/index.ts"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"sourcesContent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"const UNDERCOVER_PROMPT = `You are operating UNDERCOVER...`"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"export async function runBashCommand(cmd: string) {...}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="s2"&gt;"export class MemoryStore {...}"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mappings"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AAAA,SAASA,WAAWC..."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See what's happening here:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;sources:&lt;/em&gt; lists every original source file by name and path. Just reading this tells you the entire folder structure of Anthropic's codebase&lt;br&gt;
&lt;em&gt;sourcesContent:&lt;/em&gt; the actual full source code of each file, embedded right here as a string. You don't go anywhere else. It's all sitting right in this one JSON file&lt;br&gt;
&lt;em&gt;mappings:&lt;/em&gt; the encoded string that connects minified code character positions back to exact lines in those source files&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagine Coca-Cola&lt;/strong&gt; finally ships their secret formula in a can. The can looks normal from the outside. Same red, same taste, nobody can figure out what's inside just by drinking it.&lt;br&gt;
But they accidentally taped a piece of paper to the back of every can that says:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;ingredients&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;caramel"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;phosphoric&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;acid"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; 
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;coca&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;leaf&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;extract"&lt;/span&gt;
&lt;span class="pi"&gt;]&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;

&lt;span class="na"&gt;recipe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mix&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;caramel&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;at&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0.5%&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;concentration"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;add&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;phosphoric&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;acid&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;for&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;tartness"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;coca&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;leaf&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;extract&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;—&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;do&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;exceed&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;0.1%"&lt;/span&gt;
  &lt;span class="nv"&gt;// NOTE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;caramel ratio in batch v8 still not right&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
  &lt;span class="nv"&gt;// regression from v4. needs fixing before global launch.&lt;/span&gt;
&lt;span class="pi"&gt;]&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;

&lt;span class="na"&gt;upcomingFlavors&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Coca-Cola&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Peach&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;—&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;launching&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;May&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;2026"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt;
  &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Coca-Cola&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Zero&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Sugar&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Cherry&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;—&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;still&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;in&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;testing"&lt;/span&gt;
&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  But how exactly did it get out?
&lt;/h2&gt;

&lt;p&gt;In every JavaScript project, there's a file called .npmignore. It works like a packing checklist, it tells the build system what to leave out of the package before publishing. Things like test files, internal scripts, and yes, map files. You explicitly list what should never ship.&lt;/p&gt;

&lt;p&gt;Anthropic's build tool, Bun, generates map files automatically during the build process. That's normal and useful during development. The problem is someone never added *.map to the .npmignore file. So when the package was built and published, the map file came along for the ride, no one told to leave out the file before publishing the feature update.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who found it and how fast?
&lt;/h2&gt;

&lt;p&gt;An intern. At a small crypto company called Solayer Labs. His name is Chaofan Shou. He was poking around the Claude Code package, the kind of thing curious developers do all the time, spotted the map file, immediately knew what it meant, and posted a direct download link on X.&lt;/p&gt;

&lt;p&gt;This was at 4:23am ET.&lt;/p&gt;

&lt;p&gt;By morning, tens of thousands of developers had downloaded and mirrored the code across GitHub. It had over 80,000 stars. People were already digging through it, finding unreleased features, internal model codenames, and architectural secrets Anthropic never meant to share.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>csharp</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>If cache is faster than database, why not store everything in cache?</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Sat, 28 Mar 2026 23:42:01 +0000</pubDate>
      <link>https://dev.to/harishankarr7/if-cache-is-faster-than-database-why-not-store-everything-in-cache-lap</link>
      <guid>https://dev.to/harishankarr7/if-cache-is-faster-than-database-why-not-store-everything-in-cache-lap</guid>
      <description>&lt;p&gt;We should all have had this question, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;why not just use cache everywhere if cache is faster than a database?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I want to quantify and show the difference to you today. &lt;/p&gt;

&lt;p&gt;You are thinking, ok this read is going to be a waste of time, I am just gonna say Cache is volatile and move on to doomscroll, or vibe code or watch the latest Ai slop VC drama. Lets fix that, you have a non volatile cache and you dont have to worry about the money to make it non volatile. Can you still use Redis as your DB ? &lt;/p&gt;

&lt;p&gt;Volatility means the cache lives on RAM, when you switch it off, all the data is gone.&lt;br&gt;
Whereas DB lives on the disk, and it will survive restart.&lt;/p&gt;

&lt;p&gt;We can make it volatile by doing snapshot of the data to a disk, or replicating data across servers.&lt;/p&gt;

&lt;p&gt;So now that you have decided to think, can you actually make Redis your DB, given it is not volatile anymore?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem 1:&lt;/strong&gt; Lets talk about the easy reasoning here - COST&lt;/p&gt;

&lt;p&gt;Lets assume you own a bank, and it has the following things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;10 million total users&lt;/li&gt;
&lt;li&gt;1 million Daily active users&lt;/li&gt;
&lt;li&gt;each active user does 20 reads/ day and 2 writes/ day&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DynamoDBs Pricing:&lt;br&gt;
$0.125 per million reads&lt;br&gt;
$0.625 per million writes&lt;br&gt;
$0.25 per GB month for storage&lt;/p&gt;

&lt;p&gt;With 1 million active users you are doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;20 million reads per day&lt;/li&gt;
&lt;li&gt;2 million writes per day&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So that will cost you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$1.25 per day for reads&lt;/li&gt;
&lt;li&gt;$1.25 per day for writes&lt;/li&gt;
&lt;li&gt;50 GB storage about $0.42 per day&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Total:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$1065 per year&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Now lets compare to what that will cost us if we use Cache which is REDIS&lt;/strong&gt;&lt;br&gt;
Redis does not charge us per read the way DynamoDB does&lt;br&gt;
Instead we pay for the cluster capacity to exist all the time.&lt;/p&gt;

&lt;p&gt;So for our situation we need 2 shards, 1 replica per shard and 4 total nodes&lt;br&gt;
That will Cost:&lt;br&gt;
$1.729 per hour&lt;br&gt;
$41.50 per day&lt;br&gt;
$15,147 per year&lt;/p&gt;

&lt;p&gt;So we are paying ~15x more for REDIS.&lt;br&gt;
But you know what, lets say money aint a problem, can you still use Redis as your DB ?&lt;/p&gt;

&lt;h2&gt;
  
  
  Now comes - Eviction pressure
&lt;/h2&gt;

&lt;p&gt;What does it mean ? &lt;br&gt;
When Redis runs out of memory, it must remove some data to make space &lt;br&gt;
Redis commonly uses LRU - Least Recently Used&lt;br&gt;
Which means : delete the data that hasnt been used recently &lt;/p&gt;

&lt;p&gt;Example : User A logs in every day, then it will stay in Redis&lt;br&gt;
User B hasnt logged in for a while, it gets removed from memory&lt;/p&gt;

&lt;p&gt;So now if Redis was your source of truth, user's account details or balance could vanish.&lt;/p&gt;

&lt;p&gt;Ok then lets disable eviction and scale infinitely to have all the RAM. &lt;br&gt;
Well yea then you can do it, by spending ton of money just because you went in a rabbit hole of experimenting with the wrong tool for the job.&lt;/p&gt;

&lt;p&gt;But you know what, rabbit holes like this are totally worth the millions of dollars.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hari.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redis</category>
      <category>cache</category>
      <category>dynamodb</category>
      <category>sor</category>
    </item>
    <item>
      <title>The Art of Building Software will never Die</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Mon, 18 Aug 2025 12:48:50 +0000</pubDate>
      <link>https://dev.to/harishankarr7/the-art-of-building-software-will-never-die-5eda</link>
      <guid>https://dev.to/harishankarr7/the-art-of-building-software-will-never-die-5eda</guid>
      <description>&lt;p&gt;The art of building is such an important curiosity to have.  &lt;/p&gt;

&lt;p&gt;I fully embrace AI—I use it every day to write and ship software faster. It’s incredible, and I’d be lying if I said it hasn’t changed the way I work. &lt;/p&gt;

&lt;p&gt;But I can’t let go of my curiosity to understand the smallest moving parts. I can’t stop tinkering, breaking things down, and building my side projects brick by brick. That urge to &lt;em&gt;build for the sake of building&lt;/em&gt; is something I’m deeply grateful for.  &lt;/p&gt;

&lt;p&gt;Recently, I’ve been diving into microservices and APIs. Somewhere along the way, a simple question started haunting me: &lt;em&gt;how is my code even reachable on my local machine?&lt;/em&gt; Sure, I know the surface-level stuff—HTTP calls, GET requests, JSON responses, the satisfying &lt;strong&gt;200 OK&lt;/strong&gt;. But what even &lt;em&gt;is&lt;/em&gt; the HTTP server that makes this all possible? Why had I never broken it down, piece by piece, and seen it for myself?  &lt;/p&gt;

&lt;p&gt;So, I decided to write my own HTTP server—not because I need to, but because I &lt;em&gt;want&lt;/em&gt; to see. I want to understand. I want to &lt;em&gt;become&lt;/em&gt;.  &lt;/p&gt;

&lt;p&gt;It’s 6:36 AM. A loud truck woke me up, and I caught the sunrise. Instead of rolling back to sleep, I felt this unstoppable urge to tell you how excited I am—because today, I’m going to learn to create my own HTTP server. And yes, I’m typing this from my bathroom because I simply couldn’t wait.  &lt;/p&gt;

&lt;p&gt;Damn! Free will is an amazing thing.  &lt;/p&gt;

&lt;p&gt;And that’s the heart of it: the art of building can never die. It shouldn’t. No matter how powerful our tools get, no matter how efficient AI becomes, there’s something primal about &lt;em&gt;making&lt;/em&gt; things ourselves.  &lt;/p&gt;

&lt;p&gt;Writing code and learning computer science can feel almost... spiritual. Sometimes, when I’m building, I hear Tool’s &lt;em&gt;46 &amp;amp; 2&lt;/em&gt; looping in my head:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Listen to my muscle memory&lt;br&gt;&lt;br&gt;
Contemplate what I have been clinging to.”  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s what it feels like—muscle memory, curiosity, and the joy of creation blending into something deeper.  &lt;/p&gt;

&lt;p&gt;So yes—use the tools. Use AI. Get smarter, build faster, build cleaner. But &lt;em&gt;don’t stop building.&lt;/em&gt; Don’t stop experimenting. Don’t stop following your curiosity down strange rabbit holes.  &lt;/p&gt;

&lt;p&gt;"There’s a perfect recording of &lt;em&gt;Stairway to Heaven&lt;/em&gt; on vinyl or Spotify, and you can play it a hundred times—it will always sound solid. But it will never replace the joy of picking up a guitar and playing it with your own hands."  &lt;/p&gt;

&lt;p&gt;-some guy on the internet&lt;/p&gt;

&lt;p&gt;That’s the joy of building. That’s why it will never die.  &lt;/p&gt;

</description>
      <category>programming</category>
      <category>ai</category>
      <category>software</category>
      <category>development</category>
    </item>
    <item>
      <title>The Tea app data breach: What really happened?</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Sun, 03 Aug 2025 04:58:33 +0000</pubDate>
      <link>https://dev.to/harishankarr7/the-tea-app-data-breach-what-really-happened-3amh</link>
      <guid>https://dev.to/harishankarr7/the-tea-app-data-breach-what-really-happened-3amh</guid>
      <description>&lt;h1&gt;
  
  
  What Really Happened in the Tea App Data Breach (And Why Principles Matter)
&lt;/h1&gt;

&lt;p&gt;In July 2025, the Tea app suffered &lt;strong&gt;two major data breaches&lt;/strong&gt; — and both were preventable with basic engineering practices. Let's break it down technically.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧱 Tea App: Likely Architecture
&lt;/h2&gt;

&lt;p&gt;Tea is a social-feedback app. Its backend likely had:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A mobile frontend using React Native or Swift/Kotlin&lt;/li&gt;
&lt;li&gt;A REST API gateway (Node.js, Python, or Firebase Functions)&lt;/li&gt;
&lt;li&gt;Firebase for authentication and user management&lt;/li&gt;
&lt;li&gt;Firebase Cloud Storage for images and ID uploads&lt;/li&gt;
&lt;li&gt;A NoSQL database (Firestore or similar) for messages and posts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s the catch: &lt;strong&gt;Firebase allows direct access to storage and database&lt;/strong&gt;, bypassing your API &lt;strong&gt;if&lt;/strong&gt; you don’t lock things down explicitly.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔐 Breach #1 — Exposed Image &amp;amp; ID Data (72,000 files)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  How Firebase Works (and Where It Went Wrong)
&lt;/h3&gt;

&lt;p&gt;Firebase Storage lets mobile apps upload/view files directly using SDKs or URLs. It uses Firebase Security Rules (not your backend APIs) to enforce access control. &lt;/p&gt;

&lt;p&gt;But if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You allow public &lt;code&gt;read&lt;/code&gt; access in rules (or forget to update them),&lt;/li&gt;
&lt;li&gt;Or store files in a bucket with default “open” config,&lt;/li&gt;
&lt;li&gt;And skip backend validation...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then users — or attackers — can access images just by knowing the link. That’s what happened. A &lt;strong&gt;legacy bucket&lt;/strong&gt; storing verification images was left public.&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Storage&lt;/strong&gt;: Firebase bucket from an older version of the app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Issue&lt;/strong&gt;: Public read access. No token, no check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact&lt;/strong&gt;: 13,000 selfies/IDs + 59,000 post/comment images leaked.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cause&lt;/strong&gt;: The bucket was never secured or migrated during infrastructure updates.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💬 Breach #2 — Leaked Direct Messages (1.1+ million messages)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Service&lt;/strong&gt;: API or database storing user DMs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Issue&lt;/strong&gt;: No authentication required on endpoints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Impact&lt;/strong&gt;: Messages included sensitive content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cause&lt;/strong&gt;: A debug or legacy endpoint lacked proper auth. Even push notifications were exploited.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 The Real Lesson
&lt;/h2&gt;

&lt;p&gt;These weren’t zero-day attacks. Just:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Misconfigured cloud services (Firebase Storage, public endpoints)&lt;/li&gt;
&lt;li&gt;Legacy systems not cleaned up&lt;/li&gt;
&lt;li&gt;Missing API/auth enforcement at critical layers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Whether you “vibe code” with AI or not doesn’t matter if you skip the fundamentals. Secure architecture, proper auth, and data lifecycle awareness are the real backbone.&lt;/p&gt;




&lt;h1&gt;
  
  
  SoftwareEngineering #Security #DataBreach #BestPractices #Firebase #TeaApp
&lt;/h1&gt;

</description>
      <category>hack</category>
      <category>teaapp</category>
      <category>firebase</category>
      <category>security</category>
    </item>
    <item>
      <title>When to use Try-Catch and why too many will hurt me.</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Fri, 01 Aug 2025 05:15:31 +0000</pubDate>
      <link>https://dev.to/harishankarr7/when-to-use-try-catch-and-why-too-many-will-hurt-me-48f0</link>
      <guid>https://dev.to/harishankarr7/when-to-use-try-catch-and-why-too-many-will-hurt-me-48f0</guid>
      <description>&lt;p&gt;I was happily coding a fresh new API endpoint in C# when suddenly memories of past trauma struck: those dreaded QE pings. You know the ones—cryptic async exceptions popping up like surprise horror movie villains, never clearly pointing out their origin and instead blaming innocent methods. Nightmares!&lt;/p&gt;

&lt;p&gt;So, naturally, I thought: "Easy fix—throw try-catch blocks everywhere and make my QE happy." But then, reality check—performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 First, what really happens when you use try-catch?&lt;/strong&gt;&lt;br&gt;
“Hey, keep an eye on this block. If anything explodes, don’t crash, just catch it and let me handle it.”&lt;/p&gt;

&lt;p&gt;This makes your code safer. But it comes at a cost.&lt;br&gt;
For a more detailed explanation on Try Catch and Throw:&lt;br&gt;
refer -- &lt;a href="https://dev.to/harishankarr7/understanding-try-catch-throw-vs-no-throw-2i45"&gt;https://dev.to/harishankarr7/understanding-try-catch-throw-vs-no-throw-2i45&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens if I don’t add a try-catch?&lt;/strong&gt;&lt;br&gt;
Let's explore this with an example:&lt;br&gt;
&lt;strong&gt;🔧 Setup: Three methods calling each other&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;void Main() {
    A();
}

void A() {
    B();
}

void B() {
    C();
}

void C() {
    throw new Exception("Something broke in C!");
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🫧 What happens when you run Main()?&lt;br&gt;
Main() calls A()&lt;/p&gt;

&lt;p&gt;A() calls B()&lt;/p&gt;

&lt;p&gt;B() calls C()&lt;/p&gt;

&lt;p&gt;C() throws an exception ❌&lt;/p&gt;

&lt;p&gt;But C doesn't catch it. So it bubbles up to:&lt;/p&gt;

&lt;p&gt;B → no catch here → keep bubbling&lt;/p&gt;

&lt;p&gt;A → still no catch → keep bubbling&lt;/p&gt;

&lt;p&gt;Main → still no catch → boom 💥&lt;/p&gt;

&lt;p&gt;You’ll get an unhandled exception.&lt;/p&gt;

&lt;p&gt;🧠 That’s what bubbling means:&lt;br&gt;
If a method doesn’t catch an exception, it passes it up to the method that called it.&lt;br&gt;
That method can either catch it or keep passing it up the chain.&lt;/p&gt;

&lt;p&gt;Like bubbles rising in water — they go up until something pops them (a catch block) — or they hit the surface (top of your app) and cause a splash (crash or 500 error).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So can I just sprinkle Try-Catch wherever I want?&lt;br&gt;
What's the cost?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Memory &amp;amp; CPU overhead&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Even if nothing goes wrong, try-catch adds work&lt;/li&gt;
&lt;li&gt;The runtime tracks the call stack and exception context&lt;/li&gt;
&lt;li&gt;On some platforms (like .NET), this creates hidden metadata, and may even slow down JIT optimizations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 It’s like saying:&lt;/p&gt;

&lt;p&gt;“Hey runtime, just in case I mess up, hold onto this backup plan.”&lt;br&gt;
And that costs something, every time the method runs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;**Exception throwing is super expensive&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;If an exception is actually thrown:&lt;/li&gt;
&lt;li&gt;The runtime must unwind the call stack (walk backwards through function calls)&lt;/li&gt;
&lt;li&gt;It creates a full exception object, often with stack trace, source info, etc.&lt;/li&gt;
&lt;li&gt;This involves heap allocation, which is slow and can mess with garbage collection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ If you use exceptions to handle things like "this list is empty" or "this file is missing" — you're paying a high price for something you could’ve handled cheaply with an if.&lt;/p&gt;

&lt;p&gt;🧠 So… when should you use try-catch?&lt;br&gt;
✅ Good reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You’re calling risky external code (like a file, database, API, or user input)&lt;/li&gt;
&lt;li&gt;You want to add context to the error before rethrowing&lt;/li&gt;
&lt;li&gt;You can actually recover from the error (like retry, fallback, or return a friendly error)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Bad reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Just in case” — catching without knowing what might go wrong&lt;/li&gt;
&lt;li&gt;You’re using it instead of if/else (e.g., catching FileNotFoundException instead of checking File.Exists)&lt;/li&gt;
&lt;li&gt;You silently ignore the error (log-and-forget, or worse — do nothing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;✅ What to ask yourself before adding a try-catch:&lt;br&gt;
Here’s your mental checklist:&lt;/p&gt;

&lt;p&gt;-Can this code actually throw something?&lt;br&gt;
  If not — why are you catching?&lt;/p&gt;

&lt;p&gt;-Is the exception expected or rare?&lt;br&gt;
  Expected → handle with if&lt;br&gt;
  Rare → handle with try-catch&lt;/p&gt;

&lt;p&gt;-Can I fix or recover here?&lt;br&gt;
  If yes, catch and fix&lt;br&gt;
  If not, let it bubble up&lt;/p&gt;

&lt;p&gt;-Will this block run thousands of times per second?&lt;br&gt;
  If yes, don’t put try-catch inside the loop — handle it outside&lt;/p&gt;

&lt;p&gt;-Am I logging or hiding the exception?&lt;br&gt;
  If you’re not doing something useful, don’t catch it&lt;/p&gt;

&lt;p&gt;💡 Mnemonic to remember:&lt;br&gt;
✋ Only catch what you can coach&lt;br&gt;
(If you can’t guide it or fix it, let it go.)&lt;/p&gt;

</description>
      <category>try</category>
      <category>catch</category>
      <category>api</category>
      <category>programming</category>
    </item>
    <item>
      <title>Understanding Try-Catch: Throw vs. No Throw</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Fri, 01 Aug 2025 04:47:23 +0000</pubDate>
      <link>https://dev.to/harishankarr7/understanding-try-catch-throw-vs-no-throw-2i45</link>
      <guid>https://dev.to/harishankarr7/understanding-try-catch-throw-vs-no-throw-2i45</guid>
      <description>&lt;h2&gt;
  
  
  What is try–catch?
&lt;/h2&gt;

&lt;p&gt;Imagine you're writing code that might crash — for example, dividing by zero or opening a file that doesn’t exist.&lt;/p&gt;

&lt;p&gt;A try block says:&lt;br&gt;
🗣️ “Hey, computer, try running this code. But if something goes wrong… don’t panic. Jump to the catch block and handle it.”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-life analogy:&lt;/strong&gt;&lt;br&gt;
You're trying to open a door with a key. If the key breaks (try fails), you immediately call the locksmith (catch block).&lt;/p&gt;

&lt;p&gt;🧪 Basic Code Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
    int result = 10 / 0;  // This will crash: divide by zero
}
catch (DivideByZeroException ex) {
    Console.WriteLine("Oops! You tried to divide by zero.");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No crash. Just a friendly message.&lt;br&gt;
The program survives and keeps running.&lt;/p&gt;
&lt;h2&gt;
  
  
  🚨 2. What is throw?
&lt;/h2&gt;

&lt;p&gt;Now imagine you want to signal that something has gone wrong — maybe someone passed bad data to your method.&lt;/p&gt;

&lt;p&gt;A throw is like raising your hand and saying:&lt;br&gt;
🗣️ “This is not okay. I’m throwing this problem up to someone else to handle!”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💣 Example:&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;if (number &amp;lt; 0) {
    throw new ArgumentException("Number must be non-negative");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ Why would you want to throw?&lt;br&gt;
Because:&lt;br&gt;
You spotted a bad situation&lt;br&gt;
You don’t know how to handle it right here&lt;br&gt;
You want someone else (maybe catch) to handle it&lt;/p&gt;
&lt;h2&gt;
  
  
  When NOT to throw
&lt;/h2&gt;

&lt;p&gt;Let’s say you catch an error — but instead of escalating it, you just log it and move on. You don’t throw again.&lt;/p&gt;

&lt;p&gt;That’s OK when:&lt;br&gt;
The error isn’t critical&lt;br&gt;
You can recover from it&lt;br&gt;
Or... you're logging the error and don’t want to crash the app&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&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;try {
    var result = GetDataFromFile("missing.txt");
}
catch (FileNotFoundException ex) {
    Console.WriteLine("File not found. Skipping this part.");
    // No throw here — we're handling it gracefully
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 So what’s the difference: try–catch with throw vs. without?
&lt;/h2&gt;

&lt;p&gt;Let’s compare:&lt;/p&gt;

&lt;p&gt;🥊 With throw inside catch:&lt;br&gt;
You're passing the error up — often used when:&lt;br&gt;
You can’t fix the issue here&lt;br&gt;
You want to inform the caller that something went wrong&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
    riskyThing();
}
catch (Exception ex) {
    Console.WriteLine("Logging the error...");
    throw;  // re-throws the same exception
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🪵 Without throw:&lt;/strong&gt;&lt;br&gt;
You're handling it locally — like logging, fallback values, etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
    riskyThing();
}
catch (Exception ex) {
    Console.WriteLine("Handled and moving on.");
    // No throw here
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧾 Isn’t this just like if–else?**
&lt;/h2&gt;

&lt;p&gt;Good instinct! Here's the key difference:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;if&lt;/code&gt;–&lt;code&gt;else&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;try&lt;/code&gt;–&lt;code&gt;catch&lt;/code&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Usage&lt;/td&gt;
&lt;td&gt;For things you &lt;strong&gt;expect&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;For things you &lt;strong&gt;don’t expect&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;Faster (no overhead)&lt;/td&gt;
&lt;td&gt;Slower (exception handling has a cost)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Example case&lt;/td&gt;
&lt;td&gt;&lt;code&gt;if (fileExists)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;try { read file } catch (error)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Normal decisions&lt;/td&gt;
&lt;td&gt;Unpredictable errors&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;🚦 Example:&lt;br&gt;
You can check if a file exists before opening it using if. But if the file vanishes between check and open — you'll need try–catch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens if you throw but there’s no catch anywhere?&lt;/strong&gt;&lt;br&gt;
👉 If you throw and there's no matching catch anywhere in the call stack…&lt;br&gt;
🧨 Your program crashes (or terminates the thread).&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void Main() {
    SayHello();
}

void SayHello() {
    ThrowError();
}

void ThrowError() {
    throw new Exception("Boom!");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no try–catch anywhere.&lt;br&gt;
So when ThrowError() throws, it:&lt;/p&gt;

&lt;p&gt;Looks in ThrowError() → ❌ no catch&lt;br&gt;
Goes to SayHello() → ❌ no catch&lt;br&gt;
Goes to Main() → ❌ no catch&lt;br&gt;
Hits the top level — 💥 Unhandled Exception&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⛓️ Think of it like this:&lt;/strong&gt;&lt;br&gt;
A throw is a message in a bottle.&lt;br&gt;
Catch blocks are the lifeguards.&lt;br&gt;
If nobody catches the message, it floats to the top and sinks the ship.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧠 Why it matters:&lt;/strong&gt;&lt;br&gt;
Sometimes, you want that crash (like in tests).&lt;br&gt;
But in real apps, especially APIs or games, unhandled exceptions are dangerous — they can:&lt;br&gt;
Show ugly errors to users&lt;br&gt;
Kill threads (especially bad in multithreaded apps)&lt;br&gt;
Bring down whole services if not contained&lt;/p&gt;

&lt;p&gt;Hope this was useful.&lt;br&gt;
Next time, don't Try Catch me if you can with bugs ;)&lt;br&gt;
If you havent watched that movie - go watch it first.&lt;/p&gt;

</description>
      <category>try</category>
      <category>catch</category>
      <category>programming</category>
      <category>csharp</category>
    </item>
    <item>
      <title>I Used to Fear PROGRAM.CS, Until I Understood the DI Container Like This 🍝</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Mon, 02 Jun 2025 05:13:07 +0000</pubDate>
      <link>https://dev.to/harishankarr7/i-used-to-fear-programcs-until-i-understood-the-di-container-like-this-2944</link>
      <guid>https://dev.to/harishankarr7/i-used-to-fear-programcs-until-i-understood-the-di-container-like-this-2944</guid>
      <description>&lt;p&gt;For the longest time, opening the Program.cs file felt like opening the engine of a spaceship. All that talk of services.AddScoped, AddTransient, AddSingleton, and builder.Services gave me anxiety.&lt;/p&gt;

&lt;p&gt;I used to ask my seniors about it randomly, but I think my brain rejected all of it until I had to write an API from scratch, and I had to see it more simply.&lt;/p&gt;

&lt;p&gt;Let me take you on a little story.&lt;/p&gt;

&lt;h2&gt;
  
  
  🍽️ You’re Running a Restaurant (That’s Your App)
&lt;/h2&gt;

&lt;p&gt;Imagine your app is a restaurant. You’re the manager. Every day, you need to serve dishes to customers (handle API requests, basically).&lt;/p&gt;

&lt;p&gt;You’ve got:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;👨‍🍳 A chef&lt;/li&gt;
&lt;li&gt;🧑‍🍳 A helper&lt;/li&gt;
&lt;li&gt;🥶 A fridge full of ingredients&lt;/li&gt;
&lt;li&gt;🚛 A supplier who brings ingredients&lt;/li&gt;
&lt;li&gt;🧾 Customers who order food (clients calling your API)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don’t want to personally micromanage who chops onions, who cooks the sauce, or who gets the tomatoes from the fridge. That’s chaos.&lt;/p&gt;

&lt;p&gt;So you hire an assistant manager — her name is DotNetta.&lt;/p&gt;

&lt;p&gt;DotNetta is your Dependency Injection Container.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 What DotNetta (the DI container) Does
&lt;/h2&gt;

&lt;p&gt;Before opening for business, you give DotNetta a set of rules:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🗂️ “Whenever someone asks for a chef, give them Gordon.”&lt;br&gt;
🗂️ “If a chef needs vegetables, get them from the fridge.”&lt;br&gt;
🗂️ “If the fridge is empty, call the supplier.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is what happens in your Program.cs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;services.AddScoped&amp;lt;IChef, GordonChef&amp;gt;();
services.AddSingleton&amp;lt;IFridge, WalkInFridge&amp;gt;();
services.AddTransient&amp;lt;ISupplier, FreshFarmSupplier&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're not cooking anything yet. You're just telling DotNetta how to assemble the kitchen team when someone places an order.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛎️ A Customer Walks In
&lt;/h2&gt;

&lt;p&gt;Let’s say a customer orders spaghetti.&lt;/p&gt;

&lt;p&gt;DotNetta steps in like a pro:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;👨‍🍳 She grabs Gordon (the chef)&lt;/li&gt;
&lt;li&gt;🍅 Gordon says: “I need tomatoes and pasta.”&lt;/li&gt;
&lt;li&gt;🥫 She checks the fridge&lt;/li&gt;
&lt;li&gt;❌ If something’s missing, she calls the supplier&lt;/li&gt;
&lt;li&gt;✅ She hands everything over to Gordon&lt;/li&gt;
&lt;li&gt;🍝 Dish gets made and served&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You didn’t do a thing — and yet everything worked perfectly.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 That’s What Happens When You Inject Dependencies
&lt;/h2&gt;

&lt;p&gt;In your code, instead of doing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var fridge = new Fridge();
var chef = new GordonChef(fridge);
var dish = chef.MakeSpaghetti();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You just say:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class KitchenService
{
    public KitchenService(IChef chef)
    {
        _chef = chef;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And DotNetta figures out the rest.&lt;br&gt;
She knows who the chef is, what he needs, and how to get it all set up.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧱 What Is a Service?
&lt;/h2&gt;

&lt;p&gt;In real world:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A service is just someone who does something useful — like cook food, deliver ingredients, or clean the kitchen.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In code:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A service is any class or interface that performs some logic or functionality, and might need other things to do its job.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You register these services with DotNetta (your DI container) so she knows who to call when it’s time to work.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔄 So What is IoC (Inversion of Control)?
&lt;/h2&gt;

&lt;p&gt;Before DotNetta, you were in control of creating everything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var repo = new UserRepo();
var service = new UserService(repo);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You were the chef, the supplier, the manager — everything.&lt;/p&gt;

&lt;p&gt;But with DotNetta:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You tell the system what you need, not how to get it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s Inversion of Control — the control of object creation is inverted. You no longer control the wiring. The framework does it for you.&lt;/p&gt;

&lt;p&gt;It’s like placing an order and having an invisible kitchen team handle everything behind the scenes.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎯 Why This Matters
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You write less code&lt;/li&gt;
&lt;li&gt;You focus on what the class does, not how it's built&lt;/li&gt;
&lt;li&gt;You can easily swap parts (mock services, test different implementations)&lt;/li&gt;
&lt;li&gt;You stop fearing the Program.cs file because now you know it’s just DotNetta’s instruction sheet&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  💬 Final Words
&lt;/h2&gt;

&lt;p&gt;I used to stare at Program.cs like it was some mystical scroll.&lt;/p&gt;

&lt;p&gt;But now I know — it's just a menu.&lt;br&gt;
DotNetta (the DI container) reads it, builds the team, gets the ingredients, and serves the customer.&lt;/p&gt;

&lt;p&gt;All I do is say, “Hey, I need a spaghetti,” and trust the kitchen knows what to do.&lt;/p&gt;

&lt;p&gt;Once you start thinking like this, your fear turns into clarity — and your code?&lt;br&gt;
It starts to feel like magic.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Refit in C# — The API Client That Writes Itself (Almost)</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Mon, 02 Jun 2025 01:16:45 +0000</pubDate>
      <link>https://dev.to/harishankarr7/refit-in-c-the-api-client-that-writes-itself-almost-32am</link>
      <guid>https://dev.to/harishankarr7/refit-in-c-the-api-client-that-writes-itself-almost-32am</guid>
      <description>&lt;p&gt;I was recently asked to build an API that contacts two other APIs. My senior engineer casually dropped:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Use Refit.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At first, I was like — “what is this magic word?”&lt;br&gt;
Then I used it. And I was pleasantly shocked.&lt;/p&gt;
&lt;h2&gt;
  
  
  🧠 What is Refit?
&lt;/h2&gt;

&lt;p&gt;Think of Refit as your tiny API Copilot.&lt;/p&gt;

&lt;p&gt;Refit is a REST library for .NET that turns your OpenAPI/Swagger spec into strongly-typed, auto-generated client code. Instead of manually writing a bunch of HttpClient logic, you describe your API once, and Refit generates the rest.&lt;/p&gt;
&lt;h2&gt;
  
  
  💥 Why It Blew My Mind
&lt;/h2&gt;

&lt;p&gt;Here’s my flow:&lt;/p&gt;

&lt;p&gt;I downloaded the Swagger JSON of the external Book API I needed to consume.&lt;/p&gt;

&lt;p&gt;I created a refitter.yaml file with the configs.&lt;/p&gt;

&lt;p&gt;Ran one CLI command.&lt;/p&gt;

&lt;p&gt;And boom — Refit auto-generated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The interface with methods like GetBookByIdAsync&lt;/li&gt;
&lt;li&gt;The models like Book, Author, etc.&lt;/li&gt;
&lt;li&gt;The entire client logic, ready to use&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I can just call:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var book = await _bookApi.GetBookByIdAsync(42);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No plumbing. No extra mapping. Clean.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Installing &amp;amp; Using Refit (Quickstart)
&lt;/h2&gt;

&lt;p&gt;Install Refit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install-Package Refit

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Register the client in Program.cs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;services.AddRefitClient&amp;lt;IBookApi&amp;gt;()
        .ConfigureHttpClient(c =&amp;gt; c.BaseAddress = new Uri("https://books.example.com"));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Use it like this:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class LibraryService(IBook bookApi)
{
    public async Task&amp;lt;Book&amp;gt; FetchBook(int id)
    {
        return await bookApi.GetBookByIdAsync(id);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🤔 Swagger: Your New Best Friend
&lt;/h2&gt;

&lt;p&gt;Refit only works as well as your Swagger spec. A clean spec = clean client.&lt;br&gt;
That realization made me treat Swagger not just as documentation, but as code — the contract between services.&lt;/p&gt;

&lt;p&gt;When I polished the Swagger for my own API, downstream teams could just plug it into Refit and boom, done. That’s what future-proof API dev looks like.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 Final Thoughts
&lt;/h2&gt;

&lt;p&gt;We’re building an ecosystem where APIs and Kafka keep passing messages like trained athletes in a relay race. My role? Build one of those runners. But with Refit, I didn’t just build a runner — I gave it shoes, training, and a coach.&lt;/p&gt;

&lt;p&gt;Whether you're a beginner dev or a product owner — Refit makes integrations faster, safer, and cleaner. All it asks for?&lt;br&gt;
&lt;strong&gt;A good Swagger spec.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How Call of Duty:Verdansk Reminded Me RAM is Truly Dynamic</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Tue, 08 Apr 2025 01:50:02 +0000</pubDate>
      <link>https://dev.to/harishankarr7/how-call-of-dutyverdansk-reminded-me-ram-is-truly-dynamic-4en6</link>
      <guid>https://dev.to/harishankarr7/how-call-of-dutyverdansk-reminded-me-ram-is-truly-dynamic-4en6</guid>
      <description>&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%2Fb4lh6kdl3pi34lb3y1ov.jpg" 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%2Fb4lh6kdl3pi34lb3y1ov.jpg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🎮 Mission: Verdansk (Gone Wrong)
&lt;/h2&gt;

&lt;p&gt;It was supposed to be a laid-back weekend. My friend was installing Call of Duty: Verdansk, and I was ready for a cozy game night.&lt;/p&gt;

&lt;p&gt;And then—bam. His network adapters disappeared out of nowhere.&lt;/p&gt;

&lt;p&gt;I thought, easy fix. I uninstalled the adapters, rebooted the system, assuming Windows would reinstall the drivers automatically. It did... but they didn’t show up anywhere in the control panel.&lt;/p&gt;

&lt;p&gt;Then came the blue screen of death.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 My Brain: "Let’s Just Reset the PC"
&lt;/h2&gt;

&lt;p&gt;PC: "How About No."&lt;/p&gt;

&lt;p&gt;Things escalated. I suggested we reset the PC completely—nuke it from orbit.&lt;/p&gt;

&lt;p&gt;But here's the twist: the PC wouldn’t reset. It kept throwing errors. That was new to me. So I decided to create a bootable USB to reinstall Windows manually.&lt;/p&gt;

&lt;p&gt;Welcome to 2025—we didn’t have a USB stick in the house.&lt;br&gt;
Desperate times, desperate measures—we formatted an SSD and tried using it as a bootable drive.&lt;/p&gt;

&lt;p&gt;Did it work? Nope. Windows didn’t install. The PC acted like it was haunted.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧩 The Hidden Culprit: RAM
&lt;/h2&gt;

&lt;p&gt;At this point, everything should have worked. But apps were crashing. Updates failed. Call of Duty wouldn’t launch. Even when Windows did reinstall, the system was lagging like crazy.&lt;/p&gt;

&lt;p&gt;That’s when I remembered something crucial: RAM is dynamic.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 What Does It Mean That RAM Is “Dynamic”?
&lt;/h2&gt;

&lt;p&gt;Let’s simplify.&lt;/p&gt;

&lt;p&gt;RAM (Random Access Memory) is like your computer’s short-term memory.&lt;/p&gt;

&lt;p&gt;It doesn't store files forever—it temporarily holds data for running programs and processes.&lt;/p&gt;

&lt;p&gt;Every time you open an app, it lives in RAM while you use it.&lt;/p&gt;

&lt;p&gt;Dynamic means it's always changing—data comes in, data goes out.&lt;/p&gt;

&lt;p&gt;Here’s the kicker: when RAM goes bad, your computer doesn't always crash. It limps along—slowly, painfully—failing silently in weird ways.&lt;/p&gt;

&lt;p&gt;You might boot into Windows, but apps won’t install. Drivers might fail to load. System resets don’t finish. You get weird BSODs.&lt;/p&gt;

&lt;p&gt;Exactly what we were facing.&lt;/p&gt;

&lt;p&gt;I ran the built-in system diagnostics. Boom—both RAM sticks were faulty.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 Why Faulty RAM Doesn’t Instantly Kill Your PC (But Slowly Breaks It)
&lt;/h2&gt;

&lt;p&gt;You might be wondering—if the RAM was faulty, how did the system even boot?&lt;/p&gt;

&lt;p&gt;Here’s the wild part: RAM doesn’t just fail like a blown fuse—it fails in patches.&lt;/p&gt;

&lt;p&gt;When RAM begins to degrade, it often develops what are called “bad sectors”—tiny portions of memory that no longer hold or transfer data reliably. Think of it like a whiteboard with sections that just won’t erase or write anymore.&lt;/p&gt;

&lt;p&gt;Now, when your system boots up, it doesn't necessarily use all of your RAM at once. It starts assigning memory space as needed. So if your OS or app happens to avoid those faulty sectors for a while, things may seem “okay.”&lt;/p&gt;

&lt;p&gt;But as soon as:&lt;/p&gt;

&lt;p&gt;You open a large program (like Call of Duty or Chrome with 50 tabs),&lt;/p&gt;

&lt;p&gt;Try to install or unpack a large driver package,&lt;/p&gt;

&lt;p&gt;Or launch Windows Update that needs stable memory blocks…&lt;/p&gt;

&lt;p&gt;…the system might unknowingly use those bad RAM sectors.&lt;/p&gt;

&lt;p&gt;That’s when things start breaking in weird, inconsistent ways:&lt;/p&gt;

&lt;p&gt;🧩 Apps fail mid-install because the memory holding the install package is corrupt&lt;/p&gt;

&lt;p&gt;⚙️ Drivers crash or silently don’t load because a key file in memory is garbled&lt;/p&gt;

&lt;p&gt;🔄 System resets hang or fail because the reset process relies on temporary memory too&lt;/p&gt;

&lt;p&gt;💥 And eventually, you hit the Blue Screen of Death, when the system realizes something’s deeply wrong but doesn’t know where&lt;/p&gt;

&lt;p&gt;So the computer stays “alive,” limping through basic functions, but keeps tripping over invisible landmines every time it tries to do something serious.&lt;/p&gt;

&lt;p&gt;And that’s exactly what we were seeing.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ New RAM, New Hope... But Still No Reset?
&lt;/h2&gt;

&lt;p&gt;We grabbed new RAM sticks. Diagnostics passed. The system was stable. But we still couldn’t reset Windows.&lt;/p&gt;

&lt;p&gt;Why? My guess: the SSD we used as a bootable USB wasn’t reliable for that purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  🤔 Why an SSD Can Fail as a Boot Drive (In Simple Words)
&lt;/h2&gt;

&lt;p&gt;While SSDs are storage devices, they’re not designed to behave like USB sticks out of the box.&lt;/p&gt;

&lt;p&gt;Here’s why it likely failed:&lt;/p&gt;

&lt;p&gt;SSDs sometimes require special drivers when acting as bootable devices.&lt;/p&gt;

&lt;p&gt;Power draw and firmware differences can cause instability during OS installs.&lt;/p&gt;

&lt;p&gt;Some BIOS setups struggle to detect them as legit boot devices.&lt;/p&gt;

&lt;p&gt;Basically, it’s like asking a Ferrari to tow a trailer—not what it’s built for.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚚 Enter: DoorDash USB Delivery
&lt;/h2&gt;

&lt;p&gt;Out of patience, we literally DoorDashed a USB stick.&lt;/p&gt;

&lt;p&gt;Tried creating a bootable installer on my Mac. Failed. Macs love to mess with boot formats.&lt;/p&gt;

&lt;p&gt;So I pulled out an ancient Windows laptop, fired up Rufus, made a proper bootable USB, and we were back in business.&lt;/p&gt;

&lt;p&gt;Changed the BIOS boot order to prioritize USB—and finally, Windows started to install.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔁 Install Loop: My Final Brain Glitch
&lt;/h2&gt;

&lt;p&gt;The install process began, looked great, and then… it restarted.&lt;br&gt;
And restarted again.&lt;br&gt;
Back to the start of installation. Every. Single. Time.&lt;/p&gt;

&lt;p&gt;At this point, I was losing my mind. I told my friend to just get a PlayStation.&lt;/p&gt;

&lt;p&gt;And then it hit me.&lt;/p&gt;

&lt;p&gt;When a PC restarts after installation, it should boot from the SSD, not the USB. But since USB was still first in the boot order, it kept looping the installation.&lt;/p&gt;

&lt;p&gt;Pulled the USB out.&lt;/p&gt;

&lt;p&gt;Boom. Windows finished installing. Drivers loaded. Call of Duty launched.&lt;/p&gt;

&lt;h2&gt;
  
  
  🕹️ Back to Verdansk. We Are So Back, Baby.
&lt;/h2&gt;

&lt;p&gt;troubleshooting is 90% instinct, 10% USB delivery speed.&lt;/p&gt;

&lt;p&gt;If you've ever wanted to know what it means when we say “RAM is dynamic,” well, now you know—it lives and breathes, and when it breaks, it breaks everything weirdly.&lt;/p&gt;

&lt;p&gt;But hey, we made it.&lt;br&gt;
Verdansk 2020 vibes restored.&lt;/p&gt;

</description>
      <category>ram</category>
      <category>computerengineering</category>
      <category>dynamicmemory</category>
      <category>ddr4</category>
    </item>
    <item>
      <title>Designing an API with Swagger: A Step-by-Step Breakdown</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Mon, 07 Apr 2025 00:33:31 +0000</pubDate>
      <link>https://dev.to/harishankarr7/designing-an-api-with-swagger-a-step-by-step-breakdown-531d</link>
      <guid>https://dev.to/harishankarr7/designing-an-api-with-swagger-a-step-by-step-breakdown-531d</guid>
      <description>&lt;p&gt;Before writing any backend code, it’s important to design the API.&lt;/p&gt;

&lt;p&gt;Swagger (now officially called OpenAPI Specification) lets you define what your API will look like — the endpoints, the inputs, the outputs — in a structured way.&lt;/p&gt;

&lt;p&gt;Here’s how you write a complete Swagger document before coding anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠 Example: A Simple User API
&lt;/h2&gt;

&lt;p&gt;Let’s say you’re building a User API for a system that manages users.&lt;/p&gt;

&lt;p&gt;You want to support the following actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get all users&lt;/li&gt;
&lt;li&gt;Get a user by ID&lt;/li&gt;
&lt;li&gt;Create a new user&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ll now break down the Swagger file for this API and explain every single part.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ Step 1: Define the API Info
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openapi: 3.0.0
info:
  title: User API
  version: 1.0.0
  description: API for managing users

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What this does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;openapi: Version of the OpenAPI spec you're using&lt;/li&gt;
&lt;li&gt;info: Basic metadata about your API (name, version, description)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Step 2: Define Paths (i.e. Endpoints)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;paths:
  /users:
    get:
      summary: Get all users
      responses:
        '200':
          description: A list of users

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔍 What is a Path?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A path is a URL pattern that your API exposes. Example: /users&lt;/li&gt;
&lt;li&gt;It represents a resource — in this case, the "users" resource&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🔍 What is an Endpoint?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An endpoint is a path + method&lt;/li&gt;
&lt;li&gt;Example: GET /users is one endpoint, POST /users is another&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;/users is a path&lt;/li&gt;
&lt;li&gt;GET /users is an endpoint for fetching users&lt;/li&gt;
&lt;li&gt;POST /users would be an endpoint for creating a user&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Step 3: Add Another Endpoint (GET /users/{id})
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  /users/{id}:
    get:
      summary: Get a user by ID
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A single user
        '404':
          description: User not found

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔍 What are Path Parameters?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;{id} in the path is a dynamic part — it’ll be replaced with an actual value like /users/5&lt;/li&gt;
&lt;li&gt;You define it under parameters to describe the input expected&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Step 4: Add a Request Body (POST /users)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  /users:
    post:
      summary: Create a new user
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '201':
          description: User created

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔍 What is RequestBody?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It describes the input payload the client needs to send when making a POST request&lt;/li&gt;
&lt;li&gt;In this case, we expect the client to send a JSON object with user details&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ✅ Step 5: Define Reusable Schemas (Models)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        email:
          type: string

    UserCreate:
      type: object
      required:
        - name
        - email
      properties:
        name:
          type: string
        email:
          type: string

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔍 What is a Schema?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A schema defines the structure of the data in requests or responses&lt;/li&gt;
&lt;li&gt;You put schemas under components/schemas so you can reuse them using $ref&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User is used in responses (contains id, name, email)&lt;/li&gt;
&lt;li&gt;UserCreate is used in requests (only name, email — no id because it’s generated)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🔗 How Schemas and Endpoints Work Together
&lt;/h2&gt;

&lt;p&gt;Every endpoint that returns or receives data needs to describe what that data looks like. That’s where schemas come in.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GET /users returns a list of users → uses the User schema&lt;/li&gt;
&lt;li&gt;POST /users expects user input → uses the UserCreate schema&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You avoid repeating structure definitions everywhere&lt;/li&gt;
&lt;li&gt;You can update schemas in one place and all linked endpoints reflect it&lt;/li&gt;
&lt;li&gt;Documentation stays clean, reusable, and DRY&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Endpoints describe the actions,&lt;/li&gt;
&lt;li&gt;Schemas describe the shape of the data those actions work with.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are two sides of the same API design.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ Full Swagger YAML Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;openapi: 3.0.0
info:
  title: User API
  version: 1.0.0
  description: API for managing users

paths:
  /users:
    get:
      summary: Get all users
      responses:
        '200':
          description: A list of users
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
    post:
      summary: Create a new user
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '201':
          description: User created

  /users/{id}:
    get:
      summary: Get a user by ID
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A single user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '404':
          description: User not found

components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        email:
          type: string

    UserCreate:
      type: object
      required:
        - name
        - email
      properties:
        name:
          type: string
        email:
          type: string

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 Summary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Swagger lets you design your API before you write code.&lt;/li&gt;
&lt;li&gt;Paths define resources, endpoints define actions.&lt;/li&gt;
&lt;li&gt;Schemas define the structure of data for requests and responses.&lt;/li&gt;
&lt;li&gt;Endpoints and schemas work together to define a complete API contract.&lt;/li&gt;
&lt;li&gt;Writing Swagger first saves time, avoids confusion, and aligns your team.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>api</category>
      <category>swaggerhub</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Inside the Brain of Your Computer</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Sat, 29 Mar 2025 04:39:47 +0000</pubDate>
      <link>https://dev.to/harishankarr7/inside-the-brain-of-your-computer-2edp</link>
      <guid>https://dev.to/harishankarr7/inside-the-brain-of-your-computer-2edp</guid>
      <description>&lt;h2&gt;
  
  
  An Example
&lt;/h2&gt;

&lt;p&gt;Let’s say you and your friend are playing a secret game using a flashlight.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flashlight ON = Yes (1)&lt;/li&gt;
&lt;li&gt;Flashlight OFF = No (0)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You both agree on a secret code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One flash = “Hello”&lt;/li&gt;
&lt;li&gt;Two flashes = “Come here”&lt;/li&gt;
&lt;li&gt;No flash = “Goodbye”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even though you're just using ON and OFF, you’re communicating. That’s the key idea.&lt;/p&gt;

&lt;h2&gt;
  
  
  Now… Imagine a Computer Doing the Same Thing
&lt;/h2&gt;

&lt;p&gt;Inside every computer are billions of tiny flashlights — well, kind of.&lt;br&gt;
They're called transistors, and they also have two states:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electricity flowing = ON (1)&lt;/li&gt;
&lt;li&gt;No electricity = OFF (0)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So just like your flashlight game, a computer uses these ONs and OFFs to form patterns — and those patterns represent letters, pictures, songs, even entire video games.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same Example, Now in Tech Terms:
&lt;/h2&gt;

&lt;p&gt;Let’s say you press the letter A on your keyboard.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your computer turns that into a pattern of ONs and OFFs: 01000001&lt;/li&gt;
&lt;li&gt;Each 1 or 0 is made by a transistor turning electricity ON or OFF&lt;/li&gt;
&lt;li&gt;Billions of these switching patterns fly through the computer’s brain (the CPU)&lt;/li&gt;
&lt;li&gt;The screen reads the pattern and shows you the letter A&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From your simple key press… to a dance of electricity… to something you see on screen&lt;/p&gt;

&lt;h2&gt;
  
  
  The Big Idea:
&lt;/h2&gt;

&lt;p&gt;Computers speak in 1s and 0s because they’re made of tiny switches (transistors) that only understand ON and OFF.&lt;br&gt;
Those switches use electricity — and when you control electricity in patterns, you can make a machine understand and do almost anything.&lt;/p&gt;

&lt;p&gt;So next time you open your laptop or phone, just remember — there’s a massive, invisible flashlight game happening inside. And it’s how everything works.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>bits</category>
      <category>binary</category>
      <category>cpu</category>
    </item>
    <item>
      <title>Why JSON Feels Like an Interpreter Between Services — And Why That’s Not Far Off</title>
      <dc:creator>Hari </dc:creator>
      <pubDate>Fri, 28 Mar 2025 03:57:35 +0000</pubDate>
      <link>https://dev.to/harishankarr7/why-json-feels-like-an-interpreter-between-services-and-why-thats-not-far-off-5o3</link>
      <guid>https://dev.to/harishankarr7/why-json-feels-like-an-interpreter-between-services-and-why-thats-not-far-off-5o3</guid>
      <description>&lt;p&gt;Ever feel like JSON is less about data and more about helping apps talk clearly? You're spot-on! JSON (JavaScript Object Notation) acts like the universal translator between different programming languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why JSON is Like a Translator
&lt;/h2&gt;

&lt;p&gt;Imagine one friend speaks Spanish, another speaks French, and you're stuck trying to order tacos in Paris. You definitely need a translator! Similarly, Python, Java, C#, and JavaScript can't directly understand each other—it's like they're at an awkward programming party, nodding politely but clueless about what's going on. JSON steps in, effortlessly chatting with everyone and translating their stories.&lt;/p&gt;

&lt;h2&gt;
  
  
  Everywhere I go, I see JSON 👀
&lt;/h2&gt;

&lt;p&gt;JSON is like that friendly neighbor who’s always there but you hardly notice—it's in your web browser, your apps, even in your fridge (probably). It’s always around, quietly making sure everyone gets along without making a fuss. It's the curse of being effortlessly friendly; always present but rarely appreciated.&lt;/p&gt;

&lt;p&gt;But I care! I wanted to understand the magic behind JSON. What's this friendly neighbor actually doing?&lt;/p&gt;

&lt;h2&gt;
  
  
  How Douglas Crockford Created JSON
&lt;/h2&gt;

&lt;p&gt;Back in the early 2000s, Douglas Crockford was fed up with XML—understandably so. XML looked like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;person&amp;gt;
    &amp;lt;name&amp;gt;Hari&amp;lt;/name&amp;gt;
    &amp;lt;age&amp;gt;25&amp;lt;/age&amp;gt;
&amp;lt;/person&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s way too much drama just to say, "I'm Hari and I'm 25!"&lt;/p&gt;

&lt;p&gt;Then Douglas noticed JavaScript had a simpler, friendlier way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const person = {
  name: "Hari",
  age: 25
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Douglas thought, "Why are we complicating our lives? Let’s just use this!" And thus, JSON was born, happily simplifying everyone's data drama.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, What Exactly Did He Create?
&lt;/h2&gt;

&lt;p&gt;Douglas didn't create a new programming language—he just set clear ground rules for this friendly little structure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;{} for objects (key-value pairs)&lt;/li&gt;
&lt;li&gt;[] for arrays&lt;/li&gt;
&lt;li&gt;"" for strings&lt;/li&gt;
&lt;li&gt;Numbers, true/false, and null&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Teaching applications to understand JSON
&lt;/h2&gt;

&lt;p&gt;Now, how do we teach apps to use this newfound translator? Apps are brilliant, but they don't just wake up one day fluent in JSON—they need parsers (to understand JSON) and generators (to speak JSON). Thankfully, smart people made tools like Newtonsoft.Json (in C#) or Python's built-in JSON module to help apps pick up JSON quickly.&lt;/p&gt;

&lt;p&gt;Think of a parser as your app's personal interpreter:&lt;br&gt;
Parser (JSON → Python):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json

json_text = '{"name": "Hari", "age": 25}'
person = json.loads(json_text)
print(person['name'])  # Output: Hari
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And a generator as your app's spokesperson:&lt;br&gt;
Generator (Python → JSON):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;person = {"name": "Hari", "age": 25}
json_text = json.dumps(person)
print(json_text)  # Output: {"name": "Hari", "age": 25}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How JSON Works Practically in Microservices (C# Example)
&lt;/h2&gt;

&lt;p&gt;Picture this: you've built a microservice in C#, and it wants to chat with another microservice written in Python or JavaScript. Normally, they’d struggle—like cats and dogs trying to discuss dinner plans. But they've agreed on JSON, the neutral, drama-free mediator.&lt;/p&gt;

&lt;p&gt;They both agree to use JSON. Here's how this works practically:&lt;/p&gt;

&lt;p&gt;Microservice 1 (C#):&lt;/p&gt;

&lt;p&gt;You explicitly tell your app, "Hey, when you send or receive data, always use JSON."&lt;/p&gt;

&lt;p&gt;Your C# app uses a JSON library (like System.Text.Json or Newtonsoft.Json) to automatically convert internal C# objects into JSON text when sending data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var person = new {
  Name = "Hari",
  Age = 25
};

// Convert to JSON automatically
string jsonString = JsonSerializer.Serialize(person);
// jsonString becomes: {"Name":"Hari","Age":25}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When this C# app sends data over HTTP, it'll send the JSON string directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{"Name":"Hari","Age":25}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  JSON Holds Everything Together 🌟
&lt;/h2&gt;

&lt;p&gt;JSON might seem simple—just curly braces and quotes—but it quietly holds everything together, making our lives infinitely easier. Next time you casually glance over JSON, remember: it's not just "data," it's a friendly neighborhood translator, keeping the digital world chatty, connected, and drama-free!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Next time you use JSON, remember: You're not just handling data; you're translating clearly between worlds!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>json</category>
      <category>webdev</category>
      <category>api</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
