<?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: Sayan Kundu</title>
    <description>The latest articles on DEV Community by Sayan Kundu (@sayankundu009).</description>
    <link>https://dev.to/sayankundu009</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%2F721511%2F677fa544-49a4-47ce-8029-cde2e28c67d9.png</url>
      <title>DEV Community: Sayan Kundu</title>
      <link>https://dev.to/sayankundu009</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sayankundu009"/>
    <language>en</language>
    <item>
      <title>Coding with AI is a game of poker</title>
      <dc:creator>Sayan Kundu</dc:creator>
      <pubDate>Sun, 22 Mar 2026 17:39:23 +0000</pubDate>
      <link>https://dev.to/sayankundu009/coding-with-ai-is-a-game-of-poker-42k4</link>
      <guid>https://dev.to/sayankundu009/coding-with-ai-is-a-game-of-poker-42k4</guid>
      <description>&lt;p&gt;You've probably been there. You gave a prompt to AI, the output works, you shipped the feature, then two weeks later, something breaks in a way you didn't see coming.&lt;/p&gt;

&lt;p&gt;Or a moment where you asked the right question and the AI handed you something genuinely brilliant.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That's what got me thinking, coding with AI is a lot like playing poker.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;In a game of poker, the player gets a set of cards at the start. Some hands are clearly strong, while others might seem weak. &lt;/p&gt;

&lt;p&gt;But the game isn’t just about the cards. It’s about how you play them&lt;/p&gt;

&lt;p&gt;For a beginner, the game can feel like a gamble. Should they fold? Should they raise? Is their hand even good enough?&lt;/p&gt;

&lt;p&gt;But some players can turn the tide into their favour. They pay attention to how others are playing, decide when to take risks, when to step back, and sometimes even win with cards that do not look promising at all.&lt;br&gt;
 &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;This is what working with AI looks like&lt;/strong&gt;. &lt;em&gt;LLMs will hand you solutions, sometimes clean and elegant but sometimes brittle and wrong. some developers work their way around, guiding the AI to produce better results. But someone who is just starting out, may not grasp how much a solution can impact their work.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt; &lt;/p&gt;
&lt;h2&gt;
  
  
  Lets dive in!
&lt;/h2&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%2Fzf1hmoaf287z87sb3s9s.gif" 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%2Fzf1hmoaf287z87sb3s9s.gif" alt="Lets dive in" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
Here are few scenarios that I have came across in codebases and during my own work.&lt;/p&gt;
&lt;h3&gt;
  
  
  I'll go with the vibe ✨
&lt;/h3&gt;

&lt;p&gt;A developer starts with thier day, picks up a task which is to create new UI page in the project. They quickly open up their favorite AI-powered IDE, paste in the design screenshot, and fire off the prompt!&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%2F1vx3supt8p3xdrexylzv.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%2F1vx3supt8p3xdrexylzv.png" alt="Easy prompt" width="668" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the AI delivers 🎉. The layout is right, the spacing looks good, the code is clean. It might even look better than the original. So it gets shipped.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Few moments later&lt;/em&gt;, the design team updates the brand colors. Every other page in the project adapts automatically except that one. Because the AI somehow didn't use the theme variables, existing component classes, or the design system the project uses. Although the AI built a good UI but some parts of it are made from scratch&lt;/p&gt;

&lt;p&gt;Some additions in the prompt / workflow could result in a much better outcome&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%2Fy86dntam5sgbuhuebq8g.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%2Fy86dntam5sgbuhuebq8g.png" alt="Good prompt" width="663" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  No time to &lt;del&gt;die&lt;/del&gt; Optimize
&lt;/h3&gt;

&lt;p&gt;When creating a table with selectable rows in javascript, for tracking which rows are selected, the AI might suggest to use &lt;code&gt;new Set()&lt;/code&gt; which has O(1) lookups, clean API, the right tool for the job&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;toggleRow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setSelectedRows&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;updated&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isSelected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;selectedRows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// O(1) — instant&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A developer reads the code and hesitates. They have never used &lt;code&gt;Set&lt;/code&gt; before. The code looks unfamiliar and slightly uncomfortable. So they swap it out with &lt;code&gt;array.includes()&lt;/code&gt; something they know and trust.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;toggleRow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{...};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;isSelected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;selectedRows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// O(n) — loops&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What they did not realise is that &lt;code&gt;includes()&lt;/code&gt; loops through the entire array on every check. And with large number of rows and rapid selections, the UI might start to stutter.&lt;br&gt;
 &lt;/p&gt;
&lt;h2&gt;
  
  
  Refactor to the moon 🚀
&lt;/h2&gt;

&lt;p&gt;A developer picks up a large and messy function which has been in the codebase for a while. Everyone knows it needs refactoring. They run it through the AI, and the result is genuinely good, cleaner structure, better separation, and easier to read.&lt;/p&gt;

&lt;p&gt;But they don't stop there.&lt;/p&gt;

&lt;p&gt;"&lt;em&gt;Can you optimize this further?&lt;/em&gt;" and the AI gets to work. Each pass introduces more abstraction, generic utilities, dynamic dispatch, and configurable pipelines&lt;/p&gt;

&lt;p&gt;The code is technically impressive. But made it much harder to onboard someone new in future.&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;// Messy, but everyone understood it&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;digital&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;physical&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// First Pass — good refactor, clean, readable&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getOrderHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;process&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Second Pass — nobody asked for this&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;OrderPipeline&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;withMiddleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;OrderMiddlewareRegistry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;order&lt;/span&gt;&lt;span class="p"&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;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The AI knows your tech stack but does not know your scale, requirements, or your users. That's the hand only you can play.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
   
&lt;/h2&gt;

&lt;p&gt;Just like you, I am also trying to navigate this new era of building with AI. Here are some of the things I have learned that help me in my day to day work and improve my game.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning to verify, not just accept
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Focus on understanding the fundamental concepts. Something looks unfamiliar? Ask the AI to explain the concepts.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Plan mode in your favourite AI tool / IDE whenever a solution has multiple moving parts. It lets you see where the AI is headed before any code is written and you can modify the plan according to your needs.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Break your requirements into small chunks and explain them to the AI, which results in generating a precise solution.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Treat every AI solution as a Pull request that needs review.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learn about the best practices and security checklists. No matter what your stack is. AI won't always apply them unless you know to ask for.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ask for help, try to discuss about issues / solutions / features whenever possible. Discussions unlock ideas, new ways of building sollution.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try to keep up with the latest AI innovations, new workflows, anything that makes things easier for you. So that you can focus on building what's important&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The masters of their craft
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ensure the codebase follows good architecture, naming conventions, rules, and patterns. This gives better references to the AI, which results in consistent, manageable solutions.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Try not to over-engineer if possible. Sometimes an easier solution, which is well optimised, might be better for the long run and easier for the next developer to pick up.&lt;br&gt;
 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Help/teach others whenever you can. Explaining a concept to a person is the same skill as guiding an AI effectively. If you can walk someone through a problem, you already know how to prompt your way to a good solution.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;AI models are improving at a pace that's hard to keep up with. Maybe we are just a few months away from a model that will be intelligent enough to enforce best practices by default, catch every edge case, and never let anyone ship bad code.&lt;/p&gt;

&lt;p&gt;But not today. And we still have our pending tasks to push to prod.&lt;/p&gt;

&lt;p&gt;We are all figuring this out as we go. I hope something in here made sense and helped in a way. &lt;/p&gt;

&lt;p&gt;Now go break something 👀. That's where the real learning happens anyway! 👋&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>javascript</category>
      <category>promptengineering</category>
    </item>
  </channel>
</rss>
