<?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 Bharat Singhal on Medium]]></title>
        <description><![CDATA[Stories by Bharat Singhal on Medium]]></description>
        <link>https://medium.com/@bharatsinghal937?source=rss-78c03f77f5ac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Bharat Singhal on Medium</title>
            <link>https://medium.com/@bharatsinghal937?source=rss-78c03f77f5ac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:42:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bharatsinghal937/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[Code Is Getting Cheaper. Engineering Judgment Isn’t.]]></title>
            <link>https://medium.com/@bharatsinghal937/code-is-getting-cheaper-engineering-judgment-isnt-d2a2c5503e6d?source=rss-78c03f77f5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2a2c5503e6d</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[graphql-vs-rest]]></category>
            <category><![CDATA[engineering-judgment]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Bharat Singhal]]></dc:creator>
            <pubDate>Tue, 17 Nov 2026 09:36:18 GMT</pubDate>
            <atom:updated>2026-11-19T11:31:09.996Z</atom:updated>
            <content:encoded><![CDATA[<p>AI writes code fast. What it can’t do is judge it. Lessons from .NET and GraphQL on review, design, and debugging in the AI era.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VLODXRsH_SEfqMlI.png" /></figure><p>Not long ago, writing a working data-access layer, a REST endpoint, or a validated form took an afternoon. Today an AI assistant produces a plausible version of any of them in under a minute. That is a real shift, and I use these tools every day.<br>But years of building software across .NET, React, Python, and Node.js have taught me one thing: typing code was never the hard part. The hard part is knowing whether the code should exist, whether it fits the system around it, and what happens when it breaks at 2 a.m. AI has made the first part cheap. It has barely touched the second.<br>Code is getting cheaper. Engineering judgment isn’t. In this article, I’ll cover what AI coding assistants speed up, where they quietly introduce risk, and why review, design, and debugging matter more now than before.</p><h3><strong>What AI Genuinely Speeds Up</strong></h3><p>AI assistants are at their best on work that is well understood, repetitive, and easy to verify. In that territory, the productivity gain is real.</p><ul><li><strong>Boilerplate and scaffolding:</strong> DTOs, controllers, React components, CRUD endpoints, and migration scripts that used to eat the first hour of every feature.</li><li><strong>Test drafts:</strong> a quick first pass at unit tests and a useful list of edge cases I may not have thought of.</li><li><strong>Glue code and scripts:</strong> a Python script to reshape a data file, a small Node.js utility, a configuration snippet.</li><li><strong>Unfamiliar syntax and APIs:</strong> moving between .NET, Python, and JavaScript in the same day, or recalling how a query differs between SQL Server, PostgreSQL, and MySQL.</li><li><strong>Reading and explaining code:</strong> summarizing an unfamiliar module, or drafting documentation for something that never had any.</li></ul><p>The common thread is that I can judge the output in seconds. When verification is cheap, speed is a pure win.</p><h3><strong>Where the Risk Hides</strong></h3><p>The danger isn’t code that fails loudly. It’s code that looks right, passes a quick glance, and fails later.</p><ul><li><strong>Plausible but wrong:</strong> invented method names, outdated library APIs, and subtle logic errors such as off-by-one date boundaries, time zone handling, and rounding.</li><li><strong>Data access problems:</strong> a generated GraphQL resolver or ORM query often works on a small development dataset and struggles under production load. N+1 queries, missing indexes, and unbounded result sets are the classic examples.</li><li><strong>Security gaps:</strong> missing authorization checks, string-built SQL, overly permissive CORS, unvalidated input. Models learn from common patterns, and that includes common insecure ones.</li><li><strong>Hidden complexity:</strong> each suggestion is reasonable on its own, but together they produce duplicated logic, inconsistent patterns, and abstractions nobody chose. The codebase grows faster than anyone’s understanding of it.</li><li><strong>Confidence without accountability:</strong> an assistant sounds equally sure whether it is right or wrong. It doesn’t know your system’s history, your compliance constraints, or your real traffic.</li><li><strong>Skill atrophy:</strong> developers who accept output they can’t explain stop building the instincts they need to review it.</li></ul><p>None of these show up as compile errors. They show up later, in production, usually at the worst possible time.</p><h3>What This Looks Like in a .NET Codebase</h3><p>These risks are easiest to see in a stack I know well. Assistants write fluent C#, and that fluency is exactly why the problems are easy to miss. Here are the ones I catch most often.</p><ul><li><strong>Entity Framework queries that don’t scale:</strong> a loop that runs one query per row is the classic N+1 problem. It works with ten records in development and crawls with ten thousand in production.</li><li><strong>Blocking on async code:</strong> calling .Result or .Wait() instead of using await can cause thread pool starvation under load, and deadlocks in some older environments.</li><li><strong>Dependency injection lifetimes:</strong> injecting a scoped service, such as a DbContext, into a singleton creates a captive dependency, which leads to stale data and hard-to-trace bugs.</li><li><strong>Misused </strong><strong>HttpClient:</strong> creating a new instance for every request can exhaust sockets. IHttpClientFactory exists for a reason.</li><li><strong>Missing authorization:</strong> a new endpoint that compiles, runs, and quietly skips [Authorize] or the right policy.</li><li><strong>Outdated patterns:</strong> because models learn from years of public code, they sometimes suggest older .NET Framework-era habits when you are building on modern .NET.</li></ul><p>Here is the first one in practice. This is the kind of code an assistant will happily produce:</p><pre>// Looks fine, but runs one extra query per customer<br>var customers = await db.Customers.ToListAsync();</pre><pre>foreach (var customer in customers)<br>{<br>    customer.Orders = await db.Orders<br>        .Where(o =&gt; o.CustomerId == customer.Id)<br>        .ToListAsync();<br>}</pre><p>And this is what a reviewer with database experience would change it to:</p><pre>// One query, no tracking overhead for read-only data<br>var customers = await db.Customers<br>    .Include(c =&gt; c.Orders)<br>    .AsNoTracking()<br>    .ToListAsync();</pre><p>Both versions return the same data, and both pass a quick read. Only one of them survives real traffic. For very large datasets, I would go a step further and project into a lean DTO with Select, but that decision depends on how the data is used, which is exactly the kind of context an assistant doesn’t have.<br>The same applies to GraphQL in .NET. A generated resolver that fetches related data one record at a time reproduces the N+1 problem on every request, and the fix, batching with the DataLoader pattern, requires knowing how your schema is actually queried.<br>GraphQL Explained, and What It Can Do Now<br>GraphQL is a query language for APIs, paired with a runtime that answers those queries from your existing data. Instead of calling several fixed endpoints and accepting whatever each one returns, the client sends a single request describing exactly the fields it needs, and the server returns that exact shape. Everything is checked against a typed schema, which doubles as living documentation.</p><pre>query {<br>  customer(id: &quot;42&quot;) {<br>    name<br>    orders(first: 3) {<br>      total<br>    }<br>  }<br>}</pre><p>That one request can replace two or three REST calls, and the client never receives fields it didn’t ask for. The trade-off is that the server does more work per request, which is why the data-access habits discussed earlier matter so much.</p><p><strong>How it works under the hood</strong><br>Three ideas explain most of GraphQL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*6APw3y23slDsUZ0_x_az4g.png" /></figure><ul><li><strong>The schema:</strong> a strongly typed contract that lists every type, field, and relationship the API offers. Clients and tools can read it, which is why GraphQL editors can autocomplete fields and flag mistakes before a request is ever sent.</li><li><strong>Resolvers:</strong> the functions on the server that fetch the data for each field. The schema says what exists; resolvers decide how to get it. This is where database calls happen, and where performance problems like N+1 are born.</li><li><strong>Three operation types:</strong> <em>queries</em> read data, <em>mutations</em> change data, and <em>subscriptions</em> push updates to the client as they happen, for example live order status.</li></ul><p>Because the client chooses the shape of the response, one screen can be served by one request, and a mobile app and a web dashboard can ask for different fields from the same API without the backend building separate endpoints for each.<br>GraphQL has also moved faster over the last two years than many developers realize. Here is what has changed.</p><p><strong>The language itself: the September 2025 specification</strong><br>The GraphQL Foundation <a href="https://graphql.org/blog/2025-09-08-september-edition">published a new edition of the specification in September 2025</a>, the first since October 2021. Four additions stand out:</p><ul><li><strong>OneOf input objects:</strong> a way to say “provide exactly one of these fields” directly in the schema. Looking up a user by ID <em>or</em> by email used to mean making both fields optional and validating by hand inside the resolver. Now the schema enforces it.</li><li><strong>Schema coordinates:</strong> a standard text notation for pointing at a schema element, such as User.name. It helps tooling track field usage and flag risky changes in code review.</li><li><strong>Descriptions on queries and operations:</strong> documentation for operations, not only schema types, which helps teammates and AI tools understand intent.</li><li><strong>Broader deprecation support and full Unicode:</strong> more schema elements can now be deprecated, which makes it easier to evolve an API without breaking clients.</li></ul><p>Here is what a OneOf input looks like:</p><pre>input UserLookup @oneOf {<br>  id: ID<br>  email: String<br>}</pre><p><strong>The .NET tooling: Hot Chocolate 16</strong><br>On the .NET side, Hot Chocolate, a popular open-source GraphQL server, <a href="https://chillicream.com/blog/2026-05-11-hot-chocolate-16">shipped version 16 in May 2026</a>. These are the changes I find most relevant:</p><ul><li><strong>Batch resolvers:</strong> a single resolver that receives all parent objects for a field at once, so a query returning five brands makes one data fetch instead of five. This attacks the N+1 problem directly, without wiring up a separate DataLoader. DataLoaders are still available when you want batching in the application layer.</li><li><strong>Request and variable batching:</strong> several operations, or the same operation with different sets of variables, can travel in one HTTP request and share work on the server. This builds on an emerging proposal for GraphQL over HTTP.</li><li><strong>Incremental delivery with </strong><strong>@defer and </strong><strong>@stream:</strong> the server sends the fast parts of a response first and the slow parts later. These directives are not part of the September 2025 specification, and the wire format has already changed once, so treat them as a pre-standard feature and test client and server versions together.</li><li><strong>Better error handling:</strong> in standard GraphQL, an error in one non-null field can wipe out the data around it. A new onError option, based on a spec proposal, lets the client ask for a null at just the failed field while the rest of the response survives. That suits interfaces built from independent components.</li><li><strong>Opt-in features:</strong> fields can be marked experimental and stay hidden from introspection until a client explicitly asks for them, giving APIs a deliberate path from experimental to stable to deprecated.</li><li><strong>Cost analysis and safer defaults:</strong> since <a href="https://chillicream.com/blog/2024-10-30-newsletter-october">version 14</a>, the server has included request cost analysis based on the IBM cost specification, so expensive operations can’t easily overwhelm it. Version 16 tightened the defaults further.</li><li><strong>Semantic introspection for AI agents:</strong> two new fields, __search and __definitions, let an agent find only the relevant part of a large schema instead of loading all of it. <a href="https://chillicream.com/blog/2026-04-22-semantic-introspection">It is on by default in development mode</a>, so decide deliberately what you expose in production.</li><li><strong>MCP and OpenAPI adapters:</strong> expose GraphQL operations as tools for AI agents through the Model Context Protocol, or publish them as OpenAPI definitions for REST consumers.</li><li><strong>Federation with Fusion:</strong> for larger organizations, Fusion, the gateway from the same team, composes several GraphQL services into one unified API.</li></ul><p>A caution on upgrading: version 16 includes breaking changes, for example to custom scalars and date and time types, so read the migration guide before moving a production system.</p><p><strong>Why this matters for the argument of this article</strong><br>Many of these features are recent, and an AI assistant trained earlier may not know them. It may happily suggest the older workaround: optional fields with hand-written validation instead of @oneOf, a hand-built DataLoader for a case a batch resolver now handles in one method, or an outdated @defer payload format. Every one of those suggestions would compile and run.<br>Knowing which version you actually run, what its release notes changed, and which features are still proposals rather than standards is exactly the kind of judgment that doesn’t come from a prompt.</p><h3><strong>GraphQL or REST? How I Decide</strong></h3><p>GraphQL is not a replacement for REST, and the honest answer is usually “it depends.” This is the rule of thumb I use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*wRMWY1uJmNFNUlpu3Z8_9w.png" /><figcaption>GraphQL or REST</figcaption></figure><p><strong>GraphQL tends to pay off when:</strong></p><ul><li>Several clients (web, mobile, partners) need different slices of the same data.</li><li>Screens combine data from many related entities, and REST would mean a chain of calls.</li><li>Frontend teams need to move fast without waiting for new backend endpoints.</li><li>You want a typed, self-documenting contract between teams.</li></ul><p><strong>REST is often the better fit when:</strong></p><ul><li>The API is simple and resource-oriented, such as a small CRUD service.</li><li>You rely heavily on HTTP caching, CDNs, or straightforward rate limiting per endpoint.</li><li>The consumers are external developers who expect a familiar, predictable interface.</li><li>The team has no appetite for the extra moving parts: schema governance, resolvers, and query cost control.</li></ul><p>The two also coexist well. Plenty of systems keep REST for simple public endpoints and use GraphQL for the product’s own frontends. The mistake I see most often is adopting GraphQL because it is fashionable, then discovering that a three-endpoint API never needed it.</p><p><strong>Production Pitfalls Worth Knowing</strong><br>GraphQL’s flexibility is also its main risk, because clients can ask for almost anything. These are the areas where I’d slow down and review carefully, especially with generated code:</p><ul><li><strong>Unbounded queries:</strong> a client can request deeply nested or very expensive data in one call. Use depth limits, cost analysis, and pagination on every list, so one query can’t overwhelm the server.</li><li><strong>Authorization at the field level:</strong> protecting the endpoint isn’t enough. Every field and relationship that exposes sensitive data needs its own check, because a client can reach the same data through several different paths in the graph.</li><li><strong>Introspection in production:</strong> it is invaluable in development, but it also hands a complete map of your API to anyone who asks. Decide deliberately whether to expose it publicly.</li><li><strong>Caching:</strong> requests usually go to a single endpoint, so the standard HTTP caching that comes almost free with REST needs more thought. Persisted queries and client-side caching help.</li><li><strong>Error handling:</strong> a single response can contain both data and errors. Clients need to handle partial results rather than assuming a request either fully worked or fully failed.</li><li><strong>Schema evolution:</strong> instead of versioning the whole API, GraphQL encourages adding fields and deprecating old ones. That only works if someone owns the schema and treats it as a contract.</li></ul><p>None of these are reasons to avoid GraphQL. They are reasons to treat it as an engineering discipline, not a shortcut, which is the theme of this whole article.</p><h3>Cheap Code, Costly Contracts: What AI Changes for GraphQL</h3><p>GraphQL is where this article’s title is easiest to see in action. An assistant can generate a complete schema, with types and resolvers, from an existing database in minutes. That is the cheap part. The expensive part is that a schema is a contract: once clients depend on a field, removing it means a deprecation cycle and coordination with every consumer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*qrDKZhMKf8GrAjf9HupHcw.png" /></figure><p><strong>Where AI helps</strong></p><ul><li>Scaffolding types and resolvers from existing models.</li><li>Drafting sample queries and test cases.</li><li>Writing field and operation descriptions, which are tedious but valuable.</li></ul><p><strong>Where judgment still decides</strong></p><ul><li><strong>Modeling the domain, not the tables:</strong> assistants tend to map every table to a type and every column to a field. That exposes internal details and locks your storage design into the public contract. A good schema models what clients need to do, not how the data happens to be stored.</li><li><strong>Designing mutations:</strong> a generic updateOrder that accepts every field is easy to generate. An intent-based mutation such as approveOrder is harder to design, because it carries the business rules that a generic update quietly skips.</li><li><strong>Nullability:</strong> whether a field is non-null is not a typing detail. As covered earlier, an error in a non-null field can propagate upward and erase surrounding data, so these choices shape how your API fails.</li><li><strong>Authorization, pagination, and cost:</strong> generated resolvers work, but nothing in them says who may call them, how large a list can grow, or how expensive a query may become.</li></ul><p><strong>The other direction: AI as a consumer of your API</strong><br>AI is no longer only writing GraphQL; it is starting to read it. The <a href="https://graphql.org/blog/2025-09-08-september-edition">September 2025 specification</a> explicitly added documentation features with AI tools in mind, and servers such as Hot Chocolate now offer <a href="https://chillicream.com/blog/2026-04-22-semantic-introspection">semantic introspection</a> and adapters that expose GraphQL operations as tools for AI agents. That raises the stakes on decisions a human has to make: your schema descriptions become instructions an agent reads, and every field you expose is now something an agent may be able to act on. What to expose, to whom, and with which limits is not a decision to delegate to the tool.<br><strong>A short checklist for AI-generated GraphQL</strong></p><ol><li>Does the schema model the domain, or just mirror the database tables?</li><li>Is every list paginated, and are expensive paths covered by depth and cost limits?</li><li>Does every field that exposes sensitive data have its own authorization check?</li><li>Are nullability choices deliberate rather than defaults?</li><li>Would I be comfortable supporting this field for the next several years?</li></ol><p>The title holds here too. Assistants make the code cheap. The schema, the security model, and the limits are still judgment calls, and they are the parts you can’t easily take back.</p><p><strong>Review Is Now a Core Engineering Skill</strong><br>Every line an assistant writes still needs an owner, and the owner is the engineer who accepts it. I treat generated code like a pull request from a fast, confident colleague who knows nothing about our system. Here is the checklist I use:</p><ol><li><strong>Does it solve the real problem?</strong> Check it against the requirement, not just the prompt.</li><li><strong>Do I understand every line?</strong> If I can’t explain it, it doesn’t get merged.</li><li><strong>How does it behave at the edges?</strong> Nulls, empty collections, time zones, concurrency, and large inputs.</li><li><strong>What does it do to the database?</strong> Query count, indexes, transaction boundaries, and behavior with 100 times the data.</li><li><strong>Is it secure?</strong> Authorization, input validation, secrets, injection, and data exposure.</li><li><strong>Does it fit our codebase?</strong> Naming, error handling, and existing utilities it should reuse instead of duplicating.</li><li><strong>Do the tests prove anything?</strong> AI-written tests can simply mirror the assumptions of AI-written code.</li></ol><p>Review used to be about catching human slips. Now it is about catching confident plausibility, which is harder to spot and easier to wave through.</p><p><strong>Design Decisions Are Still Human Decisions</strong><br>An assistant can implement a design. It cannot tell you which design to choose.<br>The decisions that shape a system for years depend on context that never appears in a prompt: where service boundaries sit, whether a relational or document database fits the data, whether REST or GraphQL suits your clients, how failures are handled, and how a release is rolled back. The answers hinge on team size, existing skills, compliance rules, traffic patterns, budget, and what the business will want in two years.<br>Ask an assistant to “add a reporting feature” and you’ll get working code. It won’t ask whether reports should run against the primary database, whether the data belongs in a different store, or who will maintain that query when requirements change.<br>There is also a compounding effect. Cheap code makes a weak architecture faster to build, but no cheaper to live with. The better your assistant gets, the more important it becomes to get the foundation right first.</p><p><strong>Debugging Is Where Experience Shows</strong><br>When something breaks in production, nobody asks who wrote the code. Someone simply has to understand it.<br>Good debugging depends on a mental model of the whole system: how a request travels through the API, what the database is doing, what changed in the last deployment, and what the logs actually say versus what they merely suggest. Assistants help with pieces of this. They can explain a stack trace or propose a hypothesis, and I use them for exactly that. But root cause analysis means forming hypotheses, ruling them out, and recognizing which symptom is the real one.<br>There is a hidden cost too. Code you didn’t write and don’t fully understand is much harder to debug. A team that accepts large chunks of generated code without comprehension is borrowing against future incident time.<br>The fundamentals haven’t changed: reproduce the problem, check what changed recently, read the logs, and change one thing at a time. AI can speed up each of those steps. It can’t decide which step comes next.<br>How I Work With AI Assistants Now<br>I treat AI as a fast first draft, never a final answer. A few habits make that work.<br><strong>For individual engineers</strong></p><ul><li>Lean on it where verification is cheap, and slow down where it isn’t: security, payments, data migrations, and anything touching production data.</li><li>Give it context, such as your framework version, existing patterns, and constraints. Better inputs produce better drafts.</li><li>Ask it to critique, not just generate. Prompts like “what edge cases does this miss?” or “how could this fail under load?” are often more valuable than the code itself.</li><li>Never merge what you can’t explain.</li><li>Still write code by hand sometimes, to keep your instincts sharp.</li></ul><p><strong>For teams</strong></p><ul><li>Hold AI-assisted code to the same review standards as any other code.</li><li>Follow your company’s policy on approved tools, and never paste credentials, customer data, or proprietary code into tools that haven’t been cleared.</li><li>Invest in automated tests, linting, and CI pipelines so mistakes are caught before humans have to catch them.</li><li>Mentor junior developers on the why behind decisions, not just the what.</li></ul><p>The Takeaway<br>AI has changed how fast we can produce code. It hasn’t changed what makes software good: clear requirements, sound design, careful review, and the ability to fix problems under pressure.<br>If anything, the gap is widening. When anyone can generate code, the value moves to the people who can decide what to build, judge what has been built, and keep it running. Those are skills that experience builds, and they are worth investing in at every stage of a career.<br>Code is getting cheaper. Judgment is what you’re really being paid for.</p><p><em>How has AI changed your own workflow, and where has it surprised you? I’d like to hear your experience in the comments.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2a2c5503e6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>