<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sangwin Gawande on Medium]]></title>
        <description><![CDATA[Stories by Sangwin Gawande on Medium]]></description>
        <link>https://medium.com/@sangwin?source=rss-f494ffedbf67------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Xb_hQae7MEdv9mro7-4-MA.png</url>
            <title>Stories by Sangwin Gawande on Medium</title>
            <link>https://medium.com/@sangwin?source=rss-f494ffedbf67------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 06:32:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sangwin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Become an AI Engineer in 2026: Learning Roadmap]]></title>
            <link>https://sangwin.medium.com/how-to-become-an-ai-engineer-in-2026-learning-roadmap-bf5b96912afb?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf5b96912afb</guid>
            <category><![CDATA[roadmaps]]></category>
            <category><![CDATA[ai-engineer]]></category>
            <category><![CDATA[forward-deployed-engineer]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[enterprise-architecture]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 05:36:01 GMT</pubDate>
            <atom:updated>2026-11-02T05:36:01.435Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="How to Become an AI Engineer in 2026: Learning Roadmap — Sangwin Gawande" src="https://cdn-images-1.medium.com/max/1024/1*d16UyheaxVoaNrhrLepXDA.png" /><figcaption>How to Become an AI Engineer in 2026: Learning Roadmap</figcaption></figure><p>Two years ago, I thought you needed a PhD to work in AI.</p><p>I was wrong. Most companies are not hiring people to build models. They want people who can turn existing models into products that actually work.</p><p>That person is an AI engineer. If you can already code, you are closer than you think. Here is the roadmap I wish I had.</p><h3>What an AI Engineer Actually Does</h3><p>Three roles get mixed up:</p><ul><li><strong>ML researcher:</strong> invents new models. Heavy math.</li><li><strong>ML engineer:</strong> trains and serves models.</li><li><strong>AI engineer:</strong> builds products on top of existing models.</li></ul><p>This post is about the third one. The daily work: connecting models to company data, letting them call tools, testing answers, and keeping costs under control.</p><p>In short, it is software engineering with a smart, unpredictable piece in the middle.</p><h3>The Honest Truth Before You Start</h3><ul><li><strong>You do not need to be a math expert.</strong> Basic ideas are enough.</li><li><strong>You do need to be a good developer.</strong> AI apps still need APIs, databases, error handling, and tests.</li><li><strong>Tools change fast. Ideas do not.</strong> Learn the ideas first.</li><li><strong>It takes months.</strong> About six if you already code. A year if you are starting from zero.</li></ul><h3>Phase 1: Programming Basics</h3><p><strong>Time:</strong> 4 to 8 weeks (skip if you already code)</p><ul><li><strong>Python.</strong> Most AI tools use it.</li><li><strong>TypeScript.</strong> Optional, but many AI products are web apps.</li><li><strong>APIs and JSON.</strong> Calling them, handling errors, retries, and rate limits.</li><li><strong>SQL, Git, and the command line.</strong></li></ul><p><strong>Trade off:</strong> you can start building AI apps before mastering this. But most bugs you hit later will be normal software bugs.</p><h3>Phase 2: How LLMs Work</h3><p><strong>Time:</strong> 2 to 3 weeks</p><p>You do not need to build a model. Just understand these:</p><ul><li><strong>Tokens:</strong> how models read text and how you get billed.</li><li><strong>Context window:</strong> how much the model can see at once. Bigger costs more.</li><li><strong>Temperature:</strong> keep it low for predictable answers.</li><li><strong>Embeddings:</strong> text turned into numbers to measure similarity.</li><li><strong>Hallucination:</strong> models make things up. Design around it.</li></ul><h3>Phase 3: Build With Model APIs</h3><p><strong>Time:</strong> 3 to 4 weeks</p><p>Learn one provider’s API well, then try a second and one open source model.</p><p>Practice:</p><ul><li><strong>Clear prompts.</strong> Treat them like code. Version and review them.</li><li><strong>Structured output.</strong> Ask for JSON, then validate it.</li><li><strong>Streaming.</strong> Nobody likes staring at a spinner.</li><li><strong>Tool calling.</strong> The base of almost every serious AI feature.</li><li><strong>Failure handling.</strong> Timeouts, empty answers, weird output.</li></ul><p><strong>Opinion:</strong> prompt engineering alone is not a career. It is one skill inside AI engineering.</p><h3>Phase 4: RAG (Connecting Models to Your Data)</h3><p><strong>Time:</strong> 3 to 4 weeks</p><p>Models do not know your company’s data. RAG (retrieval augmented generation) fixes that: find the right information first, then give it to the model with the question.</p><p>The flow: split documents into chunks, turn them into embeddings, store them, find the closest matches, send them with the question.</p><p>Easy to build. Easy to build badly. The real skills:</p><ul><li><strong>Chunking.</strong> No perfect size. You test.</li><li><strong>Hybrid search.</strong> Mix vector and keyword search. Vectors are bad at exact codes.</li><li><strong>Reranking.</strong> Fetch extra results, keep the best few.</li><li><strong>Citations.</strong> Show where answers came from.</li></ul><p><strong>Trade off:</strong> for small document sets, a regular database with search is often enough. Skip the vector database until you need it.</p><h3>Phase 5: Agents and Tool Use</h3><p><strong>Time:</strong> 3 to 4 weeks</p><p>An agent is a model in a loop: pick a tool, check the result, decide the next step.</p><ul><li><strong>Build one from scratch first.</strong> About 50 lines. Then frameworks make sense.</li><li><strong>Design clear tools.</strong> Good names, good descriptions, small inputs.</li><li><strong>Learn MCP.</strong> A common standard for connecting models to tools.</li><li><strong>Add guardrails.</strong> Limit steps. Ask a human before risky actions.</li><li><strong>Watch for prompt injection.</strong> Treat everything the agent reads as data, not commands.</li></ul><p><strong>Opinion:</strong> most problems do not need an agent. A fixed workflow is cheaper and easier to test.</p><h3>Phase 6: Evaluation (The Skill Most People Skip)</h3><p><strong>Time:</strong> 2 to 3 weeks, then forever</p><p>You change a prompt. Did it get better or worse? Without evaluation, you are guessing.</p><ul><li><strong>Build a test set</strong> of 50 to 100 real questions. Grow it with every bug.</li><li><strong>Check what you can with code.</strong> Valid JSON? Right tool?</li><li><strong>Use a model as a judge</strong> for the rest, and spot check its grades.</li><li><strong>Read real outputs</strong> every week.</li></ul><p><strong>Trade off:</strong> it feels slow at first. But without it, every fix breaks something else.</p><h3>Phase 7: Production</h3><p><strong>Time:</strong> 3 to 4 weeks</p><p>A working demo is 20 percent of the job. The rest is making it work for thousands of users.</p><ul><li><strong>Cost:</strong> send easy tasks to small models.</li><li><strong>Speed:</strong> stream, cache, and run calls in parallel.</li><li><strong>Monitoring:</strong> log every prompt, response, and error.</li><li><strong>Fallbacks:</strong> providers go down. Have a plan B.</li><li><strong>Privacy:</strong> know what data goes where.</li><li><strong>Security:</strong> never put API keys in frontend code. (I have seen it. More than once.)</li></ul><h3>Do You Need Machine Learning Theory?</h3><p>Some, not a lot. Know what training and test data are, what overfitting means, and how to measure accuracy. One short course is enough.</p><p><strong>Fine tuning?</strong> Try better prompts, better examples, RAG, and a different model first. Fine tune only when those fail and you have lots of good examples.</p><p><strong>Fair point:</strong> if you want to build models yourself, you need much deeper ML. That is a different path.</p><h3>Projects That Get You Hired</h3><p>Certificates are nice. Projects get interviews. Skip the “chat with a PDF” demo. Build fewer things, go deeper.</p><ul><li><strong>A support bot</strong> for an open source project, with citations and a test score that improves over time.</li><li><strong>An agent</strong> that does one boring task well, with step limits and human approval.</li><li><strong>A model comparison</strong> of quality, cost, and speed for one task.</li><li><strong>An AI feature</strong> added properly to an app you already built.</li></ul><p>In each README, explain the problem, your trade offs, how you tested it, and what you would do next.</p><h3>Mistakes to Avoid</h3><ul><li><strong>Tutorial hopping.</strong> Build instead.</li><li><strong>Chasing every new model.</strong> Your skills should outlast them.</li><li><strong>Starting with a big framework.</strong> Learn the raw API first.</li><li><strong>Skipping evaluation.</strong> Yes, again.</li><li><strong>Ignoring cost.</strong> Expensive features get shut down.</li><li><strong>Trusting the output.</strong> Confident does not mean correct.</li></ul><h3>Conclusion</h3><p>AI engineering is not magic. It is good software engineering with a powerful, slightly unpredictable tool in the middle.</p><p>Three things to remember:</p><ul><li><strong>Be a solid developer first.</strong></li><li><strong>Learn ideas, not just tools.</strong> Frameworks fade. Retrieval, tool calling, and evaluation stay.</li><li><strong>Measure everything.</strong> The best AI engineers can prove their changes helped.</li></ul><p>Honestly, I wish I had started sooner. You will never feel fully ready. Build something small, share it, and improve it each week.</p><p>And yes, you will still be debugging JSON. Some things never change.</p><p>—</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf5b96912afb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[20 Frontend Interview Questions I Always Prepare For]]></title>
            <link>https://sangwin.medium.com/20-frontend-interview-questions-i-always-prepare-for-ba5d6ead1771?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba5d6ead1771</guid>
            <category><![CDATA[react-vs-angular-vs-vue]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[interview-questions]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Tue, 27 Oct 2026 05:11:53 GMT</pubDate>
            <atom:updated>2026-10-27T05:12:56.340Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="20 Frontend Interview Questions I Always Prepare For" src="https://cdn-images-1.medium.com/max/1024/1*_RQg6oJ74VR1C_3gHJkIwg.png" /><figcaption>20 Frontend Interview Questions I Always Prepare For</figcaption></figure><p>Did I fail a frontend interview because of a search box.? I don’t think so.</p><p>Not a hard algorithm. Not a tricky puzzle. Just a search box that showed the wrong results when you typed fast. The interviewer asked me why.?</p><p>That day I learned something. Frontend interviews are not about remembering every JavaScript method. They test if you know what really happens in the browser when things go wrong.</p><p>Later I started taking interviews myself. The same 20 topics came up again and again. This post covers all of them. If you can explain these in your own words, you are ready for most mid level frontend interviews.</p><h3>Why These Questions Matter</h3><p>Most people prepare by building one more todo app. Or by solving “write a debounce function” ten times.</p><p>That helps you pass the first round. But then the interviewer asks a follow up:</p><p><em>“Your list now has 10,000 items. What breaks?”</em></p><p>That is where many people get stuck.</p><p>These questions are good because they check two things:</p><ul><li>Do you know how to use the tool?</li><li>Do you know what the tool is doing behind the scenes?</li></ul><p>Anyone can write useEffect. Fewer people can explain why it ran twice.</p><p>You do not need perfect textbook answers. You need to understand the problem well enough to talk about it like you are explaining it to a teammate.</p><h3>JavaScript Basics</h3><p>Frameworks come and go. JavaScript stays. Almost every strange bug in a web app goes back to one of these four topics.</p><h3>1. In what order do setTimeout, a Promise, and normal code run?</h3><p>This is the event loop question. It shows up in almost every interview.</p><p>Here is the simple version:</p><ul><li>Normal code runs first.</li><li>Then all Promise callbacks run. These are called microtasks.</li><li>Then one setTimeout callback runs. This is a macrotask.</li><li>The browser can only paint the screen between macrotasks.</li></ul><p>The key point: the browser runs <strong>every</strong> microtask before it does anything else. So a never ending chain of Promises can freeze your page, just like an endless loop.</p><h3>2. Why does my loop print the same number five times?</h3><p>The classic example:</p><pre>for (var i = 0; i &lt; 5; i++) {<br>  setTimeout(() =&gt; console.log(i));<br>}</pre><p>This prints 5 five times. Why? var creates one shared i for the whole loop. By the time the timers run, the loop is done and i is 5.</p><p>Change var to let and each loop round gets its own i. Problem solved.</p><p>Why this matters in real life: the “stale state” bug in React hooks is the same problem. Your function is holding on to an old value.</p><h3>3. How does this work, and why are arrow functions different?</h3><p>this depends on <strong>how</strong> a function is called, not where you wrote it.</p><ul><li>Called as obj.run()? Then this is obj.</li><li>Called with call, apply, or bind? Then this is whatever you passed.</li><li>Called with new? Then this is the new object.</li><li>Called on its own? Then this is undefined in strict mode.</li></ul><p>Arrow functions ignore all of these rules. They take this from the code around them.</p><p>A common bug: you pass obj.run as a click handler and suddenly this is lost. Now you know why.</p><h3>4. What causes memory leaks in a single page app?</h3><p>In a single page app, the page never reloads. So anything you forget to clean up just keeps piling up.</p><p>Common causes:</p><ul><li>Event listeners that are never removed</li><li>Timers that keep running after the component is gone</li><li>DOM elements removed from the page but still saved in a variable</li><li>Caches or arrays that only ever grow</li></ul><p>How to find one: open Chrome DevTools, take a heap snapshot, use the app for a while, then take another. Compare them. If some object count keeps going up, you found your leak.</p><h3>React and Rendering</h3><p>Most frontend jobs today use React. Interviewers want to see that you know what React does for you, not just how to call it.</p><h3>5. What makes a React component render again?</h3><p>A component renders again when:</p><ul><li>Its own state changes</li><li>Its parent renders again</li><li>A context it uses changes</li></ul><p>Here is the part people miss. Changing props is not really the trigger. The parent rendering is.</p><p>This is why React.memo often does nothing. If the parent passes a new object or a new function every time, React sees &quot;new props&quot; and renders anyway.</p><p><strong>My opinion:</strong> do not wrap everything in useMemo and useCallback. They have a cost too. Use them when you have measured a real slowdown.</p><h3>6. Why is using the array index as a key a bad idea?</h3><p>Keys tell React which item is which. If you use the index and then add, remove, or sort items, React matches the wrong data to the wrong component.</p><p>You will see funny bugs. You delete row two, and the text you typed in row two suddenly shows up in row three.</p><p>The fix: use a stable ID from your data. And never use random keys. That makes React rebuild every item on every render.</p><h3>7. Why did my useEffect run twice?</h3><p>In development, React Strict Mode mounts your component, removes it, and mounts it again. It does this on purpose. It wants to catch effects that do not clean up after themselves.</p><p>Things that need a cleanup:</p><ul><li>Subscriptions</li><li>Timers</li><li>Network requests</li></ul><p>That last one is sneaky. If two requests are running and the old one finishes last, it can overwrite fresh data with old data. Use an AbortController in the cleanup to cancel the old request.</p><h3>8. CSR, SSR, SSG: what is the difference, and what is hydration?</h3><p>The big question is: <strong>when</strong> is the HTML made?</p><ul><li><strong>CSR (client side rendering):</strong> the browser builds the page with JavaScript. Simple to set up, but slower first load and weaker for SEO.</li><li><strong>SSR (server side rendering):</strong> the server builds HTML for every request. Faster first view, but more server work.</li><li><strong>SSG (static site generation):</strong> HTML is built once at build time. Very fast, but the content can get old.</li></ul><p><strong>Hydration</strong> is when React runs in the browser and connects event handlers to HTML that came from the server.</p><p>A common follow up: what is a hydration mismatch? It happens when the server and browser render different things. For example, showing the current time or reading window during render. The fix is to move that logic into an effect.</p><h3>Browser Performance</h3><p>Everyone says they care about speed. Interviewers want to know if you can find the real problem instead of guessing.</p><h3>9. What happens before the first pixel shows on screen?</h3><p>The browser goes through these steps:</p><ol><li>Reads the HTML and builds the DOM</li><li>Reads the CSS and builds the CSSOM</li><li>Combines them</li><li>Works out the layout</li><li>Paints the pixels</li></ol><p>Two things slow this down:</p><ul><li><strong>CSS blocks rendering.</strong> The browser waits for it.</li><li><strong>A normal script tag in the head blocks reading the HTML.</strong></li></ul><p>The fixes: add defer or async to scripts, keep the most important CSS small, and preload your main image and font.</p><h3>10. Why is animating top slower than animating transform?</h3><p>When you change top, width, or margin, the browser has to work out the layout again. On every frame.</p><p>When you change transform or opacity, the browser can usually skip that work. It just moves pixels around.</p><p>There is a related bug called <strong>layout thrashing</strong>. It happens when you read a size (like offsetHeight) and then change a style, over and over inside a loop. Each read forces the browser to recalculate. The fix is simple: do all your reads first, then all your writes.</p><p>Remember, you only get about 16ms per frame if you want smooth 60fps.</p><h3>11. How do you show 100,000 rows without freezing the page?</h3><p>Putting 100,000 elements on the page will hurt. No framework can save you there.</p><p>The usual answer is <strong>virtualization</strong>. You only render the rows the user can see, plus a few extra. As they scroll, you swap rows in and out.</p><p>But it has trade offs:</p><ul><li>Rows with different heights are harder to handle</li><li>Ctrl+F will not find text that is not rendered</li><li>Screen readers need extra care</li></ul><p>Sometimes the better answer is a product one. Does the user really need 100,000 rows? Maybe search or pagination is enough.</p><h3>12. Your Core Web Vitals are bad. Where do you start?</h3><p>Know the three numbers:</p><ul><li><strong>LCP (Largest Contentful Paint):</strong> how fast the main content shows. Usually slow because the main image loads late or the server is slow.</li><li><strong>INP (Interaction to Next Paint):</strong> how fast the page reacts to clicks and typing. Usually slow because long JavaScript tasks block the main thread. Break big tasks into smaller ones.</li><li><strong>CLS (Cumulative Layout Shift):</strong> how much the page jumps around. Usually caused by images without a width and height, late fonts, or banners that push content down.</li></ul><p>One more thing. Lighthouse runs on your fast laptop. Real users have slow phones. Always check real user data too.</p><h3>Data, State and the Network</h3><p>The network is slow. Requests fail. Data changes while the user is looking at it. Your frontend has to deal with all of that.</p><h3>13. Search results show up in the wrong order. Why?</h3><p>This is the question that got me. Here is the answer I wish I had given.</p><p>Every key press sends a request. But responses do not come back in order. The result for “re” can arrive after the result for “react” and replace it.</p><p>Ways to fix it:</p><ul><li><strong>Debounce</strong> the input so you only search after the user stops typing</li><li><strong>Cancel</strong> old requests with AbortController</li><li><strong>Track</strong> the latest request and ignore older answers</li></ul><p>Also know the difference between debounce and throttle. Debounce waits until the action stops. Throttle runs at most once every few milliseconds. Search boxes want debounce. Scroll handlers usually want throttle.</p><h3>14. Where should your state live?</h3><p>I have a strong opinion here. Most apps put way too much in a global store.</p><p>A simple way to decide:</p><ul><li><strong>Data from the server</strong> (users, products, posts): use a data fetching library like TanStack Query or SWR. It handles caching and refetching for you.</li><li><strong>Things that should survive a refresh or be shareable</strong> (filters, current tab, page number): put them in the URL.</li><li><strong>Truly global things</strong> (theme, logged in user): a small global store is fine.</li><li><strong>Everything else:</strong> keep it local in the component.</li></ul><p>Interviewers like it when you push back on “just put it all in Redux.”</p><h3>15. How do optimistic updates work, and what if the request fails?</h3><p>When a user likes a post, you show the like right away. You do not wait for the server. It feels fast.</p><p>The steps:</p><ol><li>Save the old state</li><li>Update the UI</li><li>Send the request</li><li>If it fails, put the old state back and tell the user</li></ol><p>The hard part is the edge cases. What if the user clicks like and unlike quickly? What if a background refresh brings back old data in the middle? Talk about these. It shows real experience.</p><h3>16. How do you cache files so users always get the latest version?</h3><p>The common pattern:</p><ul><li>Give your JS and CSS files a hash in the name, like app.3f9a1c.js</li><li>Tell the browser to cache those files for a very long time</li><li>Tell the browser to always check for a new index.html</li></ul><p>When you deploy, the file names change. The new index.html points to the new files. Users get the update, and old files never get in the way.</p><p>Bonus points: mention service workers. They can keep users on an old version until they close every tab. Many teams learn this the hard way.</p><h3>CSS, Accessibility and Security</h3><p>Many people skip these topics. Big mistake. This is often where strong candidates stand out.</p><h3>17. My modal has a z index of 9999. Why is it still behind other stuff?</h3><p>Because z index only works inside the same <strong>stacking context</strong>.</p><p>Some CSS properties quietly create a new stacking context. For example transform, filter, opacity below 1, and position: fixed. Once your modal is inside one of those, it can never go above things outside it. Not even with 999999. (Yes, I have tried.)</p><p>The usual fix: render the modal at the end of the body using a portal, or use the native &lt;dialog&gt; element.</p><h3>18. How do you build an accessible dropdown or modal?</h3><p>First rule: use native HTML elements when you can. A real &lt;button&gt; or &lt;select&gt; gives you keyboard support for free.</p><p>If you must build your own, you need:</p><ul><li>The right roles and ARIA attributes</li><li>Full keyboard support: Tab, Escape, and arrow keys</li><li>Focus moves into the modal when it opens</li><li>Focus stays inside while it is open</li><li>Focus goes back to the button when it closes</li></ul><p>A div with a click handler looks like a button. But keyboard and screen reader users cannot use it. Try your UI with only a keyboard once. You will learn a lot.</p><h3>19. What is XSS, and can it happen in React?</h3><p>XSS (cross site scripting) means an attacker gets their own script to run on your page.</p><p>React protects you by escaping text. But you can still get hurt by:</p><ul><li>dangerouslySetInnerHTML with content you did not clean</li><li>Links with javascript: in the URL</li><li>Third party scripts you added to the page</li></ul><p>How to protect yourself: clean HTML with a library like DOMPurify, and add a Content Security Policy. If something slips through, the policy limits the damage.</p><h3>20. Should you store an auth token in localStorage or a cookie?</h3><p>There is no perfect answer. That is why they ask it.</p><p><strong>localStorage</strong></p><ul><li>Easy to use</li><li>But any script on the page can read it. One XSS bug and the token is gone.</li></ul><p><strong>HttpOnly cookie</strong></p><ul><li>JavaScript cannot read it, so XSS cannot steal it</li><li>But the browser sends cookies automatically, which opens the door to CSRF attacks</li><li>SameSite and CSRF tokens help with that</li></ul><p>Many teams pick a middle path. They keep a short lived access token in memory and a refresh token in an HttpOnly cookie.</p><p>Bonus: know what CORS does. People mix it up with CSRF all the time. CORS controls which sites can read your API responses. It does not stop a browser from sending a request.</p><h3>Conclusion</h3><p>20 questions can feel like a lot. Please do not try to learn them all in one weekend.</p><p>Here is what worked for me. Pick one question a day. Open a blank project. Make the bug happen. Then fix it. Seeing a bug with your own eyes teaches you more than reading about it ten times.</p><p>You may notice a pattern in this list. Every question is about the gap between how code looks and how it works for real people:</p><ul><li>On a slow phone</li><li>On a bad network</li><li>With a keyboard instead of a mouse</li><li>With a screen reader instead of eyes</li></ul><p>That gap is where good frontend engineers spend most of their time.</p><p>So do not memorize answers. Learn what breaks and why. Once you understand the problem, the fix usually makes sense on its own. And that is exactly what interviewers want to hear.</p><p>Good luck. And may your search results always come back in the right order.</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba5d6ead1771" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI Made Writing Code Cheap. Reviewing It Is Now the Expensive Part.]]></title>
            <link>https://sangwin.medium.com/ai-made-writing-code-cheap-reviewing-it-is-now-the-expensive-part-4a4bc25fc7f4?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a4bc25fc7f4</guid>
            <category><![CDATA[expensive-things]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[code-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[code-review]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Mon, 26 Oct 2026 14:05:11 GMT</pubDate>
            <atom:updated>2026-10-26T14:05:11.313Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AI Made Writing Code Cheap. Reviewing It Is Now the Expensive Part." src="https://cdn-images-1.medium.com/max/1024/1*VKMA4YQKnDEhmfPhNPnH-g.png" /><figcaption>AI Made Writing Code Cheap. Reviewing It Is Now the Expensive Part.</figcaption></figure><p>It is Tuesday morning. You open your review queue and find eleven pull requests waiting for you. Three of them touch more than forty files. One has a description that just says “refactor and improvements.” All of them pass CI.</p><p>Not long ago, a queue like that took a week to fill. Now it fills overnight, because everyone on the team has an AI assistant that can produce a working change in minutes.</p><p>Here is the uncomfortable part. Producing code got much cheaper. Checking that code did not. The person who has to read, understand and approve the change is still the same person, with the same attention span and the same number of hours in a day.</p><p>In my view, this is one of the most underrated shifts in how teams build software. The slow step moved. If your process still treats writing code as the expensive part, you are optimizing the wrong thing.</p><h3>The bottleneck moved, the process did not</h3><p>Code review is the step where another engineer reads a proposed change, usually a pull request (PR), before it is merged. For most of software history, writing the code was the slow part. Review was a short check at the end.</p><p>There is an old idea from manufacturing called the theory of constraints. A system can only move as fast as its slowest step. If you speed up any other step, you do not get more output. You just get a bigger pile of work waiting in front of the slow step.</p><p>In a software team using AI, that pile is your review queue.</p><p>When the queue grows, two things usually happen. Reviewers start skimming, and “LGTM” (looks good to me) turns into a reflex rather than a judgment. Or authors wait for days, switch to other work, lose context, and come back to merge conflicts. Neither outcome is faster delivery. Both feel busy.</p><h3>What the research actually says</h3><p>The evidence so far points in the same direction.</p><p>The <a href="https://cloud.google.com/blog/products/ai-machine-learning/announcing-the-2025-dora-report">2025 DORA report</a>, based on a survey of nearly 5,000 technology professionals, found that 90 percent of respondents use AI at work. It found a positive relationship between AI adoption and delivery throughput, but AI adoption still had a negative relationship with delivery stability. Put simply, more changes are moving, and more of them cause trouble.</p><p>The same report found that 30 percent of respondents have little or no trust in the code AI generates. Somebody has to close that trust gap, and that somebody is usually a reviewer.</p><p>A more surprising data point came from METR, a research group that ran a <a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">randomized controlled trial with experienced open source developers</a> in early 2025. Sixteen developers worked on 246 real tasks in large repositories they knew well. When they were allowed to use AI tools, they took 19 percent longer. Before the study they expected AI to make them 24 percent faster, and even afterwards they believed it had sped them up by 20 percent.</p><p>The authors are careful to say this does not prove AI slows down most developers, and the tools have changed a lot since then. I would not use it to argue against AI. The useful lesson is narrower: our sense of how fast we are going is unreliable. Time spent reading, checking and fixing generated code is easy to forget, because it does not feel like “writing.”</p><h3>Why AI generated code is harder to review</h3><p>You might think code is code, and review is review. In practice, AI output changes the job in a few specific ways.</p><ul><li><strong>Volume.</strong> Generating 600 lines costs the author almost nothing, so diffs grow. The reviewer pays for every line.</li><li><strong>Plausibility.</strong> Generated code is usually tidy, well named and confident. Human code often has tells, like an awkward function or a strange comment, that show where the author struggled. Those tells guide a reviewer’s attention. Polished code removes them.</li><li><strong>Missing intent.</strong> If the author accepted a suggestion without fully understanding it, the reviewer becomes the first human to think hard about the change. That is not review anymore. That is authorship by proxy.</li><li><strong>Scope creep.</strong> Assistants like to be helpful. Ask for one fix and you may also get a renamed variable, a reformatted file and a “small cleanup” in a module nobody asked about.</li></ul><p>Here is a simple example. A developer asks an assistant to add retries to a call to a payment service. The assistant wraps the call in a loop with exponential backoff, which means it waits a little longer after each failure. The code looks great. But the payment endpoint is not idempotent, meaning calling it twice does not have the same effect as calling it once. Now a slow response followed by a retry can charge a customer twice.</p><p>Nothing in that diff looks wrong. The bug lives in what the diff does not say. A reviewer only catches it if they know the system and slow down enough to ask the right question.</p><h3>Verification is the real work now</h3><p>So here is my opinion. Verification is the actual constraint, and the cost of verification should move back toward the author.</p><p>That does not mean making authors suffer. It means the person who produced the change, with or without AI, should hand the reviewer evidence instead of a puzzle. A reviewer’s time is the scarcest resource on the team. Every practice below is about spending it well.</p><h3>Practical fixes</h3><p>These are not new ideas. AI just made them urgent.</p><ol><li><strong>Keep pull requests small.</strong> Google’s public <a href="https://google.github.io/eng-practices/review/developer/small-cls.html">engineering practices guide</a> says 100 lines is usually a reasonable size for a change and 1,000 lines is usually too large. It even says reviewers may reject a change just for being too big. With an assistant, it is tempting to generate a whole feature at once. Instead, ask it to plan the work as a sequence of small, self contained changes.</li><li><strong>Make the author own the change.</strong> A simple team rule helps: do not open a PR you cannot explain line by line. The description should say what changed, why, how it was tested and which parts were generated. This is not about blame. It tells the reviewer where to look first.</li><li><strong>Treat tests as evidence.</strong> A PR should include tests that prove the new behavior, and reviewers should read those tests before the implementation. Be careful here, though. Assistants can write tests that pass because they test the mock, or tests that confirm the bug. A test that would never fail is not evidence of anything.</li><li><strong>Use AI as the first pass reviewer, not the final approver.</strong> Automated review bots are good at catching missing null checks, unclear names, forgotten error handling and copy paste mistakes. Let them clear that noise before a human looks. Keep a human approval for anything that matters. GitHub’s documentation notes that, <a href="https://docs.github.com/en/copilot/concepts/agents/code-review">by default, Copilot reviews do not count toward required approvals</a>. For production code, I would keep it that way.</li><li><strong>Set a review SLA.</strong> A service level agreement (SLA) here is just a team promise about response time. Google’s guide on <a href="https://google.github.io/eng-practices/review/reviewer/speed.html">review speed</a> says one business day is the maximum time it should take to respond to a review request. Put review time on the calendar and count it as real work during planning. If reviews only happen “when I have a moment,” they will not happen.</li><li><strong>Match review depth to risk.</strong> A text change on a marketing page and a change to authentication code should not get the same treatment. Use code owners for sensitive paths, and require a second reviewer for payments, security, permissions and database migrations.</li><li><strong>Automate what humans should not check.</strong> Formatting, linting, type checks, static analysis and dependency scanning belong in CI. If a human is still commenting on indentation, a robot is not doing its job.</li></ol><h3>The trade offs</h3><p>None of this is free, and pretending otherwise would be dishonest.</p><p>Smaller PRs mean more PRs. Each one has overhead: a description, a CI run, a context switch for the reviewer. Stacked PRs, where each change builds on the previous one, help with this, but they need tooling and practice. Rebasing a stack of five changes is not anyone’s favorite afternoon.</p><p>Review SLAs can backfire. If you push for speed without limiting size, people respond faster by reading less. Speed and depth have to be managed together.</p><p>AI review bots produce noise. If half their comments are irrelevant, people learn to ignore all of them, including the one that mattered. Tune the rules, turn off the noisy ones and review the bot’s usefulness every few months.</p><p>Author accountability feels slower. It is slower, at the start. But part of the speed you lose was never real. It was just work moved to someone else’s queue, or to production.</p><h3>What I would avoid</h3><p>Two responses to the review bottleneck tend to make things worse.</p><p>The first is banning AI tools. Teams that do this lose real benefits for boilerplate, tests, migrations and exploration, and people often keep using the tools quietly anyway.</p><p>The second is measuring output. Counting lines of code, PRs merged or “AI acceptance rate” rewards exactly the flood that created the problem. If you want numbers, watch these instead:</p><ul><li>Time from PR opened to first review.</li><li>The size distribution of PRs, not the average.</li><li>Change failure rate, meaning how often a deployment causes a problem in production.</li><li>Rework, such as reverts and follow up fixes within a week of merging.</li></ul><p>These tell you whether the system is healthy. Raw output only tells you that the keyboard is busy.</p><h3>Further Reading</h3><ul><li><a href="https://google.github.io/eng-practices/review/">Google engineering practices: code review</a></li><li><a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/">METR study on AI and experienced open source developers</a></li><li><a href="https://cloud.google.com/blog/products/ai-machine-learning/announcing-the-2025-dora-report">Announcing the 2025 DORA report</a></li></ul><h3>Conclusion</h3><p>AI changed the economics of software teams. Writing code is cheap now. Understanding it, checking it and standing behind it are not, and those costs land on reviewers.</p><p>The fix is not to review harder. It is to make review smaller, earlier and better supported: small PRs, authors who can explain their changes, tests that act as real evidence, bots that clear the noise, and a team agreement that review is real work with a real response time.</p><p>If you take one thing from this article, take this: the team that ships fastest is not the one that generates the most code. It is the one that can verify its code the fastest.</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a4bc25fc7f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Put Your Coding Agent on a Leash Before It Deletes Something Important]]></title>
            <link>https://sangwin.medium.com/put-your-coding-agent-on-a-leash-before-it-deletes-something-important-195aeb8533dd?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/195aeb8533dd</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[delete-all-data]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[control]]></category>
            <category><![CDATA[production]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Thu, 22 Oct 2026 15:11:19 GMT</pubDate>
            <atom:updated>2026-10-22T15:11:19.309Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Put Your Coding Agent on a Leash Before It Deletes Something Important" src="https://cdn-images-1.medium.com/max/1024/1*kMvS_XNTQC7ca6tnUDfheg.png" /><figcaption>Put Your Coding Agent on a Leash Before It Deletes Something Important</figcaption></figure><p>How many times did you click “approve” yesterday?</p><p>If you use a coding agent for real work, the honest answer is probably “a lot, and I stopped reading after the first hour.” The agent wants to run tests. Approve. Install a package. Approve. Run a cleanup script you never quite looked at. Approve.</p><p>Coding agents now run shell commands, edit files, install dependencies and open pull requests. That is what makes them useful. It also means they run with your user account, your SSH keys, your cloud credentials and your network access. A permission prompt you approve without reading is not a control. It is a ritual.</p><p>This article is about the controls that still work when you are tired: sandboxes, permission rules, secrets hygiene and repository guardrails. The goal is not to stop the agent from working. The goal is to make sure the worst day looks like “it broke a branch” and not “it broke production.”</p><h3>Why prompts alone fail</h3><p>Permission prompts look safe on paper. In practice, they hit two problems.</p><p>The first is approval fatigue. Anthropic said this plainly when it introduced <a href="https://www.anthropic.com/engineering/claude-code-sandboxing">sandboxing for Claude Code</a>: constantly clicking approve “slows down development cycles and can lead to ‘approval fatigue’.” People stop reading, and the prompt becomes noise.</p><p>The second is that the agent may not be acting on your intent at all. If it reads a malicious README, a poisoned issue or a compromised dependency, it can be steered by text an attacker wrote. That is prompt injection, and no model today is immune to it.</p><p>A third risk needs no attacker at all: the plain old mistake. In July 2025, a widely shared incident involved a Replit agent deleting a database during what the user had declared a code freeze. <a href="https://www.thestack.technology/vibe-coding-ceo-deletes-production-database/">The Stack’s report</a> notes that Replit’s CEO called it “unacceptable” and that the company added automatic separation between development and production databases. The lesson for the rest of us: instructions in a chat are not a safety boundary. Infrastructure is.</p><h3>The two walls every sandbox needs</h3><p>A sandbox is an environment that limits what a process can touch. For coding agents, it needs two walls.</p><p><strong>Filesystem isolation.</strong> The agent can read and write inside the project folder, and not much else. It cannot edit your shell profile, read ~/.ssh, or touch files in other repositories.</p><p><strong>Network isolation.</strong> The agent can reach a short list of approved hosts, like your package registry, and nothing else. It cannot upload your code to a random server.</p><p>Anthropic’s post is clear that effective sandboxing “requires both filesystem and network isolation.” Without network isolation, a fooled agent can send out anything it can read, SSH keys included. Without filesystem isolation, it can edit files that run outside the sandbox, such as a shell profile, and escape the wall entirely.</p><h3>Your options, from light to heavy</h3><p>There is no single right sandbox. Think of it as a ladder. Climb higher when the agent gets more autonomy or the code gets less trusted.</p><h3>Built in agent sandboxes</h3><p>Several popular coding agents now ship a sandbox mode that uses operating system features. Claude Code uses bubblewrap on Linux and Seatbelt on macOS, with network traffic going through a proxy that only allows approved domains. Anthropic reported that in its internal usage, sandboxing reduced permission prompts by 84%.</p><p>OpenAI’s Codex works in a similar way. Its <a href="https://learn.chatgpt.com/docs/agent-approvals-security">documentation on approvals and security</a> describes a read only mode, a workspace write mode that limits edits to the current workspace, and a full access mode that removes restrictions. It also states that “by default, the agent runs with network access turned off.”</p><p>These are the easiest win. Turn them on for everyday work on your own machine.</p><p>The catch: these sandboxes often cover shell commands, not everything the agent runs. Claude Code’s own <a href="https://code.claude.com/docs/en/sandbox-environments">guide to choosing a sandbox environment</a> notes that the sandboxed Bash tool does not cover MCP servers and hooks, which run as separate processes on the host. Read your tool’s docs to see exactly what is inside the wall.</p><h3>Dev containers</h3><p>A dev container is a Docker container defined in your repository, following the open <a href="https://containers.dev/">Development Container specification</a>. Your editor connects to it, and every command the agent runs happens inside the container instead of on your laptop.</p><p>This gives you a full environment boundary that the whole team can share. Pair it with a firewall that only allows known domains, and you have a solid setup for longer, less supervised sessions. Anthropic publishes a reference dev container for Claude Code with exactly that kind of default deny firewall.</p><p>The Claude Code documentation adds an important warning: when you skip permission prompts, a container does not stop a malicious project from exfiltrating anything inside the container, including credentials. Do not mount ~/.ssh or cloud credential files into it. Prefer short lived, repository scoped tokens.</p><h3>Virtual machines and cloud sandboxes</h3><p>A virtual machine has its own kernel, so it is a much stronger boundary than a container. Use one when you work on code you do not trust, or when policy requires strong separation.</p><p>Hosted agents follow this model. GitHub’s <a href="https://docs.github.com/en/copilot/concepts/security-governance-and-network-settings/risks-and-mitigations">Copilot cloud agent risks and mitigations</a> page lists several controls: the agent runs with restricted internet access, can push only to its own branch, and its pull requests must be reviewed and merged by a human. The person who asked for the pull request cannot approve it.</p><h3>Permission rules: allow lists beat prompts</h3><p>Inside the sandbox, you still decide which actions need a human. Here is a simple way to think about it.</p><ul><li><strong>Allow without asking:</strong> reading files, running tests, running the linter, building the project.</li><li><strong>Ask first:</strong> installing new dependencies, editing CI configuration, running database migrations, anything touching infrastructure code.</li><li><strong>Deny outright:</strong> force pushing, deleting branches, reading secret files, running commands against production.</li></ul><p>An explicit allow list for the boring, safe commands removes most of the noise. The prompts that remain are rare enough that you actually read them.</p><p>The common mistake: someone gets tired of prompts and adds a broad rule like “allow any shell command.” Now the allow list is the whole computer. Keep rules narrow. Allowing a specific test command is fine. Allowing a shell interpreter with any arguments is not.</p><p>Many agents also have a “skip all permissions” mode for unattended runs. Treat it like running as root. Claude Code’s docs say to always run that mode inside a container, a VM or its sandbox runtime, and the CLI refuses to start in that mode as the root user on Linux and macOS. That is a good default to copy into your own policy.</p><h3>Secrets hygiene</h3><p>An agent can only leak what it can read. So reduce what it can read.</p><ol><li>Keep long lived credentials out of the project folder. Use a secret manager or environment variables injected at runtime.</li><li>Do not give the agent your personal cloud admin credentials. Create a separate role with the minimum permissions for the task.</li><li>Use short lived tokens wherever possible, scoped to one repository.</li><li>Add deny rules for files like .env and credential folders, even inside the sandbox.</li><li>Turn on secret scanning in your repository, so a key that slips into a commit is caught quickly.</li></ol><p>In my view, step 2 matters most. A sandbox that still has full access to your cloud account is a nicely decorated open door.</p><h3>Guardrails at the repository level</h3><p>Even with a perfect local sandbox, the agent’s work ends up in your repository. That is your last line of defense, and you already have most of the tools.</p><ul><li><strong>Branch protection.</strong> Require pull requests and reviews for main. No direct pushes, including from agent tokens.</li><li><strong>Required checks.</strong> Tests, linters and security scans must pass before merge.</li><li><strong>Separate identities.</strong> Give agents their own bot accounts or tokens, so audit logs show who did what.</li><li><strong>CI approval for agent changes.</strong> Changes to workflow files should need a human, because a modified CI pipeline can run with powerful secrets.</li></ul><h3>Agents in CI</h3><p>Running agents inside CI pipelines is becoming common, for example to triage issues or fix failing tests. The same rules apply, with a twist: CI runners often hold deployment secrets.</p><p>Run agent jobs in separate workflows with only the permissions they need. Give the job token read access by default and add write access only where needed. Never let an agent job and a deploy job share the same secrets. And be careful with triggers: an agent that reads issue text or pull request descriptions from outside contributors is reading untrusted input.</p><h3>The trade offs</h3><p>Sandboxes cost something. Network allow lists break builds when a new dependency needs a host you did not list. Containers add setup time and can be slow on some laptops. Strict permission rules annoy people, and annoyed people find workarounds.</p><p>The answer is not to give up but to tune. Start strict, watch which prompts and blocked requests show up most often, and widen the rules on purpose. Each widening should be a decision someone made, not a habit.</p><p>There is also a limit to what isolation can do. Anthropic’s documentation says so plainly: a sandbox reduces the impact of a breach but does not remove the risk. Anything writable can still be modified, and any allowed network path can still carry data out.</p><h3>A sensible default setup</h3><p>For a team adopting coding agents, this is a reasonable starting point.</p><ol><li>Turn on the agent’s built in sandbox for all local work.</li><li>Write a shared allow list for safe commands and a deny list for dangerous ones, and commit it to the repository.</li><li>Use a dev container with a default deny firewall for longer or unattended sessions.</li><li>Use a VM or hosted sandbox for untrusted code.</li><li>Remove long lived secrets from developer machines where possible.</li><li>Protect main with required reviews and checks, and give agents their own identities.</li></ol><h3>Further Reading</h3><ul><li><a href="https://www.anthropic.com/engineering/claude-code-sandboxing">Anthropic on Claude Code sandboxing</a></li><li><a href="https://code.claude.com/docs/en/sandbox-environments">Claude Code guide to sandbox environments</a></li><li><a href="https://learn.chatgpt.com/docs/agent-approvals-security">Codex approvals and security documentation</a></li><li><a href="https://www.thoughtworks.com/radar">Thoughtworks Technology Radar</a></li></ul><h3>Conclusion</h3><p>The Thoughtworks Technology Radar Vol. 34 named “putting coding agents on a leash” as one of its themes, and the phrase fits. A leash does not stop the dog from walking. It stops it from running into traffic.</p><p>Coding agents are worth using. But their safety should come from walls you built, not from prompts you are too tired to read. Isolate the filesystem and the network, keep the allow list short, keep secrets out of reach, and let your repository’s normal review process catch the rest. Then you can approve less and sleep better.</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=195aeb8533dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your MCP Server Is an API. Secure It Like One.]]></title>
            <link>https://sangwin.medium.com/your-mcp-server-is-an-api-secure-it-like-one-592c68570f68?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/592c68570f68</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[servers]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 14:22:44 GMT</pubDate>
            <atom:updated>2026-10-12T14:22:44.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Your MCP Server Is an API. Secure It Like One." src="https://cdn-images-1.medium.com/max/1024/1*gvMwQTbMZ6DZuBDZ1b9vww.png" /><figcaption>Your MCP Server Is an API. Secure It Like One.</figcaption></figure><p>In May 2025, researchers at Invariant Labs published a short and uncomfortable demo. They opened an issue in a public GitHub repository. The issue text contained instructions aimed not at humans, but at AI agents.</p><p>Then a user asked their agent, connected to the official GitHub MCP server, to look at the open issues in that public repository. The agent read the planted issue, followed its instructions, pulled data from the user’s private repositories, and published it in a pull request on the public one. Invariant’s <a href="https://invariantlabs.ai/blog/mcp-github-vulnerability">write up of the GitHub MCP attack</a> lists what leaked in their test: private repository names, relocation plans and salary information.</p><p>No password was stolen. No server was hacked in the classic sense. The agent did exactly what its tools allowed, with the user’s own permissions.</p><p>That is the core lesson of this article. An MCP server is not a plugin or a convenience wrapper. It is an API that a nondeterministic client can call on behalf of your users, and it deserves the same security thinking as any public API, plus a bit more.</p><h3>MCP in one minute</h3><p>The <a href="https://modelcontextprotocol.io/specification/2025-11-25">Model Context Protocol</a> is an open standard for connecting AI applications to tools and data. An MCP server exposes tools (actions like “create issue” or “run query”), resources (data to read) and prompts. An MCP client, usually inside an AI app or coding agent, discovers those tools and lets the model call them.</p><p>The spec says tools are designed to be controlled by the model. The model decides which tool to call and with which arguments, based on the conversation and on the tool descriptions the server provides.</p><p>Read that again with a security hat on. The caller of your API is a language model whose decisions can be shaped by any text it has read. That includes text written by attackers.</p><h3>Why the old API checklist still applies</h3><p>Strip away the AI parts and an MCP server looks familiar. It receives structured requests, touches databases or third party APIs, and returns results. Everything you already know still applies:</p><ul><li><strong>Authentication.</strong> Who is calling? For remote servers over HTTP, the spec defines an authorization flow based on OAuth. Use it.</li><li><strong>Authorization.</strong> What is this caller allowed to do, on which resources?</li><li><strong>Input validation.</strong> Are the arguments well formed and within limits?</li><li><strong>Rate limiting.</strong> What stops a runaway loop from calling a tool ten thousand times?</li><li><strong>Audit logs.</strong> Can you reconstruct who did what, and when?</li></ul><p>The MCP tools specification lists these directly. In its security section, it says servers MUST “validate all tool inputs,” “implement proper access controls,” “rate limit tool invocations” and “sanitize tool outputs.”</p><p>None of this is new. What is new is that the usual assumption behind API design, that the client follows a predictable code path, no longer holds.</p><h3>What makes MCP different</h3><h3>The model can be talked into things</h3><p>Prompt injection means hiding instructions inside content the model will read, so that the model treats them as commands. It sits at the top of the <a href="https://genai.owasp.org/llm-top-10/">OWASP Top 10 for LLM applications</a> as LLM01.</p><p>Direct prompt injection comes from the user. The more dangerous kind with MCP is indirect: the attack arrives inside a tool result. A web page, an email, a support ticket, a code comment or a GitHub issue can all carry instructions. When your tool returns that content to the model, the attacker’s text sits in the context next to the user’s request.</p><p>Today’s models cannot reliably tell the difference between “data I was asked to read” and “instructions I should follow.” Everything is just tokens.</p><h3>Tool descriptions are an attack surface</h3><p>In April 2025, Invariant Labs described <a href="https://invariantlabs.ai/blog/mcp-security-notification">tool poisoning attacks</a>. A malicious MCP server hides instructions inside a tool’s description. Users rarely read full descriptions, but the model reads them on every call.</p><p>Their demo used an innocent looking “add two numbers” tool. Its description quietly told the model to read sensitive files, such as SSH keys and the MCP configuration, and pass them along as a tool argument. The same post describes a “rug pull”: a server that looks clean when you approve it and changes its tool descriptions later.</p><p>The spec reflects this risk in a related rule: clients MUST treat tool annotations, the hints a server gives about how a tool behaves, as untrusted unless they come from trusted servers. The same caution belongs on descriptions.</p><h3>Tools combine in ways nobody designed</h3><p>A single tool can be safe on its own. The risk comes from combinations. Simon Willison named this pattern the <a href="https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/">lethal trifecta</a>. An agent is in serious danger when it has all three of these:</p><ol><li><strong>Access to private data.</strong> It can read your email, code, documents or database.</li><li><strong>Exposure to untrusted content.</strong> It reads text an attacker could control.</li><li><strong>A way to communicate externally.</strong> It can send data out, through an HTTP request, an email, a public comment, or even an image URL.</li></ol><p>The GitHub demo had all three in one server: private repositories, public issues, and the ability to open pull requests.</p><p>Willison’s point about MCP is direct: it “encourages users to mix and match tools from different sources.” One server reads your inbox, another fetches web pages, a third posts to chat. Each was built by a different team with no idea what the others do.</p><p>The <a href="https://www.thoughtworks.com/radar">Thoughtworks Technology Radar</a> Vol. 34 (April 2026) made “securing permission hungry agents” one of its themes, noting that the agents worth building tend to need access to everything. That is the tension in one sentence.</p><h3>Authorization mistakes specific to MCP</h3><p>The MCP project publishes <a href="https://modelcontextprotocol.io/docs/2025-11-25/tutorials/security/security_best_practices">security best practices</a> that go well beyond prompt injection. A few points deserve attention from every backend developer.</p><p><strong>Token passthrough is forbidden.</strong> Some servers accept a token from the client and forward it to a downstream API. The guidance is direct: MCP servers “MUST NOT accept any tokens that were not explicitly issued for the MCP server.” Passthrough breaks audit trails and lets clients bypass controls that depend on the token’s audience.</p><p><strong>Scopes should start small.</strong> The guide warns against publishing every scope up front and against wildcard scopes like admin:*. It recommends a minimal starting set, with more scope requested only when a privileged tool is first used. A stolen narrow token is an incident. A stolen admin token is a very long week.</p><p><strong>Sessions are not authentication.</strong> Servers that implement authorization MUST verify every inbound request, and MUST NOT use sessions for authentication. Session IDs must be random, and the guide suggests binding them to the user ID so a guessed session cannot impersonate someone else.</p><p><strong>Proxies need per client consent.</strong> If your MCP server is a proxy in front of a third party API, the guide describes a “confused deputy” attack that steals authorization codes when consent is skipped. The fix is to show your own consent screen per client and validate redirect URIs exactly.</p><h3>Controls that reduce risk</h3><p>There is no single fix for prompt injection. Willison points out that guardrail products often claim to catch 95% of attacks, and in web application security 95% is “very much a failing grade.” So the goal is to limit what a fooled agent can do. Here is a practical order of work for teams exposing tools through MCP.</p><ol><li><strong>Inventory every tool and label it.</strong> For each tool, write down whether it reads private data, reads untrusted content, or can send data out. Any server or session that ticks all three boxes needs a design change, not a better prompt.</li><li><strong>Split read and write tools.</strong> A tool that lists tickets should not also close them. Separate tools let clients require approval only for the risky ones.</li><li><strong>Scope access to the task.</strong> Give the agent access to one repository, one project or one mailbox folder, not the whole account. Invariant’s own recommendation after the GitHub demo was to restrict agents to the repositories they actually need.</li><li><strong>Validate inputs like a hostile caller sent them.</strong> Use strict schemas, allow lists for things like table names and URLs, and size limits. Assume arguments may be crafted by an attacker through the model.</li><li><strong>Treat tool output as untrusted data.</strong> Return structured fields where you can, strip content the model does not need, and never let tool output silently change which tools are available.</li><li><strong>Control outbound channels.</strong> Block arbitrary URL fetching, restrict which domains links and images can point to, and log every outbound message. Removing the exfiltration path breaks the trifecta.</li><li><strong>Keep a human in the loop for sensitive actions.</strong> The spec says there SHOULD always be a human able to deny tool invocations, and that clients should show tool inputs before calling the server. Make confirmations specific: “Send this email to this address” beats “Allow tool call?”</li><li><strong>Pin and review third party servers.</strong> Install MCP servers from sources you trust, pin versions, and review description changes the way you review dependency updates.</li><li><strong>Log everything with identity attached.</strong> Record the user, client, tool, arguments and result size for every call. When something goes wrong, you will need this trail, and your security team will ask for it.</li></ol><h3>The honest trade offs</h3><p>Every control above costs something. Narrow scopes mean more consent prompts. Human approval slows the agent down and, if overused, trains people to click “yes” without reading. Splitting tools increases the tool count, which has its own cost in model accuracy.</p><p>There is also a product tension. The most useful agent is the one that can read your inbox, browse the web and send messages. That is exactly the trifecta. Sometimes the right answer is to decline a feature, or to run it in two separate sessions that never share data.</p><p>Local MCP servers add another layer. They run as programs on a developer machine with the user’s privileges, so sandboxing the client and the servers matters too. That is a big enough topic for its own article.</p><h3>My opinion</h3><p>Treat MCP servers as part of your public attack surface from day one. Put them through the same threat modeling, security review and penetration testing you would use for a new public API.</p><p>Then add one AI specific rule: assume the model will eventually be fooled, and design so that a fooled model cannot do much harm. Prompt guardrails and model alignment help, but Invariant’s own conclusion after the GitHub demo was that model alignment cannot anticipate every deployment, so system level controls have to back it up. I agree.</p><h3>Further Reading</h3><ul><li><a href="https://modelcontextprotocol.io/docs/2025-11-25/tutorials/security/security_best_practices">MCP security best practices</a></li><li><a href="https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/">Simon Willison on the lethal trifecta for AI agents</a></li><li><a href="https://genai.owasp.org/llm-top-10/">OWASP Top 10 for LLM applications</a></li><li><a href="https://invariantlabs.ai/blog/mcp-security-notification">Invariant Labs on tool poisoning attacks</a></li></ul><h3>Conclusion</h3><p>An MCP server gives a language model real power over real systems. The caller is not a predictable script, and any text it reads can steer it. That makes classic API security necessary but not sufficient.</p><p>Start with the basics: real authentication, narrow scopes, strict input validation, rate limits and audit logs. Then look for the lethal trifecta in every agent that uses your tools, and break it wherever you can. You cannot make the model impossible to fool, but you can make a fooled model boring.</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=592c68570f68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Is Forward Deployed Engineer?]]></title>
            <link>https://sangwin.medium.com/what-is-forward-deployed-engineer-31bc1cfd2777?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/31bc1cfd2777</guid>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[trending-jobs]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[forward-deployed-engineer]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Wed, 07 Oct 2026 06:54:22 GMT</pubDate>
            <atom:updated>2026-10-07T06:54:22.536Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="What Is a Forward Deployed Engineer? A Simple Guide for Developers" src="https://cdn-images-1.medium.com/max/1024/1*bccEfNbl7HtF0PGdnmVFfw.png" /><figcaption>What Is a Forward Deployed Engineer?</figcaption></figure><p>A few years ago, a junior developer on my team asked me a funny question.</p><p>“Is a forward deployed engineer a soldier who writes code?”</p><p>I laughed. Then I tried to answer him in one sentence. I could not.</p><p>Today this job title is everywhere. AI companies are hiring them. Startups are hiring them. Your LinkedIn feed is probably full of them. But most developers I talk to are still not sure what the job really is.</p><p>So let me explain it the way I wish someone had explained it to me. No hype. No sales pitch. Just what the work looks like, what is good about it, and what can hurt.</p><h3>So What Is a Forward Deployed Engineer?</h3><p>A forward deployed engineer is a software engineer who works directly with customers to make a product actually work for them.</p><p>That is the short version.</p><p>Here is the longer one. Most engineers build a product for many customers at once. A forward deployed engineer takes that product and makes it useful for one customer at a time. They work close to the customer. Sometimes they literally sit in the customer’s office. They learn the customer’s messy systems. They write code to connect everything. They fix what breaks.</p><p>Think of it like this:</p><ul><li>A product engineer builds the car.</li><li>A forward deployed engineer drives it to your house, notices your garage door is too small, and finds a way to make it fit.</li></ul><p>The word “forward” comes from the military idea of being close to the front line. In this job, the front line is the customer.</p><h3>Where Did This Role Come From?</h3><p>The title became well known at Palantir. Their software was powerful but hard to set up. Every customer had different data, different rules, and different problems. So they sent engineers to work right next to the customer and make it work.</p><p>For a long time, it stayed a niche idea.</p><p>Then AI showed up.</p><p>Lots of companies now sell AI models and AI tools. The demo always looks great. But making AI work inside a real company is hard. The data is messy. The workflows are strange. The security team has opinions. Lots of opinions.</p><p>Someone has to sit in the middle and make it all work. Very often, that someone is a forward deployed engineer. That is why the title is suddenly everywhere.</p><h3>What Does the Work Actually Look Like?</h3><p>No two weeks are the same. That is part of the fun. It is also part of the pain.</p><p>Here is a realistic week, based on people I know in this role:</p><ul><li><strong>Monday:</strong> A call with the customer to understand why their reports look wrong.</li><li><strong>Tuesday:</strong> Digging through a 15 year old database that nobody fully understands. Not even the customer.</li><li><strong>Wednesday:</strong> Writing a small service that cleans the data and pushes it into the product.</li><li><strong>Thursday:</strong> A demo for the customer’s team. Two people love it. One person asks for a feature that does not exist.</li><li><strong>Friday:</strong> Writing notes for the product team so the next customer does not hit the same wall.</li></ul><p>You will write real code. Integrations, scripts, data pipelines, small internal tools. But you will also spend a lot of time talking, listening, and explaining.</p><p>Some days you are an engineer. Some days you are a translator. Some days you are a therapist for a very tired IT manager.</p><h3>How Is It Different From Other Roles?</h3><p>People often mix this role up with a few others. Here is how I see the difference.</p><ul><li><strong>Product engineer:</strong> Builds features for all customers. Rarely talks to customers directly. Follows a planned roadmap.</li><li><strong>Solutions or sales engineer:</strong> Helps close the deal. Builds demos. Mostly works before the contract is signed.</li><li><strong>Consultant:</strong> Solves the customer’s problem with whatever tools fit. Usually not tied to one product.</li><li><strong>Support engineer:</strong> Fixes problems after they happen. Mostly works from tickets.</li><li><strong>Forward deployed engineer:</strong> Works after the deal is signed. Goes deep inside one customer. Writes real code on top of their own company’s product.</li></ul><p>There is one more thing that sets this role apart. A good forward deployed engineer brings lessons back to the product team.</p><p>That part matters a lot. You are not just a hired gun for one customer. You are the eyes and ears of your company in the real world.</p><h3>What Skills Do You Need?</h3><p>You need to be a solid engineer first. Customers can smell weak technical skills very quickly.</p><p>On the technical side:</p><ul><li>Comfort with many languages and tools, not just one stack</li><li>Strong debugging skills, especially in systems you did not build</li><li>Data skills like SQL, APIs, file formats, and cleaning messy data</li><li>Basic cloud and security knowledge, because every customer will ask</li><li>Speed. You often need a working version in days, not months</li></ul><p>On the human side:</p><ul><li>Listening. Customers often ask for the wrong thing. Your job is to find the real problem.</li><li>Explaining technical ideas to people who do not care about technical ideas.</li><li>Saying no politely. Or saying “not yet” without starting a fight.</li><li>Staying calm when the demo breaks in front of a VP. It will happen. Probably on a Friday.</li></ul><p>If I had to pick the one skill that matters most, it is this. Be comfortable with not knowing things. You will walk into unfamiliar systems all the time. You need to enjoy figuring them out.</p><h3>The Good Parts</h3><p>There is a lot to like about this job.</p><ul><li><strong>You see your impact fast.</strong> You build something on Tuesday. A real person uses it on Thursday.</li><li><strong>You learn very quickly.</strong> Every customer teaches you a new industry, a new system, and a new set of problems.</li><li><strong>You become hard to replace.</strong> Engineers who can write code and also talk to customers are rare. That is a strong place to be in your career.</li><li><strong>You understand the business.</strong> You stop thinking only about code. You start thinking about why the code matters.</li><li><strong>It is rarely boring.</strong> If maintaining the same service for three years makes you sleepy, this role will wake you up.</li></ul><p>Many of the best engineering leaders I know spent time in roles like this. You can tell. They ask better questions.</p><h3>The Hard Parts and Trade Offs</h3><p>Now the honest part. This role is not for everyone. And some companies use the title badly.</p><p><strong>Context switching never stops.</strong> You might juggle three customers in one week. Long blocks of deep focus are rare.</p><p><strong>Your code may not live long.</strong> Much of what you build is custom. It solves one customer’s problem. Sometimes it gets thrown away later. If you love building clean systems that last for years, this can hurt.</p><p><strong>Travel and time zones.</strong> Some of these jobs involve a lot of travel or strange meeting hours. Ask about this before you join. Then ask again.</p><p><strong>You can become the customer’s developer by accident.</strong> The customer starts treating you like their own team member. Every small request lands on your desk. Setting boundaries is a real skill here.</p><p><strong>The career path can be unclear.</strong> In some companies, the promotion ladder for this role is not well defined. Product engineers often have a clearer path.</p><p><strong>Sometimes the title is just a nicer name for support or sales.</strong> If the job has almost no coding, it is not really this role. Read the job description carefully.</p><p>The core trade off is simple. You trade depth for breadth. You trade perfect code for real impact. Some people love that deal. Some people hate it. Both are fine.</p><h3>Who Should Take This Role?</h3><p>This role is a good fit if you:</p><ul><li>Like solving messy, real problems more than clean, abstract ones</li><li>Enjoy talking to people, or at least do not mind it</li><li>Get bored easily and like variety</li><li>Want to understand how businesses actually work</li><li>Are early or mid career and want to learn fast</li></ul><p>It might not be a good fit if you:</p><ul><li>Need long, quiet stretches of deep focus to feel happy</li><li>Care a lot about elegant architecture and long term code quality</li><li>Dislike travel or unpredictable schedules</li><li>Want a very clear and stable promotion path</li></ul><p>Neither list is better than the other. They just describe different kinds of engineers. The industry needs both.</p><h3>My Honest Opinion</h3><p>After more than 20 years in this industry, here is what I believe.</p><p>The forward deployed engineer is not a new idea. Good engineers have always done this work. We just called it “going on site” or “the integration project” or “that one client who needs extra love.”</p><p>What is new is that companies now admit this work is real engineering. And many of them pay for it properly. That is a good change.</p><p>But I want to warn you about one thing. A company that needs a huge number of forward deployed engineers might have a product problem. If every customer needs a custom engineer just to get started, the product may not be ready yet.</p><p>So ask this in the interview: “How often does the work I do with customers turn into real product features?”</p><ul><li>A good answer means the company learns from you.</li><li>A vague answer means you might be patching holes forever.</li></ul><p>Also, please do not take the job just because the title sounds cool. Take it because you want to be close to real users and real problems. That is the actual reward.</p><h3>Conclusion</h3><p>A forward deployed engineer is a software engineer who works closely with customers to make a product work in the real world.</p><p>They write real code. They also listen, explain, and fix problems nobody planned for. Then they bring those lessons back so the product gets better for everyone.</p><p>The job is fast, varied, and full of learning. It can also be messy, tiring, and unclear as a career path.</p><p>If you like real problems, real people, and a little bit of chaos, this can be one of the most rewarding jobs in software. If you prefer quiet focus and beautiful code, that is completely fine too.</p><p>Just know which one you are before you sign up.</p><p>—</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31bc1cfd2777" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Iterators and Generators Explained with Simple Examples]]></title>
            <link>https://sangwin.medium.com/python-iterators-and-generators-explained-with-simple-examples-b785aec57159?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/b785aec57159</guid>
            <category><![CDATA[generator]]></category>
            <category><![CDATA[iterators]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[repeat]]></category>
            <category><![CDATA[loop]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 09:56:37 GMT</pubDate>
            <atom:updated>2026-07-01T09:56:37.155Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have worked with Python for some time, you have probably used iterators and generators without even thinking about them.</p><p>Many developers know how to use them.</p><p>Fewer know why they matter.</p><p>That is where problems begin.</p><p>When your app starts working with large files, long lists, or endless streams of data, simple loops are not always enough.</p><p>Understanding iterators and generators can help you write code that uses less memory and stays easy to read.</p><p>In my view, every Python developer should know these two concepts well.</p><h3>What Is an Iterator?</h3><p>An iterator is an object that gives you one item at a time.</p><p>Instead of loading everything at once, it returns the next value whenever you ask for it.</p><p>Think about reading a book.</p><p>You read one page.</p><p>Then the next page.</p><p>You do not hold every page in your hands at the same time.</p><p>That is how an iterator works.</p><p>Many Python objects are iterable.</p><p>Some common examples are:</p><ul><li>Lists</li><li>Tuples</li><li>Strings</li><li>Dictionaries</li><li>Sets</li></ul><p>When you use a for loop, Python quietly creates an iterator for you.</p><p>Most of the time, you never notice it.</p><h3>Why Iterators Matter</h3><p>For small data, the difference is hard to see.</p><p>For large data, it becomes very important.</p><p>Imagine reading a log file with millions of lines.</p><p>Loading the whole file into memory is not a great idea.</p><p>Reading one line at a time is much better.</p><p>Benefits include:</p><ul><li>Lower memory usage</li><li>Better performance for large data</li><li>Cleaner handling of streams</li></ul><p>The trade off is simple.</p><p>Once an iterator moves forward, you usually cannot go back unless you create a new one.</p><h3>What Is a Generator?</h3><p>A generator is an easy way to create an iterator.</p><p>Instead of building a full collection first, it creates values only when needed.</p><p>This is called lazy evaluation.</p><p>The idea is simple.</p><p>Do the work only when someone asks for the next value.</p><p>I think this is one of the nicest features in Python.</p><p>It solves many real problems with very little code.</p><h3>Why Generators Are Useful</h3><p>Generators are great when working with:</p><ul><li>Large files</li><li>API responses</li><li>Database records</li><li>Data processing</li><li>Infinite sequences</li></ul><p>Since values are created one by one, memory usage stays low.</p><p>This makes generators a good choice for many backend applications.</p><h3>Iterator Versus Generator</h3><p>People often mix these two ideas.</p><p>They are related, but they are not the same.</p><p>An iterator:</p><ul><li>Is an object that returns one item at a time</li><li>Can be created from many Python collections</li><li>Follows the iterator protocol</li></ul><p>A generator:</p><ul><li>Is a simple way to build an iterator</li><li>Produces values only when needed</li><li>Usually needs much less code</li></ul><p>You can think of every generator as an iterator.</p><p>But not every iterator is a generator.</p><h3>Real World Example</h3><p>Suppose your application processes a CSV file with ten million rows.</p><p>One approach is to load everything into memory first.</p><p>That may work on your laptop.</p><p>It may fail in production.</p><p>A better approach is to process one row at a time.</p><p>Generators make this easy.</p><p>The result is lower memory usage and often better performance.</p><h3>When You Should Use Iterators</h3><p>Iterators are a good choice when:</p><ul><li>You already have a collection</li><li>You want to move through items one by one</li><li>You want to avoid manual indexing</li></ul><p>Most developers use iterators every day through for loops without thinking about them.</p><h3>When You Should Use Generators</h3><p>Generators are a better choice when:</p><ul><li>Data is very large</li><li>Data comes slowly over time</li><li>Memory matters</li><li>You only need each value once</li></ul><p>This is very common in backend systems and data pipelines.</p><h3>Trade Offs</h3><p>Generators are useful.</p><p>They are not always the best answer.</p><p>Here are some things to remember.</p><p>Pros:</p><ul><li>Lower memory usage</li><li>Cleaner code</li><li>Better for large datasets</li><li>Good for streaming data</li></ul><p>Cons:</p><ul><li>Values are usually consumed only once</li><li>Random access is not possible</li><li>Debugging can sometimes be harder</li><li>You cannot easily know the total size in advance</li></ul><p>Choosing between a list and a generator depends on the problem.</p><p>If you need to access items many times, a list may be the better option.</p><p>If you process data once, a generator is often the smarter choice.</p><h3>Common Mistakes</h3><p>Many developers make the same mistakes when learning generators.</p><p>Some examples are:</p><ul><li>Trying to reuse a generator after it is already consumed</li><li>Expecting random access like a list</li><li>Converting every generator into a list, which removes the memory benefit</li></ul><p>Knowing these limits helps you avoid surprises.</p><h3>My Opinion</h3><p>I prefer generators whenever I process large amounts of data.</p><p>They make code simpler and reduce memory usage.</p><p>That does not mean they should replace lists everywhere.</p><p>If the data is small and you need to access it many times, a list is often easier to understand.</p><p>Good software is about choosing the right tool for the job.</p><p>Not using the same tool for every problem.</p><h3>Conclusion</h3><p>Iterators and generators are simple ideas with a big impact.</p><p>They help Python work efficiently with large amounts of data.</p><p>Iterators let you move through data one item at a time.</p><p>Generators make it easy to create those iterators without wasting memory.</p><p>You do not need them for every project.</p><p>But when performance and memory start to matter, they become very valuable.</p><p>Learning them today can save you from painful debugging tomorrow.</p><p>—</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b785aec57159" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka for Beginners]]></title>
            <link>https://sangwin.medium.com/kafka-for-beginners-b12d462acfcb?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/b12d462acfcb</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[real-time-data]]></category>
            <category><![CDATA[consumer]]></category>
            <category><![CDATA[producer]]></category>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Mon, 18 May 2026 07:20:44 GMT</pubDate>
            <atom:updated>2026-05-18T07:20:44.473Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are learning backend systems, you will hear about Kafka very quickly.</p><p>At first, Kafka feels confusing.</p><blockquote>People talk about brokers, partitions, offsets, consumers, producers, and many other words that sound much bigger than they really are.</blockquote><p>I felt the same when I started reading about it.</p><p>The good news is this.</p><p>Kafka is not magic.</p><blockquote>It is just a smart way to move data from one place to another.</blockquote><p>Once you understand the basic idea, things become much easier.</p><h3>What Is Kafka?</h3><blockquote>Apache Kafka is a system that helps applications send and receive messages.</blockquote><p>Think about a food delivery app.</p><p>Many things happen at the same time.</p><ul><li>A user places an order.</li><li>A restaurant gets notified.</li><li>A delivery partner gets assigned.</li><li>The payment service checks the transaction.</li><li>Analytics systems collect data.</li></ul><p>Without Kafka, every service may directly talk to every other service.</p><p>That becomes messy very fast.</p><p>Kafka sits in the middle and handles the message flow.</p><p>It works like a traffic manager for data.</p><h3>Why Developers Use Kafka</h3><p>Simple apps may work fine without Kafka.</p><p>But bigger systems hit problems quickly.</p><p>Here are some common issues:</p><ul><li>Services become tightly connected</li><li>One slow service affects everything</li><li>Data gets lost during traffic spikes</li><li>Scaling becomes painful</li><li>Debugging becomes harder than it should be</li></ul><p>Kafka helps solve these problems.</p><p>Not perfectly.</p><p>But well enough for many real world systems.</p><h3>The Basic Kafka Idea</h3><p>Kafka has a few simple parts.</p><h3>1. Producer</h3><p><strong>A producer sends messages into Kafka.</strong></p><p>Example:</p><p>An order service sends a new order event.</p><h3>2. Consumer</h3><p><strong>A consumer reads messages from Kafka.</strong></p><p>Example:</p><p>A notification service reads the order event and sends an email.</p><h3>3. Topic</h3><p><strong>A topic is like a channel. Messages go into topics.</strong></p><p>Example topics:</p><ul><li>orders</li><li>payments</li><li>shipments</li></ul><h3>4. Broker</h3><p>A broker is a Kafka server.</p><p>Kafka usually runs with multiple brokers.</p><p>This helps with scaling and reliability.</p><h3>5. Partition</h3><p>Partitions split data into smaller pieces.</p><p>This helps Kafka handle large traffic.</p><p>At first, partitions may sound scary.</p><p>They are really just a way to spread work across machines.</p><h3>A Real World Example</h3><p>Imagine an ecommerce app.</p><p>Without Kafka:</p><ul><li>Order service calls payment service</li><li>Payment service calls inventory service</li><li>Inventory service calls shipping service</li></ul><p>Now imagine one service becomes slow.</p><p>Everything slows down.</p><p>With Kafka:</p><ul><li>Order service sends an event</li><li>Other services read it when ready</li></ul><p>This creates separation between systems.</p><p>That is one of Kafka’s biggest strengths.</p><h3>What Makes Kafka Popular</h3><p>Kafka became popular because it handles large amounts of data very well.</p><p>Companies use it for:</p><ul><li>Activity tracking</li><li>Log collection</li><li>Payments</li><li>Notifications</li><li>Analytics</li><li>Real time dashboards</li></ul><p>But here is something important.</p><p>Not every app needs Kafka.</p><p>Sometimes a simple REST API and a database are enough.</p><p>And honestly, that is often the better choice.</p><h3>The Good Parts</h3><p>Here are the things I like about Kafka.</p><p><strong>Reliable Message Handling</strong></p><ul><li>Kafka stores messages safely.</li><li>Consumers can read them later.</li><li>This is useful when systems go down.</li><li>And systems always go down eventually.</li></ul><p><strong>Easy Scaling</strong></p><ul><li>Kafka handles growing traffic well.</li><li>You can add more consumers when load increases.</li></ul><p><strong>Loose Coupling</strong></p><ul><li>Services do not need to know too much about each other.</li><li>That makes systems easier to change later.</li></ul><h3>The Hard Parts</h3><ul><li>Kafka is powerful.</li><li>But it also adds complexity.</li><li>This is where many beginner tutorials stay too positive.</li></ul><p><strong>Setup Is Not Always Simple</strong></p><ul><li>Running Kafka locally is easy enough today.</li><li>Running it properly in production is different.</li><li>Monitoring, storage, replication, and failures need attention.</li></ul><p><strong>Debugging Can Be Painful</strong></p><ul><li>Messages move asynchronously.</li><li>That means bugs are sometimes harder to trace.</li><li>You may spend hours asking: “Where did this message disappear?”</li></ul><h3>Too Much Kafka Is a Real Problem</h3><p>Some teams use Kafka for everything.</p><p>That becomes a mess.</p><p>If your app is small, adding Kafka too early may slow development.</p><blockquote>Simple systems are easier to maintain.</blockquote><p>Never forget that.</p><h3>Things Beginners Should Learn First</h3><p>Do not try to learn every Kafka feature immediately.</p><p>Start with these basics:</p><ul><li>Producers</li><li>Consumers</li><li>Topics</li><li>Partitions</li><li>Consumer groups</li></ul><p>Once these concepts feel natural, move forward.</p><h3>Best Way to Learn Kafka</h3><p>My suggestion is simple.</p><p>Build something small.</p><p>Maybe:</p><ul><li>Order processing system</li><li>Chat app</li><li>Notification service</li><li>Log processing tool</li><li>Read messages.</li><li>Send messages.</li><li>Break things.</li><li>Fix things.</li></ul><p>That is where learning actually happens.</p><p>Not from reading fifty slides about distributed systems.</p><h3>Common Beginner Mistakes</h3><p><strong>Learning Theory Only -</strong></p><p>Kafka is practical technology.</p><p>You need hands on practice.</p><p><strong>Ignoring Message Design -</strong></p><p>Bad message structure creates long term pain.</p><p>Keep messages simple and clear.</p><p><strong>Over Engineering Early -</strong></p><p>Do not build a giant event driven architecture for a tiny side project.</p><p>That is like buying a truck to carry one backpack.</p><h3>Conclusion</h3><p>Kafka can look intimidating at first.</p><p>That is normal.</p><p>The names sound bigger than the ideas.</p><p>Start small.</p><p>Focus on the basics.</p><p>Build tiny projects.</p><p>Break things on purpose.</p><p>And remember this.</p><p>Good engineering is not about using the most powerful tool.</p><p>It is about using the right tool for the problem.</p><p>Sometimes that tool is Kafka.</p><p>Sometimes it is not.</p><p>—</p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b12d462acfcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Use AI to Write Code Correctly]]></title>
            <link>https://sangwin.medium.com/how-to-use-ai-to-write-code-correctly-558c04dd8a5b?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/558c04dd8a5b</guid>
            <category><![CDATA[ai-assistant]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[how-to]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Tue, 12 May 2026 06:15:50 GMT</pubDate>
            <atom:updated>2026-05-12T06:15:50.727Z</atom:updated>
            <content:encoded><![CDATA[<p>A few years ago, developers searched Stack Overflow for every small problem.</p><p>Today, many developers open ChatGPT before opening Google.</p><p>That change happened very fast.</p><p>AI can now write functions, explain errors, create APIs, fix bugs, and even help you learn new programming languages. It feels magical sometimes.</p><p>But there is one small problem.</p><p>AI is confident even when it is wrong.</p><p>That means if you use AI carelessly, you may end up with broken code, security issues, or code that looks smart but works like a potato.</p><p>The good news is this.</p><p>AI becomes incredibly useful when you know how to guide it properly.</p><p>In this article, you will learn how to use AI to write code correctly without becoming completely dependent on it.</p><h3>AI Is Your Assistant, Not Your Brain</h3><p>The biggest mistake developers make is treating AI like a senior engineer who never makes mistakes.</p><p>It is not.</p><p>AI predicts patterns from existing data. Sometimes those patterns are excellent. Sometimes they are nonsense wearing a suit.</p><p>Think of AI as a very fast junior developer.</p><p>It can help you:</p><ul><li>Write boilerplate code</li><li>Explain concepts</li><li>Refactor messy functions</li><li>Generate tests</li><li>Debug simple problems</li><li>Speed up learning</li></ul><p>But you still need to review everything.</p><p>Would you merge code from a random stranger without checking it first?</p><p>Probably not.</p><p>Treat AI generated code the same way.</p><h3>Bad Way to Use AI</h3><p>Here is a common example.</p><p>A developer types:</p><blockquote><em>Build me a complete ecommerce app with payment integration and admin dashboard</em></blockquote><p>AI generates 500 lines of code.</p><p>The developer copies everything.</p><p>Nothing works.</p><p>Now everybody is stressed.</p><p>The developer blames AI.</p><p>The manager blames the developer.</p><p>The coffee machine stops working too.</p><p>Chaos.</p><p>The problem was not AI.</p><p>The problem was the prompt.</p><h3>Good Way to Use AI</h3><p>Instead of asking for everything at once, break problems into smaller tasks.</p><p>For example:</p><blockquote><em>Create a simple Node.js Express route for user login using JWT authentication</em></blockquote><p>This works much better because the request is clear and focused.</p><p>AI performs best when the task is specific.</p><h3>Always Give Context</h3><p>AI cannot read your mind.</p><p>At least not yet.</p><p>If you want better code, provide context like:</p><ul><li>Programming language</li><li>Framework</li><li>Expected output</li><li>Database type</li><li>Existing code</li><li>Error messages</li></ul><p>For example, this is weak:</p><blockquote><em>Fix my code</em></blockquote><p>This is much better:</p><blockquote><em>I am using React and TypeScript. This component rerenders infinitely when useEffect runs. Here is the code.</em></blockquote><p>Better context creates better answers.</p><p>Simple.</p><h3>Ask AI to Explain the Code</h3><p>One of the smartest ways to use AI is asking it to explain what it generated.</p><p>For example:</p><blockquote><em>Explain this function line by line in simple English</em></blockquote><p>This helps you:</p><ul><li>Learn faster</li><li>Catch mistakes</li><li>Understand logic</li><li>Avoid blindly copying code</li></ul><p>If you cannot explain your own code during an interview, things may become awkward very quickly.</p><h3>Use AI for Debugging</h3><p>AI is surprisingly good at debugging simple issues.</p><p>Example:</p><blockquote><em>Here is my error message and code. Explain the root cause and give possible fixes.</em></blockquote><p>This often saves hours of frustration.</p><p>Especially when the bug turns out to be a missing comma that somehow destroyed your confidence and your weekend.</p><h3>Never Trust the First Answer Completely</h3><p>This part is important.</p><p>AI generated code can contain:</p><ul><li>Security problems</li><li>Old syntax</li><li>Fake functions</li><li>Incorrect logic</li><li>Performance issues</li></ul><p>Yes, AI sometimes invents functions that do not even exist.</p><p>Confidently.</p><p>Like a developer who says:</p><blockquote><em>It works on my machine</em></blockquote><p>Always verify the code.</p><p>Run tests.</p><p>Read documentation.</p><p>Check edge cases.</p><h3>Use AI to Learn Faster</h3><p>AI is not only for writing code.</p><p>It is also an amazing teacher.</p><p>You can ask things like:</p><blockquote><em>Explain recursion like I am 12 years old</em></blockquote><p>Or:</p><blockquote><em>Compare SQL and NoSQL with real examples</em></blockquote><p>Or:</p><blockquote><em>Teach me Docker step by step</em></blockquote><p>The best part is that AI never gets tired of your questions.</p><p>You can ask the same thing five times in five different ways.</p><p>No judgment.</p><p>Human teachers are wonderful, but after the fifth repeated question, some of them start looking at the ceiling and questioning their career choices.</p><h3>Ask AI to Review Your Code</h3><p>You can paste your code and ask:</p><blockquote><em>Review this code for readability, security, and performance improvements</em></blockquote><p>This is extremely useful.</p><p>AI can spot:</p><ul><li>Bad variable names</li><li>Repeated logic</li><li>Unnecessary complexity</li><li>Possible bugs</li><li>Missing validations</li></ul><p>It is like having an extra reviewer available at midnight when your teammates are offline and your deadline is breathing heavily behind your neck.</p><h3>Learn Prompt Writing</h3><p>Good prompts produce good results.</p><p>Bad prompts produce confusion.</p><p>Here is a simple formula:</p><blockquote><em>Role + Task + Context + Expected Output</em></blockquote><p>Example:</p><blockquote><em>Act as a senior Python developer. Optimize this API function for speed and readability. Explain every improvement clearly.</em></blockquote><p>That prompt gives much better results than:</p><blockquote><em>Make this better</em></blockquote><p>AI needs direction.</p><p>The clearer you are, the better the output becomes.</p><h3>Do Not Become Lazy</h3><p>This is the hidden danger.</p><p>If AI writes everything for you, your own skills may become weaker over time.</p><p>You still need to:</p><ul><li>Practice coding</li><li>Solve problems yourself</li><li>Read documentation</li><li>Understand fundamentals</li></ul><p>AI should increase your abilities, not replace them.</p><p>A calculator helps with math.</p><p>But if someone forgets how to multiply because of the calculator, that becomes a different problem.</p><h3>Best Tasks to Use AI For</h3><p>AI works very well for:</p><ul><li>Writing repetitive code</li><li>Creating test cases</li><li>Explaining errors</li><li>Refactoring</li><li>Documentation</li><li>Learning new technologies</li><li>Generating sample data</li><li>Writing SQL queries</li><li>Converting code between languages</li></ul><p>It works less well for:</p><ul><li>Complex architecture decisions</li><li>Large scale production systems</li><li>Security critical code</li><li>Business logic with many edge cases</li></ul><p>Human thinking still matters.</p><p>Thankfully.</p><h3>Conclusion :</h3><p>AI is changing software development very fast.</p><p>Developers who learn how to use AI correctly will work faster, learn quicker, and become more productive.</p><p>But the goal is not to let AI think for you.</p><p>The goal is to work with it intelligently.</p><p>The best developers of the future will not be the ones who avoid AI.</p><p>They will be the ones who know when to trust it, when to question it, and when to say:</p><blockquote><em>Nice try, but that code is absolutely not going into production.</em></blockquote><p>And honestly, that is probably the healthiest relationship you can have with AI right now.</p><p>—</p><p><strong>Hope This Helps!!</strong></p><p>Cheers!!</p><p>Sangwin Gawande</p><p>About me : <a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=558c04dd8a5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Are You Using AI for as a Developer]]></title>
            <link>https://sangwin.medium.com/what-are-you-using-ai-for-as-a-developer-5931a9917b27?source=rss-f494ffedbf67------2</link>
            <guid isPermaLink="false">https://medium.com/p/5931a9917b27</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Sangwin Gawande]]></dc:creator>
            <pubDate>Thu, 09 Apr 2026 06:41:01 GMT</pubDate>
            <atom:updated>2026-04-09T06:41:01.511Z</atom:updated>
            <content:encoded><![CDATA[<p>AI is everywhere. But how do developers actually use it?</p><p>I want to share my experience. Not the hype. Not the marketing slides. Real life.</p><p>I have been coding for over 20 years. AI is a new tool in my toolbox. Some things are amazing. Some things are frustrating. Let’s dive in.</p><h3>Code Help and Suggestions</h3><p>AI can write code. It can also fix small bugs.</p><p>I use it for:</p><ul><li>Generating boilerplate code fast</li><li>Writing simple functions that save time</li><li>Spotting syntax errors I might miss</li></ul><p>But there are trade offs. Sometimes AI gives wrong solutions. Or code that is hard to read. You still need to check everything carefully.</p><h3>Learning and Research</h3><p>AI can explain things quickly.</p><ul><li>Understanding a new library</li><li>Getting examples for a framework</li><li>Summarizing documentation</li></ul><p>It is not perfect. AI can make mistakes. Do not trust it blindly. Think of it as a fast helper, not a teacher.</p><h3>Testing and Debugging</h3><p>AI helps with testing too.</p><ul><li>Writing unit tests</li><li>Suggesting edge cases</li><li>Explaining error messages</li></ul><p>It speeds up repetitive tasks. But it can miss subtle bugs. You still need to test manually.</p><h3>Idea Generation</h3><p>Sometimes you hit a wall. AI can help you think of ideas.</p><ul><li>Naming functions or variables</li><li>Structuring a new module</li><li>Designing simple algorithms</li></ul><p>It is like brainstorming with someone who never sleeps. Just remember, it may not know your code context perfectly.</p><h3>Documentation</h3><p>Writing docs can be boring. AI makes it faster.</p><ul><li>Summarizing code</li><li>Writing README files</li><li>Generating API docs</li></ul><p>But it can be too generic. Always review and adjust for your audience.</p><h3>Trade Offs</h3><p>AI is fast and helpful. But it is not magic.</p><ul><li>Always verify its output</li><li>It can encourage lazy coding if overused</li><li>Sometimes you waste more time fixing AI mistakes</li></ul><p>Think of AI as a tool. A strong tool. But not a replacement for skill.</p><h3>Conclusion</h3><p>I use AI as a helper, not a crutch. It saves time on boring tasks. It speeds up learning. But I still need my experience and judgement.</p><p>AI is a tool for developers. Use it wisely. Check its work. Learn from it. And yes, sometimes have fun with it too.</p><p>Cheers!!<br>Sangwin Gawande</p><p><a href="https://sangw.in/">https://sangw.in</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5931a9917b27" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>