<?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 Sarath Sadasivan Pillai on Medium]]></title>
        <description><![CDATA[Stories by Sarath Sadasivan Pillai on Medium]]></description>
        <link>https://medium.com/@sarathsp06?source=rss-d104fc16bdaf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SgI6BYFptTsYkdvmvkNFMA.jpeg</url>
            <title>Stories by Sarath Sadasivan Pillai on Medium</title>
            <link>https://medium.com/@sarathsp06?source=rss-d104fc16bdaf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 03:45:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sarathsp06/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[Understanding Tools, MCP, and RAG: How LLMs Bridge the Gap to the Real World]]></title>
            <link>https://sarathsp06.medium.com/understanding-tools-mcp-and-rag-how-llms-bridge-the-gap-to-the-real-world-d13f65cc76a1?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/d13f65cc76a1</guid>
            <category><![CDATA[mcp-protocol]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Sun, 22 Feb 2026 20:29:42 GMT</pubDate>
            <atom:updated>2026-02-22T20:29:42.033Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l1VHSWIc_6sqseOV" /><figcaption>Photo by <a href="https://unsplash.com/@job_vermeulen?utm_source=medium&amp;utm_medium=referral">Job Vermeulen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This post is my attempt to formalize a mental model that took me a while to internalize: how LLMs actually interact with the real world.</p><p>For a long time, I viewed “AI Agents” as a black box. But once you peel back the abstraction layers, what you find is not magic — it’s clean separation of concerns. In many ways, it’s just a disciplined application of the <strong>Single Responsibility Principle (SRP)</strong>.</p><p>The LLM handles reasoning (Control Plane).<br> External systems handle execution and retrieval (Data Plane).</p><p>Once I saw that split clearly, the system stopped feeling mystical and started looking like architecture.</p><h3>The Fundamental Constraint: The “Brain in a Vat”</h3><p>An LLM is a stateless file of weights.</p><p>It has:</p><ul><li>No direct access to your network</li><li>No access to your file system</li><li>No awareness of the current time</li><li>No ability to perform side effects</li></ul><p>It is isolated by design.</p><p>But isolation does not mean incapability.</p><p>What it <em>does</em> have is the ability to reason over context. It can decompose problems, infer intent, apply constraints, and evaluate tradeoffs. More importantly, it can recognize when it cannot complete a task with language alone.</p><p><strong><em>It knows when to ask for help.</em></strong></p><p>That “asking for help” manifests as tool calling. When the model determines that prose is insufficient, it predicts a structured output that signals: this requires external execution. It doesn’t execute anything itself — it delegates.</p><p>The mistake is thinking we need to make the model “smarter” to access the real world. We don’t. Instead, we build bridges around it so the model can focus on its single responsibility: predicting the next logical step given context — whether that step is reasoning in text or requesting external capability.</p><h3>1. The Reasoning Bridge: Tool Calling</h3><p>The first thing I had to demystify was the idea that a model “calls” a function. It doesn’t. It has no shell, no import os, and no permissions. It’s just a specialized text-completion task.</p><ul><li><strong>How it works:</strong> We inject a JSON schema of function signatures into the system prompt. When I ask a model to “reboot the dev server,” the model recognizes — via its latent knowledge of documentation — that it cannot satisfy this through prose. It predicts that the most logical “next token” is a structured JSON block (e.g., {&quot;action&quot;: &quot;reboot&quot;, &quot;target&quot;: &quot;dev-01&quot;}).</li><li><strong>The Handshake:</strong> The model’s job ends the moment the closing brace } is predicted. My application code then takes that &quot;intent,&quot; validates it, and performs the actual side effect.</li><li><strong>Why it’s powerful:</strong> It separates <strong>intent</strong> from <strong>implementation</strong>. The LLM decides <em>what</em> to do; my infrastructure decides <em>how</em> to do it safely.</li></ul><h3>2. The Context Bridge: Retrieval-Augmented Generation (RAG)</h3><p>If Tool Calling is about <em>acting</em>, RAG is about <em>knowing</em> beyond the training cutoff. One of my biggest “aha” moments was realizing that the model doesn’t “access” a database; it is <strong>fed</strong> the database through the context window.</p><ul><li><strong>How it works:</strong> Before the LLM even starts thinking, a retrieval system (usually a vector DB) performs a semantic search against the user’s query. It finds relevant “chunks” of data and literally pins them to the top of the prompt.</li><li><strong>Grounded Reasoning:</strong> The model isn’t “learning” my private docs; it’s performing <strong>In-Context Learning (ICL)</strong>. It reads the “cheat sheet” I just gave it and synthesizes an answer.</li><li><strong>The SRP Split:</strong> The retrieval system handles <strong>data discovery</strong>, while the LLM handles <strong>grounded synthesis</strong>.</li></ul><h3>3. The Universal Interface: Model Context Protocol (MCP)</h3><p>Connecting one tool is easy. Connecting fifty is an engineering nightmare. If every tool has a different schema, the model’s context window becomes a cluttered mess of documentation, leading to “prompt drift.”</p><ul><li><strong>How it works:</strong> <strong>MCP</strong> is the “USB-C” for AI. It’s a standardized transport layer where an <strong>MCP Server</strong> describes tools and resources in a universal format.</li><li><strong>The Standardized Socket:</strong> Whether I’m connecting the model to GitHub, a local SQLite DB, or a Slack channel, the model sees a consistent interface.</li><li><strong>The Value:</strong> It decouples the model from the plumbing. I can swap out a Postgres DB for a Pinecone index, and as long as they both speak MCP, the model’s reasoning logic remains unchanged.</li></ul><h4>The Bottom Line: They Work Together</h4><p>In practice, the most powerful setups in 2026 combine them:</p><ul><li>Use <strong>RAG</strong> to pull relevant knowledge/docs.</li><li>Use <strong>MCP</strong> (or traditional tools) to act on that knowledge — update records, schedule meetings, generate code from designs, etc.</li><li>MCP makes the whole thing more modular, scalable, and future-proof.</li></ul><p>If you’re building agents today, start with whatever your model supports best, but keep an eye on MCP — it’s quickly becoming the de-facto way to give LLMs rich, live context without reinventing the wheel every time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d13f65cc76a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Tale of Two Pasts: Why We Talk About Hitler, but Not Churchill]]></title>
            <link>https://sarathsp06.medium.com/a-tale-of-two-pasts-why-we-talk-about-hitler-but-not-churchill-b9a190d0a803?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9a190d0a803</guid>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 22:31:06 GMT</pubDate>
            <atom:updated>2026-02-02T22:31:06.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Title: The Good Samaritan Creator: Majerník, Cyprián Date: 1940 Providing institution: Slovak national gallery Aggregator: Slovak national gallery Providing Country: Slovakia Public Domain The Good Samaritan by Majerník, Cyprián - Slovak national gallery, Slovakia - Public Domain." src="https://cdn-images-1.medium.com/max/1024/0*OUKjR525HztncKdl" /><figcaption>Photo by <a href="https://unsplash.com/@europeana?utm_source=medium&amp;utm_medium=referral">Europeana</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’ve been living in Europe for a while now, and something has been nagging at me. It’s the sharp, almost jarring, contrast between two countries and how they remember their history.</p><p>In Germany, the past is a wound that never quite heals. You see it in the Stolpersteine—the &quot;stumbling stones&quot; embedded in the pavement—each one a solemn memorial to a victim of the Holocaust. They are everywhere, a constant, humbling reminder of a terrible crime. Germany doesn’t glorify its dark chapters; it confronts them. There are no statues of Hitler, no excuses made for the Third Reich. Their national motto is &quot;Never again.&quot;</p><p>Then there’s Britain.<br>Here, the empire is still romanticized, a subject of pride and nostalgia. Churchill, a man who saw the world through a lens of racial hierarchy, is revered as a national hero. In London, you can find his statues and buy mugs with his face on them. The British Museum proudly displays treasures looted from my home, India, as if they are trophies.</p><p>My country was a victim of this empire. We were drained of our wealth, our culture, and our people. Millions died in famines that were not natural disasters but man-made. The 1943 Bengal famine, which killed an estimated 3 million people, happened while Britain was shipping our grain out for the war effort. When asked about it, Churchill’s response was that it was the Indians&#39; own fault for &quot;breeding like rabbits.&quot;<br>This is the man whose legacy is still celebrated.</p><p>While Germany has spent decades atoning for its past, Britain has never truly faced its own. The empire is often framed as a civilizing force that brought railways and the English language to a &quot;backward&quot; world. This narrative willfully ignores the brutal violence, the systematic economic exploitation, and the sheer human cost of colonial rule.</p><p>Consider the numbers:<br>Before the British arrived, India’s share of the global economy was about 23%. By the time they left, it had plummeted to just 3%.<br>Some economists estimate that Britain extracted a total of $45 trillion (in today’s money) from India over two centuries.<br>The Great Famine of 1876-78 alone claimed between 5.5 and 10 million lives. Historians estimate that in total, tens of millions of Indians died in colonial famines.</p><p>We remember Hitler, and rightly so. He was a monster who committed unspeakable atrocities. But we forget that the British Empire’s actions were arguably more heinous in their scale and duration. The Holocaust was an inferno of deliberate extermination, a crime of unprecedented ferocity compressed into a few horrifying years. The suffering under the British Empire, however, was a slow-motion catastrophe that unfolded over centuries.<br>The difference is not in the actions, but in the aftermath. Germany was ashamed. <em>Britain was proud. And that, more than anything else, is why we need to talk about it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9a190d0a803" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power of Simplicity: Measuring Code Complexity with Cyclomatic and Cognitive Complexity]]></title>
            <link>https://sarathsp06.medium.com/the-power-of-simplicity-measuring-code-complexity-with-cyclomatic-and-cognitive-complexity-29414b9fc0a0?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/29414b9fc0a0</guid>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Mon, 17 Feb 2025 11:13:07 GMT</pubDate>
            <atom:updated>2025-02-17T11:13:07.257Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*44YnOh9xfn87VpSY" /><figcaption>Photo by <a href="https://unsplash.com/@chuttersnap?utm_source=medium&amp;utm_medium=referral">CHUTTERSNAP</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>“Simplicity is the ultimate sophistication.” — Leonardo da Vinci</blockquote><p>In software development, simplicity is often the key to success. Simple code is easier to understand, maintain, and test, which makes it more reliable and less error-prone. But how can we objectively measure the simplicity of our code? That’s where metrics like cyclomatic complexity and cognitive complexity come in</p><h4>What is Simplicity and Why is it Important?</h4><p>Simplicity is the idea that less is more. It’s about reducing complexity and focusing on what’s essential. In programming, simplicity means writing code that is easy to understand, modify, and maintain. Simple code is less prone to bugs, easier to test, and more resilient in the face of change.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FF3G8ymQkOkbII%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fmolly-welker-F3G8ymQkOkbII&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExM2QwNDM0MmQwZDgwY2I0ZTUzYjliYWM5YzZjYWE1YmZlN2Q4MTNhZSZjdD1n%2FF3G8ymQkOkbII%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/998d9e31328059febcc94d91e002e6a9/href">https://medium.com/media/998d9e31328059febcc94d91e002e6a9/href</a></iframe><p>But simplicity is not just a matter of personal preference or aesthetics. It’s a critical factor in software development success. According to a study by Microsoft Research, developers who work with simpler code are happier, more productive, and less likely to make mistakes.</p><h4>Measuring Code Complexity with Cyclomatic Complexity:</h4><p>Cyclomatic complexity is a metric that measures the number of possible paths through a block of code. It’s based on the idea that more complex code is more difficult to test and maintain. The higher the cyclomatic complexity, the more paths there are through the code, and the more challenging it is to test.</p><p><strong><em>Cyclomatic complexity is an objective measure of testability</em></strong></p><h4>Measuring Code Complexity with Cognitive Complexity:</h4><p>Cognitive complexity is a metric that measures how difficult code is to understand and maintain. It’s based on the idea that more complex code is more challenging to read and modify. The higher the cognitive complexity, the more difficult it is to maintain the code.</p><p><strong><em>Cognitive complexity is an objective measure of maintainability</em></strong></p><h3><strong>Cyclomatic vs. Cognitive Complexity: Complementary Perspectives</strong></h3><p>While both metrics aim to quantify complexity, they address different dimensions of code quality. Cyclomatic complexity focuses on the <em>structural</em> complexity of code by counting decision points (e.g., if, for, while), providing insight into test coverage needs. Cognitive complexity, however, evaluates <em>human readability</em> by penalizing nested logic, deeply chained methods, and overly terse syntax.</p><p>Consider this example:</p><pre># High Cyclomatic Complexity (6) but Low Cognitive Complexity (2)  <br>def calculate_discount(age, membership_status, order_total):  <br>    discount = 0  <br>    if age &gt;= 65:  <br>        discount += 0.1  <br>    if membership_status == &quot;premium&quot;:  <br>        discount += 0.15  <br>    if order_total &gt; 1000:  <br>        discount += 0.05  <br>    return discount</pre><p>Here, independent conditionals create multiple paths (high cyclomatic complexity) but remain easy to read (low cognitive complexity).</p><p>Now, a cognitively complex snippet:</p><pre># High Cognitive Complexity (8) due to nesting  <br>def process_data(data):  <br>    if data:  <br>        for item in data:  <br>            if item.is_valid():  <br>                try:  <br>                    result = item.transform()  <br>                    if result:  <br>                        print(result)  <br>                except:  <br>                    logger.error(&quot;Failed&quot;)  <br>    # ...</pre><p>Nested loops, try/except, and conditionals make this code mentally taxing, even with a cyclomatic complexity of 4.</p><p><strong>Strategies to Reduce Complexity</strong></p><ol><li><strong>Refactor Deep Nesting</strong>: Use guard clauses or return early to flatten</li></ol><pre>def process_data(data):  <br>    if not data:  <br>        return  <br>    for item in data:  <br>        if not item.is_valid():  <br>            continue  <br>        result = item.transform()  <br>        if result:  <br>            print(result)  </pre><ol><li><strong>Break Down Large Functions</strong>: Split monolithic code into smaller, single-responsibility methods.</li><li><strong>Leverage Design Patterns</strong>: Strategies like Factory or Command can simplify conditional logic.</li></ol><h3><strong>Tools for Measuring Complexity</strong></h3><p>Integrate tools like <a href="https://www.sonarsource.com/">SonarQube</a>, <a href="https://eslint.org/">ESLint</a>, or <a href="https://codeclimate.com/">CodeClimate</a> into CI/CD pipelines to automatically flag high complexity. For example, SonarQube’s “Maintainability Rating” combines both metrics to prioritize refactoring efforts.</p><h3><strong>The Cost of Ignoring Complexity</strong><br>High complexity correlates with:</h3><ol><li><strong>Increased bug prevalence</strong>: <a href="https://ntrs.nasa.gov/citations/20205011566">A NASA study </a>found that modules with cyclomatic complexity greater than 10 had 48% more bugs. This aligns with the general understanding that complex code is more prone to errors and defects</li><li><strong>Longer onboarding times</strong>: Complex codebases make it difficult for new developers to understand and become productive. The learning curve becomes steeper, requiring more time and effort for new team members to grasp the overall logic of the code.</li><li><strong>Technical debt accumulation</strong>: High complexity contributes to technical debt, which can lead to teams spending significantly more time debugging than building new features. While the specific 50% figure from the<a href="https://stripe.com/files/reports/the-developer-coefficient.pdf"> Stripe survey </a>is not directly mentioned in the search results, it is consistent with the general trend observed.</li></ol><p><strong>Conclusion: Simplicity as a Practice</strong></p><p>As Edsger Dijkstra wisely said, <em>“Simplicity is a great virtue but it requires hard work to achieve it.”</em> Cyclomatic and cognitive complexity are not just metrics — they are guardrails guiding developers toward code that is both robust and humane. By regularly auditing complexity, refactoring ruthlessly, and embracing tools, teams can transform tangled code into a clean, sustainable codebase.</p><p><strong>Start today:</strong> Add a complexity check to your next pull request, and celebrate the art of simplicity. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29414b9fc0a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Differences in Customer Support Analytics Across Communication Channels]]></title>
            <link>https://sarathsp06.medium.com/differences-in-customer-support-analytics-across-communication-channels-0f471754956f?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/0f471754956f</guid>
            <category><![CDATA[customer-experience]]></category>
            <category><![CDATA[measuring]]></category>
            <category><![CDATA[saas]]></category>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Fri, 14 Feb 2025 23:38:37 GMT</pubDate>
            <atom:updated>2025-02-14T23:38:37.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mxKawnFeREUca0xh" /><figcaption>Photo by <a href="https://unsplash.com/@nate_dumlao?utm_source=medium&amp;utm_medium=referral">Nathan Dumlao</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In today’s fast-paced digital world, customer support is no longer limited to just phone calls and emails. Businesses now engage with customers through multiple channels, including messaging apps like WhatsApp.</p><p>We at <a href="https://www.messageplus.io/">messageplus.io</a> have been researching and experimenting with measuring tools for effectively measuring support teams across different communication platforms. It isn’t as simple as applying the same metrics everywhere.</p><p>Each channel operates differently, influencing how interactions unfold and what performance indicators truly matter. WhatsApp, as a chat-based platform, generates distinct data points compared to traditional methods like phone calls, SMS, or email. As a result, directly comparing metrics across these channels without adjustments can lead to misleading conclusions and ineffective decision-making.</p><p>Below, we break down the key differences in analytics and introduce a basic mathematical approach to illustrate why analyzing these channels separately is essential.</p><h3><strong>Volume &amp; Handling Capacity</strong></h3><p><strong>WhatsApp (Chat-Based Support)</strong></p><ul><li>Agents manage multiple chats simultaneously.</li><li>Conversation duration varies based on engagement.</li><li>Asynchronous interactions may extend resolution times.</li></ul><p><strong>Traditional Channels (Call, SMS, Email)</strong></p><ul><li>Calls require full attention, one at a time.</li><li>Emails have longer response and resolution times.</li><li>SMS is primarily for notifications, not detailed support.</li></ul><h3><strong>Efficiency Comparison</strong></h3><ul><li><strong>Calls</strong>: 1 at a time, avg. 8 min per call → <strong>7.5 calls per hour</strong></li><li><strong>WhatsApp</strong>: 3 chats at once, avg. 15 min per chat → <strong>12 chats per hour</strong></li></ul><p><strong>Key Insight:</strong> Productivity metrics should be adjusted per channel.</p><h3><strong>Response Time vs. Resolution Time</strong></h3><p><strong>WhatsApp</strong></p><ul><li>First Response Time (FRT) measured in seconds/minutes.</li><li>Resolution Time varies due to pauses and resumptions.</li></ul><p><strong>Calls &amp; Email</strong></p><ul><li>Calls resolve issues in real-time, measured by Average Handle Time (AHT).</li><li>Emails track First Response Time in hours/days, often with multiple interactions.</li></ul><p><strong>Formula Comparison</strong></p><ul><li><strong>WhatsApp FRT</strong> = Total First Response Time / Total Chats</li><li><strong>Call AHT</strong> = (Total Call Duration + Hold Time) / Total Calls</li></ul><p><strong>Example:</strong></p><ul><li>WhatsApp avg. FRT = 2 min</li><li>Call avg. AHT = 8 min</li></ul><p><strong>Key Insight:</strong> Efficiency expectations must align with channel characteristics.</p><h3><strong>Customer Satisfaction (CSAT) &amp; Engagement</strong></h3><p><strong>WhatsApp</strong></p><ul><li>Higher response rates to CSAT surveys.</li><li>Engagement measured by response time, emojis, message length.</li></ul><p><strong>Calls &amp; Email</strong></p><ul><li>Lower CSAT survey response rates.</li><li>Email satisfaction measured by reply rates, sentiment analysis.</li></ul><p><strong>Engagement Rate Example</strong></p><ul><li>WhatsApp CSAT response rate = <strong>40%</strong></li><li>Call CSAT response rate = <strong>15%</strong></li><li>Weighted CSAT = (CSAT Score × Response Rate) / 100</li><li>WhatsApp: (4.5 × 40%) = <strong>1.8</strong></li><li>Calls: (4.6 × 15%) = <strong>0.69</strong></li></ul><p><strong>Key Insight:</strong> Direct CSAT comparisons can be misleading; weighting provides a clearer picture.</p><h3><strong>Why Channel-Specific Analytics Matter</strong></h3><ul><li>Use tailored KPIs (AHT for calls, FRT for chats).</li><li>Adjust productivity metrics for concurrency and response times.</li><li>Consider engagement differences when evaluating customer satisfaction.</li></ul><p>Without channel-specific analytics, businesses risk misinterpreting performance, leading to resource misallocation and inefficiencies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0f471754956f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Naming: Lessons Learned as a Programmer]]></title>
            <link>https://sarathsp06.medium.com/the-art-of-naming-lessons-learned-as-a-programmer-a3beed290438?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3beed290438</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[naming]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[convention]]></category>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Sun, 19 Feb 2023 18:48:24 GMT</pubDate>
            <atom:updated>2023-02-19T19:08:16.385Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GJ7xj99sBrx_LM6D" /><figcaption>Photo by <a href="https://unsplash.com/@christianlue?utm_source=medium&amp;utm_medium=referral">Christian Lue</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever struggled with naming your variables or functions in your code? I know I have! I used to spend way too much time trying to come up with the perfect name, only to realize later that it wasn’t quite right.</p><p>As a programmer, I have learned the hard way that naming variables and functions is one of the most important and challenging tasks in software development. The names we choose can impact our code’s readability, maintainability, and even functionality.</p><blockquote>“Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’” — Steve McConnell</blockquote><h4>Naming is Hard</h4><p>Naming variables and functions can be one of the most challenging parts of coding. The name should be clear and concise, while also providing useful context about the purpose of the variable or function. It’s a fine balance to strike, and it takes time to develop the skill of naming.</p><blockquote>“Naming things is hard. If you can’t come up with a good name, it’s usually a sign that you don’t fully understand what you’re trying to name.”</blockquote><blockquote>— Will Larson, author of “An Elegant Puzzle: Systems of Engineering Management”.</blockquote><h4>Good Names Tell a Story</h4><p>A good variable or function name should tell a story about its purpose and functionality. When someone reads your code, they should be able to understand what the variable or function does just by looking at its name.</p><blockquote>“A long descriptive name is better than a short enigmatic name. A long descriptive name is better than a long descriptive comment.” — Robert C. Martin</blockquote><pre>type BlogPost struct {<br>    Title       string<br>    Body        string<br>    Author      string<br>    PublishDate time.Time<br>}</pre><p>In this example, the variable names tell a story about the purpose and functionality of the BlogPost struct. The Title field represents the title of the blog post, the Body field represents the body of the blog post, the Author field represents the author of the blog post, and the PublishDate field represents the date the blog post was published.</p><p>By using descriptive variable names, the code becomes more readable and self-documenting. Another developer reading this code can understand the purpose of the BlogPost struct just by looking at the variable names, without needing additional comments or documentation.</p><h4>Single Letter Names are Bad; In general</h4><p>Single-letter variable names should be avoided in most cases, as they do not provide enough context to understand the purpose of the variable. It can also be confusing if the same letter is used for different variables in different parts of the code.</p><blockquote>“Make your variable names descriptive and meaningful. If a variable’s name doesn’t describe its purpose, it’s a bad name.” — Joel Spolsky</blockquote><p>Certainly, there are exceptions to the general rule that single-letter variable names should be avoided. One example is using “i” for an index in a loop, which has become a convention in many programming languages. In this case, “i” is a widely recognized shorthand for “index,” and using a longer variable name would not add any additional context or clarity to the code. However, it’s important to be mindful of using single-letter variable names in other scenarios where they may cause confusion or make the code more difficult to read and maintain.</p><h4>Avoid Using Variable Type in Variable Name</h4><p>Using the variable type in the variable name can be redundant and unnecessary, as the variable declaration should already indicate its type. It can also limit the flexibility of the variable in the future if its type needs to be changed.</p><blockquote>“Programs must be written for people to read, and only incidentally for machines to execute.” — Harold Abelson and Gerald Jay Sussman</blockquote><p>Using the data structure in the variable name, such as “list” or “array,” can be redundant and unnecessary since the declaration of the variable should already indicate its type. Additionally, it can limit the flexibility of the variable if its type needs to be changed in the future. Therefore, it’s generally better to use a more descriptive and meaningful name that reflects the purpose of the variable within the context of the code.</p><pre>// bad names<br>var intList []int<br>var strList []string<br><br>// good names<br>var numbers []int<br>var names []string</pre><h4>Good Names Should be Close to How Businesses Use the Names</h4><p>It’s important to use variable and function names that are close to how business users refer to the concepts being modelled in the code. This can make it easier for non-technical stakeholders to understand the code and provide feedback. Code is a tool for communication and using the same names across different horizontals of the organisation helps with better communication</p><blockquote>“The most important property of a program is whether it accomplishes the intention of its user.” — C.A.R. Hoare</blockquote><h4>Good Names Need Fewer Comments</h4><p>A well-named variable or function should require less commenting to explain its purpose, as the name itself provides useful information about the code. This can make the code easier to read and maintain over time. So when you feel a need to add a comment for an identifier to explain what it is or what it does, it is time to re-think if the name is appropriate. Comment should be in most cases used for why and not the what</p><blockquote>“If you need a comment to explain what a piece of code does, then the code is not good enough.” — Martin Fowler</blockquote><p>Here are a few examples of good function names in real-world Go:</p><ol><li>ParseTime - a function that takes a string representing a time and parses it into a time.Time value.</li><li>AddOrUpdateUser - a function that adds a new user to a database, or updates an existing user if they already exist.</li><li>FindNearestNeighbors - a function that finds the nearest neighbours of a given data point in a set of high-dimensional data.</li><li>CalculateDistance - a function that calculates the distance between two points in a given coordinate system.</li><li>BuildTree - a function that constructs a data structure for efficient searching and retrieval of data.</li></ol><p>In each of these examples, the function name clearly and concisely describes what the function does, making it easier for other developers to understand and use the code.</p><h4>Consistency is Key</h4><p>Consistency in naming conventions is important for making code more readable and maintainable. If variables and functions are named consistently, it becomes easier to identify patterns and understand the purpose of the code.</p><blockquote>“Consistency is not just a virtue; it’s an obligation. Without consistency, code is unreadable, unworkable, and unmaintainable.” — Robert C. Martin</blockquote><h4>Use verbs for function names</h4><p>When naming functions, it’s important to think about the function’s purpose and the action it performs. Verbs are more action-oriented and make it clear to the reader what the function does. Additionally, using verbs as function names promotes consistency and clarity throughout the codebase.</p><p>Suppose we have a function that takes an array of integers and returns the sum of all the even numbers in the array. A bad name for this function would be “EvenSumArray”, which is not very clear about what the function does. A better name would be “SumEvenNumbers” or “GetEvenSum”, which indicates that the function calculates the sum of even numbers in the array.</p><blockquote>“Function names should be verbs, not nouns.” — Robert C. Martin</blockquote><p>Here is an example of how the function with a good name can be written:</p><pre>func SumEvenNumbers(numbers []int) int {<br>    sum := 0<br>    for _, num := range numbers {<br>        if num % 2 == 0 {<br>            sum += num<br>        }<br>    }<br>    return sum<br>}</pre><p>As you can see, the name of the function indicates what it does. It takes an array of integers and calculates the sum of even numbers in the array.</p><p>Using a verb in the function name not only makes it clear what the function does but also helps to make the code more readable and maintainable.</p><p>However, there may be cases where a function is named with an adjective or a noun, rather than a verb.</p><p>For example, Go functions that return a boolean value that indicates whether a certain condition is true or false may be named with an adjective that describes the condition being checked. For instance, a function that checks whether a given slice is empty may be named isEmpty. This function is named after an adjective rather than a verb because it describes the state of the slice being checked.</p><p>In other cases, Go functions may be named after a noun when they are factory functions that create and return objects of that noun’s type. For example, the http package in Go has a function called NewServeMux that creates and returns a new ServeMux object. The function is named after the noun &quot;ServeMux&quot; rather than a verb because it creates an instance of that object.</p><p>Ultimately, the goal when naming Go functions is to choose a name that accurately reflects what the function does and is easy for others to understand and use in their own code. Whether the function name is a verb, adjective, or noun, it should be clear and consistent with the naming conventions of the language and the project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3beed290438" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Domain-Driven Design with Go]]></title>
            <link>https://sarathsp06.medium.com/domain-driven-design-with-go-be3066ae213c?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/be3066ae213c</guid>
            <category><![CDATA[ddd]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Fri, 10 Feb 2023 18:10:28 GMT</pubDate>
            <atom:updated>2023-02-10T18:10:28.131Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O5aKex92s4PEXQeW" /><figcaption>Photo by <a href="https://unsplash.com/@lox?utm_source=medium&amp;utm_medium=referral">Lachlan Donald</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Domain-Driven Design (DDD) is a software development approach that focuses on modelling complex business domains as a set of objects or entities and their interactions. The main objective of this design is to improve communication between developers, business stakeholders, and end-users, allowing the creation of a more maintainable and scalable system.</p><p>Go is a statically-typed and compiled programming language that is well-suited for building scalable and efficient software applications. In this blog post, we will explore how to implement a customer service platform using DDD principles in Go.</p><h3>Customer Service Platform</h3><p>Our customer service platform will consist of three core entities: Customer, Product, and Order. Each of these entities will be modelled as a separate Go struct, and the relationships between them will be defined through interfaces and embedding.</p><p>Let’s start by defining the directory structure for our project. The following is the recommended directory structure for DDD with Go:</p><figure><img alt="directory structure" src="https://cdn-images-1.medium.com/max/874/1*hV6fUBsoOO6xXgNRX78s_w.png" /></figure><p>The domain directory will contain the core business logic for our application. The model directory will contain the entities, value objects, and any other business objects required for our domain. The repository directory will contain the implementation of our repositories, which will be responsible for accessing and persisting data from our underlying data stores. The service directory will contain the implementation of our services, which will provide the business logic for our application.</p><p>The infrastructure directory will contain the implementation of the technical infrastructure for our application. The persistence directory will contain the implementation of our data stores and the datastore directory will contain the specific implementation of each of our data stores. The transport directory will contain the implementation of the communication layer between our application and the outside world, and the http directory will contain the implementation of our HTTP endpoints. The util directory will contain utility functions and packages required by our application.</p><h3>Entity</h3><p>The entity is a distinct and identifiable object that has its own characteristics and behaviour in the context of a business domain. It represents a business object or concept and encapsulates the data and behaviour related to it.</p><p>Entities have a unique identity that distinguishes them from other objects and they can evolve over time as their properties and relationships change. For example, in an e-commerce platform, a customer is an entity that has its own attributes such as name, address, email, and phone number, and behaviours such as place an order, cancel order, and update account information.</p><h4>Customer Entity</h4><p>Let’s start by defining the Customer entity. The Customer entity will represent a customer in our system and will contain information such as the customer&#39;s name, email, and address.</p><figure><img alt="cusomter-entity" src="https://cdn-images-1.medium.com/max/534/1*wzgUXLiKYEmzWGleqhizfw.png" /></figure><p>let’s consider the other two entities in our Customer Service platform, Product and Order.</p><h4>Product Entity</h4><p>The Product entity is used to represent the products offered by the service platform. The product can have properties like name, price, description, and image. The entity defines the structure of the product data.</p><h4>Order Entity</h4><p>The Order entity is used to keep track of the orders made by the customers. It can have properties like the customer who made the order, the products ordered the total amount, the order date, and the delivery address.</p><h3>Value Objects</h3><p>Value Objects are used to represent the data that is part of an Entity but is not used to identify it. They are used to store the data that is always used in combination with the Entity.</p><p>In our Customer Service platform, two value objects are used:</p><ul><li><strong>Address Value Object</strong> The Address value object is used to store the delivery address for the order. The address can have properties like street, city, state, and zip code.</li><li><strong>Payment Value Object</strong> The Payment value object is used to store the payment information for the order. The payment information can have properties like the payment method, the transaction id, and the amount paid.</li></ul><h4>Repository</h4><p>The repository is used to abstract the data access logic from the service layer. It is used to get and save the data from the underlying data store. In our Customer Service platform, we have three repositories:</p><ul><li><strong>Customer Repository</strong> The Customer Repository is used to access the customer data from the data store. It provides methods to get, save and update customer data.</li><li><strong>Product Repository</strong> The Product Repository is used to access the product data from the data store.</li></ul><p>Following would be an example implementation of customer repository</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U8B89Zt1oLZ4tVF6E1TYEA.png" /></figure><h3>Service</h3><p>The Service layer acts as an intermediary between the presentation layer and the repository layer. It’s responsible for coordinating the flow of data between the two layers and performing any necessary business logic. The business logic that we define in the service layer, is the glue that holds our domain and infrastructure layers together.</p><p>In this example, we have three services: CustomerService, ProductService, and OrderService. Each service would have methods to perform operations on the corresponding entity. For example, customer service could have methods to create a new customer, retrieve an existing customer, update a customer’s information, and delete a customer. The Service layer is also responsible for performing any necessary validations, such as ensuring that a customer’s email is unique, before persisting the data.</p><p>Here’s an example of what our customerservice.go file could look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dLj7i83K8ZjYXgETzAE1RQ.png" /></figure><h3>Data Store</h3><p>Datastore is a component of the infrastructure layer that is responsible for storing and retrieving data from a database or other storage system. The data store is used to implement the repositories that serve as an abstraction over the underlying storage mechanism. The goal of the datastore is to provide a simple and efficient way for the application to persist and retrieve data, without having to worry about the complexities of the underlying storage mechanism. The data store can be implemented using a variety of technologies, such as SQL databases, NoSQL databases, or file systems. The choice of datastore technology will depend on the specific requirements of the application and the type of data being stored.</p><p>Here is an example implementation of datastore</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaOzbaYVGSVDo2efb7DDhw.png" /></figure><p>It’s common for the datastore to have its own structure for storing entities, separate from the structure used in the domain. In this case, the datastore should define its own structure to follow the table schema, and the repository should be responsible for mapping between the domain entities and the datastore entities. This way, changes to the datastore structure won’t affect the domain entities and vice versa, as long as the mapping between them is maintained. Additionally, it also helps keep the separation of concerns between the domain and the infrastructure.</p><h3>Transport</h3><p>The transport layer is responsible for handling incoming and outgoing requests and responses to and from the service layer. It acts as an interface between the service layer and the external world. In our example, we will be using HTTP as our transport layer. Here is an example of how the customerhttp.go file in the http package of the infrastructure directory would look like:</p><figure><img alt="http" src="https://cdn-images-1.medium.com/max/1024/1*udv0cGOobrvbMNLNFqAp4w.png" /></figure><p>In conclusion, we’ve discussed how to implement Domain-Driven Design in Go, by breaking down a customer service platform into its various components and looking at examples of each. We’ve seen how entities, value objects, repositories, services, and datastores work together to form a complete solution. In the next part of this series, we’ll explore how to integrate the transport layer, which deals with the delivery of services to the outside world, and how to manage errors and HTTP requests. Stay tuned!”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be3066ae213c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Export StackOverflow]]></title>
            <link>https://sarathsp06.medium.com/export-stackoverflow-a8e4b58d4a40?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8e4b58d4a40</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[stackoverflow]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Wed, 17 Feb 2021 11:09:01 GMT</pubDate>
            <atom:updated>2022-12-20T13:04:24.647Z</atom:updated>
            <content:encoded><![CDATA[<h3>Export StackOverflow.</h3><p>I wanted to show my StackOverflow posts on my personal website with links to the original question. Googled how to do it with not much help for an out-of-the-box solution and digging deeper found the following solutions</p><ol><li><a href="https://api.stackexchange.com/">stackexchange api</a></li><li><a href="https://data.stackexchange.com/">stackexchange dataexplorer</a></li></ol><p>StackExchange data explorer exposes the data using SQL syntax. The home page has a set of already-created queries. For me, all I wanted was a way to get my answers in descending order of score and some details about the question.</p><p><strong>Here is how one can get that.</strong></p><p><strong>TLDR</strong>;</p><p>The prebuilt query <a href="https://data.stackexchange.com/stackoverflow/query/1044629/top-20-answers-in-decending-order-of-score">here</a> with your user id would show the top 20 answers in descending order of score</p><p><strong>In details</strong></p><p>Go to <a href="https://data.stackexchange.com/stackoverflow/query/new">compose the query</a> in <a href="https://data.stackexchange.com/">https://data.stackexchange.com</a> and use the following query in the query page</p><pre>DECLARE <a href="http://twitter.com/UserId">@UserId</a> int = ##UserId##<br>    SELECT<br>      answ.Id &quot;AnswerID&quot;,<br>      q.Id &quot;QuestionID&quot;,<br>      answ.Body &quot;AnswerBody&quot;,<br>      q.Body &quot;QuestionBody&quot;,<br>      answ.Score &quot;AnswerScore&quot;,<br>      q.Score &quot;QuestionScore&quot;,<br>      answ.CreationDate &quot;AnswerDate&quot;,<br>      q.CreationDate &quot;QuestionDate&quot;<br>    FROM<br>      Posts answ JOIN Posts q on q.Id = answ.ParentId<br>    WHERE<br>      answ.PostTypeID =  2 AND answ.OwnerUserId = <a href="http://twitter.com/UserID">@UserID</a><br>    ORDER BY answ.Score DESC</pre><p>The user id can be passed as a parameter</p><p><strong>How to get your user id</strong></p><p>To get the user id you can go to stackoverflow and click on the profile icon on top after the search bar. That would set your user id in the search bar and direct you to the activities page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k3beUYAmqaRb6kl8ty0KQ.png" /><figcaption>stackoverflkow activities page</figcaption></figure><p>the above example has <strong>1898494 </strong>as user id</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8e4b58d4a40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Discrete time crystals]]></title>
            <link>https://sarathsp06.medium.com/understanding-discrete-time-crystals-d3a22307a18c?source=rss-d104fc16bdaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a22307a18c</guid>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[explanation]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[time]]></category>
            <dc:creator><![CDATA[Sarath Sadasivan Pillai]]></dc:creator>
            <pubDate>Sun, 09 Sep 2018 12:47:30 GMT</pubDate>
            <atom:updated>2018-09-09T13:04:40.123Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8GUW0qYowMMZd_DI" /><figcaption>“round white and brown wall clock” by <a href="https://unsplash.com/@srikanta?utm_source=medium&amp;utm_medium=referral">Srikanta H. U</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Discrete time crystals</h3><p>Crystals are a manifestation of systems in their lowest energy states. While normal crystals have spatial symmetry, discrete time crystals are strange crystals that have an atomic structure that repeats not just in space, but in time, putting them in constant oscillation without energy.</p><p><strong>Is it real?<br></strong>It might seem pretty abstract as all we know about matter and it states is defined in terms of equilibrium, spatial symmetry etc</p><blockquote>“This is a new phase of matter, period, but it is also really cool because it is one of the first examples of non-equilibrium matter,” said lead researcher Norman Yao from the University of California, Berkeley.</blockquote><p>Usually, when a material is in the ground state it means movement should theoretically be impossible because that would require it to expend energy and it doesn’t have any. Normal crystals are motionless because they’re in equilibrium in their ground state, But time crystals have a structure that repeats in time, not just in space. And it keeps oscillating in its ground state.<br>A time crystal is like constantly oscillating jelly in its natural, ground state, and that’s what makes it a whole new phase of matter — non-equilibrium matter. <strong><em>It’s incapable of sitting still.</em></strong></p><p><strong>What is next ?</strong></p><p><strong>A perfect clock </strong>:If you have a quartz clock, it tells the time because when you push electricity through a quartz crystal, it vibrates. Count 32,768 vibrations and one second has gone past. The important thing is that this vibration requires energy (in this case from electricity). Time crystals oscillates just like quartz crystals without energy</p><p><strong>Better quantum computer : </strong>One of the most promising applications for time crystals is quantum computing — they could allow physicists to create stable quantum systems at far higher temperatures than can be achieved right now, and that just might be the push we need <a href="https://www.sciencealert.com/ibm-is-rolling-out-the-world-s-first-universal-quantum-computing-service">to finally make quantum computing a reality</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a22307a18c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>