<?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"><channel><title><![CDATA[Network Devices Explained Simply]]></title><description><![CDATA[Network Devices Explained Simply]]></description><link>https://network-devices-explained-simply.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 21 Oct 2026 09:27:40 GMT</lastBuildDate><atom:link href="https://network-devices-explained-simply.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[JavaScript Map & Set: Modern Data Structures Explained ╰(*°▽°*)╯]]></title><description><![CDATA[In your first few months of learning JavaScript, you rely on two trusty tools for storing data: the Array [] and the Object {}. They are the duct tape and…]]></description><link>https://network-devices-explained-simply.hashnode.dev/javascript-map-set-modern-data-structures-explained</link><guid isPermaLink="true">https://network-devices-explained-simply.hashnode.dev/javascript-map-set-modern-data-structures-explained</guid><dc:creator><![CDATA[Mayur Mirgale]]></dc:creator><pubDate>Thu, 26 Mar 2026 10:56:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/696bb4a1fcda21f7c9bafbe5/a2bdccab-c55a-40ea-bf41-003437e63565.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In your first few months of learning JavaScript, you rely on two trusty tools for storing data: the Array <code>[]</code> and the Object <code>{}</code>. They are the duct tape and WD-40 of web development.</p>
<p>But as you transition into building professional, scaleable applications, you’ll start hitting their limitations.</p>
<p>Early in my career, I was building a feature to track which DOM elements a user had clicked on to generate an analytics heat map. I tried to use a standard Object, using the HTML elements themselves as the "keys." It failed miserably. Every element I added just overwrote the previous one because JavaScript was converting all my HTML nodes into the exact same string: <code>"[object Object]"</code>.</p>
<p>If I had known about <strong>Maps</strong> and <strong>Sets</strong>, I would have saved myself two days of debugging.</p>
<p>It’s time to upgrade your toolkit. Let’s look at the modern, specialized data structures introduced in ES6, and exactly when you should use them over traditional Arrays and Objects.</p>
<h2>1. The <code>Set</code>: The Uniqueness Enforcer</h2>
<h3>The Problem with Arrays</h3>
<p>Arrays are fantastic for ordered lists. But what happens when you need to ensure every item in that list is completely unique?</p>
<p>Imagine you are building an e-commerce filter, and you are extracting "categories" from a list of 1,000 products. If you use an Array, you'll end up with 400 "Electronics" tags and 600 "Clothing" tags. Historically, filtering out those duplicates required writing clunky loops or <code>.reduce()</code> functions.</p>
<h3>Enter the <code>Set</code></h3>
<p>A <strong>Set</strong> is a collection of values where <strong>each value may occur only once</strong>. It is the ultimate bouncer for your data.</p>
<p>If you try to add a duplicate value to a Set, it simply ignores it. No errors, no fuss.</p>
<p>JavaScript</p>
<pre><code class="language-javascript">// ❌ The Old Way: Complex Array Filtering
const rawTags = ["react", "node", "react", "css", "node"];
const uniqueTagsOld = rawTags.filter((item, index) =&gt; rawTags.indexOf(item) === index);

