<?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: Harshita</title>
    <description>The latest articles on DEV Community by Harshita (@harshita_87).</description>
    <link>https://dev.to/harshita_87</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%2F1247932%2F22834201-7aa6-4450-8aea-608fdc65b489.png</url>
      <title>DEV Community: Harshita</title>
      <link>https://dev.to/harshita_87</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harshita_87"/>
    <language>en</language>
    <item>
      <title>My journey down the database rabbit hole is complete, and it completely changed how I think about building software.</title>
      <dc:creator>Harshita</dc:creator>
      <pubDate>Wed, 04 Nov 2026 17:18:47 +0000</pubDate>
      <link>https://dev.to/harshita_87/my-journey-down-the-database-rabbit-hole-is-complete-and-it-completely-changed-how-i-think-about-1h3k</link>
      <guid>https://dev.to/harshita_87/my-journey-down-the-database-rabbit-hole-is-complete-and-it-completely-changed-how-i-think-about-1h3k</guid>
      <description>&lt;p&gt;It started with a simple question: Can a database handle a customer buying 1.5 kg of sugar?&lt;/p&gt;

&lt;p&gt;What followed was a masterclass in software tradeoffs. I went from discovering a critical hardware flaw, to trying two clever workarounds, to finally understanding the gold standard used by major financial systems.&lt;/p&gt;

&lt;p&gt;Here is the exact journey of what I learned:&lt;/p&gt;

&lt;p&gt;Step 1: The Binary Flaw (Why floats fail)&lt;br&gt;
I discovered that computers think in 0s and 1s (Binary), while humans think in decimals (Base-10). Because of this, standard computer memory cannot cleanly save numbers like 0.1 or 0.2. They turn into endless repeating fractions. If you add 0.1 three times and subtract 0.3, a computer doesn't give you 0.0. It gives you a bizarre micro-error like 5.55111512312578e-17. Over time, these errors compound and break your systems.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgc0dipc9zvqwr3bfvoe.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgc0dipc9zvqwr3bfvoe.png" alt=" " width="799" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: The Text Bridge (My first workaround)&lt;br&gt;
Since SQLite doesn't have an exact decimal type, my first idea was to save the stock numbers as TEXT (like "1.5") to freeze the characters in place, and use a SQL CAST statement to convert them to numbers when doing math.&lt;/p&gt;

&lt;p&gt;I tested this live in a database browser and immediately hit two massive traps. First, text sorts alphabetically, not numerically. A query looking for items with stock "less than 30" will falsely include "100" because the character "1" comes before "3". Second, using CAST forces the database to open every single row and convert the data on the fly, which completely destroys database indexing and slows your app to a crawl.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzo0tlnwny3aoyzzyvcug.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzo0tlnwny3aoyzzyvcug.png" alt=" " width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 3: The Rounding Trick (My second workaround)&lt;br&gt;
Then I noticed SQLite has a NUMERIC label and a ROUND() function. It feels like a fix because it cleans up the screen. But under the hood, SQLite's NUMERIC is just a mask - it secretly turns decimals right back into binary floats. Using ROUND() just slaps a band-aid over a broken number after the damage is done. Plus, if you or a teammate forget to write ROUND() in just one single reporting query, those hidden micro-errors leak into your code and cause invisible bugs.&lt;/p&gt;

&lt;p&gt;Step 4: The Enterprise Database Illusion&lt;br&gt;
I thought, "Fine, I will just upgrade to an enterprise database like PostgreSQL later, because Postgres has a native, exact Base-10 decimal engine."&lt;/p&gt;

&lt;p&gt;But as I dug deeper, I learned that senior developers across the industry avoid using decimal data types altogether, even in advanced databases like Postgres.&lt;/p&gt;

&lt;p&gt;Why? Because of four hidden bottlenecks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Performance: Pure whole numbers (Integers) are processed directly by computer hardware almost instantly. Software-defined decimal types require complex algorithms that calculate math digit-by-digit, creating a massive CPU bottleneck for systems processing millions of transactions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The API and Code Trap: Even if your database stores a perfect decimal, the moment that number leaves the database via an API or into JavaScript, languages often force it right back into a standard binary float, instantly corrupting it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Portability: If your code relies on one database's unique decimal engine, your code will break if you ever have to migrate to another system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Storage: Integers take up a small, fixed amount of space. Complex decimals are variable-length and take up significantly more hard drive space and memory.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Elegant Ultimate Solution: Integer Scaling&lt;br&gt;
The ultimate breakthrough was realizing that the best way to handle decimals is to eliminate them completely from your data layer.&lt;br&gt;
Instead of tracking 1.5 Kilograms, you multiply by 1,000 and track 1500 Grams as a pure INTEGER. Instead of tracking 14.50 dollars, you track 1450 Cents.&lt;/p&gt;

&lt;p&gt;Integers never suffer from binary float distortion. They remain perfect integers inside the database, perfect integers when traveling through a JSON API, and perfect integers inside your frontend code.&lt;/p&gt;

&lt;p&gt;The golden rule of engineering is simple: Keep the absolute truth as a whole integer through your entire system, and only insert the decimal point at the very last microsecond right before showing it on the user's screen.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>computerscience</category>
      <category>database</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>I just learned something fascinating about why computers struggle with simple math, and it completely blew my mind.</title>
      <dc:creator>Harshita</dc:creator>
      <pubDate>Wed, 04 Nov 2026 16:22:45 +0000</pubDate>
      <link>https://dev.to/harshita_87/i-just-learned-something-fascinating-about-why-computers-struggle-with-simple-math-and-it-2eae</link>
      <guid>https://dev.to/harshita_87/i-just-learned-something-fascinating-about-why-computers-struggle-with-simple-math-and-it-2eae</guid>
      <description>&lt;p&gt;If you go to a shop and buy 1.5 kg of sugar, you would think a computer database could save the number 1.5 without any issues. It turns out, it isn't that simple.&lt;/p&gt;

