<?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 Omar A. Ahmed on Medium]]></title>
        <description><![CDATA[Stories by Omar A. Ahmed on Medium]]></description>
        <link>https://medium.com/@3marabadi?source=rss-9faad34dd9eb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YwdQrWZBlpFhTbJ5afRrmg.png</url>
            <title>Stories by Omar A. Ahmed on Medium</title>
            <link>https://medium.com/@3marabadi?source=rss-9faad34dd9eb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 10:44:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@3marabadi/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[API Design: How to Build APIs That Actually Work]]></title>
            <link>https://medium.com/@3marabadi/api-design-how-to-build-apis-that-actually-work-a757320f9b52?source=rss-9faad34dd9eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/a757320f9b52</guid>
            <category><![CDATA[rest-api-design]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Omar A. Ahmed]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 10:52:19 GMT</pubDate>
            <atom:updated>2026-10-13T10:52:19.786Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbZkPBUsYYCUusc-shvdng.jpeg" /></figure><p>Think of an API like a factory machine. A user sends a <strong>Request</strong> into the machine. The machine checks the data (<strong>Validation</strong>), processes it using clean rules (<strong>Clean Paths</strong>), checks the <strong>Database</strong>, and makes sure everything is safe (<strong>Security</strong>). Finally, it sends back a <strong>Response</strong> with a <strong>Status Code</strong> to say if it worked or failed.</p><p>Here is everything you need to know about API design.</p><h3>1. What is a RESTful API?</h3><p>An <strong>API</strong> (Application Programming Interface) is a bridge that lets two apps talk to each other. Instead of giving everyone direct access to your database, an API lets users ask for data safely.</p><p>A <strong>REST API</strong> is a simple way to build APIs. It uses normal web protocol (HTTP) and sends data using <strong>JSON</strong> format.</p><h3>2. Different Types of APIs</h3><p>Before you build with REST, here are other API types:</p><ul><li><strong>REST:</strong> Simple and popular. Uses HTTP and JSON format.</li><li><strong>SOAP:</strong> An old style that uses XML. It is hard to read, but big old companies still use it.</li><li><strong>GraphQL:</strong> Lets the client ask for the exact data it wants using one single endpoint.</li><li><strong>gRPC:</strong> Made by Google. It sends compressed binary data. It is very fast and great for microservices.</li><li><strong>WebSockets:</strong> Keeps a line open between server and client. Great for real-time live chat apps.</li></ul><h3>3. What Does JSON Data Look Like?</h3><p>REST APIs talk using <strong>JSON</strong> format. It looks like a list of key-value pairs inside curly braces:</p><p>JSON</p><pre>{<br>  &quot;name&quot;: &quot;Caleb&quot;,<br>  &quot;age&quot;: 30,<br>  &quot;active&quot;: true,<br>  &quot;tags&quot;: [&quot;backend&quot;, &quot;api&quot;]<br>}</pre><p><em>Note: In JSON, key names must always have double quotes around them.</em></p><h3>4. HTTP Verbs (The Action Buttons)</h3><p>When a request enters the API machine, it needs an action verb:</p><ul><li><strong>GET:</strong> Read data from the server.</li><li><strong>POST:</strong> Create new data.</li><li><strong>PUT:</strong> Replace an old item completely.</li><li><strong>PATCH:</strong> Change a small part of an item.</li><li><strong>DELETE:</strong> Remove data.</li></ul><h3>5. Clean Paths (Designing Your Endpoints)</h3><p>An <strong>endpoint</strong> is the URL link you send a request to. You should make your paths clear and easy to read.</p><h3>Nested Paths</h3><p>Good for simple relationships:</p><ul><li>GET /posts/123/comments — Get all comments for post 123.</li><li>POST /posts/123/comments — Add a new comment to post 123.</li><li>GET /comments/321 — Get one comment by its ID.</li></ul><h3>Query Parameters</h3><p>Good for filtering large lists using ?:</p><ul><li>GET /comments?postId=123 — Filter comments by post ID.</li></ul><h3>6. How to Pass Data Safely</h3><p>There are 3 main ways to send data to an API:</p><ul><li><strong>URL Path:</strong> To point to a single item ID (like /comments/321).</li><li><strong>Query Parameters:</strong> For sorting or pages (like ?page=2&amp;sort=asc).</li><li><strong>Request Body:</strong> For complex or secret data (like passwords or post text). <strong>Never put passwords inside the URL.</strong> Always put secret data inside the request body using JSON.</li></ul><h3>7. Status Codes (The Factory Responses)</h3><p>When the machine finishes, it gives back a number to tell you what happened:</p><ul><li><strong>200 Level (Success):</strong> Everything worked! (e.g., 200 OK or 201 Created).</li><li><strong>300 Level (Redirect):</strong> You need to look somewhere else.</li><li><strong>400 Level (Client Error):</strong> The user made a mistake (e.g., 404 Not Found or 400 Bad Request).</li><li><strong>500 Level (Server Error):</strong> The server broke.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a757320f9b52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The OSI Model Explained for Software Engineers]]></title>
            <link>https://medium.com/@3marabadi/the-osi-model-explained-for-software-engineers-bfc7a2a827fc?source=rss-9faad34dd9eb------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfc7a2a827fc</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[computer-networking]]></category>
            <dc:creator><![CDATA[Omar A. Ahmed]]></dc:creator>
            <pubDate>Tue, 28 Jul 2026 11:14:57 GMT</pubDate>
            <atom:updated>2026-07-28T11:14:57.404Z</atom:updated>
            <content:encoded><![CDATA[<p>Studying the OSI model sucks for software engineers because <strong>it was built for network hardware engineers, not programmers.</strong><br>When you pick up a textbook, it feels disconnected from the code you actually write every day.</p><ul><li><strong>It’s too theoretical:</strong> Layers 5 (Session) and 6 (Presentation) barely exist in modern software development — they’re swallowed directly into Application code or TCP connections.</li><li><strong>It’s taught backward:</strong> Memorizing electrical voltages (Layer 1) or MAC addresses (Layer 2) doesn’t help you figure out why your API is timing out or why your CORS policy is failing.</li><li><strong>It hides the code:</strong> Textbooks focus on switches and routers instead of the things backend developers actually configure — like API gateways, reverse proxies, connection pools, and Layer 4 vs. Layer 7 load balancers.</li></ul><blockquote><strong>TL;DR:</strong> <em>The OSI model feels like textbook jargon until you translate it into the actual stack your code runs on.</em></blockquote><h3>OSI Model Overview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3MTdxdwZKmqnF4EPtbvrDw.png" /></figure><h3>The 7 Layers Explained (Client → Server Flow)</h3><h3>1. Layer 7: Application Layer</h3><ul><li><strong>Data Focus:</strong> High-level protocols &amp; payloads (HTTP, HTTPS, FTP, WebSocket)</li><li><strong>What happens:</strong> This is where you write code (e.g., executing a fetch() or handling an Express/Node.js route). It constructs the raw message—such as an HTTP GET request with headers, cookies, and route details.</li></ul><h3>2. Layer 6: Presentation Layer</h3><ul><li><strong>Data Focus:</strong> Data formatting, serialization, &amp; encryption</li><li><strong>What happens:</strong> Translates in-memory language structures (like a JavaScript object) into a serializable format (JSON string / raw bytes). It also handles TLS/SSL encryption.</li><li><strong>Software Reality Check:</strong> Hussein highlights that in modern software engineering, Layer 6 rarely exists as a standalone layer — its responsibilities are almost entirely absorbed into Layer 7.</li></ul><h3>3. Layer 5: Session Layer</h3><ul><li><strong>Data Focus:</strong> Session establishment &amp; tagging</li><li><strong>What happens:</strong> Logically tracks and tags ongoing connections so data streams can be associated with specific active sessions.</li><li><strong>Software Reality Check:</strong> Like Layer 6, Layer 5 is rarely used independently today; connection management is usually pushed down to Layer 4 (TCP) or handled inside Layer 7.</li></ul><h3>4. Layer 4: Transport Layer</h3><ul><li><strong>Data Unit:</strong> <strong>Segment</strong></li><li><strong>Address Type:</strong> <strong>Port Numbers</strong> (e.g., Source Port 54321, Destination Port 80/443)</li><li><strong>What happens:</strong> Breaks large payloads into smaller segments and attaches source/destination ports so the receiving machine knows which process/application should receive the data. Protocols like TCP manage sequencing, acknowledgments, and retransmission.</li><li><strong>Devices/Tech:</strong> Layer 4 Load Balancers, Firewalls.</li></ul><h3>5. Layer 3: Network Layer</h3><ul><li><strong>Data Unit:</strong> <strong>Packet</strong></li><li><strong>Address Type:</strong> <strong>IP Addresses</strong> (Source IP &amp; Destination IP)</li><li><strong>What happens:</strong> Wraps the segment into an IP packet by adding source and destination IP addresses. It handles host-to-host routing across networks.</li><li><strong>Devices/Tech:</strong> Routers, Network Address Translation (NAT).</li></ul><h3>6. Layer 2: Data Link Layer</h3><ul><li><strong>Data Unit:</strong> <strong>Frame</strong></li><li><strong>Address Type:</strong> <strong>MAC Addresses</strong> (Media Access Control)</li><li><strong>What happens:</strong> Breaks packets into hardware-level frames and attaches local physical addresses. If a device only knows an IP address, it uses <strong>ARP (Address Resolution Protocol)</strong> to resolve the target or gateway’s MAC address.</li><li><strong>Devices/Tech:</strong> Network Switches, Network Interface Cards (NICs).</li></ul><h3>7. Layer 1: Physical Layer</h3><ul><li><strong>Data Unit:</strong> <strong>Raw Bits (1s and 0s)</strong></li><li><strong>Medium:</strong> Electrical signals, light pulses, or radio waves</li><li><strong>What happens:</strong> Converts binary frames into physical signals (voltage changes over copper Ethernet, light wavelengths through Fiber, or radio frequencies via Wi-Fi) and transmits them blindly across the medium.</li></ul><h3>Encapsulation &amp; Decapsulation</h3><p>One concept that makes the OSI model much easier to understand is <strong>encapsulation</strong>.</p><p>Instead of thinking about seven independent layers, imagine each layer <strong>wrapping</strong> the data it receives with its own metadata before passing it to the next layer.</p><p>Every layer adds something useful without modifying what came before it.</p><p>For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K6DLU5YgKCJ-zid0_2oA-g.png" /></figure><p>Each layer removes the information that its corresponding sender added until the original HTTP request reaches the backend application.</p><p>This process is called <strong>Decapsulation</strong>.</p><h3>Encapsulation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIz41ZLkAyAdTgqcEpVUNQ.png" /></figure><h3>Walking Through a Real Request</h3><p>Let’s follow a real backend request.</p><pre>fetch(&quot;https://api.mycompany.com/users&quot;)</pre><p>Here’s what actually happens.</p><h3>Layer 7</h3><p>Your browser creates an HTTP request.</p><pre>GET /users HTTP/1.1<br>Host: api.mycompany.com<br>Authorization: Bearer ...<br>Accept: application/json</pre><h3>Layer 6</h3><p>The browser serializes the request data.</p><p>If HTTPS is used, TLS encrypts the HTTP request before it leaves your machine.</p><h3>Layer 5</h3><p>If an existing HTTP Keep-Alive or HTTP/2 connection already exists, the browser associates this request with that session.</p><h3>Layer 4</h3><p>TCP creates one or more <strong>segments</strong>.</p><p>It adds:</p><ul><li>Source Port</li><li>Destination Port</li><li>Sequence Number</li><li>Acknowledgement Number</li></ul><p>Example</p><pre>Source Port: 54123<br>Destination Port: 443</pre><h3>Layer 3</h3><p>The operating system wraps the TCP segment inside an IP packet.</p><pre>Source IP:<br>192.168.1.20</pre><pre>Destination IP:<br>34.xxx.xxx.xxx</pre><p>Now routers know where the packet should travel.</p><h3>Layer 2</h3><p>Your computer doesn’t send packets directly.</p><p>It first needs the MAC address of the next hop.</p><p>If it doesn’t already know it, it broadcasts an ARP request.</p><pre>Who has 192.168.1.1?</pre><p>The router replies with its MAC address.</p><p>Now the IP packet is wrapped inside an Ethernet frame.</p><h3>Layer 1</h3><p>Finally, the frame becomes:</p><ul><li>Electrical signals</li><li>Light pulses</li><li>Radio waves</li></ul><p>The data travels across switches, routers, and eventually reaches the destination server.</p><p>The receiving server performs the reverse process (Decapsulation) until your backend framework receives the original HTTP request.</p><h3>Browser to Backend</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KkcgEJKPJh0dXESsloIw-A.png" /></figure><h3>Which Device Reads Which Layer?</h3><p>One of the easiest ways to understand networking is to know <strong>which device actually cares about which information.</strong></p><p>Notice something interesting:</p><ul><li>Your Express application never sees MAC addresses.</li><li>Your router never reads JSON.</li><li>Your switch never parses HTTP requests.</li></ul><p>Every device only processes the layer it understands.</p><h3>Who Reads What?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DsOLBMuVeoyEWipSA_3vw.png" /></figure><h3>Visualizing a Company Network</h3><p>To really understand the OSI model, imagine a small company network instead of a single laptop.</p><p>The company has:</p><ul><li>5 Employee PCs</li><li>1 Managed Switch</li><li>1 Router / Firewall</li><li>1 Windows Server (Active Directory, DNS, DHCP, File Sharing)</li><li>1 API Server</li><li>1 Administrator PC running Wireshark</li></ul><p>Now imagine Employee PC-1 opens:</p><pre>https://api.company.local/users</pre><p>The request travels through every OSI layer before reaching the API Server.</p><p>On the way:</p><ol><li>The browser creates the HTTP request.</li><li>TLS encrypts it.</li><li>TCP creates segments.</li><li>IP determines the destination.</li><li>Ethernet frames the packet.</li><li>The Switch forwards the frame.</li><li>The Router routes it if necessary.</li><li>The Server removes every header (Decapsulation).</li><li>The backend application finally receives the original HTTP request.</li></ol><p>This single example connects every OSI layer into one complete story instead of seven isolated definitions.</p><h3>Enterprise Network Lab</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eF6WIMzYSnOljA-f-X8fKA.png" /></figure><h3>Conclusion</h3><p>The OSI Model is often introduced as seven isolated definitions to memorize, but that’s not how modern software engineers experience networking.</p><p>When you click a button in a browser, execute a fetch() request, or call a REST API, every layer of the OSI Model participates in delivering that request. Your code creates an HTTP message, the operating system prepares it for transport, the network infrastructure forwards it across the Internet, and the destination server reconstructs it before your backend framework ever sees it.</p><p>Understanding the OSI Model changes the way you debug distributed systems.</p><p>Instead of asking:</p><blockquote><em>“Why is my API failing?”</em></blockquote><p>you begin asking more precise questions:</p><ul><li>Is the HTTP request malformed?</li><li>Is TLS failing?</li><li>Did the TCP connection establish successfully?</li><li>Is the destination IP reachable?</li><li>Is ARP resolving the correct MAC address?</li><li>Is there a routing or firewall issue?</li></ul><p>Each question maps directly to a layer of the network stack, making troubleshooting far more systematic.</p><p>For software engineers, the real value of the OSI Model isn’t memorization — it’s building a mental map that connects the code you write to the network that delivers it.</p><p>Once you understand that journey, debugging becomes faster, infrastructure becomes less mysterious, and concepts like reverse proxies, API gateways, load balancers, Kubernetes networking, and cloud architectures become much easier to understand because they all fit into the same layered model.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfc7a2a827fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>