// ✅ The Senior Way: Using a Set
const uniqueTagsNew = [...new Set(rawTags)]; 
// Output: ["react", "node", "css"]
</code></pre>
<p><em>Notice how we used the Spread operator (</em><code>...</code><em>) from our previous article to instantly unpack the Set back into a standard Array!</em></p>
<h3>Difference Between Set and Array</h3>
<ul>
<li><p><strong>Duplicates:</strong> Arrays allow them; Sets strictly forbid them.</p>
</li>
<li><p><strong>Searching:</strong> Checking if an item exists in a massive Set using <code>mySet.has(value)</code> is significantly faster than searching an Array with <code>myArray.includes(value)</code>.</p>
</li>
<li><p><strong>Access:</strong> You cannot access Set items by an index number (e.g., <code>mySet[0]</code> does not work).</p>
</li>
</ul>
<p><strong>When to use a Set:</strong> Whenever you need to maintain a unique list of items (user IDs, tag names, active filters) or when you need lightning-fast "does this exist?" lookups.</p>
<h2>2. The <code>Map</code>: The Ultimate Dictionary</h2>
<h3>The Problem with Objects</h3>
<p>Objects are the default way we store key-value pairs. However, traditional Objects have a massive structural flaw: <strong>Object keys must be Strings (or Symbols).</strong> If you try to use a number, an array, or another object as a key, JavaScript will silently convert it into a string. This is exactly what caused my analytics bug years ago. Furthermore, finding the "size" of an object is annoying (<code>Object.keys(obj).length</code>), and objects don't always iterate in the exact order you created them.</p>
<h3>Enter the <code>Map</code></h3>
<p>A <strong>Map</strong> is a pure, specialized key-value data structure. Its superpower? <strong>Absolutely anything can be a key.</strong></p>
<p>You can use an entire user object as a key to store their specific session data, without mutating the original user object!</p>
<p>JavaScript</p>
<pre><code class="language-plaintext">const userJohn = { name: "John Doe", id: 101 };
const userJane = { name: "Jane Smith", id: 102 };

// 1. Create the Map
const userSessionData = new Map();

// 2. Set data: The KEY is the actual object, the VALUE is the session string
userSessionData.set(userJohn, "Session active: 45 mins");
userSessionData.set(userJane, "Session active: 12 mins");

// 3. Retrieve data using the object reference
console.log(userSessionData.get(userJohn)); 
// Output: "Session active: 45 mins"

