<?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 aditya chaudhari on Medium]]></title>
        <description><![CDATA[Stories by aditya chaudhari on Medium]]></description>
        <link>https://medium.com/@chaudhari.aditya24?source=rss-17d8a9297723------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*poXtAVTZ0JfdPioNVscE2w.jpeg</url>
            <title>Stories by aditya chaudhari on Medium</title>
            <link>https://medium.com/@chaudhari.aditya24?source=rss-17d8a9297723------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 24 May 2026 02:12:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chaudhari.aditya24/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[What Went Wrong on the October 20th, 2025 AWS Outage?]]></title>
            <link>https://aws.plainenglish.io/what-went-wrong-in-the-october-20th-2025-aws-outage-a0dc8ef7e105?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0dc8ef7e105</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws-outage]]></category>
            <category><![CDATA[outage]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Sat, 01 Nov 2025 18:49:20 GMT</pubDate>
            <atom:updated>2025-11-09T15:19:11.867Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Went Wrong on the October 20th, 2025 AWS Outage? understanding the root cause and key learnings…</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4vcHOt-RgePvdyaEUCmTA.png" /><figcaption>AWS DynamoDB outage explained</figcaption></figure><p>On October 19–20, 2025, AWS experienced a significant outage in the US-EAST-1 region lasting over 14 hours. The root cause was a <strong>“latent race condition”</strong> in DynamoDB’s DNS management system.</p><p><strong>What is a race condition?</strong> It occurs when multiple threads try to access/update the same resource simultaneously, and the outcome depends on precise timing.</p><p><strong>What is “latent race”?</strong> “Latent” means this bug existed in the system without being triggered — potentially for years. It’s like a landmine buried in your codebase, invisible until someone steps on it. Standard testing doesn’t catch it because the timing has to be “just wrong.”</p><h3>How the race-condition happened in AWS Outage case ?</h3><p><em>Please refer to the diagram to understand the root cause quickly.</em> Understanding the role of <strong>“DNS Planner”</strong> and <strong>“DNS Enactor”</strong> is crucial:</p><ul><li><strong>DNS Planner</strong> — Creates “plans” (lists of IP addresses for DynamoDB endpoints)</li><li><strong>DNS Enactor</strong> — Picks up plans generated by the DNS Planner and applies them to <strong>Route53</strong> (3 independent instances in 3 Availability Zones). This component also includes a cleanup process to delete obsolete plans.</li></ul><h3>The Race Condition Timeline</h3><p><strong>~11:30 PM:</strong></p><ul><li>Enactor #1 picks up Plan #100</li><li>Does version check: “Is Plan #100 newer than current?” → YES ✓</li><li>Starts updating Route53, but gets stuck retrying due to transaction conflicts</li></ul><p><strong>11:30 PM — 11:47 PM:</strong></p><ul><li>Enactor #1 is still stuck retrying (18+ minutes of delays)</li><li>During this time, DNS Planner keeps creating new plans: #101, #102… #150</li><li>This is normal operation</li></ul><p><strong>11:47 PM:</strong></p><ul><li>Enactor #2 picks up Plan #150 (the latest)</li><li>Quickly applies it to ALL endpoints successfully</li><li>Route53 now has Plan #150 → Everything working perfectly ✓</li><li>Enactor #2 invokes cleanup: “Delete plans older than #140”</li></ul><p><strong>11:48 PM — THE RACE CONDITION TRIGGERS:</strong></p><p>Two things happen at the exact same millisecond:</p><ul><li><strong>Thread A (Cleanup):</strong> Deletes Plan #100 from storage</li><li><strong>Thread B (Delayed Enactor #1):</strong> Applies Plan #100 to Route53 regional endpoint, overwriting Plan #150</li></ul><p><strong>Result:</strong></p><ul><li>Route53 regional endpoint now references Plan #100</li><li>But Plan #100’s data was just deleted from storage</li><li>DNS query returns: <strong>EMPTY</strong> (no IP addresses)</li><li>DynamoDB becomes completely unreachable via DNS</li></ul><h3>Why Couldn’t It Self-Heal?</h3><p>The automation tried to fix itself but couldn’t:</p><ol><li>System asks: “What plan is currently active?”</li><li>Answer: “Plan #100” (according to Route53)</li><li>System looks for Plan #100 → <strong>NOT FOUND</strong> (it was deleted)</li><li><strong>Deadlock:</strong> Can’t apply new plans without knowing current state; can’t determine current state because it references deleted data</li></ol><p><strong>The critical flaw:</strong> The version check happened at 11:30 PM at the START of Enactor #1’s process. By the time it actually applied the plan at 11:48 PM (18 minutes later), this check was stale. The system had no mechanism to re-validate the check before the final update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L4vcHOt-RgePvdyaEUCmTA.png" /><figcaption>AWS DynamoDB outage explained</figcaption></figure><h3>Impact on Overall Outage and Different Services</h3><p>As DynamoDB is a foundational service used internally by many AWS services, this immediately became a major issue.</p><p><strong>Example:</strong> EC2 uses DynamoDB to store instance metadata. When DynamoDB became unreachable due to DNS issues, new EC2 instance creation immediately failed. This triggered multiple retry attempts and health alarms.</p><p>Even after fixing the DNS issue at 2:40 AM, the overall system took over <strong>14 hours</strong> to fully recover due to cascading effects:</p><ul><li>Failed instance launches created massive retry queues</li><li>When the system came back online, it was overwhelmed by the backlog</li><li>Network Load Balancers experienced health check failures</li><li>Lambda functions couldn’t process event sources</li></ul><p><strong>Services Impacted:</strong> EC2, Network Load Balancer, Lambda, ECS, EKS, Fargate, IAM, Redshift, Amazon Connect, and many others.</p><blockquote><strong>Regional Impact:</strong> This was a regional issue in <strong>N. Virginia (us-east-1)</strong>, one of AWS’s largest and oldest regions, serving as a core hub for major global services.</blockquote><h3>Key Learnings on System Design for Developers and Architects</h3><h4>1. Race Conditions Are Inevitable in Distributed Systems — Design for Them</h4><p>Finding “latent races” in large-scale systems is absolutely difficult. Instead of trying to prevent all race conditions, design systems that can detect and recover from them. It is hard job I know but this is new term we must be aware about hence forth.</p><h4>2. Validation Must Happen at the Point of Action</h4><p>Don’t validate once at the beginning of a multi-hour process. Re-validate immediately before critical operations. In this case, the version check at 11:30 PM was meaningless by 11:48 PM.</p><h3>3. Implement Back-pressure and Circuit Breakers</h3><p>Systems under stress shouldn’t accept unlimited work. AWS’s EC2 entered “congestive collapse” because it tried to process too much work simultaneously after recovery. Design systems that shed load gracefully and fail fast when overwhelmed.</p><h3>4. Monitor for “Impossible” States</h3><p><strong>Observability must include monitoring for conditions that “should never happen.”</strong> In this case, Route53 referencing a non-existent plan should have triggered immediate alerts. I understand it’s easier said than done, but this level of monitoring is crucial for foundational services.</p><h3>5. Design for Failure, Not Perfection</h3><p>This race condition likely existed for years, passing all tests. No amount of testing can catch every edge case in distributed systems. Design with the assumption that failures will happen, and focus on quick detection and recovery.</p><h3>6. Post-Mortems Are Investments, Not Overhead</h3><p><strong>What AWS Did Right:</strong> They published a detailed, transparent post-mortem in a short time, giving the community and industry an opportunity to learn from this incident. This transparency builds trust and advances the entire field of distributed systems engineering.<br>AWS link : <a href="https://aws.amazon.com/message/101925/">https://aws.amazon.com/message/101925/</a></p><p><strong>To summarise regional failures are extremely rare</strong>, and building systems to survive them involves significant cost trade-offs. However, for mission-critical systems, this incident raises important questions about dependency on a single cloud provider and the importance of multi-region architectures.</p><p>The question isn’t <strong>“How do we prevent all failures?”<br></strong>The question is: <strong>“When the inevitable happens, how quickly can we recover?”</strong></p><p>Thank you for your time reading the post.<br>On the journey to make cloud system design simple to understand and provide practical tips, please consider following if you wish to get notified!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0dc8ef7e105" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/what-went-wrong-in-the-october-20th-2025-aws-outage-a0dc8ef7e105">What Went Wrong on the October 20th, 2025 AWS Outage?</a> was originally published in <a href="https://aws.plainenglish.io">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[load balancers, target group and auto scaling group how they are associated with each other and…]]></title>
            <link>https://aws.plainenglish.io/load-balancers-target-group-and-auto-scaling-group-how-they-are-associated-with-each-other-and-2ac660e11af1?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ac660e11af1</guid>
            <category><![CDATA[aws-exam-preparation]]></category>
            <category><![CDATA[application-load-balancer]]></category>
            <category><![CDATA[auto-scaling-groups]]></category>
            <category><![CDATA[aws-solutions-architect]]></category>
            <category><![CDATA[aws-architecture]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Thu, 25 Sep 2025 14:07:27 GMT</pubDate>
            <atom:updated>2025-10-07T22:21:36.528Z</atom:updated>
            <content:encoded><![CDATA[<h3>load balancers, target group and auto scaling group how they are associated with each other and what all things you can do on these layers ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*7cR8VLOUL3oZpgQsbUwElw.png" /></figure><p>When architecting scalable applications on AWS, understanding how Load Balancers, Target Groups, and Auto Scaling Groups works and how they integrate with each other is crucial. These three components form the backbone of resilient, highly available and scalable systems.</p><p>Lets understand each component and then different configurations they can have and then interesting stuff which is what are different cloud design patterns they contribute to.</p><h3>Application Load Balancer — The Traffic Distribution Engine</h3><p>There are three different types of load balancers however for this post we are going to focus on Application Load Balancer.<br>The Application Load Balancer (ALB) sits at the front, receiving incoming requests <strong>and intelligently distributing them across healthy targets.</strong> It operates at Layer 7 (HTTP/HTTPS) and provides advanced routing capabilities. <strong>ALB rules is the super power it has</strong> as it helps route based on conditions and single ALB can be use to distribute different types of traffic to different backend instances.</p><h4>Key Configuration Options at ALB:</h4><ul><li><strong>Listeners</strong>: Define ports and protocols (HTTP:80, HTTPS:443)</li><li><strong>Routing Rules</strong>: Content-based routing using host headers, paths, HTTP methods</li><li><strong>SSL/TLS Termination</strong>: Handle certificates and offload encryption from backend instances</li><li><strong>Sticky Sessions</strong>: Route requests from specific users to the same target</li><li><strong>Cross-Zone Load Balancing</strong>: Distribute traffic evenly across all AZs.</li><li><strong>WAF Integration</strong>: Add Web Application Firewall protection.</li><li><strong>Cognito Integration</strong>: Handle user authentication at the load balancer level.</li><li><strong>Lambda Functions as Targets</strong>: Route requests directly to serverless functions.</li></ul><h3>Target Groups — The Routing &amp; Health-Checks</h3><p><strong>Target groups is the bridge between the load balancers and your compute resources/instances.</strong><br>They define where traffic should go and continuously monitor the health of registered targets. A target can be an EC2 instance, IP address, Lambda function, or even another Application Load Balancer.</p><blockquote>The beauty of Target Groups is their flexibility — <strong>you can register targets manually or have Auto Scaling Groups manage this automatically.</strong> When an Auto Scaling Group launches a new instance, it automatically registers it with the associated Target Group. When scaling down, it handles the deregistration process automatically.</blockquote><h4>Key configurations at the target groups :</h4><ul><li><strong>Health Monitoring</strong>: Continuously checking if targets are healthy and can receive traffic.</li><li><strong>Request Routing</strong>: Determining which healthy target should receive each request based on the configured algorithm.</li><li><strong>Session Management</strong>: Maintaining stickiness when required for stateful applications</li><li><strong>De-registration Handling</strong>: Gracefully draining connections when targets are marked for removal</li><li><strong>Stickiness</strong>: Duration-based or application-controlled cookie stickiness</li></ul><blockquote>ALB-level stickiness applies uniformly to all target groups, while target group-level stickiness allows different configurations for each service/group of instances.</blockquote><h3>Auto Scaling Groups — The Scaling &amp; Management Layer</h3><p>Auto Scaling Groups ensure you have the right number of EC2 instances running at any given time. They automatically adjust capacity based on demand, health checks, or schedules. <strong>When attached to a Target Group, they create a self-healing, auto-scaling infrastructure.</strong></p><blockquote>The integration works like this: When an Auto Scaling Group launches a new instance, it automatically registers the instance with all attached Target Groups. The Target Group then begins health checking the new instance. Only after passing health checks does the instance start receiving traffic from the load balancer.</blockquote><h4>Key configurations at the auto scaling group level :</h4><ul><li><strong>Scaling Policies</strong>: Target tracking, step scaling, or simple scaling based on metrics</li><li><strong>Launch Templates</strong>: Define instance configuration including AMI, instance type, and user data</li><li><strong>Capacity Settings</strong>: Minimum, maximum, and desired capacity. (This is important)</li><li><strong>Warm Pools</strong>: Pre-initialized instances for faster scaling</li><li><strong>Lifecycle Hooks</strong>: Execute custom actions during scale-in or scale-out event.</li></ul><h3>Cloud Design patterns based on these 3 components</h3><h4>Pattern 1: Blue-Green Deployments</h4><p>Gradually shift traffic between two application versions using weighted target groups. <br><strong>Example</strong>: An e-commerce site deploys Black Friday features by routing 10% traffic to the new version, monitoring for issues, then incrementally increasing to 100%.</p><h4>Pattern 2: Multi-Tier Architecture</h4><p>Chain multiple load balancers where frontend ALB routes to internal NLBs for backend services.<br><strong>Example :</strong> A banking app where the public ALB handles web traffic, routing to internal NLBs that distribute requests to transaction processing systems and account services.</p><h4>Pattern 3: Cross-Region Failover</h4><p>Combine Route 53 health checks with load balancers in multiple regions. Each region has its own ALB → Target Group → Auto Scaling Group stack. Route 53 monitors the health of each ALB and fails over traffic when needed.<br><strong>Example</strong>: A streaming service maintains active stacks in US-East and US-West; if the East Coast data centre fails, Route 53 automatically redirects all viewers to West Coast servers.</p><h4>Pattern 4: Hybrid Scaling Strategy</h4><p>Configure multiple Auto Scaling policies: target tracking for normal operations (e.g., maintain 70% CPU utilization), scheduled scaling for predictable traffic patterns, and step scaling for rapid response to sudden spikes.<br><strong>Example</strong>: A food delivery app scales on 70% CPU normally, adds capacity before lunch/dinner rushes (scheduled), and rapidly scales during unexpected viral promotions (step scaling).</p><h4>Pattern 5: Container-Based Architecture</h4><p>Register ECS tasks or EKS pods directly in Target Groups using IP target type. The container orchestrator handles registration/deregistration automatically as containers start and stop.<br><strong>Example</strong>: A retail platform where each microservice (inventory, pricing, recommendations) runs in containers that automatically join their respective Target Groups as they scale.</p><h3>Key Takeaways</h3><p>The relationship between these three components is beautifully simple yet powerful, where load balancers only knows about the target groups not behind them, target groups manage the targets and their health and auto scaling groups has the ability to add or remove the instances in the target groups.</p><blockquote>The integration of ALB, Target Groups, and Auto Scaling Groups creates a powerful, self-healing and self scaling infrastructure that can:<br><strong>1. Automatically distribute traffic across healthy instances<br>2. Scale compute capacity based on demand<br>3. Maintain high availability across multiple failure domains<br>4. Provide sophisticated routing and health checking capabilities</strong></blockquote><p>Understanding these interconnections allows you to design robust, scalable applications that can handle varying loads while maintaining optimal performance and cost efficiency.</p><p><strong>Remember:</strong> while the Load Balancer handles traffic distribution and Target Groups manage routing and health checks, it’s the Auto Scaling Group that brings the dynamic scaling magic to your infrastructure. Together, they form the foundation of scalable, resilient, modern cloud-native architectures on AWS.</p><p>Thank you for your time reading the post.<br>On the journey to make cloud system design simple to understand and provide practical tips, please consider following if you wish to get notified!</p><h3>References</h3><ul><li><a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/">AWS Auto Scaling Documentation</a></li><li><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/">Application Load Balancer User Guide</a></li><li><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html">Target Groups Configuration Guide</a></li><li><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html">Health Checks for ALB Target Groups</a></li><li><a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/attach-load-balancer-asg.html">Attaching Load Balancers to Auto Scaling Groups</a></li></ul><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ac660e11af1" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/load-balancers-target-group-and-auto-scaling-group-how-they-are-associated-with-each-other-and-2ac660e11af1">load balancers, target group and auto scaling group how they are associated with each other and…</a> was originally published in <a href="https://aws.plainenglish.io">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[monolith vs microservices — or is it a modern-monolith vs microservices ?]]></title>
            <link>https://medium.com/@chaudhari.aditya24/monolith-vs-microservices-or-is-it-a-modern-monolith-vs-microservices-ab3320ab765f?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab3320ab765f</guid>
            <category><![CDATA[cloud-architecture]]></category>
            <category><![CDATA[monolithic-architecture]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[microservices-vs-monolith]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Mon, 22 Sep 2025 19:30:51 GMT</pubDate>
            <atom:updated>2025-09-22T19:30:51.888Z</atom:updated>
            <content:encoded><![CDATA[<h3>monolith vs microservices — or is it a modern-monolith vs microservices ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*01Ot9zXLwerCPt_V_KyCoQ.png" /></figure><p>Whenever someone hears “monolith,” the first reaction is usually, “No — that’s legacy, not modern.” That’s a quick stereotype. Here is my attempt to flip the script and introduce a different view: the <strong>“Modern Monolith.”</strong></p><p>Over the last decade the microservices architecture has been on a rollercoaster ride. When microservices emerged, everyone raced to break apart big monoliths into dozens of small services. Cloud platforms made this easy, so teams copied standard microservice architecture template for new projects without fully weighing the trade-offs.<br>All this happened until Amazon Prime engineering team published a blog on how they moved some critical services back to monolith.</p><p><em>In this post I want to offer a different perspective on monoliths. I’m calling it a </em><strong><em>“modern monolith”</em></strong><em> — not a formal term, just a mental model to think about today’s monolithic apps differently. <br>The idea is — don’t dismiss “monolith” as legacy. A well-architected monolith — stateless, modular, event-driven, CI/CD-enabled — can deliver scalability and agility while avoiding the operational complexity of an overly fragmented microservice landscape.</em></p><p><strong>Let’s break the debate into four questions:</strong></p><p><strong>Q. What is a Monolithic Architecture?<br>Q. What is a Microservices Architecture?<br>Q. What Went Wrong in Heavy Adoption of Microservices?<br>Embracing a “Modern Monolith” — best of both worlds</strong></p><h3>Q. What is a Monolithic Architecture ?</h3><p>A <strong>monolithic architecture</strong> is a single, unified software system where most components share one codebase and one deployment artifact. Monoliths go way back — mainframes, early web apps and enterprise systems were monolithic by necessity. <strong>Containers, microservices, and elastic cloud scaling didn’t exist then.</strong></p><p><strong>Pros (early-stage / small-medium apps):</strong></p><ul><li><strong>Simplicity</strong> — one codebase, one deployable, straightforward local development.</li><li><strong>Performance</strong> — internal calls are in-process (no network hops).</li><li><strong>Faster initial delivery</strong> — less infra and orchestration overhead.</li></ul><p><strong>Cons (as it grows):</strong></p><ul><li><strong>Scaling limits</strong> — you scale the whole app, not just the hot path.</li><li><strong>Slower release cycles</strong> — rebuilding/redeploying the entire artifact.</li><li><strong>Maintainability</strong> — codebase complexity, long CI times, merge conflicts.</li><li><strong>Tech lock-in</strong> — upgrading frameworks or platforms affects the whole app.</li></ul><h3>Q. What is a Microservices Architecture?</h3><p>A <strong>microservices</strong> architecture splits functionality into small, independent services. Each service runs in its own process, owns its data model (often its own DB), and communicates via APIs or messaging. This model rose to prominence in the 2010s with large-scale examples like Netflix and Amazon, who decomposed monoliths to scale teams and features independently.</p><p><strong>Pros:</strong></p><ul><li><strong>Independent scaling</strong> per service.</li><li><strong>Resilience</strong> — faults are isolated.</li><li><strong>Team autonomy</strong> — smaller teams own services end-to-end.</li><li><strong>Technology choice</strong> per service.</li></ul><p><strong>Cons:</strong></p><ul><li><strong>Operational complexity</strong> — service discovery, observability, security, CI/CD for many services.</li><li><strong>Higher infra costs</strong> — many services mean more runtime, DBs, monitoring.</li><li><strong>Distributed debugging</strong> — tracing failures across services is harder.</li><li><strong>Data consistency difficulties</strong> — cross-service transactions get complex.</li></ul><h3>Q. What Went Wrong in Heavy Adoption of Microservices?</h3><p>Microservices became a buzzword. Many teams adopted them for reasons like “we’ll grow big soon,” like Netflix, Amazon and Uber but without real evidence or the organisational maturity to manage them and actual projection needed.</p><p><strong>Common failures:</strong></p><ul><li><strong>Premature decomposition.</strong> Splitting too early yields high operational cost without real benefit.</li><li><strong>Operational overhead.</strong> Teams underestimated the amount of platform work (observability, deployments, networking).</li><li><strong>Sprawl and cognitive load.</strong> Hundreds of tiny services become hard to manage, locate, and reason about.</li><li><strong>Cost surprises.</strong> More services often mean higher cloud bills and tooling costs.</li></ul><p>In short: microservices solve real problems, but they bring a “<strong>complexity tax.</strong>” If you’re not paying that tax for clear gains (scale, independent life cycles, independent ownership), it’s usually the wrong move.</p><h3>Embracing a “Modern Monolith” — best of both worlds.</h3><p><strong>Think of “modern monolith” as advanced version of “monolith”.</strong><br>“Modern monolith” means treating a single deployable as a first-class, cloud-native app. Apply modern patterns <em>inside</em> the monolith so it becomes easier to scale, evolve, and split later if needed.</p><p><strong>Key practices :</strong></p><ol><li><strong>Stateless design</strong> —<br>Keep the application stateless so multiple instances can run behind a load balancer. Push session/state to caches or stores (Redis, DynamoDB, etc.). That makes horizontal scaling simple — add identical nodes as load increases.<br>success story — <a href="https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith#:~:text=Atlassian%20followed%20the%20path%20to,to%20scale%20to%20future%20needs">atlassian.com</a>(reference link) .</li><li><strong>Modular code organization —<br></strong>Structure code into clear modules or bounded contexts (orders, payments, customers). A modular monolith gives you the cognitive clarity of service boundaries while keeping a single deployable. Frameworks like <em>Spring Modulith</em> exist to help verify boundaries in a Spring Boot app.<br><strong>Example</strong> : Developers often use frameworks like <em>Spring Modulith</em> that let you define and verify domain modules within a single Spring Boot app. The advantages are clear: you still deploy one artifact, but your code is well-factored and <strong>in future when you need you turn that module into microservice.</strong></li><li><strong>Event-driven internally.</strong> Use domain events or an internal message bus to decouple modules. Rather than synchronous in-app calls.<br> <strong>This reduces tight coupling and makes future extraction easier.</strong></li><li><strong>Best-of-cloud practices.</strong> Run the monolith in containers or VMs that can be scaled, and use platform services for things like caching, queues, and managed databases. <strong>Treat it like any cloud-native app.</strong> Leverage auto-deploy pipelines so that even a monolith can be continuously deployed. With modern CI/CD, even large monoliths can have quick, reliable releases if you have good test coverage and automation.</li><li><strong>Selective microservice adoption.</strong> In a modern approach, you only split off services when there’s a clear need. For example, Prime Video kept its billing and content-management as separate microservices (where that made sense), but merged the performance-sensitive playback stack into a monolith. The core idea is: start with a monolith, refine it, then peel off genuinely independent pieces.</li></ol><p>By doing this, you capture most microservices benefits (modularity, scalability) without most of the overhead. Atlassian’s own experience proves it. They moved Jira/Confluence to AWS <em>as monolithic, stateless cloud apps first</em>, then gradually carved out microservices as needed. ref — <a href="https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith#:~:text=Atlassian%20followed%20the%20path%20to,to%20scale%20to%20future%20needs">atlassian.com</a>. Only after the apps were stable on the cloud did they break apart. This gave them scaling headroom up front and a smoother path to finer-grained architecture later.</p><h3>How modern monoliths handle classic problems (scaling &amp; reliability)</h3><ul><li><strong>Horizontal app scaling</strong> — make the app stateless, scale instances, and front them with a load balancer.</li><li><strong>Database bottlenecks</strong> — use read replicas, caching (Redis), CQRS for read-heavy workloads, and table partitioning/horizontal sharding when needed.</li><li><strong>Async processing</strong> — move long-running or CPU-heavy tasks to background workers (message queues, Lambda/functions, job runners).</li></ul><h3>Practical decision checklist: when to split into microservices</h3><p>Consider extracting a module only when one or more of these are true:</p><ul><li>The module needs <strong>independent scaling</strong> and causes disproportionate infra cost if kept inside the monolith.</li><li>The module has <strong>strongly different SLAs</strong> or security/compliance needs.</li><li>The module’s team needs <strong>independent release cycles</strong> that block others.</li><li>The module requires <strong>radically different technology</strong> that can’t co-exist cleanly in the same codebase.</li><li>You have <strong>reliable metrics</strong> showing frequent incidents, latency, or deployment contention attributable to that module.</li></ul><p>If none of the above are true — keep it in the modern monolith, but modularize it.</p><blockquote>As Martin Fowler advises, nearly all successful microservice systems started as a modular monolith first. Only when that monolith hit real scaling or organizational limits should you peel off services. (ref — <a href="https://martinfowler.com/bliki/MonolithFirst.html#:~:text=1,ended%20up%20in%20serious%20trouble">martinfowler.com</a>).</blockquote><h3>Conclusion — pragmatic advice</h3><p>Start with a well-factored, cloud-ready modern monolith. Make it stateless, modular, observable, and CI/CD-enabled. Optimize and measure. Only extract microservices when data (not hype) shows a clear benefit. A <strong>modern monolith is not a step backward — it’s a practical, low-risk starting point that lets you move fast and split later if you must.</strong></p><p>Thank you for your time reading the post.<br>On the journey to make cloud system design more practical and simple to understand, please consider following if you wish to get notified!</p><p>references : <br><a href="https://www.youtube.com/watch?v=9JPYCOpeDnY">https://www.youtube.com/watch?v=9JPYCOpeDnY</a> (Amazon prime case-study)</p><ul><li><a href="https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith#:~:text=A%20monolithic%20architecture%20is%20a,consuming">Microservices vs. monolithic architecture | Atlassian</a></li><li><a href="https://www.atlassian.com/microservices/microservices-architecture/microservices-vs-monolith#:~:text=Easy%20deployment%20%E2%80%93%20One%20executable,or%20directory%20makes%20deployment%20easier">Microservices vs. monolithic architecture | Atlassian</a></li><li><a href="https://www.atlassian.com/microservices/cloud-computing/advantages-of-microservices#:~:text=1">5 Advantages of Microservices [+ Disadvantages] | Atlassian</a></li><li><a href="https://martinfowler.com/bliki/MonolithFirst.html#:~:text=1,ended%20up%20in%20serious%20trouble">bliki: Monolith First</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab3320ab765f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application Load Balancers — 3 Powerful Features Beyond Traffic Distribution]]></title>
            <link>https://aws.plainenglish.io/application-load-balancers-3-powerful-features-beyond-traffic-distribution-d47860d2372b?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/d47860d2372b</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws-certified-developer]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[application-load-balancer]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Sun, 21 Sep 2025 16:07:58 GMT</pubDate>
            <atom:updated>2025-10-01T04:31:23.657Z</atom:updated>
            <content:encoded><![CDATA[<h3>Application Load Balancers — 3 Powerful Features Beyond Traffic Distribution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TKAg3CVQc0m3ybbbOkAmaQ.png" /></figure><p>When we think about load balancers, most of us immediately think “distribute traffic.” That’s true, but modern Application Load Balancers (ALBs) can do much more — and those extras are often very handy when designing system architecture.</p><p>Apart from distributing the load to downstream servers ALB also provides :</p><ol><li><strong>sticky session / sticky affinity .</strong></li><li><strong>content based routing</strong></li><li><strong>TLS offloading (a.k.a. TLS/SSL termination)</strong></li></ol><h3><strong>1. sticky session / sticky affinity .</strong></h3><p>There’s an increasing trend to design stateless backends — centralizing cache and session state — but some use cases still benefit from having a user hit the same backend instance for a period of time. ALB supports cookie-based stickiness (either using an ALB-generated cookie or your application’s cookie) so subsequent requests from the same client are routed to the same target.</p><p><strong>Examples :</strong><br><strong>1) cart and checkout </strong>— on a busy e-commerce site, a user may keep a checkout session open while price checks and product comparisons happen. Sticky sessions can keep that user on the same server so local cache or in-memory session data improves latency for the checkout flow.</p><p><strong>2) Gaming — </strong>game sessions often require low latency and frequently access per-player state in memory. Session affinity lets a player’s traffic stay pinned to the same backend instance for the duration of a match.</p><blockquote><strong>Notes / best practice:</strong> sticky sessions are useful for short-lived or transitional state, but for long-term scalability and resiliency you should move session state to a central store (Redis, DynamoDB, etc.). ALB stickiness is configurable (cookie duration), but relying on it as a permanent design for stateful apps can hinder scaling and rolling updates.</blockquote><h3>2. <strong>content based routing</strong></h3><p>This is a great ALB feature for microservices. Because ALB operates at Layer 7, it can inspect HTTP requests and route by host, path, headers, or query string — enabling a single ALB to front many services.</p><p><strong>Examples :</strong></p><p><strong>1. Path-Based routing — </strong>An e-commerce application uses an ALB to route requests for browsing products (/products/*) to backend servers optimized for reading data, while requests for the shopping cart (/cart/*) go to servers that need to maintain state and open connections.</p><p><strong>2. Host-based routing </strong>— A single ALB can host multiple domains or subdomains, routing contact.example.com requests to a customer support microservice and home.example.com requests to a general content service</p><p><strong>3. Header-basesd routing</strong>- A request with a specific custom header, like X-API-Version: 2, could be routed to a newer version of an API service.</p><p><strong>4. Query String routing- </strong>Routing requests based on specific query parameters, such as ?order=false, to a different backend service or target group than those that process requests with ?order=true.</p><p><strong>3. TLS offloading (a.k.a. TLS/SSL termination)<br></strong>TLS offloading means the ALB negotiates TLS with the client and decrypts traffic at the load balancer. You can then forward HTTP (cleartext) or re-encrypt to the backend over HTTPS.</p><blockquote>TLS offloading is recommended on an <a href="https://www.google.com/search?q=Application+Load+Balancer&amp;rlz=1C5GCEA_en&amp;oq=why+TLS+offloading+%28a.k.a.+TLS%2FSSL+termination%29+is+recommended+on+ALB%3F&amp;gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRiPAjIHCAIQIRiPAtIBCDQ3MTJqMGo3qAIAsAIA&amp;sourceid=chrome&amp;ie=UTF-8&amp;mstk=AUtExfD2t_NYYSVDHWWzaywLCzpDYuC-5EMpuKug_qq8Gpzz-7gXbGNkAKlvosNpjLSEN3KpNXqE4X_plvO17HeAMWoHDOUiF0nBQach6r1BDLEY_scyZhbeqFF7LVwUhWLlUaSw5co4rbnFc7BylhuqU5cD1KHOFhX6Q04Z_57Jee8uzHveP1vLNa6Hdnxqtts5oklnKWdUHVUHtHMZtz3bkd5zK3C-93gW727uMF-NGerbDs5YBK_EVr4a8Su98nWKd5tKBq8VHrEsd0VIrVX99eza&amp;csui=3&amp;ved=2ahUKEwi-oqbd-emPAxUNQUEAHScOHPoQgK4QegQIARAD">Application Load Balancer</a> (ALB) to <strong>improve server performance and efficiency</strong> by offloading the computationally intensive <a href="https://www.google.com/search?q=TLS&amp;rlz=1C5GCEA_en&amp;oq=why+TLS+offloading+%28a.k.a.+TLS%2FSSL+termination%29+is+recommended+on+ALB%3F&amp;gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRiPAjIHCAIQIRiPAtIBCDQ3MTJqMGo3qAIAsAIA&amp;sourceid=chrome&amp;ie=UTF-8&amp;mstk=AUtExfD2t_NYYSVDHWWzaywLCzpDYuC-5EMpuKug_qq8Gpzz-7gXbGNkAKlvosNpjLSEN3KpNXqE4X_plvO17HeAMWoHDOUiF0nBQach6r1BDLEY_scyZhbeqFF7LVwUhWLlUaSw5co4rbnFc7BylhuqU5cD1KHOFhX6Q04Z_57Jee8uzHveP1vLNa6Hdnxqtts5oklnKWdUHVUHtHMZtz3bkd5zK3C-93gW727uMF-NGerbDs5YBK_EVr4a8Su98nWKd5tKBq8VHrEsd0VIrVX99eza&amp;csui=3&amp;ved=2ahUKEwi-oqbd-emPAxUNQUEAHScOHPoQgK4QegQIARAE">TLS</a> encryption/decryption from backend application servers</blockquote><p><strong>Example end-to-end patterns :</strong></p><ul><li><strong>Pattern A — Simple (recommended)</strong><br>Route53 → ALB (HTTPS, ACM) —TLS terminated→ Private targets (HTTP)<br>When to use: Simple, performant setup when you trust VPC traffic.</li><li><strong>Pattern B — End-to-end encrypted</strong><br>Route53 → ALB (HTTPS, ACM) —TLS terminated→ ALB re-encrypts → Targets (HTTPS with backend certs)<br>When to use: Compliance or policy requires encryption to the host.</li></ul><p>Apart from these top 3 (in my opinion), ALB also supports things like <br>1) health-checks of the target group by sending HTTP or HTTPS requests to registered targets to verify their health.<br>2) invoke lambda directly as a target in the ALB.<br>3) integrations with other services like — cognito, WAF which enhances the security further.<br>4) ALB also supports WebSockets/HTTP2, access logging, and routing rules that let you implement complex traffic shaping for microservices.</p><p>Thank you for your time reading the post.<br>On the journey to make cloud system design simple to understand and provide practical tips, please consider following if you wish to get notified!</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d47860d2372b" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/application-load-balancers-3-powerful-features-beyond-traffic-distribution-d47860d2372b">Application Load Balancers — 3 Powerful Features Beyond Traffic Distribution</a> was originally published in <a href="https://aws.plainenglish.io">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DNS is something nobody cares about …..until it stops working]]></title>
            <link>https://medium.com/@chaudhari.aditya24/dns-is-something-nobody-cares-about-until-it-stops-working-6b415a1f1b42?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b415a1f1b42</guid>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 14:02:43 GMT</pubDate>
            <atom:updated>2025-10-21T07:55:53.762Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>DNS is something nobody cares about …..until it stops working</em></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*1XdVcuUgqgKX38zIXkwATA.png" /><figcaption>DNS img credit- https://academy.bit2me.com</figcaption></figure><p>Recently, I encountered a unique challenge that led me on an unexpected path of discovery. <br><strong>Imagine this:</strong> we were trying to integrate a third-party application that used its own SMTP server. Our plan was to send emails using our email ID, <a href="mailto:salesagent@mydomain.com">salesagent@mydomain.com</a>. This approach was crucial for maintaining trust with our customers and collaborators, making it seem as though the emails were coming directly from us, despite being sent through the third-party’s SMTP server.</p><p>It seemed simple at first. However, we soon faced a problem —<strong> emails sent through this setup were not reaching their destinations. </strong><br>In the root cause analysis my usual focus was on application architecture and development, but this problem led me into uncharted territory which is DNS. DNS setting was the root cause behind our email issue, we deep dived into DNS tuned some configurations and it solved the problem.<br>All this turned into a fascinating exploration of how vital DNS settings are for ensuring emails sent from *@mydomain.com are recognized and delivered correctly. It highlighted the essential, yet often overlooked, role of DNS in our digital world.</p><h3><strong>What is DNS?</strong></h3><p>Ever wondered how typing a website address like google.com or gmail.com gets you to the right place? That’s where DNS, or the Domain Name System, comes into play.</p><blockquote>Imagine DNS as the <strong>internet’s phonebook.</strong> It matches domain names to their corresponding IP addresses, much like how a phonebook pairs names with phone numbers. So, when you visit a website or send an email, servers around the world quickly direct your request to the right server IP address, all in the blink of an eye.</blockquote><p>This process is quick, crucial, and ensures the internet operates smoothly. Let’s dive into how this critical yet unseen part of the internet works.</p><h3>How DNS Works: The Basics quick dive</h3><p>Ever typed ‘example.com’ and wondered how your browser knows where to go? That’s DNS for you — <strong>the internet’s phonebook</strong>. It’s like asking for directions and getting a precise location, say ‘192.0.2.1’, which your browser then uses to take you to your desired website. And guess what? If you visit often, your computer remembers the way, making the trip even faster next time, thanks to something called <strong>DNS caching</strong>.</p><h4>There’s More to DNS</h4><p><strong>DNS isn’t just about turning names into numbers. It does offer couple of other important things,</strong></p><ul><li><strong>Load Balancing: </strong>Think of it as air traffic control for the internet, keeping websites up and running smoothly by spreading out visitor traffic.</li><li><strong>Redundancy and Failover:</strong> It’s like having a backup plan when a server takes a day off, directing users to others that are wide awake.</li><li><strong>Domain Management:</strong> DNS juggles all sorts of records, making sure emails find their way and websites know where to stand.</li><li><strong>Geographical Routing: </strong>It’s all about getting you there faster by connecting you to a server nearby.</li><li><strong>Security Features:</strong> Protecting against the internet’s version of prank calls with things like DNSSEC.</li><li><strong>Caching: </strong>Remembering your frequent stops to make revisits a breeze.</li></ul><h4>DNS Hierarchy Explained</h4><p>“Let’s understand now how domain name is actually used by the DNS to resolve it to the IP, DNS hierarchy plays important role there. <a href="http://www.google.com">www.google.com</a></p><ol><li><strong>Root Level</strong>: At the top, we have the root servers. They guide our queries in the right direction, like signposts at a crossroads.</li><li><strong>Top-Level Domains (TLDs)</strong>: Next are the TLDs, like .com in <a href="http://www.google.com">www.google.com</a>. The .com part tells us it’s a commercial website.</li><li><strong>Second-Level Domains</strong>: Here’s where we find google in <a href="http://www.google.com">www.google.com</a>. This is the domain name, the unique identifier chosen by the website owner.</li><li><strong>Subdomains</strong>: Underneath that, we have subdomains. For example, www in <a href="http://www.google.com">www.google.com</a> is a subdomain. It&#39;s commonly used to denote a website.</li></ol><p>And don’t forget the dots! They’re like the spaces between words, helping to separate each part of the web address for clarity.</p><p>So, in <a href="http://www.google.com">www.google.com</a>, we’re going from the general to the specific – starting from the type of domain (.com), moving to the unique name of the site (google), and specifying a particular service or page (www). It’s a neat, organized system that makes navigating the internet a whole lot easier.&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/0*em84qG7aHiLR6SDp.png" /></figure><h3>DNS Records: The Basics</h3><p>DNS records is like the easy understandable syntax using which configurations can be made for the DNS servers.<br><strong>Out of others there are 4 absolutely essential DNS records types developer must know which are :</strong></p><ul><li><strong>A Record (Address Record)</strong>: This is the backbone of the DNS system. A Records map a domain name to an IPv4 address. So when someone types in <a href="http://example.com">example.com</a>, the A Record tells the DNS server which IP address to send them to.<br><strong>Example</strong>: <a href="http://example.com">example.com</a> → 93.184.216.34<br><strong>Explanation</strong>: The A Record for <a href="http://example.com">example.com</a> directs the browser to the IPv4 address 93.184.216.34.</li><li><strong>AAAA Record</strong>: Similar to the A Record, but it maps a domain to an IPv6 address, which is the newer IP address format designed to accommodate the vast number of internet devices.<br><strong>Example</strong>: <a href="http://example.com">example.com</a> → 2606:2800:220:1:248:1893:25c8:1946<br><strong>Explanation</strong>: The AAAA Record for <a href="http://example.com">example.com</a> points to the IPv6 address 2606:2800:220:1:248:1893:25c8:1946.</li><li><strong>CNAME Record (Canonical Name Record)</strong>: Think of CNAME Records as aliases. If you have multiple subdomains like <a href="http://www.example.com">www.example.com</a> and <a href="http://shop.example.com">shop.example.com</a>, and they point to the same IP address, you can use a CNAME record to redirect them to the primary domain name.<br><strong>Example</strong>: <a href="http://blog.example.com">blog.example.com</a> → <a href="http://example.com">example.com</a><br><strong>Explanation</strong>: The CNAME Record for <a href="http://blog.example.com">blog.example.com</a> redirects requests to the primary domain <a href="http://example.com">example.com</a>.</li><li><strong>MX Record (Mail Exchange Record)</strong>: <strong>This one is all about email</strong>. MX Records specify the mail server responsible for accepting email messages on behalf of a domain. It’s like a postal sorting office, directing where mail for a domain should go.<br><strong>Example</strong>: <a href="http://example.com">example.com</a> → <a href="http://mail.example.com">mail.example.com</a><br><strong>Explanation</strong>: The MX Record for <a href="http://example.com">example.com</a> specifies that <a href="http://mail.example.com">mail.example.com</a> is the server handling its email traffic.</li></ul><h3>lets understand MX records using simple example ,</h3><p>“Let’s say we have a fictional company named ‘<a href="http://SunnySideUp.com">SunnySideUp.com</a>’ that just set up their email system. They’ve decided to use an email hosting service, like Microsoft 365, for handling their emails. Here’s how MX records come into play:</p><ol><li><strong>Setting Up the MX Records</strong>: When setting up their email with Microsoft 365, <a href="http://SunnySideUp.com">SunnySideUp.com</a> is given specific MX records to add to their DNS settings. These records might look something like this:<a href="http://sunnysideup-com.mail.protection.outlook.com">sunnysideup-com.mail.protection.outlook.com</a> (Priority: 0)</li><li><strong>How It Works</strong>: Now, imagine I’m sending an email to <a href="mailto:info@sunnysideup.com">info@sunnysideup.com</a>. My email service (let&#39;s say Gmail) will look up the MX records for &#39;<a href="http://SunnySideUp.com">SunnySideUp.com</a>&#39;. It finds the MX record pointing to Microsoft&#39;s email servers.</li><li><strong>Email Routing</strong>: Gmail then sends my email directly to Microsoft’s email servers, as specified by the MX record. The priority ‘0’ in this case tells Gmail that this is the primary (and in our example, the only) server where emails should be delivered.</li><li><strong>Email Reception</strong>: Microsoft’s servers receive my email and then process it, eventually delivering it to the inbox of <a href="mailto:info@sunnysideup.com">info@sunnysideup.com</a>.</li><li><strong>Fallback Mechanism</strong>: If <a href="http://SunnySideUp.com">SunnySideUp.com</a> had multiple MX records with different priorities, my email service would try the highest priority (the lowest number) first. If that server can’t be reached, it would then try the next one in line.</li></ol><p>In this example, the MX record is essentially the signpost that tells any email sent to ‘@<a href="http://sunnysideup.com">sunnysideup.com</a>’ exactly where to go to get delivered. Without it, emails would be like letters sent without an address — they wouldn’t know where to go!”</p><h3>Picking the Right DNS Provider</h3><p>Leveraging DNS’s full suite isn’t a solo journey; there are standout services like Cloudflare and Amazon Route 53 ready to help. Cloudflare shines with its speedy and secure DNS management, while Amazon Route 53 boasts reliability and scalability. Both offer tools for everything DNS, from domain resolution to advanced security, all wrapped up in easy-to-use platforms.</p><h3>Why Developers Should Know About DNS ?</h3><p>Think of <strong>web hosting as the home for your website,</strong> a place where all the site’s information lives. <strong>DNS, or the Domain Name System, is like the sign that points people to your home when they type your website’s address</strong>, like example.com, into their browsers. <br>For anyone building web applications, knowing how to connect your site’s address to its online home(web hosted), and how to handle DNS settings, is super important. It makes sure your website is not just up and running but also easy to find and secure. Even just understanding the basics, such as how to set up where your website points or how emails are sent and received, can help you fix problems faster. I learned the hard way that not paying attention to DNS settings can lead to unexpected issues, like emails not being sent properly.</p><h4>DNS in Application Development: Handy Tips</h4><ul><li><strong>Keep DNS Records Updated: </strong>It’s like letting everyone know you’ve moved to a new house so your mail doesn’t get lost.</li><li><strong>Use DNS Caching: </strong>This speeds up how fast your app works, similar to remembering a friend’s phone number to avoid looking it up all the time.</li><li><strong>DNS Load Balancing: </strong>This spreads out website visitors to prevent your app from crashing, much like having several lines open at a store checkout.</li><li><strong>Secure Your DNS:</strong> Protecting your DNS is crucial for keeping your app safe from online threats, just like locking your doors at night.</li></ul><h4>Navigating Common DNS Issues</h4><p>Encountering problems with DNS can be frustrating, like hitting unexpected delays. For example, when you make changes to your DNS, it might take some time for everything to update across the internet — think of it as waiting for paint to dry. If your site isn’t showing up, double-checking your DNS settings is a good start, like making sure you dialed a phone number correctly. A small mistake in your DNS records can lead to big headaches, similar to dialing one wrong number in an important phone call. And if your site is slow, the issue might be with the DNS server, not your website itself, kind of like how traffic jams can slow you down even if your car is fine.</p><h3>Conclusion</h3><p>DNS might not get a lot of attention, but it’s crucial for making sure your online projects work smoothly. It does a lot more than just connect domain names to IP addresses; it affects how well your application performs, its security, and how reliable it is. Think of DNS as a helpful tool in your developer toolkit, guiding people to your app or website quickly and safely. <strong>Keeping your DNS settings in check is as essential as keeping your code clean and efficient.</strong></p><p><strong>Refecences : </strong><br>https://blog.bytebytego.com/p/a-crash-course-in-dns-domain-name?utm_source=substack&amp;utm_medium=email<br>https://www.packtpub.com/product/managing-mission-critical-domains-and-dns</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b415a1f1b42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Next-Word Prediction Is the Heart of LLMs (and Feels Like Magic)]]></title>
            <link>https://medium.com/@chaudhari.aditya24/why-next-word-prediction-is-the-heart-of-llms-and-feels-like-magic-dc488929dd0f?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc488929dd0f</guid>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Tue, 10 Jun 2025 15:31:40 GMT</pubDate>
            <atom:updated>2025-06-27T16:12:23.604Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Why Next-Word Prediction Is the Heart of LLMs (and feels like a Magic)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi9xfaNfXIXNinEnQ-lgQA.png" /><figcaption>LLM in detective analogy</figcaption></figure><p>Like many of you, I found ChatGPT magical at first — until I learned LLMs are just about predicting the next word, again and again, incredibly well.</p><blockquote>“Advanced AI systems, particularly large language models, ‘understand’ text by predicting the next word in a sequence” — Geoffrey Hinton (The “Godfather of AI”)</blockquote><blockquote>“LLMs are ‘next word prediction system’” — Andrej Karpathy (Former OpenAI founding member, Tesla AI Director)</blockquote><p>When leading AI personalities talk about LLMs, they often call them as <em>“</em><strong><em>next word prediction systems.</em></strong><em>” </em>There’s a reason for this, and it’s more profound than it sounds.</p><p>Let’s try to find answers for 3 keyq uestions about the GenAI:<br><strong>Q. How does next-word prediction actually happen inside an LLM?<br>Q. Are GenAI and LLMs the same?<br>Q. Why is next-word prediction such a big deal — and how does it relate to “intelligence”?</strong></p><h3><strong>Q. How does next-word prediction actually happen inside an LLM?</strong></h3><p>For simplicity, let’s break down the LLM pipeline into four main blocks, across two phases:</p><ul><li><strong>Training phase</strong>: Here the model learns by analyzing massive amounts of text, adjusting itself to better predict the next word.</li><li><strong>Inference phase</strong>: Here the trained model generates responses to user prompts, using what it has learned to predict the next word in real time.</li></ul><p>(Except for “Verify Predictions,” all blocks are used in both phases.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*OLNgf2jWMQ7TbZt4cjf4dg.png" /></figure><p>If you fancy going deep please check <a href="https://www.youtube.com/watch?v=7xTGNNLPyMI&amp;t=558s">here</a>.(3+hours long video but worth the time). Also have a look over <a href="https://proceedings.neurips.cc/paper_files/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf">this white paper</a>.<br>In this blog I am trying to put key things learned from above resources which are essential for any software developer, architect.</p><p>Continue reading further to get the gist of important components.</p><h3>BLOCK 1: READ TEXT — Converting human language into machine-understandable format</h3><p><strong>1) Tokenization</strong>: Breaking text into smaller units (tokens) that the model can process. Example: “Let’s learn about AI” → [“Let”, “‘s”, “learn”, “about”, “A”, “I”].</p><p><strong>2) Vector Embeddings</strong>: Each token is converted into a vector (a list of numbers) capturing its meaning. E.g., “dog” and “puppy” get vectors close together in space.</p><p><strong>3) Positional Encoding</strong>: <em>Adds information about word order. For example, “dog bites man” ≠ “man bites dog” — positional encoding helps the model know the difference.<br>Vector embeddings put the tokens on their specific area howevver positional encoding further enhance their location looking at the “position” in any specific sentense.</em></p><p><strong>Flow</strong>: Raw text → Tokenisation → Token IDs → Vector Embeddings → Position-aware representations.</p><blockquote><strong>Understanding basics of Tokenization and vector embeddings is crucial if you are looking to develop any GenAI/ LLM application.</strong></blockquote><h3>BLOCK 2: PREDICT WORD — The core engine</h3><ol><li><strong>Transformer</strong>: Architecture that processes token sequences in parallel. Example: Processing “The capital of France is” all at once to predict “Paris”. <em>Think of it as a super-flexible neural network specialised for sequences.</em></li></ol><blockquote>Do you know google translations transformer architecture model is at the heart of all modern LLMs ?</blockquote><p><strong>2) Self-attention</strong>: Mechanism allowing tokens to “see” other tokens in the sequence. Example: <em>“The cat sat on the mat because it was soft,” “it” refers to “mat” — self-attention helps the model figure that out.</em></p><p><strong>3) Multi-head Attention</strong>: Running self-attention multiple times in parallel to capture different relationships. <br><em>Example: One head focuses on grammatical structure while another captures topical relationships.</em></p><blockquote>Attention steps are where LLM start becoming intelligent, learning different meanings, intention behind the sentences like we do.</blockquote><p><strong>4) Feed-Forward</strong>: Neural network layer processing each token position independently. <br>Example: After tokens interact through attention, feed-forward networks transform each position’s representation individually.</p><p><strong>Flow</strong>: Input embeddings → Self-Attention → Multi-head Attention<strong> </strong>→ Feed-Forward → Output probabilities for next token</p><h3>BLOCK 3: VERIFY PREDICTIONS — Learning and improvement mechanisms</h3><p><strong>1) Training</strong>: Process of learning from examples.<br>This is interesting in this model is trained on the available data until it predicts known facts right.<br>Example: Model reads billions of text examples to learn language patterns.</p><p><strong>2) Loss Calculation</strong>: Measuring prediction accuracy. Example: If model predicts “dog” with 70% confidence when correct word is “cat”, it calculates how wrong this prediction was.</p><p><strong>3) Back-propagation</strong>: Sending error signals backward to adjust weights. Example: If “river” was incorrectly predicted after “The boat sailed down the”, parameters are adjusted to better predict “river” in similar contexts.</p><p><strong>4) Fine-Tuning</strong>: Refining a pre-trained model for specific tasks. <br>Example: Taking a general model and further training it on medical literature for healthcare applications.</p><p><strong>Flow</strong>: Predicted word vs. Actual next word → Calculate error → Adjust model parameters → Improve future predictions</p><blockquote>All big companies are racing to secure powerful GPU machines to keep doing propagation on their models before launching model to the public, so that they keep on improving the Accuracy of the “next” word.</blockquote><h3>BLOCK 4: ENHANCE UNDERSTANDING — Continuous improvement and knowledge integration</h3><p><strong>1) Inferencing</strong>: This is to use trained model to generate text based on new prompts.<br>Example: Given prompt “Write a poem about”, model generates most likely continuation based on training.</p><p><strong>2) Context Processing</strong>: This Keeps track of conversation history or document context to generate relevant answers. <br>Example: Remembering user mentioned “my dog Max” earlier when responding to “What’s his favorite food?”</p><p><strong>3) Temperature/Sampling</strong>: Controls randomness in word choice. Low temperature = safer, more predictable answers; high temperature = more creative, surprising outputs.<em><br></em> Example: Low temperature (0.3) gives predictable responses like “2+2=4” while higher temperature (0.8) might produce more creative or varied text.</p><p><strong>Flow</strong>: Apply learned patterns → Generate coherent responses → Demonstrate understanding of context, reasoning, and world knowledge</p><h3>Unified Analogy for All 4 Blocks</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi9xfaNfXIXNinEnQ-lgQA.png" /><figcaption>LLM in detective analogy</figcaption></figure><p>Think of the 4-block framework like a detective solving a complex case:<br><em>Imagine the LLM as a detective piecing together a story:</em></p><p><strong>Block 1 (Read Text)</strong> is the evidence collection phase.</p><ul><li><strong>Tokenization</strong> is like breaking down witness statements into key facts</li><li><strong>Vector embeddings</strong> are connecting these facts to existing knowledge (like linking a witness description to known suspects)</li><li><strong>Positional encoding</strong> is establishing the timeline of events (knowing that event A happened before event B is crucial)</li></ul><p><strong>Block 2 (Predict Word)</strong> is forming theories and connections.</p><ul><li>The <strong>transformer</strong> is the detective’s mind processing all evidence simultaneously</li><li><strong>Self-attention</strong> is making connections between separate pieces of evidence (“this fingerprint matches this suspect”)</li><li><strong>Multi-head attention</strong> is examining evidence from multiple angles (forensics, motive, opportunity)</li><li><strong>Feed-forward</strong> networks are developing conclusions from these connections</li></ul><p><strong>Block 3 (Verify Prediction)</strong> is testing theories against reality.</p><ul><li><strong>Training</strong> is the detective’s years of experience solving cases</li><li><strong>Loss calculation</strong> is measuring how far off a theory was from what actually happened</li><li><strong>Back-propagation</strong> is adjusting investigative methods based on solved cases, facts.</li><li><strong>Fine-tuning </strong>is specialising in particular types of cases (like cybercrime or homicide)</li><li><strong>Inferencing</strong> is applying experience to new cases</li><li><strong>Context processing</strong> is keeping track of all relevant case details</li><li><strong>Temperature/sampling</strong> is deciding whether to stick to just the facts or include speculative elements when presenting findings</li></ul><h3>Q. Is GenAI and LLM the same?</h3><p>Think of <strong>GenAI</strong> (Generative AI) as the whole toolbox, and <strong>LLMs</strong> (Large Language Models) as just one tool inside.</p><ul><li><strong>LLM:</strong> Specializes in generating and understanding text (e.g., ChatGPT writing an email).</li><li><strong>GenAI:</strong> Includes LLMs, but also covers image generators (like DALL-E), music generators, code assistants, and more.</li></ul><p><strong>Example:</strong></p><ul><li><em>LLM:</em> Writes a poem about the moon.</li><li><em>GenAI:</em> Writes a poem (LLM), draws a picture of the moon (image model), and composes a moon-inspired melody (music model).</li></ul><blockquote>All LLMs are GenAI, but not all GenAI are LLMs.</blockquote><h3>Q. Why predicting the next word is a big deal &amp; how it relates to generated intelligence</h3><p>It’s the secret sauce. By learning to predict the next word, the model absorbs grammar, facts, logic, and even creativity. That’s why Hinton and Karpathy emphasize it: <strong><em>“next-word prediction”, done at scale, leads to emergent intelligence.</em></strong></p><blockquote><em>When you chat with an LLM, every answer is just the sum of thousands of next-word predictions — each one informed by all the knowledge and context the model has seen.</em></blockquote><p>“Next word prediction” sounds simple, but it’s the engine behind LLM intelligence. As Geoffrey Hinton points out, this task pushes models to build deep internal representations of language, facts, and reasoning. <br>For example, <em>when GPT completes “The capital of France is” with “Paris,” it’s showing knowledge. Or, when it finishes “To bake a cake, you need flour, sugar, and” with “eggs,” it’s showing common sense.</em></p><p>As Andrej Karpathy explains, <em>“The model is forced to develop a compressed representation of everything humans have written down.”</em> The prediction task creates pressure to understand syntax, semantics, facts, logic, and even cultural nuances.</p><p>LLMs may seem magical, but their power comes from a simple, relentless process: predicting the next word, over and over, with context and knowledge. <strong>That’s what turns data into intelligence.</strong></p><p>________<br>References<br><a href="https://www.youtube.com/watch?v=7xTGNNLPyMI&amp;t=558s">https://www.youtube.com/watch?v=7xTGNNLPyMI&amp;t=558s</a><br><a href="https://proceedings.neurips.cc/paper_files/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf">https://proceedings.neurips.cc/paper_files/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf</a><br><a href="https://www.vellum.ai/blog/genai-vs-llm-breaking-down-the-basics-and-uses">https://www.vellum.ai/blog/genai-vs-llm-breaking-down-the-basics-and-uses</a><a href="https://bbycroft.net/llm">https://bbycroft.net/llm</a></p><p>__________</p><p>Thank you for your time reading the post.<br>On the journey to understand the core essence of Generative AI, Agents and its practical usage in Application Development, please consider following if you wish to get notified!<br>__________</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc488929dd0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visitor design pattern — get the gist in 2 min]]></title>
            <link>https://medium.com/javadeveloperdiary-jdd/visitor-design-pattern-get-the-gist-in-2-min-db5f12c58977?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/db5f12c58977</guid>
            <category><![CDATA[java-design-pattern]]></category>
            <category><![CDATA[visitor-design-pattern]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Sat, 17 Aug 2024 17:32:45 GMT</pubDate>
            <atom:updated>2024-11-30T18:25:50.212Z</atom:updated>
            <content:encoded><![CDATA[<h3>Visitor design pattern — get the gist in 2 min</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*gE5qBLf2k0tPjZuUjrszBQ.png" /><figcaption>Visitor design pattern</figcaption></figure><p>Imagine you’re visiting Buckingham Palace, where different guests are charged different entrance fees. Just like the Palace doesn’t tie its visitors to specific rooms, we can add “visitors” to our classes without binding them to our objects. So, while the Palace handles each guest differently, our code can do the same .</p><p><strong>Visitor Design Pattern</strong> is a <strong>behavioral design pattern</strong>.<br>The main intent behind the pattern is to allows us to add new operations to existing object structures without modifying the structures themselves. It’s particularly useful when we have a complex object hierarchy, and we want to perform various operations across objects of different types.</p><p><strong>Example scenario : </strong><br>Imagine an eCommerce platform where you have different types of products: <strong>Books</strong> and <strong>Electronics etc. </strong>You want to perform different operations on these products, such as calculating shipping costs and applying discounts. Instead of adding these operations directly to the Book and Electronics classes, we can use the Visitor pattern to separate these operations.</p><p>By doing this, we have a choice of adding the new operation on the object only on those objects we want and also we have separated the related algorithm(logic) to completely separate class, hence separation of concern is achieved.</p><p>UML class diagram</p><figure><img alt="UML class diagram for the visitor pattern" src="https://cdn-images-1.medium.com/max/1024/1*xFhtlRZAL6VqtbaYUS4fDQ.png" /><figcaption>UML class diagram for visitor design pattern</figcaption></figure><p>When a visitor (e.g., ShippingCostVisitor) is passed to a product&#39;s accept method, the product calls the appropriate visit method based on its type.</p><p>UML Sequence diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*wEbNLBQMykc2FbQRnYs_Ew.png" /><figcaption>sequence diagram for the visitor pattern</figcaption></figure><p><strong>Implementation details :</strong> <br>Here the key is to implement the different VisitorClasses and make our Products accept the Visitor(VisitorClasses) using respective hirarchies.</p><pre>*** other classes please refer the git repo link mentiond below <br><br>class ShippingCostVisitor implements Visitor {<br>    private double shippingCost;<br><br>    @Override<br>    public void visit(Book book) {<br>        shippingCost = book.getWeight() * 0.5; // Example: $0.5 per unit weight<br>    }<br><br>    @Override<br>    public void visit(Electronics electronics) {<br>        shippingCost = electronics.getWeight() * 1.5; // Example: $1.5 per unit weight<br>    }<br><br>    public double getShippingCost() {<br>        return shippingCost;<br>    }<br>}<br><br>**<br><br>public class Main {<br>    public static void main(String[] args) {<br>        Product book = new Book(20, 2); // $20, 2 kg<br>        Product laptop = new Electronics(1000, 5); // $1000, 5 kg<br><br>        // Calculate shipping cost<br>        ShippingCostVisitor shippingVisitor = new ShippingCostVisitor();<br>        book.accept(shippingVisitor);<br>        System.out.println(&quot;Book Shipping Cost: $&quot; + shippingVisitor.getShippingCost());<br><br>        laptop.accept(shippingVisitor);<br>        System.out.println(&quot;Laptop Shipping Cost: $&quot; + shippingVisitor.getShippingCost());<br><br>        // Apply discount<br>        DiscountVisitor discountVisitor = new DiscountVisitor();<br>        book.accept(discountVisitor);<br>        System.out.println(&quot;Book Discount: $&quot; + discountVisitor.getDiscount());<br><br>        laptop.accept(discountVisitor);<br>        System.out.println(&quot;Laptop Discount: $&quot; + discountVisitor.getDiscount());<br>    }<br>}</pre><p>Please check this github link for complete code.<br><a href="https://github.com/adityachaudhari24/DesignPatternsJava/tree/master/visitor-pattern">https://github.com/adityachaudhari24/DesignPatternsJava/tree/master/visitor-pattern</a></p><p><strong>When to use this patter?</strong><br><strong>Cleaning Up Logic</strong>: Use the Visitor to clean up and separate additional behaviors from the core business logic, making your codebase more maintainable.</p><p><strong>Selective Behavior</strong>: Use the pattern when a behavior applies only to certain classes within a hierarchy, allowing you to implement it without cluttering unrelated classes.</p><p><strong>Comparing visitor with other patterns</strong><br><strong>Visitor vs. Strategy</strong>:</p><ul><li><strong>Strategy</strong> focuses on swapping algorithms or behaviors at runtime, encapsulating them within interchangeable objects.</li><li><strong>Visitor</strong> focuses on performing operations across a structure of objects without changing their classes, making it ideal for adding new operations.</li></ul><p><strong>Visitor vs. Command</strong>:</p><ul><li><strong>Command</strong> encapsulates a request as an object, allowing for parameterization and queuing of operations.</li><li><strong>Visitor</strong> is more about structuring operations that need to be performed on elements of an object hierarchy, without modifying the elements themselves.</li></ul><h4>Visitor vs. Decorator</h4><ul><li><strong>Visitor</strong>: Adds new operations to a group of related classes without altering their structure. It’s particularly useful when you need to perform different operations on elements within a complex object hierarchy.</li><li><strong>Decorator</strong>: Adds or overrides behavior in individual objects dynamically. It wraps objects to extend or alter their functionality without modifying the object itself.</li></ul><p><strong>Visitor vs. Composite</strong>:</p><ul><li><strong>Composite</strong> organizes objects into tree structures, allowing clients to treat individual objects and compositions uniformly.</li><li><strong>Visitor</strong> operates on these tree structures, enabling you to apply new operations across the composite structure without altering the component classes.</li></ul><p><strong>Summary</strong><br>The Visitor Design Pattern is a powerful tool for adding new operations to complex object structures without modifying their classes. It’s ideal for scenarios where you need to apply different operations across various types of objects.<br>Visitor stands out for its ability to operate across object hierarchies, adding new behaviors without cluttering existing classes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db5f12c58977" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javadeveloperdiary-jdd/visitor-design-pattern-get-the-gist-in-2-min-db5f12c58977">Visitor design pattern — get the gist in 2 min</a> was originally published in <a href="https://medium.com/javadeveloperdiary-jdd">JavaDeveloperDiary — JDD</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Patterns — get the gist in 2 min concluding series with easy to remember one liners on each…]]></title>
            <link>https://medium.com/javadeveloperdiary-jdd/design-patterns-get-the-gist-in-2-min-concluding-series-with-easy-to-remember-one-liners-on-each-4f2d6060b7d0?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f2d6060b7d0</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[design-patterns-in-java]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Tue, 04 Jul 2023 09:43:50 GMT</pubDate>
            <atom:updated>2023-07-04T09:43:50.086Z</atom:updated>
            <content:encoded><![CDATA[<h3>Design Patterns — get the gist in 2 min concluding series with easy to remember one liners on each pattern</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W57wvYznE_u3HZtrzEiByA.png" /></figure><p>Since few months now i have been exploring design patterns from GOF and head-first books and trying to write 2 min post and long 5–10 min post.<br>In this post concluding the series of all those articles along with simple to understanding one liners.</p><p><strong>Creational design pattern</strong> gives you a lot of flexibility in what gets created, who creates it and how it gets created and when.<br><strong>Below are important types of Creational desing pattern :</strong></p><ol><li><strong>Factory method pattern : </strong><br><strong>one liner :<em>”Let subclasses decide which objects to create.”</em></strong><em><br></em>Factory method pattern defines an interface for creating an object but lets the subclass decide which class to instantiate.<br><strong>Further reference :</strong> <a href="https://medium.com/javadeveloperdiary-jdd/factory-method-pattern-get-the-gist-in-2-min-720f875142ba">https://medium.com/javadeveloperdiary-jdd/factory-method-pattern-get-the-gist-in-2-min-720f875142ba</a></li><li><strong>Singleton Pattern <br>one liner :<em>”only one item to rule them all.”<br></em></strong>The singleton pattern ensures a class has only one instance, and it provides a global point of access to it.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/singleton-design-pattern-get-the-gist-in-2-min-445539d4cf14">https://medium.com/javadeveloperdiary-jdd/singleton-design-pattern-get-the-gist-in-2-min-445539d4cf14</a></li><li><strong>Prototype Pattern <br>one liner :<em>”Clone and customize, a blueprint in action”<br></em></strong>With the Prototype pattern, you can create new objects by cloning existing ones, saving time and reducing the potential for errors.<br>The Prototype design pattern allows us to create new objects by cloning existing ones, rather than by creating them from scratch.<br><strong>Further reference :</strong> <a href="https://medium.com/javadeveloperdiary-jdd/prototype-design-pattern-get-the-gist-in-2-min-265ddaf7efa7">https://medium.com/javadeveloperdiary-jdd/prototype-design-pattern-get-the-gist-in-2-min-265ddaf7efa7</a></li><li><strong>Builder Pattern <br>one liner :<em>”Step by step build it right”<br></em></strong>The intent behind the Builder Design Pattern is to <strong>separate the construction of a complex object from its representation</strong> so that the same construction process can create different representations.<br><strong>Further reference :</strong> <a href="https://medium.com/javadeveloperdiary-jdd/builder-pattern-get-the-gist-in-2-min-7c6befd0515d">https://medium.com/javadeveloperdiary-jdd/builder-pattern-get-the-gist-in-2-min-7c6befd0515d</a></li></ol><p><strong>Structural patterns </strong>are concerned with how classes and objects are composed to form large structures.<br><strong>Below are important types of the structural design patterns</strong></p><ol><li><strong>Adaptor Pattern <br>one liner :<em>”Bridging the gaps between incompatible interfaces, making them work together seamlessly ”<br></em></strong>Adaptor pattern converts the interface of a class into another interface clients expect. The adapter lets classes work together that couldn’t otherwise because of incompatible interfaces. This is done simply by adapter implementing the interface of one object and wrapping another object.<br><strong>Further reference :</strong> <a href="https://medium.com/javadeveloperdiary-jdd/adapter-pattern-get-the-gist-in-2-min-f1fcad7d706d">https://medium.com/javadeveloperdiary-jdd/adapter-pattern-get-the-gist-in-2-min-f1fcad7d706d</a></li><li><strong>Composite Pattern <br>one liner :<em>”Treating individual and group objects uniformly, forming a unified structure with hierarchical relationships.”<br></em></strong>It’s about composing different objects of a similar family (interface) and then appearing them as one for an external client. Each object in the composition may or may not have child objects.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/composite-design-pattern-get-the-gist-in-2-min-cffcbe5953">https://medium.com/javadeveloperdiary-jdd/composite-design-pattern-get-the-gist-in-2-min-cffcbe5953</a></li><li><strong>Decorator Pattern <br>one liner :<em>”Adding new functionalities dynamically, enhancing an object’s behavior without altering its core implementation”<br></em></strong>In simple words, the decorator pattern <strong>helps attach different behaviors to the object at the runtime</strong> by wrapping the object with a specific type of wrapper class which contains the new behavior logic.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/decorator-pattern-get-the-gist-in-2-min-3a3f84d85f38">https://medium.com/javadeveloperdiary-jdd/decorator-pattern-get-the-gist-in-2-min-3a3f84d85f38</a></li><li><strong>Proxy Pattern <br>one liner :<em>”Acting as a representative or surrogate for another object, controlling access and providing additional functionality when needed.”<br></em></strong>Think of a proxy pattern when you want to add an extra layer of indirection to access a resource or control access to it. It is useful in scenarios where you would want to improve performance by caching frequently used objects, reduce network traffic by implementing lazy loading, or provide a simplified interface to a complex system.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/proxy-design-pattern-java-get-the-gist-in-2-min-684adff7b077">https://medium.com/javadeveloperdiary-jdd/proxy-design-pattern-java-get-the-gist-in-2-min-684adff7b077</a></li></ol><p><strong>Behavioral design patterns</strong> intent to focus on <strong>communication and interaction between objects, defining how they collaborate and distribute responsibilities.</strong><br>Use: These patterns are used to manage complex object interactions, providing flexible communication patterns.</p><ol><li><strong>Template method Pattern <br>one liner :<em>”Follow the blueprint, customize the details”<br></em></strong>The main intent behind the template method pattern is to <strong>provide the skeleton of an algorithm in the parent class and let subclasses extend the parent and define fill-ins by overriding methods.</strong> Well, the interesting part is that though algorithm fill-ins are implemented in the subclasses they are called by the parent class. Only parent calls those methods from subclass and this is called as famous “ Don’t call us, we will call you” Principle.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/template-method-pattern-get-the-gist-in-2-min-8cad25087564">https://medium.com/javadeveloperdiary-jdd/template-method-pattern-get-the-gist-in-2-min-8cad25087564</a></li><li><strong>Strategy Pattern <br>one liner :<em>”Switch it up choose the best approach”<br></em></strong>All intent behind the strategy pattern is to encapsulate behaviors that belongs to a similar purpose and make them interchangeable .<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/strategy-pattern-java-get-the-gist-of-it-in-2-min-b8ed180b1c43">https://medium.com/javadeveloperdiary-jdd/strategy-pattern-java-get-the-gist-of-it-in-2-min-b8ed180b1c43</a></li><li><strong>Command Pattern <br>one liner :<em>”Wrap it up, encapsulate object for further reference”<br></em></strong>The Command Design Pattern is all about encapsulating a request as an object and passing it as a request parameter. It decouples the object that invokes the action from the object that performs the action.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/command-pattern-get-the-gist-in-2-min-14a5a7dface2">https://medium.com/javadeveloperdiary-jdd/command-pattern-get-the-gist-in-2-min-14a5a7dface2</a></li><li><strong>Observer Pattern <br>one liner :<em>”Stay in sync, get notified when things change.”<br></em></strong>The basic idea behind observer pattern is to have a publisher — subscriber like mechanism , where publisher wants to notify multiple subscriber objects regarding some events / state change which is the in interest of subscriber.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/observer-pattern-get-the-gist-in-2-min-49d5f0afe6b0">https://medium.com/javadeveloperdiary-jdd/observer-pattern-get-the-gist-in-2-min-49d5f0afe6b0</a></li><li><strong>Iterator Pattern <br>one liner :<em>”Take it step by step, explore a collection one element at a time.”<br></em></strong>Iterator pattern is all about streamline the access of the collection so that the client which want to iterate over collection must not worry about entire collection instead it just check if list hasNext() element and call next() element.<br><strong>Further reference : </strong><a href="https://medium.com/javadeveloperdiary-jdd/iterator-pattern-get-the-gist-in-2-min-51ba536bf996">https://medium.com/javadeveloperdiary-jdd/iterator-pattern-get-the-gist-in-2-min-51ba536bf996</a></li></ol><p>Learning is a never-ending journey that brings constant satisfaction through multiple milestones. <br>Here at this point concluding the 2 min series of design patterns but with the promise to come up with more such simple to understand posts related to enterprise application development.<br>Please also check <a href="https://www.adityatechinsights.com/series/design-patterns">https://www.adityatechinsights.com/series/design-patterns</a> for detail insights for the design patterns and future posts.</p><p>Thanks for reading ! Happy coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f2d6060b7d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javadeveloperdiary-jdd/design-patterns-get-the-gist-in-2-min-concluding-series-with-easy-to-remember-one-liners-on-each-4f2d6060b7d0">Design Patterns — get the gist in 2 min concluding series with easy to remember one liners on each…</a> was originally published in <a href="https://medium.com/javadeveloperdiary-jdd">JavaDeveloperDiary — JDD</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prototype design pattern — get the gist in 2 min.]]></title>
            <link>https://medium.com/javadeveloperdiary-jdd/prototype-design-pattern-get-the-gist-in-2-min-265ddaf7efa7?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/265ddaf7efa7</guid>
            <category><![CDATA[design-patterns-in-java]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[prototype-design-pattern]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Tue, 09 May 2023 04:04:25 GMT</pubDate>
            <atom:updated>2023-05-09T04:04:25.390Z</atom:updated>
            <content:encoded><![CDATA[<h3>Prototype design pattern — get the gist in 2 min.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*fb3QiiHFEY33DhOAsKNOpg.png" /><figcaption>prototype design pattern Tshirt product example</figcaption></figure><p><strong>Welcome to a world of software development without copy-paste </strong>‼! <br>Just imagine the nightmare it would be — every time you needed to reuse a piece of code, you would have to manually retype it every single time. Thankfully, we live in a world where copy-paste is a widely accepted practice (without violating the copyright principles ofcource), as programmers, we are always on the lookout for better and more efficient solutions.</p><p>here is the Prototype Design Pattern — a pattern that offers a more elegant and flexible alternative to copy-paste. With the Prototype pattern, you can create new objects by <strong>cloning existing ones</strong>, saving time and reducing the potential for errors.</p><blockquote>The Prototype design pattern is a <strong>creational pattern</strong> that <strong>allows you to create new objects by cloning existing ones</strong>, rather than by creating them from scratch.</blockquote><p><strong>Simple Example <br></strong>Let’s say we have an online store that sells customized t-shirts. Customers can choose the color, size, and design of the t-shirt.<br>1. To avoid creating new instances for all the variants we are thinking to<br> provide a way for the backend to use a base variant and then customize<br> that base Tshirt and then add that to the cart.<br>2. Customers can also choose OLD orders, and choose Tshirt from that order as a base variant, modify it and add to the cart.</p><p>To keep the brevity adding only main method here please refer entire github code here [<a href="https://github.com/adityachaudhari/DesignPatternsJava/tree/master/prototype-pattern/src/main/java/com/ecommercearchitect/designpatterns/prototype/example/product">github link</a>]</p><pre>public class Main {<br>    public static void main(String[] args) {<br>        // Create a prototype t-shirt our base default variant<br>        TShirt prototype = new TShirt(&quot;red&quot;, &quot;M&quot;, &quot;logo&quot;, 24.99);<br><br>        // Create an order for 3 t-shirts<br>        //Order order = new Order(prototype, 3);<br><br>        // Get a clone of the prototype t-shirt<br>        try {<br><br>            TShirt tShirt = prototype.clone();<br>            // Customize the t-shirt<br>            tShirt.setColor(&quot;blue&quot;);<br>            tShirt.setSize(&quot;L&quot;);<br>            tShirt.setDesign(&quot;text&quot;);<br>            tShirt.setPrice(29.99);<br><br>            // Add the customized t-shirt to the cart<br>            Cart cart = new Cart();<br>            cart.addItem(tShirt);<br>            System.out.println(&quot;\nPrinting items in the cart &quot;);<br>            cart.printItems();<br><br><br>            // cloning the product from the OLD order, modify it and then modified product to the cart<br>            // Create a prototype t-shirt our base default variant  which belongs to the old order<br>            TShirt oldOrderTSHIRT = new TShirt(&quot;black&quot;, &quot;L&quot;, &quot;Name&quot;, 26.99);<br><br>            // Create an order for 3 t-shirts<br>            Order order = new Order(oldOrderTSHIRT, 3);<br><br>            // in the getShirt , its providing the cloned object .<br>            TShirt tShirt2 = order.getTShirt();<br>            // Customize the t-shirt<br>            tShirt2.setColor(&quot;blue&quot;);<br>            tShirt2.setSize(&quot;L&quot;);<br>            tShirt2.setDesign(&quot;Name&quot;);<br>            tShirt2.setPrice(26.99);<br><br>            // adding Tshirt to the cart<br>            cart.addItem(tShirt2);<br>            System.out.println(&quot;\nPrinting items in the cart &quot;);<br>            cart.printItems();<br><br>        } catch (CloneNotSupportedException e) {<br>            e.printStackTrace();<br>        }<br><br>    }<br>}<br>***********************************<br>OUTPUT <br>Printing items in the cart <br>text t-shirt, L, blue: $29.99<br><br>Printing items in the cart <br>text t-shirt, L, blue: $29.99<br>Name t-shirt, L, blue: $26.99<br>***********************************</pre><p>The Prototype pattern is commonly used in situations where many objects with similar properties need to be created quickly and efficiently. This includes scenarios such as creating product catalogs, generating reports, and creating user profiles in a social network.</p><p>The Prototype pattern has real-world applicability in scenarios where there are many objects with similar properties that need to be created quickly and efficiently, and where object creation is expensive or time-consuming. The pattern has several benefits, such as reducing the amount of time and resources required to create new objects, promoting code reusability, and allowing for dynamic modification of objects</p><p>In Java <strong>Cloneable </strong>marker interface is provided to clone an object using the prototype principles. <br>Also if you have come across prototype scope in spring, the <strong>prototype</strong> scope is based on the Prototype pattern and allows you to define a bean as a prototype, which means that a new instance of the bean will be created each time it is requested.</p><p><strong>The real fun is in the details</strong>, if you wish to know and understand different styles of strategy pattern and java code examples, pros-cons, please consider visiting my detailed article at [<a href="https://ecommercearchitect.hashnode.dev/prototype-pattern-java-explained">prototype-pattern-java-explained-7-min-read</a>]</p><p>Thanks for reading. Love IT, Live IT, Enjoy IT.</p><p>On the journey to understand the core essence of design patterns.<br>Every Tuesday publishes a small 2 min post and a long 5–10 min post along with a code example, please consider following if you wish to get notified!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=265ddaf7efa7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javadeveloperdiary-jdd/prototype-design-pattern-get-the-gist-in-2-min-265ddaf7efa7">Prototype design pattern — get the gist in 2 min.</a> was originally published in <a href="https://medium.com/javadeveloperdiary-jdd">JavaDeveloperDiary — JDD</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Builder pattern — get the gist in 2 min]]></title>
            <link>https://medium.com/javadeveloperdiary-jdd/builder-pattern-get-the-gist-in-2-min-7c6befd0515d?source=rss-17d8a9297723------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c6befd0515d</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[design-pattern-in-java]]></category>
            <dc:creator><![CDATA[aditya chaudhari]]></dc:creator>
            <pubDate>Wed, 03 May 2023 04:46:08 GMT</pubDate>
            <atom:updated>2023-05-03T04:46:08.281Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="https://medium.com/javadeveloperdiary-jdd/template-method-pattern-get-the-gist-in-2-min-8cad25087564?source=your_stories_page-------------------------------------">Builder pattern — get the gist in 2 min</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*e2MN1-tPtjZ_BoNwLq94_A.png" /><figcaption>builder design pattern</figcaption></figure><p>The intent behind the Builder Design Pattern is to<strong> separate the construction of a complex object from its representation</strong> so that the same construction process can create different representations.<br>It’s a type of creational design pattern.</p><p>This is useful when we need to create objects that have multiple options or configuration settings, Instead of having a constructor with a long list of parameters that are difficult to manage and remember, the Builder pattern provides a more organized and flexible approach.</p><blockquote>Using the <strong>Builder pattern allows you to create objects step by step,</strong> with each step adding more options or configurations. The final result is an object that is fully configured and ready to use.</blockquote><h3>Structure of the builder pattern</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*0ceuZv_u2JKC5YhQJB4tyg.png" /><figcaption>Builder design pattern UML — source wiki</figcaption></figure><p>In the above UML class diagram, the Director class doesn&#39;t create and assemble the ProductA1 and ProductB1 objects directly. Instead, the Director refers to the <strong>Builder interface</strong> for building (creating and assembling) the parts of a complex object, which makes the Director independent of which concrete classes are instantiated (which representation is created). The Builder1 class implements the Builder interface by creating and assembling the ProductA1 and ProductB1 objects.</p><p><strong>Simple Example <br></strong>In the below code, we are creating the Car object using the Builder pattern.<br>This is the method chaining builder pattern implementation where each method in the builder class returns the Builder instance.</p><pre>public class Car {<br>    private String model;<br>    private String color;<br>    private int year;<br><br>    public static class Builder {<br>        private String model;<br>        private String color;<br>        private int year;<br><br>        public Builder() {}<br><br>        public Builder setModel(String model) {<br>            this.model = model;<br>            return this;<br>        }<br>        public Builder setColor(String color) {<br>            this.color = color;<br>            return this;<br>        }<br><br>        public Builder setYear(int year) {<br>            this.year = year;<br>            return this;<br>        }<br><br>        public Car build() {<br>            return new Car(this);<br>        }<br>    }<br><br>    private Car(Builder builder) {<br>        this.model = builder.model;<br>        this.color = builder.color;<br>        this.year = builder.year;<br>    }<br><br>    public String getModel() {<br>        return model;<br>    }<br><br>    public void setModel(String model) {<br>        this.model = model;<br>    }<br><br>    public String getColor() {<br>        return color;<br>    }<br><br>    public void setColor(String color) {<br>        this.color = color;<br>    }<br><br>    public int getYear() {<br>        return year;<br>    }<br><br>    public void setYear(int year) {<br>        this.year = year;<br>    }<br>}<br><br>*****<br>package com.ecommercearchitect.designpatterns.builder.methodchainingexample;<br><br>public class BuilderMethodChainingExampleMain {<br>    public static void main(String[] args) {<br>        Car car = new Car.Builder().setModel(&quot;Honda Civic&quot;).setColor(&quot;Red&quot;).setYear(2021).build();<br>        System.out.println(car.getModel()); // output: Honda Civic<br>        System.out.println(car.getColor()); // output: Red<br>        System.out.println(car.getYear());  // output: 2021<br>    }<br>}<br><br>**** OUTPUT ****<br>Honda Civic<br>Red<br>2021</pre><p><strong>StringBuilder </strong>and <strong>StringBuffer </strong>classes in Java are used to implement the Builder pattern, allowing you to append strings and other data types to build a final string which is Immutable.</p><p><strong>The real fun is in the details</strong>, if you wish to know and understand the pros-cons, java-code examples then please consider checking the detailed article at [<a href="https://ecommercearchitect.hashnode.dev/builder-design-pattern-java-explained">builder-pattern-explained-8-min-read</a>]</p><p>Thanks for reading. Love IT, Live IT, Enjoy IT.</p><p>On the journey to understand the core essence of design patterns.<br>Every Tuesday I publish a small 2 min post and a long 5–10 min post along with a code example, please consider following if you wish to get notified!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c6befd0515d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javadeveloperdiary-jdd/builder-pattern-get-the-gist-in-2-min-7c6befd0515d">Builder pattern — get the gist in 2 min</a> was originally published in <a href="https://medium.com/javadeveloperdiary-jdd">JavaDeveloperDiary — JDD</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>