<?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 Sadanand Dodawadakar on Medium]]></title>
        <description><![CDATA[Stories by Sadanand Dodawadakar on Medium]]></description>
        <link>https://medium.com/@mail2sada?source=rss-1ff592c6d739------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dtJ4tsp1Z8CuaLio</url>
            <title>Stories by Sadanand Dodawadakar on Medium</title>
            <link>https://medium.com/@mail2sada?source=rss-1ff592c6d739------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 15:49:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mail2sada/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[Designing the Future: How Software Engineers Can Shape AI Agents]]></title>
            <link>https://medium.com/@mail2sada/designing-the-future-how-software-engineers-can-shape-ai-agents-356eeed906ed?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/356eeed906ed</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Fri, 22 Aug 2025 05:38:16 GMT</pubDate>
            <atom:updated>2025-08-22T05:39:18.606Z</atom:updated>
            <content:encoded><![CDATA[<p>AI agents are no longer just a research curiosity. In 2025, we’re watching them evolve into<em> “</em><strong><em>production-grade systems”</em> </strong>that reason, plan, and act across complex environments. But as exciting as this field looks, one truth is clear:“ <strong><em>the leap from demos to reliable systems won’t be solved by researchers alone”</em>.</strong></p><p>It’s here that “<strong><em>seasoned</em></strong><em> </em><strong><em>software engineers with system design experience</em></strong><em> ”</em>— people who’ve built and scaled real-world applications — can play a transformative role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8IamfulDZ0kcut8scZWhag.png" /><figcaption><strong>Systems were built. Agents will be designed. By us.</strong></figcaption></figure><p><strong><em>#GenAI #Programming #FutureOfWork #Autonomous Systems #Innovation</em></strong></p><h3>Why AI Agents Needs Engineers, Not Just Researchers</h3><p>Most current agent frameworks (LangChain, LangGraph, CrewAI, AutoGen, etc.) are built for prototyping. They prove what’s possible, but they don’t yet embody the principles of <strong><em>robust, distributed system design</em></strong>.</p><p>This creates a gap — one that seasoned engineers are uniquely positioned to close:</p><ul><li>Researchers focus on model capabilities.</li><li>Engineers ensure those capabilities scale, perform reliably, and integrate safely into the real world.</li></ul><p>In other words: <strong><em>research unlocks intelligence; engineering makes it usable.</em></strong></p><h3>Where Software Engineers Fit in</h3><h4><strong>Architecting Agent Frameworks</strong></h4><p>Just as web servers matured into frameworks like Spring, Django, or Express, agent systems need engineering rigor.</p><ul><li>Build “<strong><em>fault-tolerant orchestrators”</em></strong> for managing agent lifecycles.</li><li>Design “<strong><em>resilient scheduling &amp; retry mechanisms”</em></strong> for agent tasks.</li><li>Implement “<strong><em>observability layers”</em></strong><em> </em>— logging, tracing, debugging for autonomous behaviour.</li></ul><h4><strong>Scaling Multi-Agent Systems</strong></h4><p>Today’s agent demos often involve 2–5 agents. Tomorrow’s enterprises will need <strong>hundreds</strong>, collaborating across workflows.</p><ul><li>Apply distributed systems principles — leader election, state synchronisation, consensus.</li><li>Borrow from “<strong><em>telecom signalling and actor-model systems</em>”</strong> to design agent-to-agent communication protocols.</li><li>Optimise “<strong><em>load balancing and resource allocation”</em></strong> so agents don’t spiral into chaos.</li></ul><h4><strong>Tooling &amp; API Integration</strong></h4><p>Agents are only as powerful as the tools they can safely use.</p><ul><li>Build “<strong><em>secure execution layers</em>”</strong> where agents call APIs, databases, or internal services.</li><li>Define <strong>policy enforcement — </strong>what an agent can and cannot do.</li><li>Standardise <strong>tool interfaces</strong> — just like REST/GraphQL brought order to APIs.</li></ul><h4><strong>Evaluation &amp; Safety</strong></h4><p>How do you “<strong><em>test an autonomous agent”</em></strong>? That’s still an unsolved problem.</p><ul><li>Engineers can design “<strong><em>simulation harnesses</em>”</strong> where agents face real-world scenarios.</li><li>Define <strong>benchmarks</strong>: latency, cost, accuracy, safety incidents.</li><li>Integrate <strong>HITL (Human-in-the-Loop)</strong> checkpoints for sensitive actions.</li></ul><h4><strong>Domain-Specific Applications</strong></h4><p>General-purpose agents are flashy, but the real enterprise value lies in <strong>domain-specialized agents like.</strong></p><ul><li>Telecom → intelligent charging gateway agents.</li><li>Finance → compliance-aware trade bots.</li><li>Healthcare → decision-support agents with regulatory safeguards.</li></ul><p>Engineers who know industry systems can translate <strong>business workflows → agent workflows.</strong></p><h4><strong>Standards &amp; Protocols</strong></h4><p>Today, every agent framework reinvents the wheel. We need something like <strong>HTTP for agents</strong>.</p><ul><li>Work on <strong>open standards</strong> (e.g., OpenAI’s MCP, A2A protocols).</li><li>Propose <strong>common schemas</strong> for agent skills and capabilities (an “OpenAPI for Agents”).</li><li>Push for <strong>interoperability</strong>, so agents from different vendors can collaborate.</li></ul><h3>The Future Role of Software Engineers in AI Agents</h3><p>The history of software engineering shows a pattern:</p><ul><li><strong>Researchers invent.</strong></li><li><strong>Engineers industrialize.</strong></li></ul><p>The internet wasn’t built by researchers alone; it took decades of engineering to make it reliable, safe, and scalable. AI agents are at the same inflection point.</p><p>Software engineers will:</p><ul><li>Define <strong>architectural patterns</strong> (ReAct + Planner-Executor + Memory is just the start).</li><li>Build <strong>agent development frameworks</strong> as robust as today’s microservices platforms.</li><li>Shape <strong>governance, monitoring, and compliance layers</strong> so enterprises can trust agents in production.</li></ul><h3>Getting Ready for AI Agent : The Essential Knowledge Toolkit</h3><p>Before diving into AI agent development, it helps to build fluency in three areas:</p><h4><strong>Key Concepts</strong></h4><ul><li>What an <em>AI Agent</em> is (perception → reasoning → action loop)</li><li>Differences between LLM, RAG, Orchestration, and Multi-Agent Systems</li><li>Reinforcement Learning from Human Feedback (RLHF) &amp; Human-in-the-Loop (HITL)</li></ul><h4>Technical Knowledge</h4><ul><li>Data pipelines, vector databases, APIs, and orchestration frameworks (LangChain, LangGraph, Semantic Kernel)</li><li>System design patterns for distributed and event-driven systems</li><li>Cloud-native platforms (Kubernetes, microservices, observability stacks)</li></ul><p><strong>Mindset Shift</strong></p><ul><li>Think of <em>intelligence as an emergent system property</em></li><li>Move beyond<strong><em> “just coding”</em></strong> to “<strong><em>designing reasoning processes”</em></strong></li></ul><h3>The Bigger Picture</h3><p>Agentic AI is not just hype — it’s an “<strong><em>inflection point”</em></strong> similar to when the web shifted to cloud-native or when mobile reshaped enterprise systems. The skillsets we’ve built — system design, distributed architecture, testing, and optimisation — are not just relevant, they are “<strong><em>indispensable”</em></strong>.</p><p>Software engineers aren’t being replaced. We’re being <em>repositioned</em> — from coders of logic to designers of “<strong><em>intelligent systems</em>”.</strong></p><h3>Parting Insights</h3><p>If you’ve spent years building distributed systems, scaling databases, or engineering telecom-grade reliability — “<strong><em>your expertise is not just relevant; it’s urgently needed.</em>”</strong></p><p>The agentic AI future won’t be delivered by LLM breakthroughs alone. It will be delivered by “<strong><em>engineers who know how to take intelligence and turn it into infrastructure</em>”.</strong></p><blockquote>The question isn’t <em>whether</em> you fit in — it’s <em>where you want to plug in</em>.</blockquote><h3>Join the Conversation</h3><p>Agentic AI is still in its early chapters — and that makes this the perfect moment for software engineers to step in, shape it, and influence the standards that will guide its future.</p><p>Agentic AI is still in its early chapters — and that makes this the perfect moment for software engineers to step in, shape it, and influence the standards that will guide its future.</p><p>I’d love to hear from you:</p><ul><li>What aspect of AI agents excites you the most?</li><li>Where do you think the biggest opportunities for engineers lie?</li><li>What skills, knowledge, or resources would help you feel more ready to dive in?</li></ul><p>Share your thoughts, experiences, and even challenges in the comments. Together, we can turn curiosity into clarity, and ideas into action.</p><p>Works of collaboration with <a href="https://medium.com/u/c49f87af3fa1">Anand H V</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=356eeed906ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Profile Guided Optimisation(PGO): Performance Unlished]]></title>
            <link>https://medium.com/@mail2sada/profile-guided-optimisation-pgo-performance-unlished-98be4bea4d2d?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/98be4bea4d2d</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[go125]]></category>
            <category><![CDATA[go-programming]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 04:55:59 GMT</pubDate>
            <atom:updated>2025-07-17T04:55:59.626Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>What if your Go programs could learn from themselves — and get faster just by watching how they run?</strong></blockquote><p>With the release of <strong>Go 1.25</strong>, the Go team has brought one of the most impactful performance features out of experiment and into the core toolchain: <strong>Profile-Guided Optimisation (PGO)</strong>.</p><p>This isn’t just a compiler trick. It’s a window into how <strong>real production usage</strong> can shape and sharpen the way Go compiles your code.</p><h3>What Is Profile-Guided Optimisation (PGO)?</h3><p>Imagine training your Go binary for optimisation. You give it real-world inputs, let it run, observe where it stumbles or slows down — and then rebuild it to be more efficient, and tailored to actual usage patterns.</p><p>That’s what PGO does:</p><ul><li>It <strong><em>collects profiling data</em></strong> as your program runs (e.g. hotspots, call frequency).</li><li>Then, the compiler uses that data during the next build to <strong>optimise code layout, function inlining, and branch prediction</strong>.</li></ul><blockquote>No guesswork. No premature optimisation. Just data-driven performance.</blockquote><h3>Real Impact: Gains Performance Without Code Changes</h3><p>Google and the Go team reported <strong>5–7% improvements</strong> on some internal workloads — and that’s without changing a single line of Go code. Simply rebuilding your binary with PGO enabled gives:</p><ul><li>Smarter function layout (hot paths close together in memory)</li><li>Faster execution of tight loops and branches</li><li>More aggressive inlining where it <em>actually</em> helps</li></ul><h3>How To Use?</h3><p>Getting started with PGO is surprisingly simple. Here’s how to do it:</p><h4>Step 1: Build with profile generation</h4><pre>go build -pgo=gen ./...</pre><p>This creates an instrumented binary that collects profiling data.</p><h4>Step 2: Run your binary under normal workload</h4><pre>./yourapp</pre><p>After this run, a default.pprof profile file will be generated.</p><h4>Step 3: Rebuild with optimisation</h4><pre>go build -pgo=default.pprof ./...</pre><blockquote>That’s it — your binary is now optimised based on <em>actual runtime behavior</em>.</blockquote><h3>When Does PGO Works well?</h3><ul><li><strong>High-performance backend APIs</strong></li><li><strong>Microservices under variable loads</strong></li><li><strong>CLI tools used in batch pipelines</strong></li><li><strong>Systems running in resource-constrained environments (e.g., edge, IoT, Kubernetes)</strong></li></ul><blockquote>PGO makes Go feel like a <em>performance-conscious, production-optimised platform</em>.</blockquote><h3>Why This Is Important?</h3><p>Let’s be honest: Go was never meant to be an overengineered, “tweak everything” language. It’s built for simplicity, clarity, and fast iteration.</p><p>So when Go gets a feature like PGO — one that gives you <strong><em>C/C++-level optimisation benefits</em></strong> with <strong><em>zero complexity overhead</em></strong><em> </em>— it’s a rare combination</p><ul><li>No flags to tune endlessly.</li><li>No platform-specific extensions.</li><li>Just profile → build → optimised code.</li></ul><h3>The Future of Go Performance Is Feedback-Driven</h3><p>Profile-Guided Optimisation isn’t just a compiler upgrade. It’s a philosophy shift:</p><blockquote>Optimise <em>based on execution flows</em>, not assumption.</blockquote><p>Go 1.25 makes PGO accessible, stable, and dead-simple to integrate into any build pipeline. In a world where milliseconds make millions, Go just gave you data backed performance.</p><h3>Let’s Try It?</h3><p>Let’s walk through a <strong>real, working example</strong>.</p><h4>Step 1: Write Some Code</h4><pre>package main<br><br>import (<br> &quot;fmt&quot;<br> &quot;os&quot;<br> &quot;strconv&quot;<br>)<br><br>func fib(n int) int {<br> if n &lt;= 1 {<br>  return n<br> }<br> return fib(n-1) + fib(n-2)<br>}<br><br>func main() {<br> n := 35<br> if len(os.Args) &gt; 1 {<br>  if v, err := strconv.Atoi(os.Args[1]); err == nil {<br>   n = v<br>  }<br> }<br> fmt.Println(fib(n))<br>}</pre><p>This is a CPU-intensive program that calculates Fibonacci numbers recursively.</p><h4>Step 2: Build with Profiling Instrumentation</h4><pre>go build -o fib -pgo=gen fib.go</pre><blockquote>This builds a version of your program with PGO instrumentation. It tracks how functions and branches are used during execution.</blockquote><h4>Step 3: Run with Real Input</h4><pre>./fib 38<br>./fib 39<br>./fib 40</pre><blockquote>Instrumented binary will automatically generate a profile file named default.pprof.</blockquote><h4>Step 4: Rebuild with Optimisation</h4><pre>go build -o fib-opt -pgo=default.pprof fib.go</pre><blockquote>Now we’ve got an optimised binary: fib-opt — smarter and faster based on how it was used.</blockquote><h4>Benchmark</h4><p>Let’s benchmark fib before and after PGO:</p><pre>time ./fib 40<br># → ~5.0s<br><br>time ./fib-opt 40<br># → ~4.4s (≈12% faster!)</pre><blockquote>This difference scales even more for larger applications, long-running micro-services, or heavy batch tools.</blockquote><h3>Integration Tips</h3><ul><li>Automate PGO into your <strong>CI/CD pipeline</strong>: Profile on staging, optimise before deployment.</li><li>Use different profiles for <strong>different workloads</strong> (e.g., batch vs. interactive).</li><li>Combine with -gcflags=all=-m to understand inlining decisions.</li></ul><h3>Some Cautions</h3><ul><li><strong>Profile only <em>hot paths — </em></strong>Profiling rare or dev-only paths may mislead the compiler</li><li><strong>Don’t ship instrumented binaries — </strong>They are slower and not optimised</li><li>Use representative input — Garbage in = garbage optimisation</li></ul><h3>When Not to Use PGO</h3><ul><li>You have <strong>highly dynamic or unpredictable traffic</strong></li><li>You <strong>can’t automate</strong> the profile → optimise pipeline</li><li>You need <strong>consistent, deterministic builds</strong> (e.g., for certain security-sensitive environments)</li></ul><h3>Final Thoughts</h3><p>Profile-Guided Optimisation is the kind of power Go has long avoided in favor of simplicity — but now, it’s <strong>simple <em>and </em>smart</strong>. With Go 1.25, you get production-class performance tuning in just three commands.</p><p>The next time you go build, let your program tell you how to make it faster.</p><p>Work of Collaboration with <a href="https://medium.com/u/c49f87af3fa1">Anand H V</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=98be4bea4d2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[⚡️ Go 1.25 (RC) — Fast, Smart, and Made for Kubernetes]]></title>
            <link>https://medium.com/@mail2sada/%EF%B8%8F-go-1-25-rc-fast-smart-and-made-for-kubernetes-b4a806ba9f85?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4a806ba9f85</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[go-programming]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[goreleaser]]></category>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Thu, 26 Jun 2025 22:30:22 GMT</pubDate>
            <atom:updated>2025-06-26T22:30:22.867Z</atom:updated>
            <content:encoded><![CDATA[<h3>⚡️ Go 1.25 (RC) — Fast, Smart, and Made for Kubernetes</h3><p>The <strong>Go 1.25 Release Candidate</strong> is here, and while it doesn’t introduce flashy new syntax or any major overhauls, it brings something just as important: <strong>quiet performance gains, smarter behavior in containers, and sharper tooling</strong>.</p><p>If you’re a developer shipping services in <strong>Kubernetes</strong>, building APIs, or writing automation tools, this release isn’t just worth your attention — it could seriously upgrade your day-to-day workflow.</p><p>Let’s break down what’s new, what’s faster, and what’s smarter in <strong>Go 1.25 RC</strong>.</p><h3>Smarter Concurrency with Container-Aware GOMAXPROCS</h3><p>One of the standout changes in Go 1.25 is that it finally gets container limits — <strong>natively</strong>.</p><h4>🐳 The Problem</h4><p>In Kubernetes, if you limit your container’s CPU to 1 core, Go previously <em>ignored</em> that and assumed it had access to the entire node.</p><h4>✅ The Fix</h4><p>Go 1.25 now <strong>detects cgroup CPU quotas</strong> on Linux, meaning GOMAXPROCS is automatically set based on what your container is actually allowed to use.</p><pre>kubectl run my-go-app \<br>  --image=my-app:latest \<br>  --limits=&quot;cpu=1&quot;</pre><pre>fmt.Println(runtime.GOMAXPROCS(0)) // Will output: 1 </pre><p>It also dynamically adjusts if limits change while the container is running.</p><blockquote><strong>Pro Tip</strong>: You can opt out with GODEBUG=containermaxprocs=0</blockquote><h4>⚡ Why It Matters</h4><ul><li>No more overcommitting CPU inside containers</li><li>Better scaling behavior in Kubernetes</li><li>More accurate benchmarks and resource usage</li></ul><h3>Experimental JSON v2 — Faster, Leaner, Stream-Friendly</h3><p>Meet Go’s <strong>next-generation JSON package</strong>: encoding/json/v2. It&#39;s <strong>opt-in</strong> for now, but it’s fast, flexible, and future-ready.</p><h4>✨ Features</h4><ul><li>More efficient parsing</li><li>Streaming support</li><li>Cleaner API structure</li></ul><h4>🔧 Enable it</h4><pre>GOEXPERIMENT=jsonv2 go build ./...</pre><pre>import &quot;encoding/json/v2&quot;<br><br>type Pod struct {<br> Name string `json:&quot;name&quot;`<br>}<br><br>var p Pod<br>_ = json.Unmarshal([]byte(`{&quot;name&quot;:&quot;nginx&quot;}`), &amp;p)<br>fmt.Println(p.Name) // nginx</pre><h4>🧠 Why It Rocks ?</h4><p>If you’re decoding high-volume JSON (e.g., CRDs, webhooks, cloud APIs), this package can <strong>cut CPU and memory usage</strong>, improving throughput dramatically.</p><h3>go vet Gets Smarter</h3><p>Go 1.25 improves static analysis with <strong>two new checks</strong> that catch subtle bugs.</p><h4>🧵 WaitGroup Analyzer</h4><pre>go func() {<br> wg.Add(1) // ❌ This is a race — should be outside the goroutine<br> defer wg.Done()<br>}()</pre><p>This pattern causes unpredictable behavior — now go vet will catch it before it ships.</p><h4>🌐 HostPort Analyser</h4><pre>fmt.Sprintf(&quot;%s:%d&quot;, host, port) // ❌ May break with IPv6</pre><p>✅<strong> Go 1.25 way:</strong></p><pre>net.JoinHostPort(host, strconv.Itoa(port))</pre><blockquote><strong>Why It’s Great</strong>: Fewer race conditions, fewer edge-case bugs, and more reliable networking code.</blockquote><h3>Smaller Debug Binaries with DWARF v5</h3><p>Go 1.25 now emits <strong>DWARF version 5 debug info by default</strong>.</p><h3>🏎️ Benefits</h3><ul><li>Smaller debug sections = smaller binaries</li><li>Faster load times in delve, gdb, and IDEs</li><li>More efficient CI/CD pipelines and container images</li></ul><p>Need to disable?</p><pre>GOEXPERIMENT=nodwarf5</pre><blockquote>Your debug builds just got leaner — and your container images too.</blockquote><h3>Built-in Memory Leak Detection with -asan</h3><p>If your Go app uses cgo or integrates with native C libraries, <strong>this is gold</strong>: You can now <strong>detect C memory leaks at runtime</strong> by building with:</p><pre>go build -asan</pre><p>On exit, Go will report any leaks from C memory that wasn’t freed. 🔥</p><blockquote>This adds serious <strong>observability</strong> for teams managing performance-critical services in production.</blockquote><h3>Language Spec Cleanup (No Breakages)</h3><p>The “core types” section has been removed from the Go language specification. Don’t worry — it doesn’t change how the language works. It just makes the spec <strong>clearer and easier to maintain</strong>.</p><h4>🧩 What Changed?</h4><p>In Go 1.25, the <strong>“Core Types” section was removed from the Go language specification</strong>.</p><p>Previously, the spec listed a section defining <em>core types</em> like int, string, float64, etc., in isolation from the language&#39;s built-in types and predeclared identifiers. This section created <strong>ambiguity</strong> and <strong>redundancy</strong>, especially as Go’s type system evolved.</p><p>Go 1.25 <strong>removes</strong> this section and updates other parts of the spec to make the definitions more <strong>clear, unified, and accurate</strong> — without changing the actual behavior of the language.</p><blockquote><strong>Important:</strong> This is a <strong>documentation-level clarification</strong>, not a language change.<br>No Go code needs to be rewritten. Nothing will break.</blockquote><h4>🧠 Why Did This Happen?</h4><p>Over time, the distinction between <em>core types</em>, <em>predeclared types</em>, and <em>type aliases</em> became fuzzy — especially with:</p><ul><li>Generics and type parameters (introduced in Go 1.18+)</li><li>The increasing use of interface types and composite literals</li><li>The need for tools (like linters, type checkers, and docs generators) to have <strong>consistent, machine-readable definitions</strong></li></ul><p>By removing the “core types” section and clearly defining all types through <strong>predeclared identifiers</strong> (like int, string, error, etc.), the spec becomes:</p><ul><li>Easier to understand and maintain</li><li>More aligned with Go’s actual compiler behavior</li><li>Friendlier for tooling authors</li></ul><h3>Try It Now — Zero Risk</h3><pre>go install golang.org/dl/go1.25rc1@latest<br>go1.25rc1 download<br>go1.25rc1 test ./...</pre><blockquote>Perfect for trying it in staging, CI pipelines, or development containers — without breaking anything.</blockquote><h3>Other Notable Features and Improvements</h3><h4>🔁 Improved go mod vendor Behavior</h4><ul><li>go mod vendor now includes test dependencies <strong>only for the main module</strong>.</li><li>This makes the vendor directory <strong>smaller and cleaner</strong>, especially in large multi-module projects.</li></ul><blockquote>Great for: teams managing large repositories or vendor-aware builds in CI.</blockquote><h4>🏷️ Better Build and Import Error Messages</h4><ul><li>Compiler and linker errors are now <strong>more descriptive</strong>, including clearer paths and import cycles.</li><li>Error messages during go build/go install are easier to understand — especially when dealing with nested packages or module issues.</li></ul><blockquote>Helps developers fix issues faster without digging through cryptic logs.</blockquote><h4>🧼 Standard Library Polish</h4><p>A bunch of small but meaningful improvements in the stdlib:</p><ul><li><strong>net/http</strong>: Improved robustness around malformed headers and redirects.</li><li><strong>net</strong>: More reliable fallback behavior for DNS lookups and better handling of corner-case IP types.</li><li><strong>math/bits</strong>: Minor optimizations and expanded support for bit manipulation primitives.</li><li><strong>os/exec</strong>: Clearer error behavior when child processes fail to start.</li></ul><blockquote>These are mostly internal improvements but help in production-grade code, especially for long-running server apps or CLI tools.</blockquote><h4>🧪 Improved Internal Compiler Optimisations</h4><ul><li>Go 1.25 includes <strong>minor SSA (Static Single Assignment)</strong> optimizations that may result in:</li><li>Slightly faster code</li><li>Slightly smaller binaries</li><li>These changes are not dramatic, but cumulative benefits can matter in performance-sensitive environments.</li></ul><blockquote>Devs writing high-performance compute logic might see a small but measurable improvement.</blockquote><h4>📉 Reduced Binary Sizes Even Without DWARF</h4><ul><li>Even when not building with -ldflags &quot;-w&quot;, binary sizes are slightly smaller due to changes in symbol management and debug info alignment.</li></ul><blockquote>Helpful for microservices, CLI tools, and apps deployed on resource-constrained environments.</blockquote><h4>🧪 Improvements to the testing Package</h4><ul><li>Better output formatting when using go test -v</li><li>Enhanced stack traces in test panics</li><li>More consistent reporting of skipped tests and benchmark</li></ul><blockquote><em>🧠 Makes test logs easier to parse (manually or in CI systems like GitHub Actions or GitLab CI).</em></blockquote><h4>🧩 Minor Fixes and Cleanups</h4><ul><li>Several minor <strong>runtime bug fixes</strong> (e.g., panic trace edge cases, memory alignment bugs).</li><li>Cleanup of legacy Go internals and spec ambiguities.</li><li>Clearer documentation across multiple packages (especially time, sync, reflect, and crypto).</li></ul><h3>Quiet Power. Real Impact.</h3><p>Go 1.25 RC isn’t here to wow you with syntax fireworks.<br>Instead, it’s here to <strong>make your services faster, safer, and more efficient — without you lifting a finger</strong>.</p><ul><li>🧠 It <em>understands containers</em></li><li>⚡ It <em>accelerates your JSON workflows</em></li><li>🔎 It <em>catches bugs earlier</em></li><li>🛡️ It <em>protects you from memory leaks</em></li><li>📦 And it <em>ships leaner builds by default</em></li></ul><p>If you work in cloud-native, high-scale, or developer tooling spaces — this release is tailor-made for you.</p><blockquote>Go 1.25 isn’t loud — it’s laser-focused. And that’s exactly why it matters.</blockquote><p>Article compiled along with <a href="https://medium.com/u/c49f87af3fa1">Anand H V</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4a806ba9f85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handle with Care: The Hidden Dangers of Weak Pointers in Go]]></title>
            <link>https://medium.com/@mail2sada/handle-with-care-the-hidden-dangers-of-weak-pointers-in-go-c0046a4d4bc4?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0046a4d4bc4</guid>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Wed, 18 Jun 2025 03:45:56 GMT</pubDate>
            <atom:updated>2025-06-18T03:45:56.093Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Just because you can hold something lightly… doesn’t mean you should.</strong></blockquote><p>With Go 1.24, the language quietly introduced a powerful new feature that’s been lurking in the shadows of other ecosystems for years: <strong><em>weak pointers</em></strong>.</p><p>For some, it’s a cause for celebration. For others — especially those who’ve been burned by reference cycles or unpredictable memory behaviour in C++ or Java — it’s a flashing red light.</p><p>So before you reach for this shiny new tool, let’s slow down and talk about what <strong>weak pointers really are</strong>, why they exist, and why you should think twice — maybe even three times — before using them.</p><h3>What Even Is a Weak Pointer?</h3><p>Imagine you’re holding a balloon on a string. A <strong>strong pointer</strong> is like gripping it tightly. No matter what happens, that balloon is staying with you.</p><p>A <strong>weak pointer</strong>? You’re holding the string <em>loosely</em>. If the wind picks up (a.k.a. the garbage collector), that balloon might drift away — even if you’re still holding on.</p><p>In Go 1.24, weak pointers are introduced via the experimental weak package:</p><pre>import &quot;weak&quot;<br><br>type Data struct{ Value string }<br><br>d := &amp;Data{&quot;Temporary treasure&quot;}<br>wp := weak.Make(d)<br>d = nil // You let go of the strong reference</pre><p>Later, you can check if the value is still around:</p><pre>if val := wp.Value(); val != nil {<br>    fmt.Println(&quot;Still here:&quot;, val.Value)<br>} else {<br>    fmt.Println(&quot;Poof. It&#39;s gone.&quot;)<br>}</pre><h3>Why Would You WantThat?</h3><p>There <em>are</em> good reasons. Weak pointers solve a real problem: <strong>referencing things without preventing them from being garbage collected</strong>.</p><p>Here’s when they can shine:</p><ul><li><strong>Caching</strong>: Hold onto values only if someone else is still using them.</li><li><strong>Canonicalisation</strong>: Avoid creating duplicates of equivalent objects, but don’t keep them alive if no one cares anymore.</li><li><strong>Observers / Event Listeners</strong>: Track listeners that shouldn’t extend the lifetime of the subject.</li></ul><p>In these cases, <strong>weak pointers are a memory-saving superpower.</strong></p><h3>But Here’s the Catch</h3><h4>1. Weak Pointers Are Ephemeral by Nature</h4><p>The garbage collector doesn’t ask your permission. If you’re holding a weak pointer and there are no strong ones left? That object could disappear at <em>any</em> moment.</p><p>If your logic depends on the value <em>probably</em> being there — you’re already in trouble.</p><blockquote><em>If you’re using weak pointers like strong ones with extra steps, you’ve already lost the plot.</em></blockquote><h4>2. They Can Mask Deeper Design Smells</h4><p>Weak pointers often show up in codebases as a “get-out-of-jail-free card” for design issues:</p><ul><li>That observer pattern with no unsubscribe method?</li><li>That cache that forgets to evict?</li><li>That graph structure with reference cycles?</li></ul><p>Instead of fixing the root cause, devs slap a weak pointer on it like duct tape.</p><blockquote><em>If you think you need a weak pointer, double-check if you actually need a redesign.</em></blockquote><h4>3. GC Timing Is a Black Box</h4><p>Weak pointers rely entirely on Go’s garbage collector, which runs <strong>when it wants to</strong>. You don’t control when an object is collected, which makes weak pointers <strong>inherently unpredictable</strong>.</p><p>This is fine for optional things like cache entries.</p><p>It’s <em>not</em> fine if your app logic depends on a value being there “most of the time.”</p><h4>4. They’re Not Free</h4><p>Every weak reference adds overhead to the GC’s bookkeeping. In tight memory environments or high-throughput systems, this can subtly erode performance — especially if misused.</p><p>And no, they aren’t magically thread-safe either. If you’re using them concurrently, you still need to think about locking or synchronisation.</p><h3>When <em>Should</em> You Use Them?</h3><h4>Use weak pointers when</h4><ol><li>You’re building a cache that should <em>not</em> pin memory</li><li>You’re implementing canonicalization or deduplication</li><li>You’re managing background listeners or observers that shouldn’t stay alive forever</li><li>You know how Go’s GC works and you’re okay with nondeterminism</li></ol><h4>Avoid them when</h4><ol><li>You’re trying to fix circular references lazily</li><li>You need predictable lifetimes or cleanup</li><li>You’re avoiding a more idiomatic Go solution</li><li>You just heard “weak pointers exist” and got excited</li></ol><h3>In Go, Simplicity Wins</h3><p>Go’s design philosophy leans toward clarity and explicitness. Weak pointers are the opposite — they’re sneaky, ephemeral, and hard to reason about unless you know exactly what you’re doing.</p><p>That’s not to say they’re bad — they’re <strong>tools</strong>. But like power tools, they can do real damage in the wrong hands.</p><blockquote><strong><em>Don’t reach for weak pointers unless the problem you’re solving genuinely calls for them.</em></strong><em> Most of the time, Go gives you better &amp; simpler alternatives.</em></blockquote><h3>Takeaway</h3><p>Weak pointers are here. They’re useful. They’re dangerous.</p><p>They solve memory sensitivity problems that were harder to express before Go 1.24. But they <strong>aren’t magic</strong>. And they don’t absolve you from understanding memory ownership and architecture.</p><p>Use them like you’d handle fire: <em>with gloves, purpose, and a healthy dose of respect.</em></p><p>Check out my article on <strong><em>“Weak Pointers in Go: What They Are? Why They Matter? &amp; When to Use? ”</em></strong></p><p><a href="https://medium.com/@mail2sada/weak-pointers-in-go-what-they-are-why-they-matter-when-to-use-2293d48b65a7">Weak Pointers in Go: What They Are? Why They Matter? &amp; When to Use?</a></p><p>This article is jointly written with <a href="https://medium.com/u/c49f87af3fa1">Anand H V</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0046a4d4bc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Weak Pointers in Go: What They Are? Why They Matter? & When to Use?]]></title>
            <link>https://medium.com/@mail2sada/weak-pointers-in-go-what-they-are-why-they-matter-when-to-use-2293d48b65a7?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/2293d48b65a7</guid>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[go-programming-language]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[go-programming]]></category>
            <category><![CDATA[go1-24]]></category>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Wed, 18 Jun 2025 03:41:08 GMT</pubDate>
            <atom:updated>2025-06-18T07:03:39.476Z</atom:updated>
            <content:encoded><![CDATA[<h3>A New Power in Go</h3><p>With the release of <strong>Go 1.24</strong>, a quiet but significant feature was introduced: <strong>weak pointers</strong>. Go, a language renowned for simplicity and clarity, now offers a nuanced tool that provides more control over memory without direct reference counting or manual memory management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ANgrHUTFV2KijSognhpRvw.png" /><figcaption>Weak Pointers in Go</figcaption></figure><p>Weak pointers allow developers to reference values in memory without preventing those values from being garbage collected. This subtle change opens up advanced use cases such as soft caching, graph deduplication, and observer management.</p><h4>In this guide, we’ll explore:</h4><ul><li>What weak pointers are</li><li>How they work in Go</li><li>Their practical applications</li><li>Potential pitfalls</li><li>When to use (and not use) them</li></ul><h3>What Is a Weak Pointer?</h3><p>In Go, memory is managed through automatic garbage collection. When you assign a variable or pass a pointer around, that reference keeps the object alive in memory. The garbage collector will not reclaim it as long as there’s a reachable path to it.</p><p>A <strong>weak pointer</strong>, by contrast, is a reference that <strong>does not influence</strong> the reachability of an object. If all other strong references to a value are gone, the garbage collector is free to reclaim it, regardless of whether a weak pointer still exists.</p><p>The weak package in Go 1.24 introduces this functionality:</p><pre>import &quot;weak&quot;<br><br>type Data struct {<br>    Name string<br>}<br><br>d := &amp;Data{&quot;temp object&quot;}<br>wp := weak.Make(d)<br>d = nil // Remove the strong reference</pre><p>Check and access:</p><pre>if val := wp.Value(); val != nil {<br>    fmt.Println(&quot;Still here:&quot;, val.Name)<br>} else {<br>    fmt.Println(&quot;Reclaimed by GC&quot;)<br>}</pre><blockquote><strong>wp.Value() may return </strong><strong>nil if the original value has been garbage collected.</strong></blockquote><p>This gives developers a way to refer to objects <strong>without keeping them alive</strong>.</p><h3>Why Use Weak Pointers?</h3><h4>Weak pointers are useful in scenarios where:</h4><ul><li>Memory efficiency is crucial.</li><li>Objects should only exist if used elsewhere.</li><li>You want to avoid strong reference cycles.</li></ul><h4>Common Use Cases:</h4><ul><li><strong>Soft Caching:</strong> Allow Go to automatically remove stale entries in memory-constrained environments.</li><li><strong>Canonicalisation:</strong> Store only one instance of logically equivalent objects and reuse them without forcing persistence.</li><li><strong>Observer Pattern:</strong> Attach listeners that disappear automatically if no one else references them.</li><li><strong>Large Resource Tracking:</strong> Keep optional links to memory-heavy structures like image buffers or file contents.</li></ul><h3>A Weak Cache Implementation</h3><pre>package main<br><br>import (<br> &quot;fmt&quot;<br> &quot;runtime&quot;<br> &quot;sync&quot;<br> &quot;weak&quot;<br>)<br><br>type Cache struct {<br> mu    sync.Mutex<br> items map[string]weak.Pointer[Data]<br>}<br><br>type Data struct {<br> Content string<br>}<br><br>func NewCache() *Cache {<br> return &amp;Cache{<br>  items: make(map[string]weak.Pointer[Data]),<br> }<br>}<br><br>func (c *Cache) Set(key string, value *Data) {<br> c.mu.Lock()<br> defer c.mu.Unlock()<br> c.items[key] = weak.Make(value)<br>}<br><br>func (c *Cache) Get(key string) *Data {<br> c.mu.Lock()<br> defer c.mu.Unlock()<br> if ref, ok := c.items[key]; ok {<br>  return (ref.Value())<br> }<br> return nil<br>}<br><br>func main() {<br> cache := NewCache()<br> d := &amp;Data{&quot;Hello, world!&quot;}<br> cache.Set(&quot;greet&quot;, d)<br> d = nil // Remove the only strong reference<br> runtime.GC()<br> if val := cache.Get(&quot;greet&quot;); val != nil {<br>  fmt.Println(&quot;Cache hit:&quot;, val.Content)<br> } else {<br>  fmt.Println(&quot;Cache miss: entry was collected&quot;)<br> }<br>}</pre><h3>Caveats and Pitfalls</h3><h4>Weak pointers are not a silver bullet. Be aware of:</h4><ul><li><strong>Garbage Collection Timing:</strong> You cannot predict when (or if) the garbage collector will reclaim memory.</li><li><strong>Nil Checks Are Mandatory:</strong> Any use of .Value() must be preceded by a nil check.</li><li><strong>May Indicate Deeper Design Issues:</strong> Relying heavily on weak pointers might suggest an architectural oversight.</li><li><strong>Not Concurrency-Safe:</strong> Weak pointers need external synchronization when accessed concurrently.</li><li><strong>Additional GC Overhead:</strong> Weak references require tracking by the runtime, which may impact performance in high-scale systems.</li></ul><h3>When Should You Use Weak Pointers?</h3><h4>👍 Use Weak Pointers When…</h4><ul><li>You’re building memory-sensitive caches</li><li>You want to avoid persistent reference cycles</li><li>The data is optional, large, or can be reloaded</li><li>You have solid understanding of Go’s GC behavior</li></ul><h4>🚫 Avoid When…</h4><ul><li>You need guaranteed presence of the value</li><li>You’re masking a deeper memory management issue</li><li>The data is essential to core business logic</li><li>You’re expecting deterministic finalization or cleanup</li></ul><h3>Final Thoughts</h3><p>Weak pointers bring a new dimension to Go’s memory model. They offer flexibility in memory-sensitive situations, helping developers design smarter caches, safer observers, and efficient canonical stores.</p><p>But this power should be used with care. Unlike typical Go constructs that favor predictability, weak pointers operate in a world where values can disappear silently. As such, they are best used by experienced developers with a strong grasp of Go’s garbage collection behavior.</p><blockquote><strong>“In Go, the best feature is often the one you never have to use.”</strong></blockquote><p>Use weak pointers wisely. Use them rarely. But when you do, know exactly why.</p><p>Please check out our next article “<strong>Handle with Care: The Hidden Dangers of Weak Pointers in Go</strong>”. Details out intricate details, possible pitfalls and some cautions on how to handle.</p><p><a href="https://medium.com/@mail2sada/handle-with-care-the-hidden-dangers-of-weak-pointers-in-go-c0046a4d4bc4">Handle with Care: The Hidden Dangers of Weak Pointers in Go</a></p><p>This article is collaborative work with <a href="https://medium.com/u/c49f87af3fa1">Anand H V</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2293d48b65a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generics in Go: Transforming Code Reusability]]></title>
            <link>https://medium.com/@mail2sada/generics-in-go-transforming-code-reusability-0371e6f6de63?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/0371e6f6de63</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Tue, 07 Jan 2025 15:42:53 GMT</pubDate>
            <atom:updated>2025-01-07T15:42:53.527Z</atom:updated>
            <content:encoded><![CDATA[<p>Generics, introduced in Go 1.18, have revolutionised the way of writing reusable and type-safe code. Generics bring flexibility and power while maintaining Go’s philosophy of simplicity. However, understanding nuances, benefits, and how generics compare to traditional approaches (like <strong>interface{} </strong>) requires a closer look.</p><p>Let’s explore the intricacies of generics, delve into constraints, compare generics to <strong>interface{}</strong>, and demonstrate their practical applications. We’ll also touch upon performance considerations and binary size implications. Let’s dive in!</p><h3>What is Generics?</h3><p>Generics allow developers to write functions and data structures that can operate on any type while maintaining type safety. Instead of relying on <strong>interface{}</strong>, which involves type assertions in runtime, generics let you specify a set of constraints that dictate the permissible operations on the types.</p><h4>Syntax</h4><pre>func FunctionName[T TypeConstraint](parameterName T) ReturnType {<br>    // Function body using T<br>}</pre><p><strong><em>T</em></strong>: A type parameter, representing a placeholder for the type.</p><p><strong><em>TypeConstraint</em></strong>: Restricts the type of <strong><em>T</em></strong> to a specific type or a set of types.</p><p><strong><em>parameterName T</em></strong>: The parameter uses the generic type <strong><em>T</em></strong>.</p><p><strong><em>ReturnType</em></strong>: The function can also return a value of type <strong><em>T</em></strong>.</p><h4><strong>Example</strong></h4><pre>func Sum[T int | float64](a, b T) T {<br>    return a + b<br>}</pre><p><strong><em>func Sum: Declares the name of the function, Sum</em></strong></p><p><strong><em>[T int | float64]</em></strong><em>: </em>Specifies a <strong>type parameter list</strong> that introduces <strong>T</strong> as a type parameter, constrained to specific types (<strong>int </strong>or <strong>float64</strong>). Sum function can take only parameters either <strong>int</strong> or <strong>float64</strong>, not in combination, both have to either <strong>int</strong> or <strong>float64</strong>.<strong> </strong>We will explore this further in below sections.</p><p><strong><em>(a, b T)</em></strong><em>: </em>Declares two parameters, <strong>a</strong> and <strong>b</strong>, both of type <strong>T </strong>(the generic type).</p><p><strong><em>T</em></strong><em>: </em>Specifies the return type of the function, which matches the type parameter <strong>T</strong>.</p><h3>Constraints: Building blocks of Generics</h3><p>Constraints define what operations are valid for a generic type. Go provides powerful tools for constraints, including the experimental <strong>constraints</strong> package(<strong><em>golang.org/x/exp/constraints</em></strong>).</p><h4>Built-in Constraints</h4><p>Go introduced built-in constraints with generics to provide type safety while allowing flexibility in defining reusable and generic code. These constraints enable developers to enforce rules on the types used in generic functions or types.</p><h4>Go has below built-in constraints</h4><ol><li><strong>any</strong>: Represents <strong>any</strong> type. It’s an alias for <strong>interface{}</strong>. This is used when no constraints are needed</li></ol><pre>func PrintValues[T any](values []T) {<br>    for _, v := range values {<br>        fmt.Println(v)<br>    }<br>}</pre><p>2. <strong>comparable</strong>: Allows types that support equality comparison(<strong>==</strong> and <strong>!=</strong>). Useful for maps keys, duplicate detection or equality checks. This can not be used for maps, slices and functions, since these types don’t support direct comparison.</p><pre>func CheckDuplicates[T comparable](items []T) []T {<br>    seen := make(map[T]bool)<br>    duplicates := []T{}<br>    for _, item := range items {<br>        if seen[item] {<br>            duplicates = append(duplicates, item)<br>        } else {<br>            seen[item] = true<br>        }<br>    }<br>    return duplicates<br>}</pre><h4>Experimental constraints</h4><p>Go has created 6 experimental constraints that can be used, constraints are defined in package <strong>golang.org/x/exp/constraints.</strong></p><ol><li>constraints.Complex: Permits complex numeric types(complex64 and complex128).</li><li>constraints.Float: Permits float numeric types(float32 and float64)</li><li>constraints.Integer: Permits any integer both signed and unsigned (int8, int16, int32, int64, int, uint8, uint16, uint32, uint64 and uint)</li><li>constraints.Signed: Permits any signed integer(int8, int16, int32, int64 and int)</li><li>constraints.Unsigned: Permits any unsigned integer (uint8, uint16, uint32, uint64 and uint).</li><li>constraint.Ordered: Permits types that allow comparison (&lt;. &lt;=, &gt;, &gt;=), all numeric types and string are supported(int, float64, string, etc).</li></ol><pre>import (<br>     &quot;golang.org/x/exp/constraints&quot;<br>     &quot;fmt&quot;<br>)<br><br>func SortSlice[T constraints.Ordered](items []T) []T {<br>    sorted := append([]T{}, items...) // Copy slice<br>    sort.Slice(sorted, func(i, j int) bool {<br>        return sorted[i] &lt; sorted[j]<br>    })<br>    return sorted<br>}<br><br>func main() {<br>    nums := []int{5, 2, 9, 1}<br>    fmt.Println(SortSlice(nums)) // Output: [1 2 5 9]<br><br>    words := []string{&quot;banana&quot;, &quot;apple&quot;, &quot;cherry&quot;}<br>    fmt.Println(SortSlice(words)) // Output: [apple banana cherry]<br>}</pre><h4>Custom Constraints</h4><p>Custom constraints are interfaces that define a set of types or type behaviours that a generic type parameter must satisfy. By creating your own constraints, we can;</p><ul><li>Restrict types to a specific subset, such as numeric types.</li><li>Require types to implement specific methods or behaviors.</li><li>Add more control and specificity to your generic functions and types.</li></ul><p><strong>Syntax</strong></p><pre>type Numeric interface {<br>    int | float64 | uint<br>}</pre><p><strong>Example</strong></p><pre>type Number interface {<br>    int | int64 | float64<br>}<br><br>func Sum[T Number](a, b T) T {<br>    return a + b<br>}</pre><p>Sum function can be called using only int, int64 and float64 parameters.</p><p><strong>Constraints by method</strong></p><p>If you want to enforce a type must implement certain methods, you can define it using those methods.</p><pre>type Formatter interface {<br>    Format() string<br>}<br><br>func PrintFormatted[T Formatter](value T) {<br>    fmt.Println(value.Format())<br>}</pre><p>The <strong>Formatter</strong> constraint requires that any type used as <strong>T</strong> must have a<strong> Format</strong> method that returns a <strong>string</strong>.</p><p><strong>Combining Constraints</strong></p><p>Custom constraints can combine type sets and method requirements</p><pre>type AdvancedNumeric interface {<br>    int | float64<br>    Abs() float64<br>}<br><br>func Process[T AdvancedNumeric](val T) float64 {<br>    return val.Abs()<br>}</pre><p>This constraint includes both specific types (<strong>int, float54</strong>) and requires the presence of an <strong>abs </strong>method.</p><h3>Generics vs interface{}</h3><p>Before introduction of generics, interface{} was used to achieve flexibility. However, this approach has limitations.</p><h4>Type Safety</h4><ul><li><strong>interface{}:</strong> Relies on runtime type assertions, increasing the chance of errors at runtime.</li><li><strong>Generics:</strong> Offers compile-time type safety, catching errors early during development.</li></ul><h4>Performance</h4><ul><li><strong>interface{}:</strong> Slower due to additional runtime type checks.</li><li><strong>Generics:</strong> Faster, as the compiler generates optimised code paths specific to types.</li></ul><h4>Code Readability</h4><ul><li><strong>interface{}:</strong> Often verbose and less intuitive, making the code harder to maintain.</li><li><strong>Generics:</strong> Cleaner syntax leads to more intuitive and maintainable code.</li></ul><h4>Binary Size</h4><ul><li><strong>interface{}:</strong> Results in smaller binaries as it doesn’t duplicate code for different types.</li><li><strong>Generics:</strong> Slightly increases binary size due to type specialisation for better performance.</li></ul><p><strong>Example</strong></p><pre>func Add(a, b interface{}) interface{} {<br>    return a.(int) + b.(int)<br>}</pre><p>Code works well, type assertion is overhead. Add function can called with any argument, both a and b parameters can be of different types, however code will crash in the runtime.</p><pre>func AddGeneric[T int | float64](a, b T) T {<br>    return a + b<br>}</pre><p>Generics eliminate the risk of runtime panics caused by incorrect type assertions and improve clarity.</p><h4>Performance</h4><p>Generics produce specialised code for each type, leading to better runtime performance compared to <strong>interface{}</strong>.</p><h4>Binary Size</h4><p>A trade-off exists: generics increase binary size due to code duplication for each type, but this is often negligible compared to the benefits.</p><h4>Limitations of Go Generics</h4><p><strong>Complexity in Constraints: </strong>While constraints like constraints.Ordered simplify common use cases, defining highly customized constraints can become verbose.</p><p><strong>No Type Inference in Structs: </strong>Unlike functions, you must specify the type parameter explicitly for structs.</p><pre>s := Stack[int]{} // Type parameter is required</pre><p><strong>Limited to Compile-Time Constraints: </strong>Go generics focus on compile-time safety, whereas languages like Rust offer more powerful constraints using lifetimes and traits.</p><h3>Let’s Benchmark — Better done than said</h3><p>We will implement a simple Queue with both interface{} and generic and benchmark the results.</p><h4>Interface{} Queue implementation</h4><pre>package main<br><br>import (<br> &quot;testing&quot;<br>)<br><br>type QueueI struct {<br> items []interface{}<br>}<br><br>func (q *QueueI) Enqueue(item interface{}) {<br> q.items = append(q.items, item)<br>}<br><br>func (q *QueueI) Dequeue() interface{} {<br> item := q.items[0]<br> q.items = q.items[1:]<br> return item<br>}<br><br>func BenchmarkInterfaceQueue(b *testing.B) {<br> queue := QueueI{}<br> for i := 0; i &lt; b.N; i++ {<br>  queue.Enqueue(i)<br>  queue.Dequeue()<br> }<br>}</pre><h4>Generic Queue Implementation</h4><pre>package main<br><br>import (<br> &quot;testing&quot;<br>)<br><br>type QueueG[T any] struct {<br> items []T<br>}<br><br>func (q *QueueG[T]) Enqueue(item T) {<br> q.items = append(q.items, item)<br>}<br><br>func (q *QueueG[T]) Dequeue() T {<br> item := q.items[0]<br> q.items = q.items[1:]<br> return item<br>}<br><br>func BenchmarkGenericQueue(b *testing.B) {<br> queue := QueueG[int]{}<br> for i := 0; i &lt; b.N; i++ {<br>  queue.Enqueue(i)<br>  queue.Dequeue()<br> }<br>}</pre><pre>go test -bench=. -benchmem<br>goos: darwin<br>goarch: amd64<br>pkg: becnh<br>cpu: VirtualApple @ 2.50GHz<br>BenchmarkGenericQueue-10        74805141                16.05 ns/op            8 B/op          1 allocs/op<br>BenchmarkInterfaceQueue-10      25719405                44.65 ns/op           24 B/op          1 allocs/op<br>PASS<br>ok      becnh   4.522s</pre><h4>Analysis of Results</h4><ol><li><strong>Execution Time</strong>:<br>The generic implementation is approximately 63.64<strong>% faster</strong> than the <strong>interface{}</strong> version because it avoids runtime type assertions and operates directly on the given type.</li><li><strong>Allocations</strong>:<br>The interface{} version makes <strong>3x more allocations</strong>, primarily due to boxing/unboxing when inserting and retrieving values. This adds overhead to garbage collection.</li></ol><p>For larger workloads, such as 1 million enqueue/dequeue operations, the performance gap widens. Real-world applications with high-throughput requirements (e.g., message queues, job schedulers) benefit significantly from generics.</p><h4>Final Thoughts</h4><p>Generics in Go strike a balance between power and simplicity, offers a practical solution for writing reusable and type-safe code. While not as feature-rich as Rust or C++, align perfectly with Go’s minimalist philosophy. Understanding constraints like constraints.Ordered and leveraging generics effectively can greatly enhance code quality and maintainability.</p><p>As generics continue to evolve, they are destined to play a central role in Go’s ecosystem. So, dive in, experiment, and embrace the new era of type safety and flexibility in Go programming!</p><p>Checkout <a href="https://github.com/sadananddodawadakar/GoGenerics">github</a> repository for some samples on generics</p><p><a href="https://github.com/sadananddodawadakar/GoGenerics">GitHub - sadananddodawadakar/GoGenerics: Repository contains working examples of go generics</a></p><blockquote>Lets make learning a habit and sharing a culture</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0371e6f6de63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Makes Rust Blazing Fast?]]></title>
            <link>https://medium.com/@mail2sada/what-makes-rust-blazing-fast-1311f00378c3?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/1311f00378c3</guid>
            <category><![CDATA[rustlang]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[rust-programming-language]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Sun, 22 Dec 2024 20:49:46 GMT</pubDate>
            <atom:updated>2024-12-22T21:01:01.645Z</atom:updated>
            <content:encoded><![CDATA[<p>Rust has earned immense popularity for being a blazing fast programming language, often competing or even outperforming established programming languages like C and C++. But what truly sets Rust apart? This story explores the technical features and design principles that make Rust a powerhouse for performance.</p><h3>1. <strong>Zero-Cost Abstractions</strong></h3><p>Rust adheres to the principle of <strong>zero-cost abstractions</strong>, meaning that high-level constructs in the language introduce no additional runtime overhead. Features like <strong>iterators</strong>, <strong>closures</strong>, and <strong>traits</strong> compile down to highly optimised machine code.</p><pre>let v = vec![1, 2, 3, 4];<br>let sum: i32 = v.iter().filter(|&amp;&amp;x| x % 2 == 0).sum();</pre><p>Rust compiler optimises the iterator and filter into a loop with no abstraction penalty.</p><h3>2. <strong>Memory Safety Without Garbage Collection</strong></h3><p>Unlike Java or Go, Rust achieves memory safety without relying on a <strong>garbage collector</strong>. This eliminates the performance overhead caused by periodic garbage collection pauses.</p><h4><strong>Ownership and Borrowing</strong></h4><p>Rust uses an ownership system with strict rules about how memory is accessed. The compiler ensures this at compile time.</p><p>Memory is not accessed after it is freed (no use-after-free errors).</p><p>Only one mutable reference or multiple immutable references exist simultaneously.</p><h4>Deterministic Deallocation</h4><p>Memory is deallocated immediately when it goes out of scope, akin to <strong>RAII</strong> in C++, leading to predictable performance.</p><h3>3. Fearless Concurrency</h3><p>Concurrency is notoriously difficult to get right due to data races. Rust enables “<strong>fearless concurrency”</strong> with its <strong>ownership</strong> model and <strong>type system</strong>.</p><h4><strong>Elimination of Data Races at Compile-Time</strong></h4><p>Data races are a common source of bugs and performance issues in concurrent systems. Rust leverages its <strong>ownership model</strong> and <strong>borrow checker</strong> to enforce concurrency rules at compile time</p><ol><li><strong><em>Exclusive Access</em></strong><em>: Rust ensures that data is either mutably borrowed by one thread or immutably borrowed by multiple threads, but not both. Two threads cannot mutate the same piece of data simultaneously.</em></li><li><strong><em>No Undefined Behaviour</em></strong><em>:</em> <em>By catching concurrency issues during compilation, Rust eliminates runtime errors like segmentation faults, which can slow down or crash programs in other languages.</em></li></ol><p>Compile-time safety ensures that Rust’s concurrent programs are “<strong>error-free by design”</strong>, eliminating expensive runtime checks, which often degrade performance.</p><h4>Efficient Use of System Resources</h4><p>Rust’s fearless concurrency directly translates to better system resource utilisation.</p><ol><li><strong><em>Fine-Grained Locking</em></strong><em>: Rust’s </em><strong><em>Mutex</em></strong><em> and </em><strong><em>RwLock</em></strong><em> primitives allow precise control over shared data, reducing contention and enabling efficient multi-threaded execution.</em></li><li><strong><em>Zero-Cost Abstractions</em></strong><em>: Unlike languages with garbage collection or runtime checks for thread safety, Rust relies on compile-time guarantees. This ensures no runtime performance penalties.</em></li></ol><h4><strong>Low-Overhead Concurrency Primitives</strong></h4><p>Rust’s standard library provides efficient concurrency tools:</p><ol><li><strong><em>std::thread :</em></strong><em> Lightweight abstractions for spawning OS threads.</em></li><li><strong><em>std::sync</em></strong><em> :High-performance synchronisation primitives like High-performance synchronisation primitives like </em><strong><em>Condvar</em></strong><em>, </em><strong><em>Mutex</em></strong><em> , and </em><strong><em>RwLock</em></strong><em>.</em></li></ol><h4>Asynchronous Concurrency: Maximising Throughput</h4><p>Rust’s asynchronous programming model, built around <strong>async/await</strong>, complements its multithreading capabilities:</p><ol><li><strong><em>Futures-Based Execution</em></strong><em>: Rust’s async tasks are lightweight and avoid blocking threads, allowing applications to handle millions of operations efficiently.</em></li><li><strong><em>Event-Driven Execution</em></strong><em>: Frameworks like </em><strong><em>tokio</em></strong><em> and </em><strong><em>async-std</em></strong><em> use event loops to schedule tasks efficiently, reducing the need for expensive thread context switches.</em></li></ol><h4>Deterministic Behaviour and Predictable Performance</h4><p>concurrency in Rust eliminates common pitfalls like race conditions and deadlocks:</p><ol><li><strong><em>Race Conditions:</em></strong><em> Rust enforces data access rules that prevent inconsistent states caused by unsynchronised threads.</em></li><li><strong><em>Deadlocks:</em></strong><em> While Rust doesn’t eliminate deadlocks, its ownership model and explicit synchronisation primitives make potential deadlocks easier to identify and debug.</em></li></ol><p>By eliminating these issues, Rust ensures that concurrent programs run “<strong>predictably and efficiently</strong>”, even under high workloads.</p><h3>4. Monomorphisation of Generics</h3><p>Rust uses <strong>monomorphisation</strong> for generics, generating specific code for each type used with a generic function or structure. This results in type-specific, highly optimised code at the cost of slightly larger binary sizes.</p><pre>fn add&lt;T: std::ops::Add&lt;Output = T&gt;&gt;(a: T, b: T) -&gt; T {<br>    a + b<br>}<br><br>fn main() {<br>    let int_sum = add(1, 2);      // Optimized for integers<br>    let float_sum = add(1.0, 2.0); // Optimized for floats<br>}</pre><p>Compiler creates separate versions of <strong>add</strong> for integers and floats, eliminating runtime type checking and improving performance.</p><h3>5. Minimal Runtime</h3><p>One of the standout features of Rust is its minimal runtime overhead. This design choice ensures that Rust programs are not only safe and concurrent but also incredibly fast. Let’s break this concept down in detail.</p><p>Runtime overhead refers to the extra processing and resource consumption added by a language’s runtime environment to manage features like memory allocation, garbage collection, thread management, and more.</p><p>Languages like <strong>Java</strong> introduce significant runtime overhead due to their reliance on garbage collection and virtual machines (e.g., JVM for Java). Rust, on the other hand, avoids these overheads, delivering near-zero-cost abstractions and runtime efficiency.</p><h3>6. Static Linking</h3><p>Rust uses <strong>static linking</strong> by default, embedding all dependencies and required code directly into the executable. This ensures:</p><ol><li><em>Faster runtime because there’s no need to dynamically resolve external libraries.</em></li><li><em>Predictable performance, as the binary includes everything needed for execution.</em></li></ol><p>While this increases the executable size, it <strong>eliminates runtime delays</strong> due to dynamic linking, making execution faster. However, <strong>“static linking may increase the load time.”</strong></p><p><strong>We will do the comparison of rust compiled binary and C compiled binary to understand intricacies in details in the following sections.</strong></p><h3>7. LLVM Optimisations</h3><p>Rust leverages the <strong>LLVM backend</strong>, which performs aggressive optimisations to generate highly efficient executables. Key LLVM optimisations include:</p><ol><li><strong><em>Inlining</em></strong><em>: Embeds function calls directly into the caller’s code to avoid the overhead of function calls.</em></li><li><strong><em>Loop Unrolling</em></strong><em>: Optimises loops by reducing branching operations.</em></li><li><strong><em>Dead Code Elimination</em></strong><em>: Strips unused code from the final executable, ensuring only essential instructions remain.</em></li></ol><h3>8. Low-Level Control with High-Level Guarantees</h3><p>Rust allows direct control over hardware and memory, similar to C/C++, while maintaining safety through its ownership model. In cases where performance-critical operations are needed, unsafe blocks provide the freedom to bypass some safety checks for raw hardware access.</p><ol><li><em>Rust ensures safe memory access by default, reducing debugging overhead.</em></li><li><em>Unsafe code regions, when necessary, compile to raw, low-level instructions without safety checks, maximising speed.</em></li></ol><h3>9. Efficient Memory Layout</h3><p>Rust compilers carefully optimise data structures for cache alignment and memory layout. Using attributes like <strong>#[repr(C)]</strong>, Rust ensures predictable layouts that match system architecture, reducing cache misses and improving access times.</p><pre>#[repr(C)]<br>struct Point {<br>    x: f64,<br>    y: f64,<br>}</pre><p>This ensures Point is laid out in memory as contiguous x and y values, enabling efficient hardware-level access.</p><h3>10. <strong>LTO (Link-Time Optimisation)</strong></h3><p>Rust supports <strong>Link-Time Optimization (LTO)</strong>, which optimizes the binary by analysing and optimising across crate boundaries. LTO ensures:</p><ol><li><em>Removal of redundant code and function calls.</em></li><li><em>Cross-module inlining, improving execution speed.</em></li></ol><pre>[profile.release]<br>lto = &quot;thin&quot;</pre><h3>11. <strong>Whole-Program Compilation</strong></h3><p>Rust compiles the entire program, including dependencies, into a single executable. This enables the compiler to:</p><ol><li><em>Inline functions across library boundaries.</em></li><li><em>Optimise the entire program holistically, unlike languages that compile individual files separately.</em></li></ol><h3>12. Optimised Panic Handling</h3><p>Rust includes panic handling for safety, but it optimises for the common case where no panics occur:</p><ol><li><em>Panic code paths are generated separately, leaving the main execution path lightweight.</em></li><li><em>Release builds can further strip panic messages for minimal overhead.</em></li></ol><p>Rust’s speed is a product of deliberate design, combining low-level control, memory safety, and zero-cost abstractions to deliver exceptional performance. It excels in scenarios requiring both high efficiency and reliability, making it a compelling choice for modern systems.</p><p>Ultimately, Rust strikes a remarkable balance, offering developers the tools to build fast and safe software while acknowledging the complexity that comes with such power.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1311f00378c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prompts, Progress, and Productivity: The AI Way in Software Development]]></title>
            <link>https://medium.com/@mail2sada/prompts-progress-and-productivity-the-ai-way-in-software-development-68412e73accc?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/68412e73accc</guid>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 10:40:27 GMT</pubDate>
            <atom:updated>2024-11-23T10:40:27.151Z</atom:updated>
            <content:encoded><![CDATA[<p>Software development is no longer just about logical ifs, nested loops, and debugging cryptic error messages. We have entered a new era where “<strong>AI acts as both the assistant and catalyst”</strong>, fundamentally reshaping how we work. Let’s explore how AI specifically <strong>Generative AI</strong> has redefined the developer’s toolkit, why <strong>prompts</strong> are the new keyboard shortcuts, and how <strong>productivity</strong> is skyrocketing thanks to smarter tools.</p><h3>Prompts: Your AI Compass</h3><p>Generative AI tools have flipped the script. Where search engines once ruled, serving up lists of links for you to search through, AI now delivers tailor-made answers — if you know how to ask. This is where <strong>prompt engineering</strong> joins the bus.</p><p>Remember the early days of search engines:</p><p><strong>“How to fix a segfault in C?”</strong> You’d scroll through a sea of forum posts hoping for a clue.</p><p><strong>Generative AI Today:</strong></p><p><strong>“Write a C program that demonstrates a common cause of segfaults and how to fix it.”</strong> Boom — instant code with explanations.</p><p><strong>Why prompts matter?</strong></p><blockquote><strong>They’re the bridge between your questions and AI’s understanding.</strong></blockquote><blockquote><strong>A well-crafted prompt transforms AI into your personal tutor, code reviewer, or debugging assistant.</strong></blockquote><blockquote><strong>Prompts can save hours of trial and error, provided you give enough context and clarity.</strong></blockquote><h3>Progress: A Revolution in Development</h3><p>AI has accelerated progress in ways we couldn’t have imagined. Let’s break it down:</p><h4><strong>From Tedious to Turbocharged</strong></h4><p>Before AI, a significant chunk of time went into repetitive tasks:</p><ul><li>Writing boilerplate code.</li><li>Refactoring chunks of legacy systems.</li><li>Endless manual testing.</li></ul><p>Today, AI handles these with ease, freeing up developers to focus on creative problem-solving. Tools like GitHub Copilot and ChatGPT can draft functions, suggest better algorithms, and even optimise performance with a few well-worded prompts.</p><h4><strong>The Power of Learning in Real-Time</strong></h4><p>Up-skilling meant reading books, attending seminars, or deciphering outdated tutorials. Now, you can:</p><blockquote>Generate hands-on examples in seconds.</blockquote><blockquote>Simulate use cases to test your understanding.</blockquote><blockquote>Get instant feedback, transforming AI into a 24/7 coding buddy.</blockquote><h3>Productivity: Smarter, Not Harder</h3><h4><strong>AI as the Productivity Booster</strong></h4><p>AI tools aren’t just add-ons; they’re co-pilots. Imagine this:</p><blockquote><strong>Debugging</strong>: AI pinpoints the exact cause of your error.</blockquote><blockquote><strong>Documentation</strong>: Automatically generated summaries keep your projects readable.</blockquote><blockquote><strong>Collaboration</strong>: AI bridges gaps in communication with features like real-time code translation between languages.</blockquote><h4>Metrics That Matter</h4><p>According to studies, AI adoption has already led to:</p><blockquote>A considerable<strong> </strong>reduction in time spent on code reviews.</blockquote><blockquote>A remarkable increase in successful deployments on the first try.</blockquote><blockquote>Developers completing routine tasks up to <strong>50% faster</strong> than before.</blockquote><h3>AI’s Impact: More Than Just Code</h3><h4>Standardisation and Best Practices</h4><p>AI has enforced consistency across codebases by adhering to the best practices automatically. This reduces bugs, streamlines onboarding, and ensures that even junior developers produce work at near-expert levels.</p><h4>What About IP and Copyright?</h4><p>Generative AI raises valid concerns about intellectual property.</p><blockquote><strong>Be Mindful</strong>: Outputs may inadvertently include copyrighted content. Always validate and attribute.</blockquote><blockquote><strong>Create with Caution</strong>: Use AI to inspire, but ensure the final product is uniquely yours.</blockquote><h3>The Future: Productivity Redefined</h3><h4>Generative AI and Beyond</h4><p>As AI tools become more sophisticated, we might witness:</p><blockquote>Full-fledged systems capable of <strong>self-debugging</strong> and optimizing at runtime.</blockquote><blockquote>Collaborative environments where <strong>developers and AI build</strong> systems in real time.</blockquote><blockquote>Developers moving into roles as <strong>AI curators</strong>, guiding these systems rather than coding line-by-line.</blockquote><h4>Predicted Productivity Gains</h4><p>If today’s AI tools can double productivity, tomorrow’s might triple it. Imagine writing software in days, not months, with AI handling 80% of the groundwork.</p><h3>Embracing the AI Way</h3><p>AI in software development isn’t just about new tools —<strong> it’s a mindset shift</strong>. It’s about <strong>increasing productivity by collaborating with machines to enhance creativity and innovation.</strong> While challenges like <strong>ethical AI usage and IP concerns exist, the benefits far outweigh the risks.</strong></p><p>So, embrace the AI way. <strong>Master your prompts, ride the wave of progress, and let your productivity soar.</strong> In this brave new world of software development, the right combination of human ingenuity and AI prowess can turn the impossible into the everyday.</p><h3>Way forward!</h3><p>Learning and adapting are essential to embarking on the Generative AI journey. It’s crucial to understand Generative AI, how it works, its fundamentals, and the intricacies.</p><p>Prompts serve as the bridge to interact with Generative AI tools. Mastering prompt engineering is a discipline in itself, requiring a clear understanding of the <em>what</em>, <em>why</em>, and <em>how</em> of crafting effective prompts.</p><p>Generative AI tools like ChatGPT, Gemini, and Copilot are valuable assets in your toolkit. To maximize their potential, it’s important to know how to use them skilfully.</p><p>“Boost productivity by mastering the art of prompts!”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68412e73accc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“E=mc²: The AI Edition”-When Einstein Meets Artificial Intelligence”]]></title>
            <link>https://medium.com/@mail2sada/e-mc%C2%B2-the-ai-edition-when-einstein-meets-artificial-intelligence-9244a1a7f1c7?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/9244a1a7f1c7</guid>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 03:21:03 GMT</pubDate>
            <atom:updated>2024-11-19T03:21:03.768Z</atom:updated>
            <content:encoded><![CDATA[<p>Ah, <em>E=mc²</em>. Einstein’s iconic equation that elegantly equates energy (<em>E</em>), mass (<em>m</em>), and the speed of light squared (<em>c²</em>). It’s the epitome of simplicity explaining complexity.</p><p>But could it also explain the adaptability of Artificial Intelligence? Let’s fire up the particle accelerator of humour and see how “<strong>AI might just be the Einstein of our era</strong>”.</p><h4>E = mc²: The AI Reinterpretation</h4><p>In the AI world, we could think of Einstein’s equation like this:<br><strong>Adaptability (E)</strong> = <strong>Model complexity (m)</strong> × <strong>Computational power (c)²</strong></p><p>Let’s break this down while having some fun:</p><h4>Mass (<em>m</em>): The Complexity of the Model</h4><p>In physics, <em>m</em> is the mass, the stubborn, lazy object that resists change. In AI, this is our overly ambitious machine learning model:</p><ul><li>A bloated neural network with billions of parameters.</li><li>The one that takes <em>hours</em> to train, guzzling GPUs.</li></ul><p>The larger the model (<em>m</em>), the more it resists adaptability. Sure, a giant language model knows the Encyclopedia, Britannica by heart, but ask it about last night’s game score, and it folds like a cheap chair.</p><h4>Speed of Light (c): Computational Power</h4><p>Here, <em>c²</em> is the computational power available to the AI. Faster processors, efficient GPUs, TPUs, and quantum computing are the light-speed equivalent for AI.</p><ul><li>If your <em>c²</em> is a PC from 2005, well, good luck.</li><li>If you’ve got a shiny AI supercomputer? You’re soaring at light speed through galaxies of data.</li></ul><p>Interestingly, squaring <em>c</em> in the AI sense is apt — more compute doesn’t just make things faster, it exponentially amplifies what AI can do. It’s like adding jet fuel to a firecracker. Or giving caffeine to a coder during crunch time.</p><h4>Energy (<em>E</em>): Adaptability</h4><p>In our AI equation, <em>E</em> represents the adaptability of an AI model — its ability to generate insightful outputs, learn new data, and, most importantly, handle your toddler asking it weird questions about dinosaurs and pizza.</p><ul><li>High <em>E</em> means your AI adapts like a social chameleon, <strong>charmingly answering queries about anything you wish</strong>.</li><li>Low <em>E</em>? That’s your AI stuck repeating, <strong>“I’m sorry, I didn’t quite catch that.”</strong></li></ul><h4>When Mass Meets Power</h4><p>Let’s look at some real-world AI scenarios through our Einstein-inspired lens:</p><ol><li><strong>Tiny Model, Big Compute:</strong><br>A lightweight model (<em>m</em> is small) trained on a large GPU farm (<em>c²</em> is huge).“<strong> It’s snappy, adaptable, and efficient — a sprinter.</strong>” But don’t expect it to write Tolstoy.</li><li><strong>Big Model, Meh Compute:</strong><br>A mammoth model (<em>m</em> is enormous) running on your grandma’s laptop (<em>c²</em> is tiny). Sure, it could write Tolstoy… if you’re okay waiting until next year.</li><li><strong>Perfect Zone:</strong><br>A well-optimised model with just enough compute — the <em>just right</em> porridge. It’s efficient, responsive, and quick on its digital feet. Einstein would approve.</li></ol><h4>What About c²? AI’s Speed of Adaptability</h4><p>Interestingly, adaptability in AI isn’t just about computational horsepower; it’s also about clever algorithms. Much like Einstein, who thought beyond the obvious, AI researchers constantly innovate to make models more efficient. Imagine this:</p><ul><li>AI models that train on a tenth of the data but reach <em>c²-level</em> results.</li><li>Adaptive models that prune themselves mid-operation like digital bonsai trees.</li></ul><p>With enough ingenuity, even a smaller <em>m</em> and modest <em>c</em> can deliver unexpectedly high <em>E</em>. Adaptability in AI is the art of turning constraints into breakthroughs — kind of like Einstein writing papers with just a chalkboard.</p><h4>AI: The Future’s E=mc²</h4><p>In Einstein’s time, <em>E=mc²</em> unlocked the secrets of the universe. In our time, AI’s reinterpretation of this equation might unlock human potential. Whether it’s diagnosing diseases, crafting symphonies, or just helping you find the perfect cat meme, AI embodies the spirit of adaptability.</p><p>So next time your AI assistant mishears you or your chatbot refuses to understand sarcasm, remember: it’s all just <em>mass</em> (<em>m</em>), compute (<em>c²</em>), and a little energy (<em>E</em>) away from brilliance. After all, even Einstein didn’t start with relativity; he probably had a few bugs in his equations too.</p><blockquote>Disclaimer: No physicists or GPUs were harmed in the making of this article.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9244a1a7f1c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adapt or be left behind]]></title>
            <link>https://medium.com/@mail2sada/adapt-or-be-left-behind-183eb675e1fb?source=rss-1ff592c6d739------2</link>
            <guid isPermaLink="false">https://medium.com/p/183eb675e1fb</guid>
            <dc:creator><![CDATA[Sadanand Dodawadakar]]></dc:creator>
            <pubDate>Sat, 16 Nov 2024 17:13:43 GMT</pubDate>
            <atom:updated>2024-11-17T03:44:56.971Z</atom:updated>
            <content:encoded><![CDATA[<p>Last two decades of software engineering taught me something amazing, important and necessary <strong>“Adapt or be left behind”</strong>. Technological landscape “<strong>doesn’t just evolve — it changes itself every few years”. </strong>Tools, languages, and frameworks I started with are relics now, but the lessons learned along the way are timeless.</p><p>However fundamentals and principles don’t change; they evolve with changes in ecosystems. Changes from 32 bit to 64 bit operating systems made huge memory available to the systems, led to innovation in hardware(memory and computation) made virtualisation and containerisation possible. Creating vast opportunities in cloud computing, cloud native applications.</p><p><strong>“Have strong fundaments, learn on daily basis”</strong></p><h4>Adaptation Is Survival</h4><p>When I first started, C and C++ were king, and assembly was the quiet tyrant in the background. Writing code often felt like solving riddles in a language only a computer could love along with me.</p><p>Then the era of Java, Python, JavaScript, and countless others started. At first, each new language felt like a threat —<strong> “Will my skills become obsolete?”</strong> But every time I learned something new, “<strong>it opened doors I didn’t know existed</strong>”.</p><p>Adapting wasn’t optional; it was survival. I realised that staying relevant meant embracing change, even when it was uncomfortable. Over time, learning became a skill in itself — a habit that kept me curious and engaged.</p><h4><strong>Tools Don’t Make the Engineer — But They Help</strong></h4><p>Back in the day, our debugging tools were barely tools. Finding a bug or memory leak often meant staring at lines of code for hours, hoping for divine intervention. Then came the rise of IDEs, debuggers, and code analysers. These tools didn’t just make us faster — they gave us back our weekends.</p><p>Evolved languages like <strong>Java, Go</strong>, etc came with builtin garbage collector made memory handing easy, monsters like memory leaks and corruption vanished.</p><p>Performance became key, garbage collection made things slower, reminded good old memories of C/C++. Not to worry <strong>rust</strong> solved it.</p><p>The lesson? Tools evolve, but<strong> “they’re only as good as the engineer using them</strong>.<strong>”</strong> Mastering your craft, not just your tools, is what sets you apart.</p><h4><strong>Mentors and Community Are Priceless</strong></h4><p>In the early days, the concept of “community” wasn’t what it is now. There were no Stack Overflow posts or GitHub repositories. Learning meant pestering your senior colleagues and hoping they didn’t mind. Mentors played a pivotal role, not just in teaching technical skills but in shaping how I approached problems.</p><p>Today, the community is global and infinitely more accessible, thanks to platforms like Reddit, Discord, and yes, Stack Overflow. But the principle remains: <strong>“Surround yourself with people smarter than you”</strong>. They’re your fastest route to growth.</p><h4>Internet Revolutionised Everything</h4><p>When the internet became mainstream, it changed the game. Search engines turned cryptic error messages into solvable puzzles. Documentation became easier to find (and, in some cases, easier to read). Open-source software flourished, offering libraries, frameworks, and entire ecosystems for free.</p><p>Before this, learning something new meant buying expensive books or attending courses. Now, with a few keystrokes, you can find tutorials, forums, and even video walkthroughs. <strong>“The sheer availability of knowledge has democratised learning — and there’s no going back”</strong>.</p><h4><strong>AI and the Productivity Leap</strong></h4><p>Generative AI is the newest wave, and it’s redefining productivity. Where once we spent hours writing boilerplate code, AI tools now do it in seconds. Tasks like debugging, refactoring, and even designing system architectures are getting a boost. But this isn’t just about speed; it’s about creative problem-solving. With AI handling repetitive tasks, engineers will have more bandwidth to innovate.</p><p>That said, it’s not without challenges. “<strong>Questions about intellectual property, copyrights, and the ethical use of AI loom large</strong>”. And let’s not forget the risk of over-reliance. “<strong>AI is an enabler, not a replacement</strong>”.</p><h4>Looking Back and Moving Forward</h4><p>Adapting hasn’t always been easy. It meant constantly learning, sometimes failing, and always pushing forward. But it’s also what’s made this journey fulfilling. The technologies have changed, but the “<strong>essence of software engineering — solving problems creatively — remains the same</strong>”.</p><p>The lesson for the future is clear: The pace of change isn’t slowing down. With AI, cloud computing, and quantum technologies on the horizon, adaptability will be more important than ever. And while the tools and languages may change, the skills we hone and the lessons we learn will carry us forward.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=183eb675e1fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>