// 4. Getting the size is built-in and instant
console.log(userSessionData.size); // Output: 2
</code></pre>
<h3>Difference Between Map and Object</h3>
<ul>
<li><p><strong>Key Types:</strong> Object keys are Strings/Symbols. Map keys can be <em>anything</em> (Arrays, Functions, Objects, DOM Elements).</p>
</li>
<li><p><strong>Size:</strong> Maps have a built-in <code>.size</code> property. Objects require manual calculation.</p>
</li>
<li><p><strong>Iteration:</strong> Maps are guaranteed to maintain the exact insertion order of their keys, making them highly predictable to loop over.</p>
</li>
<li><p><strong>Performance:</strong> Maps are highly optimized for scenarios involving frequent additions and removals of key-value pairs.</p>
</li>
</ul>
<p><strong>When to use a Map:</strong> When your keys are not strings at runtime, when you are frequently adding/removing data (like a caching system), or when you need to attach temporary metadata to an object without permanently altering that object.</p>
<hr />
<h2>The Takeaway: Choose the Right Tool</h2>
<p>Arrays and Objects are not bad. They are still the backbone of JSON and web data transfer. You will still use them for 80% of your daily tasks.</p>
<p>But engineering is about knowing exactly which tool fits the specific problem.</p>
<ul>
<li><p>Need an ordered list? Use an <strong>Array</strong>.</p>
</li>
<li><p>Need a list of strictly unique items? Use a <strong>Set</strong>.</p>
</li>
<li><p>Need a static record of data? Use an <strong>Object</strong>.</p>
</li>
<li><p>Need a dynamic, high-performance dictionary with complex keys? Use a <strong>Map</strong>.</p>
</li>
</ul>
<p>Stop forcing Arrays and Objects to do jobs they weren't designed for. Master <code>Map</code> and <code>Set</code>, and watch your data architecture become cleaner, faster, and much less prone to bugs.</p>
]]></content:encoded></item><item><title><![CDATA[Simple Explanation of Networking Devices for Beginners]]></title><description><![CDATA[Beginner's guide to networking devices, explaining modems, routers, switches, and firewalls, and how they connect and protect internet communications]]></description><link>https://network-devices-explained-simply.hashnode.dev/simple-explanation-of-networking-devices-for-beginners</link><guid isPermaLink="true">https://network-devices-explained-simply.hashnode.dev/simple-explanation-of-networking-devices-for-beginners</guid><dc:creator><![CDATA[Mayur Mirgale]]></dc:creator><pubDate>Mon, 19 Jan 2026 09:30:45 GMT</pubDate><content:encoded><![CDATA[<p>As developer we often push code to GitHub ,uses chatgpt or multiple operation on internet .we see a single internet connection support 50 device.</p>
<p>A developer works on application layer But underneath our application layer sits a complex, physical, and highly organized world of hardware is present which consists of component.</p>
<p>These component are Know as Network component. In These article we will breaks down the core network component — <strong>Modem, Router, Switch, and Firewall ,Switch vs. Hub: How Local Networks Work, Firewall, Load Balancer.</strong></p>
<p><strong>The High-Level Flow: Internet to Device:</strong> Before diving in, here is the path of data from the Internet to your laptop:</p>
<p>Internet → Modem → Router → Switch → Devices / Servers</p>
<p><strong>1. What is a Modem?</strong></p>
<p><strong>Definition</strong>: A Modem is a postal service clerk who translates letters from a foreign language into your native language.</p>
<ul>
<li><ul>
<li><p><strong>Role:</strong> The Modulator-Demodulator (Modem) connects your local network to your Internet Service Provider (ISP).</p>
<ul>
<li><p><strong>How it Works:</strong> The internet reaches your home through analog signals (via phone lines, fiber optic, or coaxial cable). Your computer uses digital (binary) language. The modem converts (demodulates) analog signals from the ISP into digital data, and also converts (modulates) digital data back into analog signals.</p>
</li>
<li><p><strong>The Key Point:</strong> It connects only <em>one</em> device (or a Router) to the internet. </p>
<pre><code class="lang-plaintext">  Computer → [Digital Data]
            ↓
        Modulation
            ↓
     Analog Signal ~~~~~~~
            ↓
       Transmission
            ↓
     Analog Signal ~~~~~~~
            ↓
       Demodulation
            ↓
  Computer → [Digital Data]
</code></pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><strong>2. What is a Router?</strong></p>
<p><strong>Definition:</strong> A router act as Traffic Police Officer at a busy intersection directing cars (packets) to their specific destinations. </p>
<ul>
<li><p><strong>Role:</strong> Connects multiple networks together (e.g., your home LAN to the internet WAN) and directs data packets.</p>
</li>
<li><p><strong>How it Works:</strong> A router takes the single IP address assigned by your ISP to your modem and shares it with multiple devices in your home/office. It maintains a <strong>routing table</strong> to determine the best path for data, ensuring your Netflix request doesn't end up on your printer.</p>
</li>
<li><p><strong>Key Features:</strong> It manages local IP addresses (DHCP) and usually includes a built-in <strong>NAT (Network Address Translation)</strong> firewall to protect internal devices. </p>
<pre><code class="lang-plaintext">  Data Packet
  [ Source IP | Destination IP | Data ]
              │
              ▼
          ┌─────────┐
          │ ROUTER  │  → Checks Destination IP
          └─────────┘
              │
       Selects Best Path
              │
              ▼
       Forwards Packet
</code></pre>
</li>
</ul>
<p><strong>3. Switch vs. Hub: How Local Networks WorkAnalogy:</strong></p>
<ul>
<li><p><strong>Hub:</strong> A megaphone. Everyone hears everything, even if it's not for them.</p>
</li>
<li><p><strong>Switch:</strong> A receptionist. She knows exactly which person needs which document and hands it directly to them.</p>
</li>
</ul>
<p><strong>Hub (Dumb Repeater)</strong></p>
<ul>
<li><p>Receives data and broadcasts it to <em>all</em> connected devices, regardless of who it is for.</p>
</li>
<li><p>Causes high traffic congestion and collisions (half-duplex).</p>
</li>
<li><p><em>Hardly used today.</em> </p>
</li>
</ul>
<p><strong>Switch (Intelligent Communicator)</strong></p>
<ul>
<li><p>Learns the <strong>MAC address</strong> of every device connected to it and sends data <em>only</em> to the intended device.</p>
</li>
<li><p>Provides dedicated bandwidth to each port (full-duplex).</p>
</li>
<li><p><em>This is the standard for local networking.</em> </p>
</li>
<li><p><strong>Key takeaway:</strong> Use a switch to connect wired devices (desktop, NAS) together in a LAN.</p>
</li>
</ul>
<p><strong>4. What is a Firewall? The Security</strong></p>
<p><strong>Definition:</strong> A security guard at a gated community inspecting IDs and allowing only authorized guests in. </p>
<ul>
<li><p><strong>Role:</strong> Monitors and controls incoming/outgoing network traffic based on security rules.</p>
</li>
<li><p><strong>Why it Matters:</strong> Without a firewall, any server or computer is exposed to the entire internet, making it easy for hackers, bots, and malware to gain unauthorized access.</p>
</li>
<li><p><strong>Placement:</strong> Usually resides at the edge of the network (between the Modem and Router) or is integrated into the router itself. </p>
<pre><code class="lang-plaintext">  Data Packet
  [ Source IP | Destination IP | Port | Protocol ]
                       │
                       ▼
                  ┌────────┐
                  │Firewall│
                  └────────┘
            ┌──────────┴──────────┐
        Allowed (✔)           Blocked (✖)
          │                         │
          ▼                         ✘
     Internal Network          Dropped
</code></pre>
</li>
</ul>
<p><strong>5.What is a ? The Traffic Splitter</strong></p>
<p><strong>Definition:</strong> A receptionist in a busy restaurant managing a long line of customers, directing them to the next available table (server). </p>
<ul>
<li><p><strong>Role:</strong> Distributes incoming network traffic across multiple servers to ensure high availability and reliability.</p>
</li>
<li><p><strong>Why Scalable Systems Need It:</strong> Without it, a single server would be overwhelmed by high traffic, leading to downtime. Load balancers ensure no single server bears too much load.</p>
</li>
<li><p><strong>Types:</strong></p>
<ul>
<li><p><strong>Layer 4 (Transport):</strong> Based on IP address and port (TCP/UDP).</p>
</li>
<li><p><strong>Layer 7 (Application):</strong> Based on HTTP content (URL, cookies, headers). </p>
<pre><code class="lang-plaintext">  Client Request
        │
        ▼
   ┌──────────────┐
   │ Load Balancer│ → Chooses least busy / next server
   └──────────────┘
        │
        ▼
   Server Response → Back to Client
</code></pre>
</li>
</ul>
</li>
</ul>
<p><strong>6. Real-World Setup: Putting It All Togethe</strong></p>
<p>devices work in a chain:</p>
<pre><code class="lang-plaintext">graph LR
    Internet((Internet)) --&gt; Modem[Modem]
    Modem --&gt; FW[Firewall]
    FW --&gt; Router[Router]
    Router --&gt; LB[Load Balancer]
    LB --&gt; Switch[Switch]
    Switch --&gt; Server1[Server A]
    Switch --&gt; Server2[Server B]
    Switch --&gt; Server3[Server C]
</code></pre>
<p><strong>The Scenario: A user requests</strong></p>
<ol>
<li><p><strong>Request:</strong> User hits the public IP (via Firewall/Load Balancer).</p>
</li>
<li><p><strong>Edge:</strong> The Router/Firewall checks if the request is safe.</p>
</li>
<li><p><strong>Distribution:</strong> The Load Balancer looks at available servers (A, B, or C).</p>
</li>
<li><p><strong>Delivery:</strong> The Switch delivers the request to Server B.</p>
</li>
<li><p><strong>Response:</strong> Server B sends data back down the same.</p>
</li>
</ol>
]]></content:encoded></item></channel></rss>