<?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 Dadu Khan on Medium]]></title>
        <description><![CDATA[Stories by Dadu Khan on Medium]]></description>
        <link>https://medium.com/@dadukhan?source=rss-7aa9b2716cc6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1Jb9YwR42hAsHJ59cwvxpQ.png</url>
            <title>Stories by Dadu Khan on Medium</title>
            <link>https://medium.com/@dadukhan?source=rss-7aa9b2716cc6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:14:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dadukhan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding Clean Architecture in .NET: A Practical Guide]]></title>
            <link>https://dadukhan.medium.com/understanding-clean-architecture-in-net-a-practical-guide-f098e62db245?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f098e62db245</guid>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[aspdotnetcore]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 02:38:31 GMT</pubDate>
            <atom:updated>2026-11-09T02:38:31.794Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJXBKdcRV348JF6WJNe8OA.png" /></figure><p>As software applications grow, managing code becomes increasingly challenging. What starts as a simple application can eventually become difficult to maintain when business logic, database operations, API handling, and external services are tightly coupled.</p><p>This is where <strong>Clean Architecture</strong> comes into play.</p><p>Clean Architecture provides a structured way to organize applications by separating responsibilities into independent layers. Its primary goal is to keep business logic independent of external technologies, making applications easier to maintain, test, and extend.</p><p>Let’s understand how it works in .NET.</p><h3>1. What Is Clean Architecture?</h3><p>Clean Architecture is a software design approach introduced by Robert C. Martin (Uncle Bob).</p><p>It organizes an application around its core business logic rather than external frameworks, databases, or UI technologies.</p><p>The fundamental principle is:</p><p><strong>Dependencies should always point towards the inner layers.</strong></p><p>This means the Domain and Application layers should not depend directly on Infrastructure or Presentation implementations.</p><p>For example, your business logic should not care whether your application uses MongoDB, SQL Server, or PostgreSQL.</p><p>This separation makes your application more flexible and maintainable.</p><h3>2. The Four Main Layers of Clean Architecture</h3><p>Clean Architecture typically consists of four layers, each responsible for a specific part of the application.</p><h3>1. Domain Layer</h3><p>The Domain Layer is the core of the application. It contains the most important business concepts and rules.</p><p>It is independent of frameworks, databases, and external services.</p><p>Common components include:</p><ul><li><strong>Entities:</strong> Objects representing core business concepts, such as Product, Order, and Customer.</li><li><strong>Value Objects:</strong> Objects representing values defined by their attributes, such as Address or Money.</li><li><strong>Enums:</strong> Represent a predefined set of values.</li><li><strong>Domain Abstractions:</strong> Contracts for domain-related behavior or services.</li></ul><p>The Domain Layer should contain the business rules that define how your application operates.</p><h3>2. Application Layer</h3><p>The Application Layer defines what the application can do.</p><p>It coordinates operations and uses the Domain Layer to execute business use cases.</p><p>Common components include:</p><ul><li><strong>Use Cases:</strong> Specific operations such as CreateProduct, UpdateOrder, and PlaceOrder.</li><li><strong>DTOs:</strong> Objects used to transfer data between different parts of the application.</li><li><strong>CQRS:</strong> Separates operations that modify data (Commands) from operations that retrieve data (Queries).</li><li><strong>Interfaces:</strong> Contracts for services and repositories required by application use cases.</li><li><strong>Validation:</strong> Ensures incoming application requests satisfy defined requirements.</li></ul><p>For example, when a customer places an order, the Application Layer coordinates the process, applies the necessary business operations, and requests persistence through an abstraction.</p><h3>3. Infrastructure Layer</h3><p>The Infrastructure Layer handles communication with external technologies and provides implementations for abstractions defined by the inner layers.</p><p>Common responsibilities include:</p><ul><li>Database connectivity (MongoDB, SQL Server, PostgreSQL).</li><li>Repository implementations.</li><li>File and cloud storage.</li><li>Email services.</li><li>External API integrations.</li><li>Message brokers.</li></ul><p>For example, the Application Layer might define an IProductRepository interface, while the Infrastructure Layer provides its implementation using MongoDB.</p><p>The Application Layer depends on the abstraction, not the MongoDB implementation.</p><h3>4. Presentation Layer</h3><p>The Presentation Layer acts as the entry point to the application.</p><p>It handles communication with external clients and forwards requests to the Application Layer.</p><p>In an ASP.NET Core application, it commonly includes:</p><ul><li>Controllers.</li><li>API endpoints.</li><li>Middleware.</li><li>Authentication and authorization configuration.</li><li>Dependency injection configuration.</li></ul><p>For example, when a client sends an HTTP request to create a product, the Controller receives the request and forwards it to the appropriate application use case.</p><h3>3. Understanding the Dependency Rule</h3><p>The Dependency Rule is one of the most important principles of Clean Architecture.</p><p>It states:</p><p><strong>Source code dependencies must point inward, towards the more stable layers.</strong></p><p>Consider this example:</p><ul><li>Application defines an IProductRepository interface.</li><li>Infrastructure implements IProductRepository using MongoDB.</li><li>Application uses the interface without knowing the underlying database implementation.</li></ul><p>This is an application of the <strong>Dependency Inversion Principle (DIP)</strong>.</p><p>Instead of high-level business logic depending on low-level database implementations, both work through abstractions.</p><p>As a result, you can replace MongoDB with SQL Server without rewriting your core business logic.</p><h3>4. Typical Clean Architecture Project Structure in .NET</h3><p>A .NET solution might look like this:</p><pre>MyApplication<br>│<br>├── MyApplication.Domain<br>│   ├── Entities<br>│   ├── ValueObjects<br>│   ├── Enums<br>│   └── Interfaces<br>│<br>├── MyApplication.Application<br>│   ├── Features<br>│   ├── DTOs<br>│   ├── Interfaces<br>│   ├── Behaviors<br>│   └── DependencyInjection.cs<br>│<br>├── MyApplication.Infrastructure<br>│   ├── Persistence<br>│   ├── Repositories<br>│   ├── Services<br>│   └── DependencyInjection.cs<br>│<br>└── MyApplication.API<br>    ├── Controllers<br>    ├── Middleware<br>    ├── Extensions<br>    └── Program.cs</pre><p>This is a common organizational approach, not a mandatory folder structure. The exact organization depends on application complexity and team preferences.</p><h3>5. How Does a Request Flow Through Clean Architecture?</h3><p>Let’s take a simple example: creating a new product.</p><ol><li><strong>Presentation:</strong> A Controller receives the HTTP request.</li><li><strong>Application:</strong> A CreateProduct use case handles the operation.</li><li><strong>Domain:</strong> Business rules validate whether the product information is acceptable.</li><li><strong>Infrastructure:</strong> The repository implementation saves the product in MongoDB.</li></ol><p>The response then travels back through the application and presentation layers to the client.</p><p>This separation ensures that each layer focuses on its own responsibility.</p><h3>6. Benefits of Clean Architecture</h3><p>Implementing Clean Architecture offers several advantages:</p><ul><li><strong>Maintainability:</strong> Changes in one layer have less impact on others.</li><li><strong>Testability:</strong> Business logic can be tested independently of databases and external services.</li><li><strong>Flexibility:</strong> External technologies can be replaced without rewriting core business logic.</li><li><strong>Separation of Concerns:</strong> Every layer has a clearly defined responsibility.</li><li><strong>Scalability:</strong> A well-organized codebase is easier to extend as application requirements grow.</li></ul><h3>7. When Should You Use Clean Architecture?</h3><p>Clean Architecture is particularly useful for:</p><ul><li>Large and complex applications.</li><li>Enterprise-level software.</li><li>Applications with complex business rules.</li><li>Systems expected to evolve over time.</li><li>Projects requiring extensive testing and maintainability.</li></ul><p>However, it is not necessary for every project.</p><p>For a small CRUD application with limited business logic, introducing multiple layers and abstractions may create unnecessary complexity.</p><p>Choose architecture based on the actual needs of your application.</p><h3>Conclusion</h3><p>Clean Architecture is not simply about creating multiple projects or folders in a .NET solution. It is about managing dependencies, separating responsibilities, and protecting the core business logic from external changes.</p><p>Understanding its principles helps developers build applications that are easier to maintain, test, and evolve.</p><p><strong>Good architecture is not about making code complicated; it’s about making future changes easier.</strong></p><p><strong>Technologies &amp; Concepts:</strong> .NET | ASP.NET Core | Clean Architecture | Dependency Inversion | CQRS | Repository Pattern</p><p>#DotNet #CleanArchitecture #ASP.NETCore #SoftwareArchitecture #SoftwareEngineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f098e62db245" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Distributed Systems — Architectures]]></title>
            <link>https://dadukhan.medium.com/distributed-systems-architectures-b56712f335d1?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/b56712f335d1</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 12:46:02 GMT</pubDate>
            <atom:updated>2026-10-05T12:46:02.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MLOc-F7d9vrFKZgRwzDKVQ.png" /></figure><p>Distributed systems are usually <strong>complex software systems</strong> because their components are spread across multiple computers. To manage this complexity, we need to organize the system properly.</p><p>There are <strong>two important ways</strong> to look at this organization:</p><h3>1. Logical organization</h3><p>This describes <strong>how the software components are organized</strong> and how they communicate with each other.</p><h3>2. Physical organization</h3><p>This describes <strong>where those software components actually run</strong> — that is, which machines they are placed on.</p><h3>Software Architecture</h3><p>A <strong>software architecture</strong> describes:</p><ul><li>What software components exist.</li><li>How these components are organized.</li><li>How the components communicate and interact.</li></ul><p>This chapter first discusses different <strong>architectural styles</strong> commonly used to organize distributed systems.</p><h3>Middleware</h3><p>One important goal of distributed systems is to separate the <strong>application</strong> from the underlying computers and networks.</p><p>This is done using a <strong>middleware layer</strong>.</p><p>Think of middleware as a layer between:</p><p><strong>Application → Middleware → Operating System/Network/Hardware</strong></p><p>Its main purpose is to provide <strong>distribution transparency</strong>.</p><h3>Distribution transparency</h3><p>It means hiding the complexity of distribution from the application.</p><p>For example, an application can communicate with a service on another computer without needing to worry about exactly <strong>where that computer is or how the network communication happens</strong>.</p><p>However, complete transparency is not always possible or desirable. There are <strong>trade-offs</strong>, so middleware can be adjusted according to the needs of different applications.</p><h3>System Architecture</h3><p>After designing the software architecture, we need to actually <strong>run those software components on real machines</strong>.</p><p>The process of deciding:</p><blockquote><strong><em>Which components run on which machines?</em></strong></blockquote><p>is called the <strong>system architecture</strong> or physical realization of the system.</p><p>There are several possible approaches.</p><h3>Centralized Architecture</h3><p>In a centralized architecture, <strong>one main server performs most of the work</strong>.</p><p>Remote clients communicate with this server using relatively simple communication mechanisms.</p><p><strong>Example:</strong></p><pre>Client 1 ──┐<br>Client 2 ──┼──→ Server<br>Client 3 ──┘</pre><h3>Decentralized / Peer-to-Peer Architecture</h3><p>In a <strong>peer-to-peer (P2P)</strong> architecture, there is no single machine doing all the important work.</p><p>Instead, the nodes generally have <strong>similar roles</strong> and can communicate directly with each other.</p><pre>Node ↔ Node<br> ↕     ↕<br>Node ↔ Node</pre><h3>Hybrid Architecture</h3><p>Many real-world distributed systems combine centralized and decentralized approaches.</p><p>Such systems are called <strong>hybrid architectures</strong>.</p><p>They use a combination of:</p><ul><li>Centralized components</li><li>Peer-to-peer/decentralized components</li></ul><h3>Systems Discussed in This Chapter</h3><p>The chapter ends by examining the architecture of two widely used distributed systems:</p><ul><li><strong>NFS (Network File System)</strong> — used for file sharing across a network.</li><li><strong>The Web</strong> — a large-scale distributed system consisting of clients, servers, and supporting components.</li></ul><h3>In short</h3><p>The chapter is mainly about <strong>how distributed systems are organized</strong>, both <strong>logically (software)</strong> and <strong>physically (machines)</strong>, including <strong>middleware, centralized architectures, P2P architectures, and hybrid architectures</strong>.</p><h3>2.1 Architectural Styles</h3><p>A <strong>software architecture</strong> describes how the software components of a distributed system are logically organized and how they work together.</p><p>For large software systems, choosing a good architecture is very important because it makes the system easier to <strong>build, maintain, and modify</strong>.</p><h3>What is an Architectural Style?</h3><p>An <strong>architectural style</strong> describes:</p><ul><li><strong>Components</strong> — the software parts of the system.</li><li><strong>Connectors</strong> — how those components communicate.</li><li><strong>Data</strong> — what information is exchanged.</li><li><strong>Configuration</strong> — how everything is arranged into a complete system.</li></ul><h3>Components</h3><p>A <strong>component</strong> is a modular software unit with clearly defined:</p><ul><li><strong>Provided interfaces</strong> → what services it offers.</li><li><strong>Required interfaces</strong> → what services it needs from other components.</li></ul><p>An important feature is that a component should be <strong>replaceable without stopping the entire system</strong>.</p><p>For example, a distributed system may replace one server component while the rest of the system continues working.</p><p>This is important because large systems often <strong>cannot simply be shut down for maintenance</strong>. Usually, only a small part of the system can temporarily be taken offline.</p><p>For a component to be replaced safely, its <strong>interfaces must remain unchanged</strong>. Other components should still be able to communicate with the replacement in the same way.</p><h3>Connectors</h3><p>A <strong>connector</strong> is the mechanism that allows components to <strong>communicate, coordinate, or cooperate</strong>.</p><p>For example:</p><ul><li><strong>Remote Procedure Calls (RPC)</strong></li><li><strong>Message passing</strong></li><li><strong>Streaming data</strong></li></ul><p>So, simply:</p><blockquote><strong><em>Component = does the work</em></strong><em><br></em><strong><em>Connector = allows components to communicate</em></strong></blockquote><p>Connectors allow both <strong>control and data</strong> to flow between components.</p><h3>Architectural Styles in Distributed Systems</h3><p>By combining components and connectors in different ways, we can create different <strong>architectural styles</strong>.</p><p>The four important styles discussed in this chapter are:</p><ol><li><strong>Layered architectures</strong></li><li><strong>Object-based architectures</strong></li><li><strong>Resource-centered architectures</strong></li><li><strong>Event-based architectures</strong></li></ol><p>These styles are not always used separately. In real-world distributed systems, <strong>multiple styles are often combined</strong>.</p><p>One particularly common principle is the <strong>layered approach</strong>, where a system is divided into several logical layers. Layering is so useful that it is often combined with other architectural styles.</p><h3>Key Idea</h3><blockquote><strong><em>Architectural style = Components + Connectors + Data + Configuration</em></strong></blockquote><h3>Layered Architectures</h3><p>A <strong>layered architecture</strong> divides a system into multiple layers. Each layer has a specific responsibility and normally communicates with the layer directly below it.</p><p>A higher layer makes a <strong>downcall</strong> to a lower layer and usually receives a response.</p><pre>Higher Layer<br>     ↓<br>Lower Layer<br>     ↓<br>Even Lower Layer</pre><p>An <strong>upcall</strong> is the opposite: a lower layer calls a higher layer. This is less common and usually happens when the lower layer needs to notify the higher layer about an event.</p><h3>Three common forms</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zcefz2ZcTxb88gH5A-bcGA.png" /></figure><h3>Pure Layering</h3><p>In a <strong>pure layered architecture</strong>, each layer communicates only with the <strong>next lower layer</strong>.</p><p>This is commonly used in <strong>network communication systems</strong>.</p><h3>Mixed Layering</h3><p>Sometimes a higher-level component can directly use a lower layer without going through every intermediate layer.</p><p>For example:</p><pre>Application A ──→ OS Library<br>       │<br>       ↓<br> Math Library ──→ OS Library</pre><p>Both the application and mathematical library use the same operating-system library.</p><h3>Layering with Upcalls</h3><p>Sometimes a lower layer needs to notify a higher layer.</p><p>For example, an operating system may detect an event and call a function that an application previously registered.</p><p>This registered reference is often called a <strong>handle</strong>.</p><h3>Layered Communication Protocols</h3><p>One of the most common examples of layered architecture is a <strong>communication-protocol stack</strong>.</p><p>Each layer provides a <strong>communication service</strong> and offers an <strong>interface</strong> through which other components can use that service.</p><p>There are three important concepts:</p><h3>1. Service</h3><p>A <strong>service</strong> describes <strong>what a layer provides</strong>.</p><p>Example:</p><blockquote><em>Reliable communication between two parties.</em></blockquote><h3>2. Interface</h3><p>An <strong>interface</strong> describes <strong>how an application uses that service</strong>.</p><p>For example:</p><ul><li>connect()</li><li>send()</li><li>receive()</li><li>close()</li></ul><p>The interface hides the internal implementation.</p><h3>3. Protocol</h3><p>A <strong>protocol</strong> describes the <strong>rules that communicating parties follow</strong> to exchange information.</p><p>So remember:</p><blockquote><strong><em>Service = What is provided</em></strong><em><br> </em><strong><em>Interface = How you use it</em></strong><em><br> </em><strong><em>Protocol = Rules used to provide it</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3ZhleBwVOD15PchcmKKzQ.png" /></figure><h3>Reliable Connection-Oriented Service</h3><p>A common communication service is <strong>reliable, connection-oriented communication</strong>.</p><p>Before sending data, two parties first establish a connection.</p><p>It provides reliability by trying to ensure that:</p><ul><li>Messages reach the destination.</li><li>Lost messages can be detected and retransmitted.</li><li>Messages arrive in the correct order.</li></ul><p>On the Internet, <strong>TCP (Transmission Control Protocol)</strong> provides this type of service.</p><p>TCP’s protocol defines things such as:</p><ul><li>How a connection is established.</li><li>How a connection is terminated.</li><li>How message ordering is maintained.</li><li>How lost data is detected.</li><li>How lost data is retransmitted.</li></ul><p>The application doesn’t need to know how TCP internally achieves these things.</p><h3>Application Layering</h3><p>Layering is also commonly used when designing distributed applications.</p><p>Many applications work with databases, so they can often be divided into <strong>three logical layers</strong>:</p><pre>1. Application Interface<br>          ↓<br>2. Processing<br>          ↓<br>3. Data</pre><h3>1. Application-Interface Level</h3><p>This handles interaction with:</p><ul><li>Users</li><li>External applications</li></ul><p>It is essentially the <strong>front end</strong>.</p><h3>2. Processing Level</h3><p>This contains the <strong>main logic of the application</strong>.</p><p>It receives requests from the interface, processes them, and interacts with the data level.</p><h3>3. Data Level</h3><p>This manages the actual data.</p><p>It may use:</p><ul><li>File systems</li><li>Databases</li></ul><p>The data is often <strong>persistent</strong>, meaning it remains stored even when the application is not running.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MrFNgn34bhN9zplSS9nBOA.png" /></figure><h3>Example 1: Internet Search Engine</h3><p>A search engine can be divided into three layers.</p><h3>Application Interface</h3><p>The user enters keywords and receives a list of results.</p><h3>Processing</h3><p>The search engine:</p><ul><li>Converts keywords into database queries.</li><li>Searches the indexed data.</li><li>Ranks the results.</li><li>Converts the results into HTML pages.</li></ul><h3>Data</h3><p>A huge database contains <strong>prefetched and indexed web pages</strong>.</p><pre>User<br> ↓<br>Search Interface<br> ↓<br>Search/Ranking Logic<br> ↓<br>Indexed Web Pages</pre><h3>Data Level and Consistency</h3><p>The data level does more than simply store data.</p><p>It also helps maintain <strong>consistency</strong> when multiple applications use the same data.</p><p>A database can store:</p><ul><li>Actual application data</li><li>Table descriptions</li><li>Data constraints</li><li>Application-specific metadata</li></ul><p>For example, a bank could define a database <strong>trigger</strong> that automatically performs an action when a customer’s credit-card debt reaches a particular value.</p><p>So the data layer can also contain rules that automatically react to changes in data.</p><h3>Final Takeaway</h3><p>The whole section can be remembered with these three ideas:</p><blockquote><strong><em>Layering:</em></strong><em> Divide a system into levels with clear responsibilities.</em></blockquote><blockquote><strong><em>Communication stack:</em></strong><em><br> </em><strong><em>Service = what is provided</em></strong><em><br> </em><strong><em>Interface = how it is accessed</em></strong><em><br> </em><strong><em>Protocol = rules for communication</em></strong></blockquote><blockquote><strong><em>Application layering:</em></strong><em><br> </em><strong><em>Interface → Processing → Data</em></strong></blockquote><h3>Object-Based and Service-Oriented Architectures</h3><p>Object-based architecture is a <strong>looser form of organization</strong> than layered architecture.</p><p>The main idea is simple:</p><blockquote><strong><em>Objects communicate with each other by calling methods.</em></strong></blockquote><p>Each object contains its own <strong>data (state)</strong> and the <strong>operations (methods)</strong> that work on that data.</p><h3>Object-Based Architecture</h3><p>In a distributed system, the object being called does <strong>not have to be on the same computer</strong>.</p><pre>Object A ──→ Object B<br>             (possibly on another machine)</pre><p>The call can travel through the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aXbJtqvuB3dxcOfQo3B_vg.png" /></figure><h3>Why Object-Based Architecture Is Useful</h3><p>An object combines:</p><ul><li><strong>State</strong> → the data stored by the object.</li><li><strong>Methods</strong> → operations that can be performed on that data.</li></ul><p>The object’s <strong>interface hides its implementation details</strong>.</p><p>For example, a client only needs to know:</p><blockquote><em>“What methods can I call?”</em></blockquote><p>It doesn’t need to know:</p><blockquote><em>“How are those methods implemented internally?”</em></blockquote><p>Because of this, an object can be replaced with another object as long as it provides the <strong>same interface</strong>.</p><h3>Distributed Objects</h3><p>An object can have its interface available on one machine while the actual object exists on another machine.</p><p>This is called a <strong>distributed object</strong> or <strong>remote object</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*btfWLKMmN83CZYU8ghgspA.png" /></figure><h3>Proxy</h3><p>When a client connects to a distributed object, a <strong>proxy</strong> representing that object’s interface is placed in the client’s address space.</p><p>The proxy works similarly to a <strong>client stub in RPC</strong>.</p><p>Its job is to:</p><ol><li>Convert a method call into a message (<strong>marshalling</strong>).</li><li>Send the message to the server.</li><li>Receive the reply.</li><li>Convert the reply back into a result (<strong>unmarshalling</strong>).</li></ol><p>So the client can call a remote object almost as if it were a local object.</p><h3>Server Stub / Skeleton</h3><p>On the server side, requests first reach a <strong>server stub</strong>, often called a <strong>skeleton</strong>.</p><p>It:</p><ul><li>Unmarshals the incoming request.</li><li>Calls the appropriate method on the actual object.</li><li>Marshals the result.</li><li>Sends the reply back to the client.</li></ul><p>The skeleton provides the connection between the <strong>middleware</strong> and the developer’s actual object.</p><h3>Where Is the Object’s State?</h3><p>An interesting point is that in most distributed objects, the object’s <strong>state is NOT distributed</strong>.</p><p>The state normally exists on <strong>one machine</strong>, usually the server.</p><p>Only the object’s <strong>interface</strong> is made available to other machines.</p><p>So:</p><pre>Client<br>  ↓<br>Interface/Proxy<br>  ↓ network<br>Actual Object + State</pre><p>In more general distributed objects, the state itself <strong>can be spread across multiple machines</strong>, but this complexity is hidden from the client behind the object’s interface.</p><h3>From Objects to Services</h3><p>Object-based architectures provide a strong idea:</p><blockquote><strong><em>Encapsulate functionality into independent units.</em></strong></blockquote><p>Each service/object can operate independently while possibly using other services.</p><p>This idea leads naturally to <strong>Service-Oriented Architectures (SOA)</strong>.</p><h3>Service-Oriented Architecture (SOA)</h3><p>In an SOA, a distributed application is built by <strong>composing multiple independent services</strong>.</p><p>Each service:</p><ul><li>Performs a particular job.</li><li>Is logically encapsulated.</li><li>Provides a well-defined interface.</li><li>Can potentially be operated by a different organization.</li></ul><p>For example, a company might run its main application but use <strong>storage services provided by a cloud provider</strong>.</p><pre>Application<br>    ↓<br>Storage Service<br>    ↓<br>Cloud Provider</pre><h3>Example: Online Web Shop</h3><p>Consider an online shop that sells e-books.</p><p>A simple system might contain:</p><pre>Customer<br>   ↓<br>Web Shop<br>   ↓<br>Order Processing<br>   ↓<br>Database</pre><p>The order-processing system may handle:</p><ul><li>Selecting products.</li><li>Registering the delivery method.</li><li>Checking delivery information.</li><li>Handling payment.</li></ul><p>However, payment can be handled by a <strong>separate payment service</strong> operated by another organization.</p><p>The customer may be redirected to the payment service. After successful payment, the payment service informs the web shop so the transaction can be completed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tsx3SnR9mQdjJBGfAhjSyg.png" /></figure><h3>Service Composition</h3><p>Building a distributed system using services is partly a problem of <strong>service composition</strong>.</p><p>This means making different services work together correctly.</p><p>The challenge becomes greater when services:</p><ul><li>Are developed independently.</li><li>Have different interfaces.</li><li>Are operated by different organizations.</li></ul><p>Therefore, every service needs a <strong>well-defined programming interface</strong>.</p><p>However, each service may have its <strong>own interface</strong>, so combining many services can become complicated.</p><h3>Key Idea</h3><blockquote><strong><em>SOA = Build a distributed system by combining independent services through well-defined interfaces.</em></strong></blockquote><h3>Resource-Based Architectures</h3><p>As more services became available on the Web, building systems by connecting many different services became common.</p><p>However, <strong>service composition can become an integration nightmare</strong> because every service may have a different interface.</p><p>A different idea is to think of the whole distributed system as a collection of <strong>resources</strong>.</p><p>A resource can be:</p><ul><li>Created</li><li>Retrieved</li><li>Modified</li><li>Deleted</li></ul><p>This approach is widely used on the Web and is called <strong>REST (Representational State Transfer)</strong>.</p><h3>RESTful Architecture</h3><p>REST has <strong>four main characteristics</strong>:</p><ol><li><strong>Every resource has a unique naming scheme.</strong></li><li><strong>Resources use a common interface</strong> with at most four basic operations.</li><li><strong>Messages are self-described</strong>, meaning a message contains enough information to understand how it should be processed.</li><li>After completing an operation, the service <strong>doesn’t remember the client</strong>.</li></ol><p>The last property is called <strong>statelessness</strong>.</p><h3>The Four REST Operations</h3><ul><li><strong>PUT</strong> → Create a resource</li><li><strong>GET</strong> → Retrieve a resource</li><li><strong>DELETE</strong> → Delete a resource</li><li><strong>POST</strong> → Modify a resource</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aItPc7NHGG083fwR_SnS3A.png" /></figure><h3>Example: Amazon S3</h3><p>A good example of a RESTful system is <strong>Amazon S3</strong>, a cloud storage service.</p><p>S3 mainly works with two types of resources:</p><ul><li><strong>Objects</strong> → similar to files</li><li><strong>Buckets</strong> → similar to directories</li></ul><p>Buckets cannot be placed inside other buckets.</p><p>A resource can be identified using a <strong>URI</strong>.</p><p>Conceptually:</p><pre>Bucket → Object</pre><p>An application can use HTTP requests to interact with these resources.</p><h3>Creating a resource</h3><p>The application sends a <strong>PUT</strong> request.</p><p>If the bucket or object already exists, an error can be returned.</p><h3>Retrieving resources</h3><p>The application sends a <strong>GET</strong> request.</p><p>For example, requesting a bucket can return the names of the objects inside it.</p><p>So REST essentially uses standard HTTP operations to work with resources.</p><h3>Why REST Is Popular</h3><p>REST became popular mainly because of its <strong>simplicity</strong>.</p><p>However, REST is <strong>not always the best solution</strong>.</p><h3>REST is good when:</h3><ul><li>Services are relatively simple.</li><li>Resources can be easily represented.</li><li>Simple integration is required.</li><li>Stateless communication works well.</li></ul><h3>REST can become difficult when:</h3><ul><li>Communication is complicated.</li><li>Distributed transactions are required.</li><li>Services need to remember execution state.</li></ul><p>For example, a distributed transaction may require services to keep track of what has already happened.</p><p>So there is no universally “best” architecture.</p><blockquote><strong><em>REST gives simplicity, but complex systems may need more specialized service interfaces.</em></strong></blockquote><h3>Publish-Subscribe Architectures</h3><p>As distributed systems become larger, processes may frequently <strong>join or leave</strong>.</p><p>Therefore, it is useful to reduce the dependencies between processes as much as possible.</p><p>Publish-subscribe architectures do this by separating:</p><blockquote><strong><em>Processing</em></strong><em> from </em><strong><em>Coordination</em></strong></blockquote><p>Processes work independently, while a coordination mechanism handles communication between them.</p><p>Think of coordination as the <strong>glue connecting independent processes</strong>.</p><h3>Two Types of Coupling</h3><p>To understand publish-subscribe systems, we need two concepts.</p><h3>Referential Coupling</h3><p>Do the processes <strong>know who they are communicating with?</strong></p><ul><li><strong>Coupled:</strong> A process knows the name/ID of another process.</li><li><strong>Decoupled:</strong> A process does not know the identity of the receiver.</li></ul><h3>Temporal Coupling</h3><p>Do both processes need to be <strong>running at the same time?</strong></p><ul><li><strong>Coupled:</strong> Both must be running.</li><li><strong>Decoupled:</strong> They don’t need to run simultaneously.</li></ul><p>These two dimensions produce four coordination models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EFLsjYj3xT4Qidzon1DP5A.png" /></figure><h3>1. Direct Coordination</h3><p>Processes are:</p><ul><li><strong>Referentially coupled</strong></li><li><strong>Temporally coupled</strong></li></ul><p>They know who they are communicating with, and both must be running.</p><p>A simple example is a <strong>phone call</strong>.</p><pre>Process A ←→ Process B</pre><h3>2. Mailbox Coordination</h3><p>Processes are:</p><ul><li><strong>Referentially coupled</strong></li><li><strong>Temporally decoupled</strong></li></ul><p>The sender knows the <strong>mailbox</strong> where the message should go, but the receiver does not have to be running at that moment.</p><pre>Process A → Mailbox ← Process B</pre><p>The message waits in the mailbox until the receiver accesses it.</p><h3>3. Event-Based Coordination</h3><p>Processes are:</p><ul><li><strong>Referentially decoupled</strong></li><li><strong>Temporally coupled</strong></li></ul><p>A process does <strong>not know the specific receiver</strong>.</p><p>Instead, it publishes an event/notification.</p><p>Other processes subscribe to the types of events they are interested in.</p><pre>Publisher<br>    ↓<br>  Event<br>    ↓<br>Subscribers</pre><p>However, subscribers generally need to be running when the event is published.</p><h3>4. Shared Data Space</h3><p>Processes are:</p><ul><li><strong>Referentially decoupled</strong></li><li><strong>Temporally decoupled</strong></li></ul><p>Processes communicate through a <strong>shared data space</strong>.</p><p>They don’t directly communicate with each other.</p><p>Instead, they put and retrieve <strong>tuples</strong>.</p><p>A tuple is simply a structured collection of data, similar to a <strong>row in a database table</strong>.</p><p>For example:</p><pre>(name, age, city)</pre><p>A process can search for a tuple using a <strong>pattern</strong>.</p><p>If a matching tuple is found, it can be retrieved and removed.</p><h3>Publish-Subscribe</h3><p>Both <strong>event-based systems</strong> and <strong>shared data spaces</strong> can be considered publish-subscribe architectures.</p><p>The key idea is:</p><blockquote><strong><em>Publishers don’t need to know who the subscribers are.</em></strong></blockquote><p>A publisher simply announces an event.</p><p>Subscribers tell the middleware what events they are interested in.</p><p>The middleware matches the two.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LDxuJdd6da6VburcI2oXKw.png" /></figure><h3>Event Bus</h3><p>The mechanism that matches <strong>published events</strong> with interested subscribers is often called an <strong>event bus</strong>.</p><pre>Publisher<br>    ↓<br>Event Bus<br> ↙  ↓  ↘<br>S1  S2  S3</pre><p>The publisher doesn’t need to know S1, S2, or S3.</p><p>The event bus handles the matching.</p><h3>Types of Publish-Subscribe</h3><p>Subscriptions describe the events a subscriber wants.</p><p>There are two important forms.</p><h3>Topic-Based</h3><p>A subscription specifies a particular <strong>topic</strong>.</p><p>For example:</p><pre>(topic = &quot;weather&quot;)</pre><p>The subscriber receives events related to that topic.</p><h3>Content-Based</h3><p>The subscription describes the <strong>content</strong> of the event.</p><p>For example:</p><pre>temperature &gt; 30</pre><p>Or:</p><pre>room = &quot;ZI.1060&quot;<br>AND door = &quot;unlocked&quot;</pre><p>More complex subscriptions can even look similar to database queries.</p><p><strong>Figure:</strong> Not necessary; the examples above are enough.</p><h3>Matching Events with Subscriptions</h3><p>The middleware has to continuously determine:</p><blockquote><strong><em>Does this event match this subscription?</em></strong></blockquote><p>For example:</p><pre>Event:<br>temperature = 35</pre><pre>Subscription:<br>temperature &gt; 30</pre><pre>→ MATCH</pre><p>The more complicated the subscription, the harder it becomes to perform matching efficiently.</p><p>This is one of the <strong>main technical challenges</strong> in publish-subscribe systems.</p><h3>What Happens When an Event Occurs?</h3><p>Suppose an event means:</p><blockquote><em>“New data is available.”</em></blockquote><p>There are two possibilities.</p><h3>Option 1: Send the Data Directly</h3><p>The middleware sends both:</p><p><strong>Notification + Data</strong></p><p>to matching subscribers.</p><p>In this case, the middleware generally doesn’t need to store the data.</p><h3>Option 2: Send Only a Notification</h3><p>The middleware tells subscribers:</p><blockquote><em>“New data is available.”</em></blockquote><p>The subscriber then performs a read operation to retrieve the actual data.</p><p>In this case, the middleware <strong>must store the data</strong>.</p><p>It may also use a <strong>lease</strong>, meaning the data is automatically deleted when the lease expires.</p><h3>Example of Complex Events</h3><p>Consider this subscription:</p><blockquote><em>Notify me when </em><strong><em>room ZI.1060 is unoccupied AND its door is unlocked.</em></strong></blockquote><p>This may require two independent sources:</p><pre>Motion Sensor → Occupancy Event<br>Door Sensor   → Door Event</pre><p>The system must combine these events to determine whether the complete condition is true.</p><p>This is called <strong>event composition</strong>.</p><p>Event composition becomes difficult when the events come from different machines or locations.</p><h3>Main Challenge of Publish-Subscribe</h3><p>Publish-subscribe architectures have a major advantage:</p><blockquote><strong><em>Very strong decoupling between processes.</em></strong></blockquote><p>This makes them attractive for <strong>large-scale distributed systems</strong>.</p><p>But there is a major challenge:</p><blockquote><strong><em>Matching a large number of subscriptions with a large number of notifications efficiently and at scale.</em></strong></blockquote><p>This becomes especially difficult for <strong>content-based subscriptions</strong>, because their matching rules can be complex.</p><p>The four coordination models are:</p><ul><li><strong>Direct:</strong> Referentially coupled + temporally coupled</li><li><strong>Mailbox:</strong> Referentially coupled + temporally decoupled</li><li><strong>Event-based:</strong> Referentially decoupled + temporally coupled</li><li><strong>Shared data space:</strong> Referentially decoupled + temporally decoupled</li></ul><p><strong>The big idea:</strong> REST simplifies interaction by giving resources a common interface, while publish-subscribe simplifies large distributed systems by <strong>decoupling processes from one another</strong>.</p><h3>2.2 Middleware Organization</h3><p>Middleware is the <strong>software between applications and the underlying system/network</strong>.</p><p>The main goal is <strong>openness</strong> → middleware should be easy to extend, adapt, and work with different components.</p><p>Three important ideas are:</p><ul><li><strong>Wrappers</strong></li><li><strong>Interceptors</strong></li><li><strong>Modifiable middleware</strong></li></ul><h3>1. Wrappers</h3><p>A <strong>wrapper/adapter</strong> solves the problem of <strong>incompatible interfaces</strong>.</p><p>👉 If an old component provides an interface that an application cannot directly use, we put a wrapper around it.</p><p><strong>Simple idea:</strong></p><p>Application → Wrapper → Existing Component</p><p>The wrapper converts the application’s request into something the old component understands.</p><h3>Example</h3><p>Amazon S3 can provide a REST/HTTP interface while its internal storage system works differently.</p><p>The <strong>Web server acts as an adapter/wrapper</strong> between the client and the actual storage service.</p><h3>Problem with many applications</h3><p>Suppose every application needs to communicate directly with every other application.</p><p>With <strong>N applications</strong>, we could need approximately:</p><p><strong>N × (N − 1) = O(N²) wrappers</strong></p><p>That’s a lot and doesn’t scale.</p><h3>Solution: Broker</h3><p>Use a <strong>broker</strong> in the middle:</p><p>Application → Broker → Other Applications</p><p>The broker:</p><ul><li>Receives requests.</li><li>Finds the appropriate application.</li><li>Sends the request.</li><li>Combines/transforms responses if needed.</li><li>Returns the result.</li></ul><p>Now we need roughly <strong>O(N)</strong> wrappers instead of <strong>O(N²)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C3tXOU9BsFh_Q4S32MrguA.png" /></figure><h3>2. Interceptors</h3><p>An <strong>interceptor</strong> is software that <strong>interrupts the normal flow of a request</strong> so additional application-specific processing can happen.</p><p>It helps middleware <strong>adapt to different application requirements</strong>.</p><h3>Remote object example</h3><p>Suppose object <strong>A</strong> wants to call object <strong>B</strong>, but B is on another machine.</p><p>The process is:</p><ol><li><strong>A calls B normally</strong> through B’s interface.</li><li>Middleware converts the call into a <strong>generic invocation</strong>.</li><li>The generic invocation is converted into a <strong>network message</strong>.</li></ol><p>So:</p><p>A → Generic Invocation → Network Message → B</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-g1is573s01fZtblSByURg.png" /></figure><h3>Why interceptors are useful?</h3><h3>Replicated objects</h3><p>Suppose B has <strong>3 replicas</strong>.</p><p>Normally A doesn’t need to know about replication.</p><p>The <strong>request-level interceptor</strong> can automatically send:</p><p>invoke(B, doit, val)</p><p>to every replica.</p><p>So:</p><p>A → Interceptor → B1 + B2 + B3</p><p>The application remains unaware of the replication.</p><h3>Large data</h3><p>Suppose val contains a <strong>huge array</strong>.</p><p>A <strong>message-level interceptor</strong> can:</p><ul><li>Break the data into smaller pieces.</li><li>Send those pieces.</li><li>Help assemble them at the destination.</li></ul><p>This can improve <strong>performance and reliability</strong>.</p><h3>3. Modifiable Middleware</h3><p>Distributed environments constantly change:</p><ul><li>Network quality changes.</li><li>Hardware can fail.</li><li>Devices can move.</li><li>Batteries can drain.</li><li>System size can grow.</li></ul><p>So middleware must be able to <strong>adapt without shutting the whole system down</strong>.</p><p>This is called <strong>modifiable middleware</strong>.</p><h3>Main idea</h3><p>Instead of stopping the system:</p><p>Modify middleware → while system is running</p><p>For example:</p><ul><li>Add a component.</li><li>Remove a component.</li><li>Replace a component.</li><li>Change middleware behavior at runtime.</li></ul><h3>Component-Based Middleware</h3><p>One popular approach is to build middleware from <strong>components</strong>.</p><p>Components can be:</p><ul><li>Loaded at runtime.</li><li>Unloaded at runtime.</li><li>Replaced at runtime.</li></ul><p>This requires <strong>late binding</strong> → deciding which component implementation to use <strong>at runtime instead of design time</strong>.</p><h3>Important requirements</h3><p>For runtime modification:</p><ul><li>Components need clear <strong>interfaces they provide</strong>.</li><li>Components need clear <strong>interfaces they require</strong>.</li><li>The system needs support for <strong>loading/unloading components</strong>.</li><li>If a component maintains <strong>state between calls</strong>, extra handling is required.</li></ul><h3>Main challenge</h3><p>Components are often <strong>not completely independent</strong>.</p><p>Changing one component may affect other components, so dynamically replacing components can be complicated.</p><h3>🔑 In one line</h3><p><strong>Wrappers</strong> → make incompatible components work together.<br><strong>Interceptors</strong> → modify/control the normal flow of requests.<br><strong>Modifiable middleware</strong> → allows middleware to adapt or change <strong>at runtime without shutting down</strong>.</p><h3>2.3 System Architecture</h3><p><strong>System architecture</strong> means:</p><blockquote><strong><em>Where the software components are placed and how they communicate with each other.</em></strong></blockquote><p>The main organizations discussed here are:</p><ol><li><strong>Centralized → Client-Server</strong></li><li><strong>Multitiered Client-Server</strong></li><li><strong>Decentralized → Peer-to-Peer (P2P)</strong></li><li><strong>Hybrid architectures</strong></li></ol><h3>1. Centralized Organizations</h3><p>The basic idea is <strong>Client + Server</strong>.</p><ul><li><strong>Client</strong> → requests a service.</li><li><strong>Server</strong> → provides the service.</li><li>Client sends a <strong>request</strong>.</li><li>Server processes it and sends a <strong>reply</strong>.</li></ul><p>This is called <strong>request-reply communication</strong>.</p><h3>Example</h3><p>Client → Request → Server</p><p>Client ← Reply ← Server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*153a8Ca4L6Iw-EYYYdVBtA.png" /></figure><h3>2. Connectionless Communication</h3><p>If the network is fairly reliable, the client and server can communicate without creating a permanent connection.</p><p>The process is:</p><ol><li>Client creates a request message.</li><li>Client sends it.</li><li>Server receives it.</li><li>Server processes it.</li><li>Server sends a reply.</li></ol><h3>Advantage</h3><p>It is <strong>efficient</strong> because there is no need to establish and close a connection.</p><h3>Problem: Lost Messages</h3><p>Suppose the client sends a request but receives no reply.</p><p>The client doesn’t know:</p><ul><li>Was the <strong>request lost</strong>?</li><li>Or was the <strong>reply lost</strong>?</li></ul><p>If it sends the request again, the operation might happen twice.</p><h3>Example</h3><p><strong>Bank transfer:</strong></p><p>Transfer $10,000</p><p>If the first request actually succeeded but the reply was lost, sending it again could transfer another $10,000. ❌</p><p>But:</p><p>How much money do I have?</p><p>can safely be requested again. ✅</p><h3>3. Idempotent Operations</h3><p>An operation is <strong>idempotent</strong> if repeating it multiple times causes no harmful difference.</p><p>Example:</p><ul><li>Check account balance → usually idempotent.</li><li>Transfer $10,000 → not idempotent.</li></ul><p>So there is <strong>no single solution</strong> for lost requests because some operations can safely be repeated while others cannot.</p><h3>4. Connection-Oriented Communication</h3><p>Another solution is to use a <strong>reliable connection-oriented protocol</strong>, such as TCP.</p><p>The process is:</p><ol><li>Client creates a connection.</li><li>Client sends request.</li><li>Server sends reply through the same connection.</li><li>Connection is closed.</li></ol><h3>Advantage</h3><p>It is reliable and works well for unreliable networks such as wide-area Internet communication.</p><h3>Disadvantage</h3><p>Creating and closing connections has overhead.</p><p>If the request and reply are very small, this overhead can be expensive.</p><h3>5. Client and Server Are Not Always Completely Separate</h3><p>A server can also behave as a <strong>client</strong>.</p><h3>Example</h3><p>A distributed database server may receive a query from a client.</p><p>But internally, the database server may request data from several file servers.</p><p>So:</p><p>Client → Database Server → File Servers</p><p>Here the database server is:</p><ul><li>a <strong>server</strong> to the original client.</li><li>a <strong>client</strong> to the file servers.</li></ul><p>So the client/server distinction is not always clear.</p><h3>6. Multitiered Architectures</h3><p>A distributed application is often divided into three logical layers:</p><ol><li><strong>User Interface</strong></li><li><strong>Processing</strong></li><li><strong>Data</strong></li></ol><p>These layers can be physically distributed across different machines.</p><h3>Physically Two-Tier Architecture</h3><p>There are mainly two types of machines:</p><ul><li><strong>Client machine</strong></li><li><strong>Server machine</strong></li></ul><p>The client contains some/all of the user interface.</p><p>The server contains processing and/or data.</p><p>There are several ways to divide the application.</p><h3>Type 1: Very Thin Client</h3><p>The client contains only the part of the UI that depends on the terminal.</p><p>Most of the application runs on the server.</p><p>The client is almost like a <strong>dumb terminal</strong>.</p><h3>Type 2: Complete UI on Client</h3><p>The entire user interface runs on the client.</p><p>The client mainly handles presentation.</p><p>The actual application processing happens on the server.</p><p>So:</p><p>Client UI → Server Application</p><h3>Type 3: Some Processing on Client</h3><p>Some application processing is moved to the client.</p><p>Example:</p><p>A form can be checked on the client before being sent to the server.</p><p>The client can check:</p><ul><li>Required fields.</li><li>Correct format.</li><li>Consistency.</li></ul><p>Another example is a word processor:</p><ul><li>Basic editing → client.</li><li>Advanced spelling/grammar checking → server.</li></ul><h3>Type 4: Most Application on Client</h3><p>Most of the application runs on the user’s PC.</p><p>But file/database operations go to the server.</p><p>Example:</p><p><strong>Banking application</strong></p><p>The user prepares transactions locally, then the application sends them to the bank’s server for processing.</p><h3>Type 5: Client Also Stores Some Data</h3><p>The client’s local disk stores part of the data.</p><p>Example:</p><p><strong>Web browser cache</strong></p><p>The browser stores recently visited pages locally so they can be accessed faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRC1lGhp4Y5DDUYtqpUZKg.png" /></figure><h3>7. Three-Tier Architecture</h3><p>Sometimes the server itself needs to communicate with another server.</p><p>This creates a <strong>three-tier architecture</strong>.</p><p>A common structure is:</p><p>Client → Application Server → Database Server</p><p>For example, on a website:</p><ul><li><strong>Client</strong> → browser.</li><li><strong>Web/Application server</strong> → processes the request.</li><li><strong>Database server</strong> → stores and retrieves data.</li></ul><h3>Example</h3><p>An online bookstore:</p><p>Browser → Application Server → Inventory Database</p><p>The application server asks the database for available books.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfRPjE8gy1n2I-DrvwH_IQ.png" /></figure><h3>8. Vertical Distribution</h3><p><strong>Vertical distribution</strong> means putting <strong>different logical components on different machines</strong>.</p><p>For example:</p><p>Machine 1 → UI</p><p>Machine 2 → Processing</p><p>Machine 3 → Database</p><p>Each machine performs a different type of work.</p><h3>Simple idea</h3><p><strong>Different functions → different machines.</strong></p><h3>9. Horizontal Distribution</h3><p>Horizontal distribution is different.</p><p>Here, logically similar components are split across multiple machines.</p><p>Each machine handles <strong>part of the data/workload</strong>.</p><p>The goal is usually:</p><ul><li>Load balancing.</li><li>Scalability.</li><li>Better performance.</li></ul><h3>Simple idea</h3><p><strong>Same type of function → multiple machines.</strong></p><p>This idea is especially important in <strong>peer-to-peer systems</strong>.</p><h3>10. Peer-to-Peer (P2P) Systems</h3><p>In a traditional client-server system:</p><p>Client → Server</p><p>In P2P:</p><p><strong>All nodes are roughly equal.</strong></p><p>Every peer can act as:</p><ul><li>Client</li><li>Server</li></ul><p>So:</p><p>Peer ↔ Peer ↔ Peer</p><p>A peer can request something from another peer and also provide something to another peer.</p><h3>11. Overlay Network</h3><p>P2P systems use an <strong>overlay network</strong>.</p><p>The nodes are the P2P processes.</p><p>The links represent which peers can communicate directly.</p><p>A peer may not be able to directly contact every other peer.</p><p>It may have to forward messages through other peers.</p><p>There are two main types:</p><ul><li><strong>Structured P2P</strong></li><li><strong>Unstructured P2P</strong></li></ul><h3>12. Structured P2P</h3><p>In structured P2P, nodes follow a <strong>specific and deterministic topology</strong>.</p><p>Examples:</p><ul><li>Ring</li><li>Tree</li><li>Grid</li><li>Hypercube</li></ul><p>This structure helps nodes find data efficiently.</p><h3>Main idea: DHT</h3><p>Structured P2P systems commonly use a <strong>Distributed Hash Table (DHT)</strong>.</p><p>A data item gets a key using a hash function:</p><p>Data → Hash → Key</p><p>The system decides which node is responsible for that key.</p><p>So:</p><p>lookup(key) → responsible node</p><h3>Simple example</h3><p>Suppose:</p><p>File → hash → 14</p><p>The system knows which peer is responsible for the key 14.</p><p>The request is routed toward that peer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*innUggNqL1yB-ZFgs0d0Hw.png" /></figure><h3>13. Hypercube Example</h3><p>The book gives a four-dimensional hypercube example.</p><p>There are <strong>16 nodes</strong>.</p><p>Each node has an identifier.</p><p>Suppose:</p><ul><li>Starting node = 0111</li><li>Requested key = 1110</li></ul><p>The request is forwarded through neighboring nodes that are progressively closer to 1110.</p><p>For example:</p><p>0111 → 0110 → 1110</p><p>Finally, node 1110 provides the data.</p><p>The important idea is:</p><blockquote><em>The topology helps efficiently route a request to the node responsible for the key.</em></blockquote><h3>14. Chord</h3><p><strong>Chord</strong> is a practical structured P2P system.</p><p>Instead of a hypercube, Chord organizes nodes into a <strong>ring</strong>.</p><p>Each data item has a key.</p><p>The key belongs to the first node whose identifier is equal to or greater than that key.</p><p>This node is called the <strong>successor</strong>.</p><p>Example:</p><p>If the available nodes are:</p><p>1, 4, 9, 11, 14...</p><p>Then:</p><p>successor(7) = 9</p><p>because 9 is the first node after 7.</p><h3>Chord Shortcuts</h3><p>Every node maintains shortcuts to other nodes.</p><p>These shortcuts allow requests to jump long distances around the ring.</p><p>As a result, lookup can usually be done in approximately:</p><p><strong>O(log N)</strong></p><p>where N = the number of nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FIOyxS7ZFrrcPZ-BjMaFPA.png" /></figure><h3>15. Joining and Leaving Chord</h3><h3>When a node joins:</h3><ol><li>It finds its correct position.</li><li>It inserts itself between two existing nodes.</li><li>Some shortcuts are updated.</li><li>Data belonging to the new node is transferred to it.</li></ol><h3>When a node leaves:</h3><ol><li>It informs its neighbors.</li><li>It transfers its data to its successor.</li><li>The overlay is updated.</li></ol><p>So Chord supports <strong>dynamic joining and leaving</strong>.</p><h3>16. Unstructured P2P</h3><p>Unstructured P2P is different.</p><p>There is <strong>no fixed topology</strong>.</p><p>Each node maintains an ad-hoc list of neighbors.</p><p>The network therefore looks somewhat like a <strong>random graph</strong>.</p><p>When a node joins:</p><ul><li>It contacts another known peer.</li><li>Gets a list of peers.</li><li>Finds more peers.</li><li>Its neighbor list can change over time.</li></ul><h3>17. Searching in Unstructured P2P</h3><p>Because there is no deterministic routing, a node has to <strong>search</strong> for data.</p><p>Two important methods are:</p><ol><li><strong>Flooding</strong></li><li><strong>Random walks</strong></li></ol><h3>18. Flooding</h3><p>A node sends the search request to <strong>all of its neighbors</strong>.</p><p>Those neighbors forward it to their neighbors.</p><p>And so on.</p><p>Example:</p><p>A → B, C, D</p><p>Then:</p><p>B → more peers</p><p>C → more peers</p><p>D → more peers</p><p>Eventually, a peer containing the data responds.</p><h3>Problem</h3><p>Flooding can generate <strong>huge network traffic</strong>.</p><p>Therefore, searches often use <strong>TTL (Time-To-Live)</strong>.</p><p>TTL tells how many hops the request can travel.</p><ul><li>Small TTL → low traffic but may not find the data.</li><li>Large TTL → better chance of finding data but high traffic.</li></ul><p>Another strategy is to start with TTL = 1 and increase it if not enough results are found.</p><h3>19. Random Walk</h3><p>Instead of contacting everyone, a node chooses <strong>one random neighbor</strong>.</p><p>If that peer doesn’t have the data:</p><p>A → B → C → D → ...</p><p>Each node chooses another random neighbor.</p><h3>Advantage</h3><p>Much less network traffic.</p><h3>Disadvantage</h3><p>It can take a long time to find the data.</p><p>To improve the waiting time, a node can start multiple random walks simultaneously.</p><p>For example:</p><p>16 random walks</p><p>can significantly reduce the time needed to find data.</p><h3>20. Flooding vs Random Walk</h3><p>The basic trade-off is:</p><p><strong>Flooding</strong></p><ul><li>Finds data quickly.</li><li>Creates lots of network traffic.</li></ul><p><strong>Random walk</strong></p><ul><li>Uses much less traffic.</li><li>May take longer.</li></ul><p>The book also explains that because P2P data is often <strong>replicated</strong>, random walks can actually be surprisingly efficient.</p><p>For example, if data exists on many nodes, a random walk has a good chance of finding it without contacting thousands of nodes.</p><h3>21. Policy-Based Search</h3><p>Between flooding and random walks, systems can use smarter search policies.</p><p>For example:</p><ul><li>Prefer peers that previously gave useful results.</li><li>Search only some neighbors.</li><li>Prefer neighbors that themselves have many connections.</li></ul><p>So the system tries to make searching more intelligent.</p><h3>22. Hierarchical P2P / Super Peers</h3><p>Large unstructured P2P networks have a problem:</p><blockquote><em>Finding data becomes difficult as the network grows</em></blockquote><p>One solution is to introduce <strong>super peers</strong>.</p><p>A super peer performs additional work such as:</p><ul><li>Maintaining indexes.</li><li>Helping locate data.</li><li>Acting as a broker.</li></ul><p>Normal peers are sometimes called <strong>weak peers</strong>.</p><p>So:</p><p>Weak Peers → Super Peers</p><p>Super peers can themselves form a P2P network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPVW3o5vGG1TZE98w87byg.png" /></figure><h3>23. Why Super Peers?</h3><p>Super peers improve searching and resource management.</p><p>For example, in a file-sharing network:</p><p>A super peer can maintain information about which files are available.</p><p>Then a weak peer can ask:</p><blockquote><em>“Which peer has this file?”</em></blockquote><p>instead of searching the entire network.</p><h3>Problem</h3><p>Now we need to decide:</p><blockquote><em>Which nodes should become super peers?</em></blockquote><p>Super peers should usually be:</p><ul><li>Stable.</li><li>Highly available.</li><li>Capable of handling more work.</li></ul><p>This becomes related to the <strong>leader election problem</strong>.</p><h3>24. Skype Example</h3><p>The book uses Skype as an example of hierarchical P2P.</p><p>Skype used:</p><ul><li><strong>Weak peers</strong></li><li><strong>Super peers</strong></li><li>A centralized <strong>login server</strong></li></ul><p>A weak peer keeps a <strong>host cache</strong> containing addresses of reachable super peers.</p><p>If none works, it can use default super peers.</p><p>The weak peer connects to a super peer using TCP.</p><h3>Skype Communication Cases</h3><h3>Case 1: Both users have public Internet access</h3><p>A and B can communicate directly.</p><p>Control information uses TCP, while the actual voice communication can use UDP.</p><h3>Case 2: A is behind a firewall, B is public</h3><p>A connects to a super peer.</p><p>The super peer helps establish communication.</p><p>The actual voice traffic can then potentially travel directly between A and B.</p><h3>Case 3: Both are behind firewalls</h3><p>This is harder.</p><p>A and B connect through a super peer/relay.</p><p>The relay forwards the voice traffic.</p><h3>How users are found</h3><p>A asks its super peer to find another user.</p><p>The super peer provides peers to search.</p><p>If the user isn’t found, the search continues with more peers.</p><p>So Skype’s search can be viewed as a <strong>policy-based search</strong>.</p><p>The centralized login server is useful for:</p><ul><li>User registration.</li><li>Unique user IDs.</li><li>Administrative tasks.</li></ul><h3>25. Hybrid Architectures</h3><p>Many real distributed systems don’t use only one architecture.</p><p>They combine:</p><p><strong>Client-server + P2P</strong></p><p>These are called <strong>hybrid architectures</strong>.</p><p>Two important examples are:</p><ul><li>Edge-server systems</li><li>Collaborative distributed systems</li></ul><h3>26. Edge-Server Systems</h3><p>An edge server is placed <strong>near the users</strong>, at the edge of the Internet.</p><p>Instead of every user accessing one central server, users can access a nearby edge server.</p><p>The edge server can:</p><ul><li>Serve content.</li><li>Filter content.</li><li>Transform/transcode content.</li><li>Cache/replicate content.</li></ul><h3>Example</h3><p>An organization has an origin server.</p><p>Its content can be copied to several edge servers.</p><p>Users get content from a nearby edge server.</p><p>This can improve:</p><ul><li>Performance.</li><li>Response time.</li><li>Scalability.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eXylXq_7igT7eObH4gh3eA.png" /></figure><h3>27. Edge + Cloud + Fog</h3><p>The idea can be extended further.</p><h3>Cloud computing</h3><p>Large-scale computing/storage happens in a central data center.</p><h3>Edge computings</h3><p>Some computation/storage is moved closer to users through edge servers.</p><h3>Fog computing</h3><p>Even <strong>end-user devices</strong> can participate in computing/storage and may be partly controlled by the cloud provider.</p><p>Simple idea:</p><p>Cloud → Edge → User Devices</p><p>The closer computation gets to users, the more distributed the system becomes.</p><h3>28. Collaborative Distributed Systems</h3><p>Another hybrid approach is used in systems where users <strong>help each other</strong>.</p><p>A common pattern is:</p><ol><li>Use a centralized server to help users <strong>join/start</strong>.</li><li>After joining, users communicate in a <strong>decentralized P2P manner</strong>.</li></ol><p>The best example is <strong>BitTorrent</strong>.</p><h3>29. BitTorrent</h3><p>BitTorrent is a <strong>P2P file-sharing system</strong>.</p><p>A large file is divided into smaller pieces.</p><p>Instead of downloading the whole file from one server:</p><p>User downloads pieces from many peers</p><p>The pieces are then assembled into the complete file.</p><h3>Main goal</h3><p>BitTorrent tries to prevent <strong>free riding</strong>.</p><p><strong>Free riding</strong> means:</p><blockquote><em>A user downloads from others but contributes almost nothing back.</em></blockquote><p>BitTorrent encourages users to upload pieces to others while downloading.</p><h3>30. BitTorrent Tracker</h3><p>To start downloading, the user accesses a directory containing <strong>torrent information</strong>.</p><p>A torrent file contains information needed to download the file, including the address of a <strong>tracker</strong>.</p><p>The tracker knows about active peers that have pieces of the file.</p><p>So initially:</p><p>User → Tracker → Other Peers</p><p>After finding peers, the downloading user becomes part of the P2P swarm.</p><h3>31. BitTorrent Collaboration</h3><p>Suppose:</p><ul><li>Peer P is uploading to Q.</li><li>Q is downloading more than it uploads.</li></ul><p>P can reduce the amount of data it sends to Q.</p><p>This encourages peers to <strong>upload in exchange for downloading</strong>.</p><p>Peers are usually given multiple other peers so they have more opportunities to trade pieces.</p><h3>32. BitTorrent DHT</h3><p>The tracker can become a <strong>bottleneck</strong> because many users depend on it.</p><p>A solution is to use a <strong>DHT</strong>.</p><p>Instead of one tracker doing all the tracking:</p><ul><li>Tracking information is distributed across peers.</li><li>Each peer handles a small portion.</li></ul><p>So:</p><p>Centralized tracker → Distributed tracking</p><p>Some modern BitTorrent systems use the tracker mainly for initially providing peers, after which peers communicate directly.</p><h3>33. BitTorrent Important Terms</h3><h3>Swarm</h3><p>All peers currently downloading a particular file.</p><h3>Seeder</h3><p>A peer that has the <strong>complete file</strong> and continues sharing it.</p><h3>Leecher</h3><p>A peer that <strong>does not yet have the complete file</strong>.</p><h3>Piece</h3><p>A large chunk of the file.</p><p>Typically around <strong>256 KB</strong> in the textbook example.</p><h3>Block</h3><p>A smaller unit transferred between peers.</p><p>Typically around <strong>16 KB</strong>.</p><p>A peer can upload a block only if it has the complete piece containing that block.</p><h3>34. Potential Set</h3><p>For peer A:</p><p><strong>Potential set PA</strong> = peers that have data A needs and can potentially trade with A.</p><p>If:</p><p>B ∈ PA</p><p>then B has something A needs.</p><p>And A may have something B needs.</p><p>So they can trade.</p><h3>35. Three Phases of BitTorrent Downloading</h3><h3>1. Bootstrap Phase</h3><p>The peer has just joined and has very little data.</p><p>It needs to get its <strong>first piece</strong>.</p><p>This is helped by <strong>optimistic unchoking</strong>, where existing peers provide some data to help the new peer get started.</p><h3>2. Trading Phase</h3><p>Now the peer has useful pieces.</p><p>It can trade blocks with other peers.</p><p>This is normally the <strong>fastest and longest phase</strong>.</p><h3>3. Last Download Phase</h3><p>The peer has almost everything.</p><p>But the remaining pieces are harder to find.</p><p>Its potential set becomes small, so downloading the final pieces can take longer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SuxItRchLT6aozKZh-yqww.png" /></figure><h3>36. BitTorrent’s Two Smart Strategies</h3><h3>Highest upload rate</h3><p>When choosing a trading peer, a node prefers a peer with a <strong>high upload rate</strong>.</p><h3>Rarest piece first</h3><p>A node generally tries to distribute the <strong>rarest piece</strong> first.</p><p>Why?</p><p>Because if a piece exists on very few peers, it is important to copy it to more peers quickly.</p><p>This creates a better and more uniform distribution across the swarm.</p><h3>2.4 Example Architectures</h3><p>This section gives two real examples of distributed-system architectures:</p><ul><li><strong>NFS (Network File System)</strong></li><li><strong>The Web</strong></li></ul><h3>1. Network File System (NFS)</h3><p>NFS lets users access files stored on <strong>another machine</strong> as if they were local files.</p><h3>Main idea</h3><p>Each NFS server gives clients a <strong>standard file-system interface</strong>, even if the server’s actual file system is different.</p><p>So different machines and operating systems can <strong>share files</strong>.</p><h3>Remote Access Model</h3><p>The client accesses a remote file directly through the NFS server.</p><p>Client → NFS Server → File</p><p>The user normally does <strong>not need to know where the file is actually stored</strong>.</p><p>This is called the <strong>remote file service / remote access model</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7HdsCy5mR7U3CoPSgAF6w.png" /></figure><h3>Upload/Download Model</h3><p>Another approach is:</p><ol><li>Client downloads the complete file.</li><li>Client works on the local copy.</li><li>Client uploads it again.</li></ol><p>Example: using <strong>FTP</strong> to download, edit, and upload a file.</p><h3>Main difference</h3><ul><li><strong>NFS remote access</strong> → file stays on server.</li><li><strong>Upload/download</strong> → file is copied to client first.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66opZTH72dN6LtsF625ETg.png" /></figure><h3>2. Basic NFS Architecture</h3><p>On the client:</p><p>Application → Operating System/VFS → NFS Client → RPC → Network</p><h3>VFS</h3><p><strong>VFS (Virtual File System)</strong> gives applications one common interface for different file systems.</p><p>When an application performs a file operation:</p><ul><li>If the file is local → VFS sends it to the local file system.</li><li>If the file is remote → VFS sends it to the <strong>NFS client</strong>.</li></ul><p>The NFS client communicates with the server using <strong>RPC (Remote Procedure Calls)</strong>.</p><h3>On the server</h3><p>Network → RPC → NFS Server → VFS → Local File System</p><p>The NFS server receives the request, converts it into normal file-system operations, and the local file system accesses the actual file.</p><h3>Why VFS is useful</h3><p>NFS does not need to care whether the underlying file system is:</p><ul><li>Unix</li><li>Windows</li><li>MS-DOS</li><li>etc.</li></ul><p>It only needs the file system to follow the <strong>NFS file-system model</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h8Wa6VBbHesCclIRGx0IJg.png" /></figure><h3>3. NFSv3 vs NFSv4</h3><p>The important difference is that <strong>NFSv4 changed file handling and state management</strong>.</p><h3>NFSv3</h3><ul><li>Designed to be mostly <strong>stateless</strong>.</li><li>After finishing a request, the server forgets the client state.</li><li>create → creates regular files.</li><li>symlink → symbolic link.</li><li>mkdir → directory.</li><li>mknod → special file.</li><li>rmdir → removes directory.</li></ul><h3>NFSv4</h3><ul><li>Server generally <strong>maintains state</strong> between operations.</li><li>open and close were introduced.</li><li>open can create a new regular file.</li><li>create is used for nonregular objects such as directories/symbolic links/special files.</li><li>remove can remove any kind of file.</li></ul><h3>5. Path Lookup</h3><p>In <strong>NFSv3</strong>, lookup stops at a <strong>mount point</strong>.</p><p>The client may need to explicitly mount the next file system.</p><p>In <strong>NFSv4</strong>, lookup can continue across mount points, making path resolution simpler.</p><h3>6. Symbolic Links</h3><p>lookup does <strong>not</strong> directly follow a symbolic link.</p><p>When it reaches one:</p><ol><li>Use readlink.</li><li>Get the path stored inside the link.</li><li>Continue lookup using that path.</li></ol><h3>7. File Attributes</h3><p>Files have attributes such as:</p><ul><li>File type</li><li>File size</li><li>File-system identifier</li><li>Last modification time</li></ul><p>These are accessed with:</p><ul><li>getattr</li><li>setattr</li></ul><h3>8. Reading and Writing</h3><h3>Read</h3><p>The client tells the server:</p><ul><li>Where to start.</li><li>How many bytes to read.</li></ul><p>The server returns the data and status, such as whether <strong>end-of-file</strong> was reached.</p><h3>Write</h3><p>The client tells the server:</p><ul><li>Where to start writing.</li><li>Number of bytes.</li><li>Data to write.</li></ul><p>NFS can also require the server to put data into <strong>stable storage</strong>, meaning it should survive failures such as power loss or hardware/OS failure.</p><h3>The Web</h3><p>The Web is also a distributed system.</p><p>It started mainly as a system for <strong>sharing documents</strong>, but it evolved into systems that provide:</p><ul><li>Dynamic content</li><li>Applications</li><li>Services</li></ul><h3>9. Simple Web Architecture</h3><p>Basic Web architecture:</p><p>Browser → HTTP → Web Server → File System</p><p>The server stores documents, and the browser requests and displays them.</p><h3>URL</h3><p>A <strong>URL</strong> identifies a document.</p><p>It includes information such as:</p><ul><li>Server/DNS name</li><li>File name/path</li><li>Protocol used to retrieve it</li></ul><h3>HTTP</h3><p>The browser and Web server communicate using <strong>HTTP</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6r8WssjC8nZm0FSdrP_kJw.png" /></figure><h3>10. HTML</h3><p>A Web document can contain <strong>HTML markup</strong>.</p><p>HTML tells the browser <strong>how to display the content</strong>.</p><p>Example idea:</p><p>&lt;emph&gt;text&lt;/emph&gt;</p><p>The browser interprets the markup and displays the result.</p><h3>11. JavaScript</h3><p>A Web document can also contain <strong>JavaScript</strong>.</p><p>The browser executes the JavaScript locally.</p><p>This makes Web pages more <strong>interactive</strong>.</p><p>JavaScript can also send information back to the server.</p><h3>12. Multitiered Web Architecture</h3><p>The original Web was simple, but modern websites are much more advanced.</p><p>Instead of simply sending a stored file:</p><p>Browser → Web Server → File</p><p>the server may:</p><p>Browser → Web Server → Program/Database → Dynamic Document → Browser</p><p>Content can be generated <strong>on the fly</strong>.</p><p>For example:</p><ul><li>Data comes from a database.</li><li>Server-side code processes it.</li><li>HTML is generated.</li><li>Browser receives the final result.</li></ul><p>So modern Web documents are often <strong>dynamic rather than static</strong>.</p><h3>13. CGI</h3><p><strong>CGI (Common Gateway Interface)</strong> lets a Web server execute a program using data supplied by the user.</p><p>Typical flow:</p><ol><li>User fills an HTML form.</li><li>Browser sends the data to the server.</li><li>Web server starts the CGI program.</li><li>CGI program processes the data.</li><li>It may access a database.</li><li>It generates an HTML document.</li><li>Server sends the result to the browser.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t10_YYk63UJcpLztkURrUw.png" /></figure><h3>14. Server-Side Scripts</h3><p>Modern servers can also execute <strong>server-side scripts</strong> before sending a document.</p><p>The script itself is <strong>not sent to the client</strong>.</p><p>Instead:</p><p>Server-side code → Execute → Result inserted into document → Browser</p><p>Example:</p><p>PHP code can ask:</p><blockquote><em>“What is the client’s IP address?”</em></blockquote><p>The server executes the PHP and sends the <strong>result</strong>, not the PHP code.</p><p>It can also access a database and combine database data with other content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IVo4CNTfDoKTkd9RWTC6fg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b56712f335d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How JavaScript Really Runs: Interpreter, Compiler, and JIT Explained]]></title>
            <link>https://dadukhan.medium.com/how-javascript-really-runs-interpreter-compiler-and-jit-explained-96d618d5bdc4?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d618d5bdc4</guid>
            <category><![CDATA[just-in-time]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[interpreters]]></category>
            <category><![CDATA[compilers]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Wed, 05 Aug 2026 12:07:04 GMT</pubDate>
            <atom:updated>2026-08-05T12:07:04.999Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E5d06z-y7ekSgYLTDDNPcQ.png" /></figure><h3>1. What is an Interpreter?</h3><p>An <strong>interpreter</strong> reads your code <strong>line by line</strong> and executes it immediately.</p><pre>console.log(&quot;Hello&quot;);<br>let x = 5;<br>console.log(x);</pre><p>The interpreter:</p><ol><li>Reads console.log(&quot;Hello&quot;) → executes it.</li><li>Reads let x = 5 → executes it.</li><li>Reads console.log(x) → executes it.</li></ol><p><strong>No machine code is permanently created first.</strong></p><h3>2. What is a Compiler?</h3><p>A compiler converts <strong>all the code</strong> into <strong>machine code (0s and 1s)</strong> before running it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zU1c1pdoVXxXphC61l2qPQ.png" /></figure><p>Examples: C, C++.</p><h3>3. What is JIT (Just-In-Time) Compilation?</h3><p>JavaScript engines like <strong>V8</strong> combine <strong>both</strong> approaches.</p><p>When your program starts:</p><ol><li>V8 first <strong>interprets</strong> the code so it starts running immediately.</li><li>While the program is running, V8 watches which functions are used <strong>many times</strong>.</li><li>Those frequently used functions are <strong>compiled into machine code</strong>.</li><li>Next time they run, they execute much faster.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYhl3wGXzs9VSX4dAP5UaA.png" /></figure><h3>4. Example</h3><pre>function add(a, b) {<br>    return a + b;<br>}</pre><pre>for (let i = 0; i &lt; 1000000; i++) {<br>    add(2, 3);<br>}</pre><p>Initially:</p><ul><li>add() is interpreted.</li></ul><p>After V8 notices:</p><ul><li>“add() is being called millions of times!&quot;</li></ul><p>It compiles add() into machine code.</p><p>Now every future call to add() is much faster.</p><h3>5. Why is Node.js fast?</h3><p>Node.js uses the <strong>V8 engine</strong>.</p><ul><li>JavaScript starts quickly because it’s interpreted.</li><li>Hot (frequently used) code becomes machine code through JIT.</li><li>Combined with Node’s asynchronous I/O, this gives excellent performance, especially for web servers.</li></ul><h3>One-line definition:</h3><ul><li><strong>Interpreter:</strong> Executes code line by line.</li><li><strong>Compiler:</strong> Converts all code to machine code before running.</li><li><strong>JIT:</strong> Starts by interpreting, then compiles frequently used code into machine code while the program is running. This gives JavaScript both <strong>fast startup</strong> and <strong>fast execution</strong>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d618d5bdc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding JavaScript Execution Context: A Beginner-Friendly Guide]]></title>
            <link>https://dadukhan.medium.com/understanding-javascript-execution-context-a-beginner-friendly-guide-04e85c062960?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/04e85c062960</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-interview]]></category>
            <category><![CDATA[javascript-execution]]></category>
            <category><![CDATA[global-execution-context]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Wed, 08 Jul 2026 07:23:59 GMT</pubDate>
            <atom:updated>2026-07-08T07:23:59.090Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gw8VWM6EbsGqI65mIh3vlQ.png" /></figure><p>Many JavaScript developers learn concepts like hoisting, TDZ, and the call stack separately. The problem is that these concepts are all connected through one important idea:</p><p><strong>Execution Context.</strong></p><p>Once you understand execution context, many JavaScript behaviors that seem confusing start making sense.</p><p>Let’s break everything down step by step.</p><h3>What is an Execution Context?</h3><p>Whenever JavaScript runs your code, it creates an environment called an <strong>Execution Context</strong>.</p><p>Think of it as a box that contains everything JavaScript needs to execute your code.</p><p>When a JavaScript file starts running, JavaScript creates the <strong>Global Execution Context (GEC)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bAtmxJXSfC9ObusZjTR86g.png" /></figure><h3>The Two Phases of Execution</h3><p>Every execution context goes through two phases:</p><h3>1. Memory Phase (Creation Phase)</h3><p>Before a single line of code executes, JavaScript scans the entire code and allocates memory.</p><p>During this phase:</p><ul><li>Variables declared with var are initialized as undefined</li><li>Function declarations are stored completely in memory</li><li>let and const variables are allocated memory but remain uninitialized</li></ul><p>No code is executed yet.</p><p>JavaScript is simply preparing everything it needs.</p><h3>2. Code Phase (Execution Phase)</h3><p>After memory allocation is complete, JavaScript starts executing code line by line.</p><p>Variables receive their actual values and functions are called.</p><p>Example:</p><pre>var name = &quot;Dadu&quot;;</pre><pre>function greet() {<br>  console.log(&quot;Hello&quot;);<br>}</pre><pre>greet();</pre><p>During the memory phase:</p><pre>name = undefined<br><br>function greet() {<br>  console.log(&quot;Hello&quot;);<br>}</pre><p>During the code phase:</p><pre>name = &quot;Dadu&quot;<br>greet()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbMvSkppKiQvrAAeGhXP7g.png" /></figure><h3>Understanding Hoisting</h3><p>Hoisting is one of the most misunderstood concepts in JavaScript.</p><p>Many people say:</p><blockquote><em>JavaScript moves variables and functions to the top.</em></blockquote><p>That’s not exactly what happens.</p><p>Instead, JavaScript allocates memory before execution starts.</p><p>Consider:</p><pre>console.log(x);<br>var x = 10;</pre><p>Output:</p><pre>undefined</pre><p>Why?</p><p>Because during the memory phase:</p><pre>var x = undefined;</pre><p>So JavaScript already knows about x.</p><p>The value 10 is assigned later during execution.</p><h3>Function Declarations vs Function Expressions</h3><p>This is where many developers get confused.</p><h3>Function Declaration</h3><pre>greet();</pre><pre>function greet() {<br>  console.log(&quot;Hello&quot;);<br>}</pre><p>Output:</p><pre>Hello</pre><p>This works because the entire function is stored in memory before execution begins.</p><h3>Function Expression</h3><pre>sayHi();</pre><pre>var sayHi = function () {<br>  console.log(&quot;Hi&quot;);<br>};</pre><p>Output:</p><pre>TypeError: sayHi is not a function</pre><p>Why?</p><p>During memory creation:</p><pre>var sayHi = undefined;</pre><p>Only the variable is hoisted.</p><p>The function assignment happens later during execution.</p><h3>Temporal Dead Zone (TDZ)</h3><p>Now let’s look at let and const.</p><p>Consider:</p><pre>console.log(y);<br>let y = 10;</pre><p>Output:</p><pre>ReferenceError: Cannot access &#39;y&#39; before initialization</pre><p>Many developers assume that let is not hoisted.</p><p>That’s incorrect.</p><p>let and const are hoisted too.</p><p>The difference is that they are not initialized immediately.</p><p>During memory creation:</p><pre>let y;</pre><p>Memory is allocated, but the variable remains uninitialized.</p><p>The period between memory allocation and initialization is called the:</p><h3>Temporal Dead Zone (TDZ)</h3><p>During this period, accessing the variable causes an error.</p><p>Example:</p><pre>console.log(score);<br>let score = 100;</pre><p>JavaScript knows the variable exists, but it cannot be used yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kUPRTJSlM0RDAIomQwaElQ.png" /></figure><h3>Simple Rule for Variables</h3><p>Always declare variables before using them.</p><pre>var x = 10;<br>console.log(x);</pre><pre>let y = 20;<br>console.log(y);</pre><pre>const z = 30;<br>console.log(z);</pre><p>This avoids hoisting confusion and TDZ errors.</p><h3>Function Execution Context</h3><p>So far we’ve only discussed the Global Execution Context.</p><p>But what happens when a function is called?</p><p>Consider:</p><pre>function greet() {<br>  console.log(&quot;Hello&quot;);<br>}</pre><pre>greet();</pre><p>When greet() runs, JavaScript creates a new:</p><h3>Function Execution Context (FEC)</h3><p>Just like the global context, it has:</p><ul><li>Memory Phase</li><li>Code Phase</li></ul><p>The function executes inside its own execution context.</p><p>When the function finishes, that execution context is destroyed.</p><h3>Understanding the Call Stack</h3><p>JavaScript uses a data structure called the <strong>Call Stack</strong> to manage execution contexts.</p><p>Think of it as a stack of plates.</p><p>The last plate placed on top is removed first.</p><p>Example:</p><pre>function one() {<br>  two();<br>}<br>function two() {<br>  console.log(&quot;Inside two&quot;);<br>}</pre><pre>one();</pre><p>Execution happens like this:</p><h3>Step 1</h3><p>Global Execution Context is created.</p><p>Stack:</p><pre>Global</pre><h3>Step 2</h3><p>one() is called.</p><p>Stack:</p><pre>one()<br>Global</pre><h3>Step 3</h3><p>two() is called from inside one().</p><p>Stack:</p><pre>two()<br>one()<br>Global</pre><h3>Step 4</h3><p>two() finishes.</p><p>Stack:</p><pre>one()<br>Global</pre><h3>Step 5</h3><p>one() finishes.</p><p>Stack:</p><pre>Global</pre><p>This process continues throughout the lifetime of your application.</p><h3>Final Summary</h3><p>JavaScript execution becomes much easier when you understand these rules:</p><p>✅ Every program starts with a Global Execution Context.</p><p>✅ Every execution context has a Memory Phase and a Code Phase.</p><p>✅ var is hoisted and initialized with undefined.</p><p>✅ Function declarations are fully hoisted.</p><p>✅ Function expressions only hoist the variable.</p><p>✅ let and const are hoisted but remain uninitialized.</p><p>✅ The period before initialization is called the Temporal Dead Zone (TDZ).</p><p>✅ Every function call creates a new Function Execution Context.</p><p>✅ JavaScript uses the Call Stack to manage execution contexts.</p><p>Once these concepts click, debugging JavaScript becomes significantly easier because you’ll understand what the engine is doing behind the scenes.</p><p>#JavaScript #WebDevelopment #Frontend #NodeJS #Programming</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04e85c062960" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rate Limiting in JavaScript ( Express Rate Limit )]]></title>
            <link>https://dadukhan.medium.com/rate-limiting-in-javascript-express-rate-limit-2842caf38d57?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2842caf38d57</guid>
            <category><![CDATA[api-rate-limiting]]></category>
            <category><![CDATA[rate-limiting]]></category>
            <category><![CDATA[rate-limiting-algorithms]]></category>
            <category><![CDATA[express-rate-limit]]></category>
            <category><![CDATA[rate-limiting-in-js]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Fri, 15 May 2026 09:38:29 GMT</pubDate>
            <atom:updated>2026-05-15T09:38:29.333Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3BsJF7Hjf69Lmdw8FTwPJw.png" /></figure><h3>Protect Your APIs Before Traffic Becomes a Problem</h3><p>APIs power almost everything today.</p><p>Authentication systems, mobile apps, SaaS products, payment gateways, and AI tools — all of them rely on backend APIs handling requests reliably.</p><p>But there’s one problem many developers ignore early on:</p><blockquote><em>What happens when users send too many requests?</em></blockquote><p>Without proper protection, your server can quickly become vulnerable to:</p><ul><li>Brute force attacks</li><li>API abuse</li><li>Traffic spikes</li><li>Bot spam</li><li>Resource exhaustion</li></ul><p>That’s where <strong>Rate Limiting</strong> comes in.</p><p>In this article, we’ll learn:</p><ul><li>What is rate limiting</li><li>Why it matters</li><li>How to implement it in JavaScript</li><li>Popular rate-limiting strategies used in production systems</li></ul><h3>What is Rate Limiting?</h3><p>Rate limiting is a backend technique used to control how many requests a client can make within a specific time period.</p><p>For example:</p><ul><li>100 requests every 15 minutes</li><li>5 login attempts per minute</li><li>1000 API requests per day</li></ul><p>Instead of allowing unlimited traffic, the server sets boundaries to protect itself and ensure fair usage.</p><p>A simple request flow looks like this:</p><pre>User Requests → Rate Limiter → API Server</pre><p>The rate limiter acts like a gatekeeper between the client and your backend.</p><h3>Why Rate Limiting Matters</h3><p>Many developers think rate limiting is only needed for huge applications.</p><p>That’s not true.</p><p>Even small applications can suffer from abuse and unexpected traffic.</p><p>Let’s look at the biggest reasons why rate limiting matters.</p><h3>1. Prevents Brute Force Attacks</h3><p>Attackers often spam login endpoints using thousands of password combinations.</p><p>Without limits, they can continuously hit your authentication routes.</p><p>Rate limiting slows this down significantly.</p><p>Example:</p><ul><li>Maximum 5 login attempts per minute</li><li>Temporary block after limit exceeded</li></ul><p>This makes automated attacks far less effective.</p><h3>2. Stops API Spam</h3><p>Public APIs are common targets for bots and scrapers.</p><p>Without rate limiting:</p><ul><li>Bots can flood your endpoints</li><li>Resources get exhausted</li><li>Real users experience slower performance</li></ul><p>Rate limiting ensures fair resource usage across all clients.</p><h3>3. Helps Reduce DDoS Impact</h3><p>Rate limiting is not a complete DDoS solution, but it helps reduce the impact of excessive request floods.</p><p>It protects your server from:</p><ul><li>CPU overload</li><li>Memory exhaustion</li><li>Database pressure</li><li>Traffic spikes</li></ul><p>This improves overall system stability.</p><h3>4. Keeps Systems Predictable</h3><p>One of the biggest benefits of rate limiting is predictability.</p><p>Instead of random traffic spikes crashing your infrastructure, request flow becomes controlled and manageable.</p><p>This is extremely important for:</p><ul><li>Scalable applications</li><li>Cloud deployments</li><li>Microservices</li><li>Public APIs</li></ul><h3>Implementing Rate Limiting in Express.js</h3><p>One of the easiest ways to add rate limiting in Node.js is by using the express-rate-limit package.</p><h3>Install the Package</h3><pre>npm install express express-rate-limit</pre><h3>Basic Example</h3><pre>import express from &quot;express&quot;;<br>import rateLimit from &quot;express-rate-limit&quot;;</pre><pre>const app = express();</pre><pre>const limiter = rateLimit({<br>  windowMs: 15 * 60 * 1000, // 15 minutes<br>  max: 100 // limit each IP to 100 requests<br>});</pre><pre>app.use(limiter);</pre><pre>app.get(&quot;/&quot;, (req, res) =&gt; {<br>  res.send(&quot;Rate limited API&quot;);<br>});</pre><pre>app.listen(3000);</pre><h3>How This Works</h3><p>In this example:</p><ul><li>Each IP can make 100 requests</li><li>The time window is 15 minutes</li><li>After exceeding the limit, the server returns:</li></ul><pre>429 Too Many Requests</pre><p>This simple setup is enough for many beginner and intermediate projects.</p><p>But larger systems often require more advanced strategies.</p><h3>Popular Rate Limiting Strategies</h3><p>There are multiple ways to implement rate limiting.</p><p>Each strategy has different trade-offs.</p><p>Let’s explore the most common ones.</p><h3>1. Fixed Window</h3><h3>Concept</h3><p>Requests are counted inside fixed time intervals.</p><p>Example:</p><ul><li>100 requests every 15 minutes</li></ul><p>Once the time window resets, the counter resets too.</p><h3>Simple Example</h3><pre>let count = 0;<br>let windowStart = Date.now();</pre><pre>function fixedWindowLimit(req, res, next) {<br>  const now = Date.now();</pre><pre>  if (now - windowStart &gt; 15 * 60 * 1000) {<br>    count = 0;<br>    windowStart = now;<br>  }</pre><pre>  if (count &gt;= 100) {<br>    return res.status(429).send(&quot;Too many requests&quot;);<br>  }</pre><pre>  count++;<br>  next();<br>}</pre><h3>Pros</h3><ul><li>Easy to implement</li><li>Fast and lightweight</li><li>Good for smaller systems</li></ul><h3>Cons</h3><ul><li>Allows traffic spikes at window boundaries</li><li>Less accurate than modern strategies</li></ul><h3>2. Sliding Window</h3><h3>Concept</h3><p>Instead of checking fixed intervals, the server continuously tracks requests from the last X minutes.</p><p>This creates smoother and fairer traffic control.</p><h3>Example</h3><pre>const requests = [];</pre><pre>function slidingWindow(req, res, next) {<br>  const now = Date.now();</pre><pre>  while (requests.length &amp;&amp; requests[0] &lt; now - 60000) {<br>    requests.shift();<br>  }</pre><pre>  if (requests.length &gt;= 100) {<br>    return res.status(429).send(&quot;Limit exceeded&quot;);<br>  }</pre><pre>  requests.push(now);</pre><pre>  next();<br>}</pre><h3>Pros</h3><ul><li>More accurate</li><li>Better fairness</li><li>Prevents boundary spikes</li></ul><h3>Cons</h3><ul><li>Higher memory usage</li><li>More processing overhead</li></ul><h3>3. Token Bucket</h3><h3>Concept</h3><p>This is one of the most popular production-level approaches.</p><p>A virtual bucket contains tokens.</p><ul><li>Tokens refill over time</li><li>Each request consumes one token</li><li>No tokens = request denied</li></ul><h3>Example</h3><pre>let tokens = 100;<br>let lastRefill = Date.now();</pre><pre>function tokenBucket(req, res, next) {<br>  const now = Date.now();</pre><pre>  const elapsed = now - lastRefill;</pre><pre>  tokens += Math.floor(elapsed / 1000);<br>  tokens = Math.min(tokens, 100);</pre><pre>  lastRefill = now;</pre><pre>  if (tokens &lt;= 0) {<br>    return res.status(429).send(&quot;No tokens left&quot;);<br>  }</pre><pre>  tokens--;</pre><pre>  next();<br>}</pre><h3>Pros</h3><ul><li>Handles burst traffic well</li><li>Smooth request control</li><li>Excellent for APIs</li></ul><h3>Cons</h3><ul><li>Slightly more complex</li><li>Requires proper tuning</li></ul><h3>4. Concurrency Limiting</h3><h3>Concept</h3><p>Instead of limiting request frequency, concurrency limiting controls how many requests can be active at the same time.</p><p>This protects servers from overload during expensive operations.</p><h3>Example</h3><pre>let active = 0;<br>const MAX = 50;</pre><pre>function concurrencyLimit(req, res, next) {<br>  if (active &gt;= MAX) {<br>    return res.status(429).send(&quot;Server busy&quot;);<br>  }</pre><pre>  active++;</pre><pre>  res.on(&quot;finish&quot;, () =&gt; {<br>    active--;<br>  });</pre><pre>  next();<br>}</pre><h3>Best Use Cases</h3><p>Concurrency limiting works especially well for:</p><ul><li>File uploads</li><li>Database-heavy operations</li><li>CPU-intensive workloads</li><li>AI inference APIs</li></ul><h3>Production-Level Rate Limiting</h3><p>In real-world systems, applications usually run on multiple servers.</p><p>That means memory-based counters are often not enough.</p><p>Production systems commonly use:</p><ul><li>Redis</li><li>API Gateways</li><li>Reverse Proxies</li><li>Distributed Caches</li></ul><p>Popular tools include:</p><ul><li>Redis</li><li>NGINX</li><li>Cloudflare</li><li>express-rate-limit</li></ul><h3>Best Practices</h3><h3>Use Different Limits for Different Routes</h3><p>Not every endpoint needs the same protection.</p><p>Examples:</p><ul><li>Login routes → strict limits</li><li>Public APIs → moderate limits</li><li>Internal services → higher limits</li></ul><h3>Return Proper HTTP Status Codes</h3><p>Use:</p><pre>429 Too Many Requests</pre><p>This clearly tells clients they exceeded the allowed request limit.</p><h3>Add Retry Headers</h3><p>Helpful APIs tell users when they can retry.</p><p>Example:</p><pre>Retry-After: 60</pre><h3>Monitor Traffic</h3><p>Always monitor:</p><ul><li>Request counts</li><li>Rejected requests</li><li>Traffic spikes</li><li>Suspicious IP activity</li></ul><p>Observability helps detect abuse early.</p><h3>Final Thoughts</h3><blockquote><em>Great APIs don’t just respond faster.<br>They survive smarter.</em></blockquote><p>Rate limiting is one of the simplest yet most powerful backend protections you can implement.</p><p>Most developers only install middleware and move on.</p><p>But understanding:</p><ul><li>Fixed windows</li><li>Sliding windows</li><li>Token buckets</li><li>Concurrency limits</li></ul><p>…helps you think like a real backend engineer.</p><p>Because scalable systems are not built only for speed.</p><p>They’re built for stability under pressure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2842caf38d57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Can Your Frontend Talk Directly to the Database? Yes — But Only Safely With Row Level Security]]></title>
            <link>https://dadukhan.medium.com/can-your-frontend-talk-directly-to-the-database-yes-but-only-safely-with-row-level-security-ed7945888ce3?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed7945888ce3</guid>
            <category><![CDATA[postgressql]]></category>
            <category><![CDATA[row-level-security]]></category>
            <category><![CDATA[supabase]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 01:12:24 GMT</pubDate>
            <atom:updated>2026-04-21T01:12:24.440Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*1s6hJFQWTHVrSnssupgwZw.png" /></figure><p><em>A beginner-friendly guide to understanding Row Level Security (RLS) with Supabase and PostgreSQL</em></p><h3>Wait, Frontend Calling the Database Directly?</h3><p>When I first heard that tools like <strong>Supabase</strong> let your React app query a PostgreSQL database directly — no backend, no API layer — my first reaction was:</p><blockquote>“Isn’t that a massive security hole?”</blockquote><p>Turns out, it can be. But only if you don’t know about <strong>Row Level Security (RLS)</strong>.</p><p>In this blog, I’ll walk you through:</p><ul><li>What RLS is and why it exists</li><li>How it works under the hood</li><li>Real code examples (beginner-friendly)</li><li>How Supabase makes it super easy</li><li>Common mistakes to avoid</li></ul><p>Let’s go.</p><h3>The Problem: Who Gets to See What?</h3><p>Imagine you’re building a simple to-do app. You have a todos table in your database:</p><p>id user_id title 1 alice Buy groceries 2 bob Fix the car 3 alice Read a book 4 carol Call the doctor</p><p>Now Alice logs into your app and fetches her to-dos. She should only see rows 1 and 3. But what if someone bypasses your app’s code and queries the database directly?</p><p>Without any protection, they’d get <strong>all 4 rows</strong> — including Bob’s and Carol’s data.</p><p>This is the problem RLS solves.</p><h3>What Is Row Level Security?</h3><p><strong>Row Level Security (RLS)</strong> is a feature built into PostgreSQL (and supported by Supabase) that lets you define <em>policies</em> controlling which rows a user can read, insert, update, or delete.</p><p>The key thing to understand: <strong>it’s enforced at the database level</strong> — not in your application code.</p><p>This means:</p><ul><li>Even if someone bypasses your API</li><li>Even if a developer queries the DB directly</li><li>Even if there’s a bug in your app logic</li></ul><p>The database itself will enforce who sees what. It’s like a security guard built into the data storage itself.</p><h3>How Does RLS Work?</h3><p>RLS works by attaching <strong>policies</strong> to a table. A policy is basically a rule that says:</p><blockquote>“Only return this row if this condition is true for the current user.”</blockquote><p>Every time a query runs on a table with RLS enabled, PostgreSQL automatically adds your policy as a hidden WHERE clause to the query.</p><p>So instead of:</p><pre>SELECT * FROM todos;</pre><p>The database secretly runs:</p><pre>SELECT * FROM todos WHERE user_id = &#39;alice&#39;;</pre><p>Alice never has to write this filter herself. The database does it automatically, every single time.</p><h3>Step-by-Step: Enabling RLS in PostgreSQL</h3><p>Let’s walk through the actual steps.</p><h3>Step 1: Create your table</h3><pre>CREATE TABLE todos (<br>  id SERIAL PRIMARY KEY,<br>  user_id TEXT NOT NULL,<br>  title TEXT NOT NULL,<br>  created_at TIMESTAMP DEFAULT now()<br>);</pre><h3>Step 2: Enable RLS on the table</h3><p>By default, RLS is <strong>off</strong>. You have to turn it on:</p><pre>ALTER TABLE todos ENABLE ROW LEVEL SECURITY;</pre><p>Once you do this, <strong>all queries will return zero rows</strong> until you create a policy. This is intentional — the database defaults to “deny everything” for safety.</p><h3>Step 3: Create a policy</h3><pre>CREATE POLICY user_sees_own_todos<br>  ON todos<br>  FOR SELECT<br>  USING (user_id = current_user);</pre><p>Breaking this down:</p><ul><li>user_sees_own_todos — just a name for your policy</li><li>ON todos — apply this to the todos table</li><li>FOR SELECT — this rule applies to read queries</li><li>USING (user_id = current_user) — only return rows where user_id matches the current logged-in user</li></ul><p>That’s it. Now Alice can only ever see her own todos, no matter how she queries the database.</p><h3>RLS With Supabase (The Easy Way)</h3><p>Supabase is a backend-as-a-service built on top of PostgreSQL. It lets your frontend query the database directly using their JavaScript SDK — and RLS is the feature that makes this safe.</p><p>In Supabase, the current user’s ID is available via auth.uid() instead of current_user.</p><p>Here’s how it looks:</p><h3>Enable RLS (one click in dashboard or via SQL)</h3><pre>ALTER TABLE todos ENABLE ROW LEVEL SECURITY;</pre><h3>Create the policy</h3><pre>CREATE POLICY user_sees_own_todos<br>  ON todos<br>  FOR SELECT<br>  USING (user_id = auth.uid());</pre><h3>Query from your React frontend</h3><pre>import { createClient } from &#39;@supabase/supabase-js&#39;</pre><pre>const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)</pre><pre>const { data, error } = await supabase<br>  .from(&#39;todos&#39;)<br>  .select(&#39;*&#39;)</pre><p>Notice there’s <strong>no </strong><strong>.eq(&#39;user_id&#39;, userId) filter</strong> in the query. You don&#39;t need it. RLS handles it automatically at the database level.</p><p>When Alice is logged in and runs this query, she gets only her todos. When Bob runs it, he gets only his. Same query — different results based on identity.</p><h3>Policies for INSERT, UPDATE, and DELETE</h3><p>RLS isn’t just for reading data. You can apply it to every type of operation.</p><h3>INSERT — only users can insert their own rows</h3><pre>CREATE POLICY user_inserts_own_todos<br>  ON todos<br>  FOR INSERT<br>  WITH CHECK (user_id = auth.uid());</pre><p>WITH CHECK is used for INSERT and UPDATE — it validates the data being written, not just what&#39;s being read.</p><h3>UPDATE — only update your own rows</h3><pre>CREATE POLICY user_updates_own_todos<br>  ON todos<br>  FOR UPDATE<br>  USING (user_id = auth.uid());</pre><h3>DELETE — only delete your own rows</h3><pre>CREATE POLICY user_deletes_own_todos<br>  ON todos<br>  FOR DELETE<br>  USING (user_id = auth.uid());</pre><h3>A Real-World Example: Multi-Tenant SaaS</h3><p>RLS really shines in <strong>multi-tenant applications</strong> — where many companies or teams share the same database, but each should only see their own data.</p><p>Imagine a project management tool where multiple companies use your app. You have a projects table:</p><pre>CREATE TABLE projects (<br>  id SERIAL PRIMARY KEY,<br>  org_id UUID NOT NULL,<br>  name TEXT NOT NULL<br>);</pre><p>Each user belongs to an organization. You store org_id in their JWT token as a custom claim.</p><p>Your RLS policy:</p><pre>CREATE POLICY org_isolation<br>  ON projects<br>  FOR ALL<br>  USING (org_id = (auth.jwt() -&gt;&gt; &#39;org_id&#39;)::UUID);</pre><p>Now <strong>Acme Corp</strong> employees can only see Acme’s projects, and <strong>Globex Corp</strong> employees can only see Globex’s — even though they’re all in the same database table. No accidental data leaks. No “oops I forgot to filter by org” bugs.</p><h3>Common Mistakes to Avoid</h3><h3>1. Forgetting to enable RLS</h3><p>You can write a beautiful policy, but if you forget ALTER TABLE todos ENABLE ROW LEVEL SECURITY, the policy does nothing.</p><h3>2. Testing as a superuser</h3><p>PostgreSQL superusers <strong>bypass RLS entirely</strong>. If you’re testing your policies while connected as a superuser (which is common in development), everything will look fine — even if your policies are broken.</p><p>Always test with a regular user role:</p><pre>SET ROLE regular_user;<br>SELECT * FROM todos;</pre><h3>3. Missing policies for INSERT</h3><p>Many developers enable RLS and add a SELECT policy, then forget INSERT. Result: users can’t add any data. Make sure you have a policy for every operation your app needs.</p><h3>4. Overly permissive policies</h3><p>Avoid writing:</p><pre>USING (true)</pre><p>This is basically no security at all — it allows every row for every user. Always check against the actual user identity.</p><h3>RLS vs Application-Level Filtering</h3><p>You might be thinking: <em>“Can’t I just add a WHERE clause in my application code?”</em></p><p>Yes, you can. But there’s a big difference:</p><p>Application-Level Filter Row Level Security Where enforced Your code The database Bypassed by SQL clients Yes No Bypassed by API bugs Yes No Works without backend No Yes Compliance-friendly Sometimes Yes</p><p>RLS doesn’t replace good application code — it’s an extra layer underneath it. Even if your application logic fails, the database still protects the data.</p><h3>Enabling RLS in Supabase Dashboard (No SQL Needed)</h3><p>If you’re not comfortable writing SQL yet, Supabase has a visual dashboard:</p><ol><li>Go to <strong>Table Editor</strong> in your Supabase project</li><li>Click on your table</li><li>Go to the <strong>RLS</strong> tab</li><li>Toggle <strong>Enable RLS</strong> on</li><li>Click <strong>Add Policy</strong> and choose from templates like “Users can only read their own data”</li></ol><p>Supabase auto-generates the SQL for you. It’s honestly one of the best ways to learn what the policies look like.</p><h3>Summary</h3><p>Here’s everything we covered:</p><ul><li><strong>RLS = security enforced at the database layer</strong>, not in application code</li><li>Every table needs ENABLE ROW LEVEL SECURITY before policies take effect</li><li>Policies use USING for SELECT/UPDATE/DELETE and WITH CHECK for INSERT/UPDATE</li><li>In Supabase, use auth.uid() to match the current logged-in user</li><li>RLS is what makes it safe to query Supabase directly from your frontend</li><li>Always test policies with non-superuser roles</li><li>RLS is a must-have for multi-tenant apps and compliance requirements</li></ul><h3>Final Thought</h3><p>RLS changed how I think about database security. Instead of hoping my application code always filters data correctly, I now have a guarantee at the lowest possible layer.</p><p>If you’re building with Supabase, enabling RLS isn’t optional — it’s the default assumption the whole platform is built around. And once you understand it, you’ll wonder how you ever built without it.</p><p><em>Found this useful? Share it with someone learning backend development. And if you want to explore more, Supabase’s official documentation on RLS is excellent — it’s where I learned most of this.</em></p><p><strong>Tags:</strong> #supabase #postgresql #databases #webdevelopment #backendsecurity #beginners</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed7945888ce3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ What is Docker? Fix “It Works on My Machine” Forever]]></title>
            <link>https://dadukhan.medium.com/what-is-docker-fix-it-works-on-my-machine-forever-c2b05e80bfc0?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2b05e80bfc0</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 14:23:08 GMT</pubDate>
            <atom:updated>2026-03-23T14:47:05.609Z</atom:updated>
            <content:encoded><![CDATA[<h3>🐳 What is Docker and Why Do We Need It?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_woHjuYPzZgzr38dUBK73Q.png" /></figure><p>From <em>“it works on my machine”</em> → Virtual Machines → Docker — a simple, practical guide.</p><h3>🚨 The Problem — “It Works on My Machine.”</h3><p>You build an app on your laptop. It works perfectly.</p><p>You send it to a colleague or deploy it to a server — it breaks.</p><blockquote><strong><em>“But it works on my machine!”</em></strong></blockquote><h3>Why does this happen?</h3><p>Because every machine is different:</p><ul><li><strong>Different software versions</strong><br>(e.g., your Node.js 18 vs their Node.js 14)</li><li><strong>Different library versions</strong><br>Same library, different behavior</li><li><strong>Missing dependencies</strong><br>Installed months ago, now forgotten</li><li><strong>Different operating systems</strong><br>Windows vs Linux — commands and paths behave differently</li></ul><p>👉 This is one of the oldest and most frustrating problems in software development.</p><p>The industry needed a solution.</p><h3>🖥️ First Solution — Virtual Machines</h3><p>A <strong>Virtual Machine (VM)</strong> is a software-based computer running inside your real computer.</p><p>It includes:</p><ul><li>Its own operating system</li><li>CPU, RAM, and storage</li><li>Fully isolated environment</li></ul><p>Tools like VirtualBox and VMware made this possible.</p><h3>✅ Why VMs worked</h3><ul><li>Everyone runs the <strong>same environment</strong></li><li>No more dependency issues</li><li>Strong isolation</li></ul><h3>❌ But they had major drawbacks</h3><ul><li>Each VM includes a <strong>full OS</strong> → takes <strong>GBs of space</strong></li><li><strong>Slow startup</strong> (minutes, not seconds)</li><li><strong>Heavy resource usage</strong></li><li>Running multiple apps = multiple operating systems</li></ul><blockquote><em>💡 Analogy: Renting an entire house just to use one room.</em></blockquote><h3>⚡ The Better Solution — Docker &amp; Containers</h3><p>Then came Docker.</p><p>Docker packages your app and everything it needs into a <strong>Container</strong>:</p><ul><li>Application code</li><li>Dependencies</li><li>Runtime (Node, Python, etc.)</li><li>Configuration</li></ul><h3>🔑 Key Idea</h3><ul><li><strong>VM:</strong> App + Full OS</li><li><strong>Docker:</strong> App + Dependencies (shares OS kernel)</li></ul><p>👉 This makes containers <strong>lightweight, fast, and efficient</strong>.</p><h3>📦 Core Docker Concepts</h3><h3>1. Dockerfile</h3><p>A <strong>recipe</strong> that defines how your container is built.</p><h3>2. Image</h3><p>A <strong>built package</strong> (snapshot of your app + environment).</p><h3>3. Container</h3><p>A <strong>running instance</strong> of the image (your live app).</p><h3>🔁 Workflow</h3><pre>Dockerfile → Image → Container</pre><h3>⚔️ Docker vs Virtual Machines</h3><p><strong>Size:</strong><br> Virtual Machines → GBs<br> Docker Containers → MBs</p><p><strong>Startup Time:</strong><br> Virtual Machines → Minutes<br> Docker Containers → Seconds</p><p><strong>Resource Usage:</strong><br> Virtual Machines → Heavy<br> Docker Containers → Lightweight</p><p><strong>Scalability:</strong><br> Virtual Machines → Slow &amp; costly<br> Docker Containers → Fast &amp; efficient</p><h3>🚀 Why Do We Prefer Docker?</h3><h3>✅ Consistency</h3><p>Same environment everywhere — no more surprises.</p><h3>✅ Portability</h3><p>Run your app anywhere:</p><ul><li>Laptop</li><li>Server</li><li>Cloud</li></ul><h3>✅ Isolation</h3><p>Applications don’t interfere with each other.</p><h3>✅ Speed</h3><p>Containers start in seconds → faster development.</p><h3>✅ Scalability</h3><p>With tools like Kubernetes:</p><ul><li>Run hundreds of containers</li><li>Auto-scale based on demand</li><li>Self-heal failures</li></ul><h3>🧠 Final Thoughts</h3><p>The evolution is simple:</p><blockquote><em>“It works on my machine” → VMs solved it (but heavy) → Docker solved it better (lightweight, fast, scalable)</em></blockquote><p>Today, Docker is a <strong>must-have skill</strong> for developers working in cloud and DevOps environments.</p><h3>💡 Key Insight</h3><blockquote><em>Virtual Machines virtualized hardware.<br>Docker virtualized the environment.<br>Kubernetes virtualized the system.</em></blockquote><p>🐳 <strong>“It works on my machine” was the problem. Docker made it work everywhere.</strong></p><h3>📌 Tags</h3><p>#Docker #DevOps #Cloud #Containers #VirtualMachines #Kubernetes #SoftwareEngineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2b05e80bfc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Angular’s ngOnDestroy: The Silent Hero That Saves Your App]]></title>
            <link>https://dadukhan.medium.com/angulars-ngondestroy-the-silent-hero-that-saves-your-app-2befa76a80d7?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2befa76a80d7</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[ngondestroy]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 17:15:06 GMT</pubDate>
            <atom:updated>2025-09-17T17:15:40.413Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRzF3GM__7tVvt47PMC2TA.png" /></figure><p>When we build Angular apps, we love focusing on the shiny stuff: creating components, binding data, and connecting APIs. But there’s a silent killer lurking in almost every project… <strong>memory leaks</strong>.</p><p>And trust me — if you ignore them, they’ll quietly <strong>destroy your app’s performance</strong>.</p><p>That’s where Angular’s <strong>ngOnDestroy</strong> lifecycle hook becomes your best friend. 🚀</p><h3>🧹 What is ngOnDestroy?</h3><p>Simply put, ngOnDestroy is called <strong>just before Angular removes a component or directive from the DOM</strong>.</p><p>It’s your one final chance to:</p><ul><li>Unsubscribe from Observables</li><li>Clear intervals and timeouts</li><li>Detach event listeners</li><li>Release any external resources</li></ul><p>Think of it like <strong>turning off the lights before leaving a room</strong>. If you don’t, the energy (or memory in this case) keeps draining.</p><h3>🔑 Quick Example</h3><p>Here’s how most of us use it:</p><pre>export class DashboardComponent implements OnDestroy {<br>  private subscription: Subscription;<br>  private timer: any;<br><br>  constructor(private dataService: DataService) {<br>    this.subscription = this.dataService.getData().subscribe();<br>    this.timer = setInterval(() =&gt; console.log(&#39;Tick...&#39;), 1000);<br>  }<br><br>  ngOnDestroy() {<br>    this.subscription.unsubscribe();<br>    clearInterval(this.timer);<br>    console.log(&#39;Component destroyed &amp; resources cleaned up!&#39;);<br>  }<br>}</pre><p>Without ngOnDestroy, both the subscription and timer would keep running — <strong>even after the component is gone</strong>. That’s wasted memory.</p><h3>🚀 Pro Tips to Avoid Leaks</h3><p>✅ Always unsubscribe in ngOnDestroy.<br> ✅ Use takeUntil with a Subject for multiple streams.<br> ✅ Or better yet, use the AsyncPipe in templates — Angular will handle cleanup for you.</p><h3>🔥 Why This Matters</h3><p>I once debugged an Angular app that kept crashing after a few hours. Guess what? None of the developers had bothered with ngOnDestroy. Subscriptions were piling up like unpaid bills.</p><p>After fixing the cleanup, performance improved <strong>dramatically</strong>.</p><h3>🎯 Final Thought</h3><p>Angular is powerful, but with great power comes great responsibility.<br> Don’t just build — <strong>clean up after yourself.</strong></p><p>So next time you write a component, ask yourself:<br> 👉 “Am I turning off the lights when I leave the room?”</p><p>💬 Have you ever faced a memory leak in Angular because of a missing ngOnDestroy? Share your experience below — your story might save someone else’s app!</p><p>#Angular #WebDevelopment #Frontend #JavaScript #CleanCode</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2befa76a80d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Constructor vs ngOnInit in Angular: The Confusion Finally Solved ]]></title>
            <link>https://dadukhan.medium.com/constructor-vs-ngoninit-in-angular-the-confusion-finally-solved-d9497307832f?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9497307832f</guid>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Sat, 06 Sep 2025 04:42:57 GMT</pubDate>
            <atom:updated>2025-09-06T04:42:57.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ulc4qY_KF2xZNC6jsR4j6Q.png" /></figure><p>If you’re new to Angular, you’ve probably asked yourself this question at least once:</p><p>👉 <em>“Should I put my logic in the constructor or in ngOnInit?”</em></p><p>Trust me — every Angular developer has been there. Let’s break it down in the simplest possible way so you never get confused again.</p><h3>🔹 Constructor: Setting the Stage</h3><p>The <strong>constructor</strong> is called when your component is created.</p><ul><li>Perfect for <strong>dependency injection</strong> (services, router, etc.).</li><li>Runs <em>before</em> Angular initializes bindings.</li><li>❌ Not the right place for heavy logic or API calls.</li></ul><p>Think of it like <strong>building the stage</strong> before the show starts.</p><pre>constructor(private userService: UserService) {<br>  console.log(&quot;Constructor called - service injected&quot;);<br>}</pre><h3>🔹 ngOnInit: The Real Action</h3><p>The <strong>ngOnInit()</strong> lifecycle hook runs <em>after</em> Angular has finished setting up the component.</p><ul><li>Best place for <strong>API calls</strong>, data fetching, or any startup logic.</li><li>Runs only <strong>once</strong> after component creation.</li></ul><p>This is like saying: <strong>“The stage is ready, now start the performance!”</strong></p><pre>ngOnInit() {<br>  this.userService.getUsers().subscribe(data =&gt; {<br>    console.log(&quot;Data loaded:&quot;, data);<br>  });<br>}</pre><h3>✅ Rule of Thumb</h3><ul><li><strong>Constructor = Setup tools</strong> (get everything ready).</li><li><strong>ngOnInit = Start the work</strong> (execute your logic).</li></ul><h3>🏠 Simple Analogy</h3><p>Imagine you’re moving into a new house:</p><ul><li><strong>Constructor:</strong> Hiring movers, bringing furniture (setup).</li><li><strong>ngOnInit:</strong> Actually arranging furniture and living in the house (execution).</li></ul><p>Without setup, execution fails. Without execution, setup is useless.</p><h3>🔥 Final Takeaway</h3><p>Use constructor for <strong>wiring things up</strong>.<br> Use ngOnInit for <strong>starting things up</strong>.</p><p>Once you understand this simple mental model, you’ll never misuse it again.</p><p>📌 If you found this useful, share it with your fellow Angular devs. Let’s save them from this common confusion, too! 💯</p><p>#Angular #WebDevelopment #Frontend #Programming</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9497307832f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A computed() function in Angular]]></title>
            <link>https://dadukhan.medium.com/a-computed-function-in-angular-dd7aa9ee7945?source=rss-7aa9b2716cc6------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7aa9ee7945</guid>
            <category><![CDATA[computed-signals]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[signals-in-angular]]></category>
            <dc:creator><![CDATA[Dadu Khan]]></dc:creator>
            <pubDate>Sun, 31 Aug 2025 09:19:17 GMT</pubDate>
            <atom:updated>2025-08-31T09:19:17.550Z</atom:updated>
            <content:encoded><![CDATA[<p>💡 Angular Tip of the Day</p><p>Did you know❓<br> A computed() function in Angular will only re-run when a signal used inside it changes.</p><p>👉 This means:<br>No wasted recalculations 🚀<br>Auto-tracking of dependencies ⚡<br>Cleaner, reactive code 🧩</p><p>Example:</p><h4>const count = signal(0);<br>const double = computed(() =&gt; count() * 2);</h4><p>Here, double will only re-execute when the count changes. Nothing else triggers it.</p><p>This is one of the core powers of Angular Signals — precision reactivity with zero extra effort.<br><a href="https://www.linkedin.com/search/results/all/?keywords=%23angular&amp;origin=HASH_TAG_FROM_FEED">#Angular</a> <a href="https://www.linkedin.com/search/results/all/?keywords=%23webdevelopment&amp;origin=HASH_TAG_FROM_FEED">#WebDevelopment</a> <a href="https://www.linkedin.com/search/results/all/?keywords=%23signals&amp;origin=HASH_TAG_FROM_FEED">#Signals</a> <a href="https://www.linkedin.com/search/results/all/?keywords=%23codingtips&amp;origin=HASH_TAG_FROM_FEED">#CodingTips</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7aa9ee7945" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>