&lt;p&gt;Here is what I learned today:&lt;/p&gt;

&lt;p&gt;The Core Problem: Humans and Computers Count Differently&lt;br&gt;
Humans count in Base-10. We use ten digits (0 to 9), so clean decimals like 0.1, 0.5, or 1.5 make perfect sense to us.&lt;/p&gt;

&lt;p&gt;Computers, however, count in Base-2 (Binary). Their brains only understand 0s and 1s.&lt;/p&gt;

&lt;p&gt;Because of this hardware limitation, a computer cannot cleanly save a normal human decimal like 0.1 using its standard number memory. To a computer, 0.1 turns into an endless, repeating loop of 0s and 1s that gets cut off. Because it gets cut off, standard computer math breaks. If you ask a computer to do 0.1 + 0.2, it doesn't give you 0.3. It gives you 0.30000000000000004!&lt;/p&gt;

&lt;p&gt;While that tiny error seems small, if you calculate it thousands of times, your money vanishes or your stock numbers break.&lt;/p&gt;

&lt;p&gt;How We Fix It: The SQLite vs. PostgreSQL Approach&lt;/p&gt;

&lt;p&gt;To stop this corruption, our code and our database need to talk in exact human decimals, not computer binary.&lt;/p&gt;

&lt;p&gt;Right now, I am using SQLite. SQLite is lightweight but it does not have a built-in exact decimal system - it defaults to those messy 0s and 1s. To fix this, we use a clever trick: we save our numbers as TEXT in the database. Text freezes the characters "1.5" exactly as they are so they don't warp. Then, we bring that text into Python and use a special tool called decimal.Decimal to do the math perfectly.&lt;/p&gt;

&lt;p&gt;If I upgrade to a bigger database like PostgreSQL in the future, the code stays safe. Postgres actually has a native engine built just for human decimals. It saves the exact decimal directly on the disk, hands it to Python automatically, and Python does the exact same precise math.&lt;/p&gt;

&lt;p&gt;The Takeaway is :-&lt;br&gt;
The database and our code have two different jobs. The database acts like a secure filing cabinet to keep the numbers safe on the hard drive, and Python acts like the calculator doing the math in memory.&lt;/p&gt;

&lt;p&gt;No matter what tools we use, both sides have to speak the same language so our data never gets corrupted. If you are building any system that tracks money or stock, never trust standard computer numbers!&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvesp66zj6nonksaot2w8.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvesp66zj6nonksaot2w8.png" alt=" " width="668" height="362"&gt;&lt;/a&gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftihh037jscgsb5e3y4jg.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftihh037jscgsb5e3y4jg.png" alt=" " width="670" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>api</category>
      <category>architecture</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>I’m currently grinding through functional programming, and my brain is actively rewiring itself in real time.</title>
      <dc:creator>Harshita</dc:creator>
      <pubDate>Mon, 28 Sep 2026 15:28:15 +0000</pubDate>
      <link>https://dev.to/harshita_87/im-currently-grinding-through-functional-programming-and-my-brain-is-actively-rewiring-itself-in-4bed</link>
      <guid>https://dev.to/harshita_87/im-currently-grinding-through-functional-programming-and-my-brain-is-actively-rewiring-itself-in-4bed</guid>
      <description>&lt;p&gt;Honestly, I used to think a lot of these advanced patterns were just pretentious jargon. But after breaking a bunch of code and yelling at my terminal, I've had some massive personal breakthroughs where the lightbulbs finally went off.&lt;/p&gt;

&lt;p&gt;My real realizations so far:&lt;br&gt;
I finally get why people force strict rules onto a messy language like Python. It feels like putting a tailored tuxedo on a wild bear. The bear doesn't need the suit, and the language won't force you to be clean. But you do it anyway for your own sanity so your codebase stops turning into a tangled pile of moving parts.&lt;/p&gt;

&lt;p&gt;I stopped writing massive, annoying logic blocks to handle data shapes manually after realizing I could just let a mathematical formula do the heavy lifting in a single, clean expression.&lt;/p&gt;

&lt;p&gt;I used to confuse stateful and stateless code until I pictured them in memory. Stateful code is like a bank account - it has a memory and constants morphing over time. Stateless code is just a pocket calculator. It handles the input, flashes a result, and leaves the original data completely untouched.&lt;/p&gt;

&lt;p&gt;I realized that while pure functions are great, a program with zero side effects is completely useless because it can't actually print an answer to a screen or save a file. Now I'm learning to write my code like a sandwich - messy inputs on the outside, pure mathematical logic in the middle, and physical side effects at the end.&lt;/p&gt;

&lt;p&gt;I fell into a brutal debugging trap because I forgot that passing lists and dictionaries is like sharing a Google Doc link - if your function modifies it, you instantly corrupt that data for the entire application.&lt;/p&gt;

&lt;p&gt;It’s been a painful but awesome week of learning. I’m definitely not throwing away loops or classes yet, but it’s completely changing how I think about data stability and tracking variables.&lt;/p&gt;

&lt;p&gt;For anyone else who has gone through this transition - what was the hardest mental shift for you to make?&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94asj14n4ysx94h0hl99.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F94asj14n4ysx94h0hl99.png" alt=" " width="799" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>testing</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
