<?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 Deborah Ogutu on Medium]]></title>
        <description><![CDATA[Stories by Deborah Ogutu on Medium]]></description>
        <link>https://medium.com/@ogutu333?source=rss-825ad0895b02------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BiTpiLXmqnpXA-bS</url>
            <title>Stories by Deborah Ogutu on Medium</title>
            <link>https://medium.com/@ogutu333?source=rss-825ad0895b02------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:56:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ogutu333/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[RPS: The Ultimate Showdown]]></title>
            <link>https://medium.com/@ogutu333/rps-the-ultimate-showdown-f26bcf983211?source=rss-825ad0895b02------2</link>
            <guid isPermaLink="false">https://medium.com/p/f26bcf983211</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[code-newbie]]></category>
            <category><![CDATA[codecademy]]></category>
            <dc:creator><![CDATA[Deborah Ogutu]]></dc:creator>
            <pubDate>Sat, 22 Nov 2025 16:48:36 GMT</pubDate>
            <atom:updated>2025-11-22T19:28:07.958Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnXX7waz-QJ4rcLjZXcZXg.png" /></figure><p>You’re aware of the regular Rock Paper Scissors game? Well, this ain’t it. Welcome to <strong>Rock Paper Scissors x99</strong>, where each player picks <strong>three moves</strong>, each with a <strong>strength value</strong>, and a grand total of <strong>99 points</strong> to split however you like.</p><p>Let’s dive into how I built the logic and why each piece of code matters.</p><h3>The Concept</h3><p>Each player has three moves, e.g.,</p><pre>Move 1: Rock - 30 points  <br>Move 2: Rock - 60 points  <br>Move 3: Paper - 9 points</pre><ul><li><strong>Strength for each move</strong> must be at least 1.</li><li>Moves are compared in order.</li><li>If types differ, normal RPS rules apply: Rock beats Scissors, Paper beats Rock, etc.</li><li>If types match, the move with <strong>higher strength wins</strong>.</li><li>Equal strength? It’s a <strong>tie</strong>.</li></ul><p>Win <strong>two out of three rounds</strong>, and you’re the champion.</p><h3>Step 1: Global Variables</h3><p>First, we need <strong>12 global variables</strong>: 3 types and 3 values for each player. They’ll hold the moves throughout the game.</p><pre>let playerOneMoveOneType;<br>let playerOneMoveTwoType;<br>let playerOneMoveThreeType;<br>let playerTwoMoveOneType;<br>let playerTwoMoveTwoType;<br>let playerTwoMoveThreeType;<br><br>let playerOneMoveOneValue;<br>let playerOneMoveTwoValue;<br>let playerOneMoveThreeValue;<br>let playerTwoMoveOneValue;<br>let playerTwoMoveTwoValue;<br>let playerTwoMoveThreeValue;</pre><p><strong>Why this matters:</strong><br>These 12 little soldiers are your game’s memory. Each type and value keeps track of one of the three moves per player. Without them, the game wouldn’t know if “Rock vs Scissors” is happening in Round 2.</p><h3>Step 2: Validating Player Moves</h3><p>Moves need valid strength points:</p><pre>const validTypes = [&#39;rock&#39;, &#39;paper&#39;, &#39;scissors&#39;];</pre><p>We declare the <strong>official roster of move types</strong>. Anything outside this list gets rejected. This prevents negative values, decimals, or zero from breaking the game. Each move must have at least 1 point.</p><h3>Step 3: Setting Moves With setPlayerMoves()</h3><p>The main function to assign moves:</p><pre>function setPlayerMoves(player, move1Type, move1Value, move2Type, move2Value, move3Type, move3Value) {<br>    if (<br>        !player || !move1Type || !move2Type || !move3Type ||<br>        !move1Value || !move2Value || !move3Value<br>    ) return;<br><br>    if (!validTypes.includes(move1Type) || !validTypes.includes(move2Type) || !validTypes.includes(move3Type)) return;<br>    if (move1Value &lt; 1 || move1Value &gt; 99 || move2Value &lt; 1 || move2Value &gt; 99 || move3Value &lt; 1 || move3Value &gt; 99) return;<br>    if (move1Value + move2Value + move3Value &gt; 99) return;<br><br>    if (player === &quot;Player One&quot;) {<br>        playerOneMoveOneType = move1Type; playerOneMoveOneValue = move1Value;<br>        playerOneMoveTwoType = move2Type; playerOneMoveTwoValue = move2Value;<br>        playerOneMoveThreeType = move3Type; playerOneMoveThreeValue = move3Value;<br>    } else if (player === &quot;Player Two&quot;) {<br>        playerTwoMoveOneType = move1Type; playerTwoMoveOneValue = move1Value;<br>        playerTwoMoveTwoType = move2Type; playerTwoMoveTwoValue = move2Value;<br>        playerTwoMoveThreeType = move3Type; playerTwoMoveThreeValue = move3Value;<br>    }<br>}</pre><p><strong>Why this matters:</strong><br>This function ensures that:</p><ol><li>All moves are provided.</li><li>Types are valid (rock, paper, scissors).</li><li>Values are between 1–99.</li><li>Total points ≤ 99.</li></ol><p>Only valid moves that respect types and the 99-point total can be set. Any invalid input is ignored. Only then does it actually <strong>commit the moves</strong> to the global variables. It’s the gatekeeper of fairness.</p><h3>Step 4: Round Winners With getRoundWinner()</h3><p>Each round compares moves:</p><pre>function getRoundWinner(round) {<br>    let p1type, p2type, p1value, p2value;<br><br>    if (round === 1) { p1type = playerOneMoveOneType; p2type = playerTwoMoveOneType; p1value = playerOneMoveOneValue; p2value = playerTwoMoveOneValue; }<br>    else if (round === 2) { p1type = playerOneMoveTwoType; p2type = playerTwoMoveTwoType; p1value = playerOneMoveTwoValue; p2value = playerTwoMoveTwoValue; }<br>    else if (round === 3) { p1type = playerOneMoveThreeType; p2type = playerTwoMoveThreeType; p1value = playerOneMoveThreeValue; p2value = playerTwoMoveThreeValue; }<br>    else return null;<br><br>    if (!p1type || !p2type || !p1value || !p2value) return null;<br><br>    if (p1type === p2type) {<br>        if (p1value &gt; p2value) return &quot;Player One&quot;;<br>        if (p2value &gt; p1value) return &quot;Player Two&quot;;<br>        return &quot;Tie&quot;;<br>    }<br><br>    if ((p1type === &quot;rock&quot; &amp;&amp; p2type === &quot;scissors&quot;) || (p1type === &quot;paper&quot; &amp;&amp; p2type === &quot;rock&quot;) || (p1type === &quot;scissors&quot; &amp;&amp; p2type === &quot;paper&quot;)) {<br>        return &quot;Player One&quot;;<br>    }<br><br>    return &quot;Player Two&quot;;<br>}</pre><p><strong>Why this matters:</strong></p><ul><li>Pulls the correct move and value for the given round.</li><li>If <strong>types match</strong>, compare strength.</li><li>If <strong>types differ</strong>, use standard RPS rules.</li><li>Missing or invalid moves return null.</li></ul><p>This function is the <strong>referee</strong> of your 3-round battle.</p><h3>Step 5: Overall Game Winner</h3><p>Count wins across 3 rounds:</p><pre>function getGameWinner() {<br>    if (!playerOneMoveOneType || !playerOneMoveTwoType || !playerOneMoveThreeType ||<br>        !playerTwoMoveOneType || !playerTwoMoveTwoType || !playerTwoMoveThreeType ||<br>        !playerOneMoveOneValue || !playerOneMoveTwoValue || !playerOneMoveThreeValue ||<br>        !playerTwoMoveOneValue || !playerTwoMoveTwoValue || !playerTwoMoveThreeValue) {<br>        return null;<br>    }<br><br>    let p1Wins = 0, p2Wins = 0;<br>    for (let i = 1; i &lt;= 3; i++) {<br>        let winner = getRoundWinner(i);<br>        if (winner === &quot;Player One&quot;) p1Wins++;<br>        if (winner === &quot;Player Two&quot;) p2Wins++;<br>    }<br><br>    if (p1Wins &gt; p2Wins) return &quot;Player One&quot;;<br>    if (p2Wins &gt; p1Wins) return &quot;Player Two&quot;;<br>    return &quot;Tie&quot;;<br>}</pre><p><strong>Why it matters:</strong></p><ul><li>Calls getRoundWinner() for all three rounds.</li><li>Counts wins per player.</li><li>Declares a final winner or tie.</li></ul><p>It’s the <strong>scoreboard</strong> and final judge.</p><h3>Step 6: Computer Moves</h3><p>Random moves for player two:</p><pre>function setComputerMoves() {<br>    const typeOptions = [&quot;rock&quot;, &quot;paper&quot;, &quot;scissors&quot;];<br>    playerTwoMoveOneType = typeOptions[Math.floor(Math.random() * 3)];<br>    playerTwoMoveTwoType = typeOptions[Math.floor(Math.random() * 3)];<br>    playerTwoMoveThreeType = typeOptions[Math.floor(Math.random() * 3)];<br><br>    let v1 = Math.floor(Math.random() * 97) + 1;<br>    let v2 = Math.floor(Math.random() * (98 - v1)) + 1;<br>    let v3 = 99 - v1 - v2;<br><br>    playerTwoMoveOneValue = v1;<br>    playerTwoMoveTwoValue = v2;<br>    playerTwoMoveThreeValue = v3;<br>}</pre><p><strong>Why it matters:</strong></p><ul><li>Random types keep the computer unpredictable.</li><li>Random values still total <strong>99 =&gt; </strong>fairness is maintained.</li><li>Every game is a new strategy puzzle!</li></ul><p>This makes the game dynamic. Every playthrough is different, and you never know what the computer will throw.</p><h3>Conclusion</h3><p>This fully working Rock Paper Scissors x99 game contains<strong>:</strong></p><ul><li><strong>12 global variables</strong> track moves and strength.</li><li><strong>setPlayerMoves()</strong> validates inputs.</li><li><strong>getRoundWinner()</strong> judges each round.</li><li><strong>getGameWinner()</strong> declares the champion.</li><li><strong>setComputerMoves()</strong> brings the chaos of AI strategy.</li></ul><p>This version of RPS is all about strategy and planning. Players pick moves, assign strength points, and the system calculates winners with logic that’s robust and safe.</p><h3>Flow Diagram</h3><p>This flow diagram shows exactly how your RPS x99 code works from moves → rounds → game winner.</p><pre>Player One Moves -------------------<br>(move1Type, move1Value)<br>(move2Type, move2Value)<br>(move3Type, move3Value)<br><br>Player Two Moves -------------------<br>(move1Type, move1Value)<br>(move2Type, move2Value)<br>(move3Type, move3Value)<br><br>             |<br>             v<br>       setPlayerMoves()<br>(Validates types, values, total ≤ 99)<br>             |<br>             v<br>        Move Variables<br>(playerOneMoveOneType/Value, etc.)<br>             |<br>             v<br>       getRoundWinner(round)<br>(Round 1 → compares p1Move1 vs p2Move1)<br>(Round 2 → compares p1Move2 vs p2Move2)<br>(Round 3 → compares p1Move3 vs p2Move3)<br>  - If types match → compare strength<br>  - If types differ → classic RPS rules<br>  - Missing/invalid → null<br>             |<br>             v<br>       Round Winners<br>(&quot;Player One&quot;, &quot;Player Two&quot;, &quot;Tie&quot;)<br>             |<br>             v<br>        getGameWinner()<br>(Counts wins for 3 rounds)<br>  - p1Wins &gt; p2Wins → &quot;Player One&quot;<br>  - p2Wins &gt; p1Wins → &quot;Player Two&quot;<br>  - Else → &quot;Tie&quot;<br>             |<br>             v<br>        Game Winner</pre><h3>Computer Moves</h3><pre>setComputerMoves()<br>  - Random type for each move<br>  - Random values summing to 99<br>  - Assign to playerTwoMoveXType/Value<br>             |<br>             v<br>        Player Two Moves</pre><p>These diagrams show the step-by-step flow:</p><ol><li>Players choose moves and strength.</li><li>setPlayerMoves() validates and stores them.</li><li>Each round is judged with getRoundWinner().</li><li>getGameWinner() counts wins and declares the champion.</li><li>setComputerMoves() generates AI moves.</li></ol><p>Github Repo: <a href="https://github.com/ogutu333/Cumulative-Project-Rock-Paper-Scissors-x99">https://github.com/ogutu333/Cumulative-Project-Rock-Paper-Scissors-x99</a></p><p>Linkedln: <a href="https://linkedin.com/in/deborah-ogutu-2b0282257">in/deborah-ogutu-2b0282257</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f26bcf983211" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Signing HTTP Requests: Building a Content-Type Resolver.]]></title>
            <link>https://medium.com/@ogutu333/signing-http-requests-building-a-content-type-resolver-2448a24429b8?source=rss-825ad0895b02------2</link>
            <guid isPermaLink="false">https://medium.com/p/2448a24429b8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <dc:creator><![CDATA[Deborah Ogutu]]></dc:creator>
            <pubDate>Fri, 21 Nov 2025 20:00:37 GMT</pubDate>
            <atom:updated>2025-11-22T07:39:18.224Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered what happens behind the scenes when your browser loads a web page? Here’s a hint: A LOT! One thing that quietly holds everything together is the <strong>Content-Header. </strong>It tells the browser what kind of file it’s receiving so it knows how to handle it.</p><p>But what happens when someone decides they can do it better?</p><p>Well… Welcome to <strong>Content Creators Contracting,</strong> the fictional company that hired me to fix a very real problem <strong>they created themselves.</strong></p><p>Things didn’t go as planned…</p><h3><strong>Prerequisites (from the Codecademy project brief)</strong></h3><p>Before we begin, the original Codecademy project recommends that you:</p><ul><li>Understand basic JavaScript syntax</li><li>Know how to write modular JavaScript (using <em>module.exports</em> and <em>require</em>)</li><li>Have some experience using the terminal</li><li>Be comfortable running npm install and npm run test</li><li>Be familiar with conditionals, regex basics, and string manipulation</li></ul><p>You don’t need to know anything advanced. This project <em>teaches you through the tests</em>.</p><h3>The Problem</h3><p>They probably thought it was a good idea for them to create their own custom logic. In doing so, they completely <em>mucked</em> it up. Now none of their files load correctly. HTML loads like text. Images display like broken icons. CSS doesn’t even load anymore?! See, a mess.</p><p>To their credit, they did manage to extract the file extension from a filename using:</p><pre>const extension = filename.match(/.*\.([^\.]*)$/)[1];</pre><p>What they <em>didn’t</em> implement is the part where the extension gets turned into an actual <strong>Content-Type</strong>.</p><h3><strong>Goal of the Project</strong></h3><p>Build a function:</p><pre>getContentType(filename)</pre><p>It should:</p><ul><li>Take in a filename like “<em>index.html</em>”</li><li>Return the correct Content-Type based on its extension</li><li>Work for: <em>text/html</em>, <em>text/css</em>, <em>image/jpeg</em>, <em>text/plain</em> (for everything else)</li></ul><p>All the logic above should be inside this file:</p><pre>js/request-logic.js</pre><p>Remember…</p><p>The entire project is test-driven. The testing suite tells you <em>exactly</em> what to implement and when you’ve done it right.</p><h3>Running The Tests</h3><p>In your terminal:</p><pre>npm install<br>npm run test</pre><p>The output will have some of the following details:</p><ul><li>Some tests pass (Yay! That’s great!)</li><li>Some tests fail (Womp! Womp!)</li><li>Failed tests explain <em>why</em> they failed (Which is super helpful)</li><li>Your job, if you choose to accept it, is to fix your function until all tests pass.</li></ul><p>This is essentially <strong>Test-Driven Development (TDD). </strong>Writing code <em>around</em> tests, not the other way around. It forces you to think clearly, code cleanly, and catch edge cases early.</p><h3>Implementing getContentType()</h3><p>There are many ways to implement this function. I decided to use the <strong>switch statement. </strong>It’s readable, predictable, and perfect for simple mapping tasks like this.</p><p>The Full Code:</p><pre>function getContentType(filename) {<br>  const extension = filename.match(/.*\.([^\.]*)$/)[1].toLowerCase();<br><br>  switch (extension) {<br>    case &#39;html&#39;:<br>      return &#39;text/html&#39;;<br>    case &#39;css&#39;:<br>      return &#39;text/css&#39;;<br>    case &#39;jpg&#39;:<br>    case &#39;jpeg&#39;:<br>      return &#39;image/jpeg&#39;;<br>    case &#39;png&#39;:<br>      return &#39;image/png&#39;;<br>    case &#39;txt&#39;:<br>      return &#39;text/plain&#39;;<br>    default:<br>      // Required by the test suite: unknown files → text/plain<br>      return &#39;text/plain&#39;;<br>  }<br>}<br><br>module.exports = getContentType;</pre><h3>Why I Chose The Switch Statement?</h3><ol><li>Clean and easy to read =&gt; Anyone looking at the code instantly understands what is happening.</li></ol><p>2. Groups related cases =&gt; For example, .jpg and .jpeg both correctly map to ‘image/jpeg’:</p><pre>case &#39;jpg&#39;:<br>case &#39;jpeg&#39;:<br>  return &#39;image/jpeg&#39;;</pre><p>3. Explicit control =&gt; No magic, no hidden behavior, everything is spelled out clearly.</p><p>4. Easy to extend =&gt; Need to add application/json later? Just drop in another case.</p><h3>Testing The Implementation</h3><p>Every time you think you’re done, run:</p><pre>npm run test</pre><p>The suite will tell you:</p><ul><li>Did you name the function correctly?</li><li>Does it return the right Content-Type for each file type?</li><li>Does it handle .jpg and .jpeg consistently?</li><li>Does it default correctly to ‘text/plain’?</li></ul><p>And when all tests light up green…CELEBRATE!</p><p>Woohoo! You’ve just built a tiny but essential piece of backend logic using the power of <strong>test-first engineering</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HIzQOY6QOzSg0Ez6Jcj5VA.png" /><figcaption>Visualizing how file extensions map to HTTP content types. The core logic behind fixing Content Creators Contracting’s broken request system.</figcaption></figure><p>Github Repo: <a href="https://github.com/ogutu333/Cumulative-Project-Content-Creators-Contracting">https://github.com/ogutu333/Cumulative-Project-Content-Creators-Contracting</a></p><p>Linkedln: <a href="https://linkedin.com/in/deborah-ogutu-2b0282257">in/deborah-ogutu-2b0282257</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2448a24429b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[THE MAZE PROJECT.]]></title>
            <link>https://medium.com/@ogutu333/the-maze-project-6753b429e9e4?source=rss-825ad0895b02------2</link>
            <guid isPermaLink="false">https://medium.com/p/6753b429e9e4</guid>
            <dc:creator><![CDATA[Deborah Ogutu]]></dc:creator>
            <pubDate>Wed, 15 Nov 2023 18:26:28 GMT</pubDate>
            <atom:updated>2023-11-15T18:26:28.883Z</atom:updated>
            <content:encoded><![CDATA[<p>INTRODUCTION.</p><p>In this blog post, I will discuss the trials and lessons that I endured while working on my maze game project. I will share my thoughts on what worked and the process from the initial concept to the final product. So, why this project? It’s literally just a labyrinth right? No game engines like Unity….Well, I was drawn to an old school/nostalgic type of game with no game engine.</p><p>DEVELOPMENT PROCESS.</p><p>This part was very challenging because my vision was very big, however, implementing that into code was full of setbacks. I pushed myself to learn about game development and programming in general. Through perseverance, I was able to tough it out and it was not in vain. It proved to be very rewarding. The small successes made me more determined to keep pushing through and improve the game as the days went by.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XTGuHoMPPMxeKb2lMs-sBQ.jpeg" /></figure><p>The purpose of the project was to explore and learn about Ray Casting, how it was built and how it creates a 3D perspective in a 2D map. To make all this work, I only used C and the SDL2 library. I also wanted to explore the possibilities of creating a game without a game engine. Why SDL2 library? I wanted to use a backend language that I’ve used mostly this year.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WldsAWSRRCas5_iwFDuQ5A.jpeg" /></figure><p>I used ray-casting to design the walls, leveraging LodeV’s method of calculating ray length using vectors. Textures are used by default in the maze, although they can be disabled during execution. The maps are defined in text files as 2D arrays that are interpreted when supplied as an argument to the maze program. All other integers are shown as walls except 0, which depicts free space. In addition, I rendered and added textures using C and the SDL2 library. Lastly, I implemented wall collision, which prevents camera rays from passing through the walls.</p><p>WHAT I’VE LEARNED.</p><p>Firstly, I’ve learned how to create a 3D first person game using SDL2 which means without a game engine and it was an amazing process as my first step into game development. I believe I gained a lot from this, just seeing how math and physics actually work in games was quite fascinating. In conclusion, the goal of this project was to render a well-known game to make it more interactive, and I believe that my project was able to achieve this goal. Secondly, I had to overcome a lot of challenges while working on this project. I was eager to learn new things and overcame my fear of asking for help because it indeed helped in the long run. Lastly, as much as there were some brutal nights of sweat and tears, I had to be patient with myself in order to achieve my goal. I am very proud of myself and quite excited to see what the future holds! :)</p><p>CHALLENGES.</p><p>Loading texture into the different regions of the game proved to be difficult and frustrating because I couldn’t figure it out as I was working alone on this. However, it is a skill I am eager to master. I also had a hard time dealing with global variables. As you know, most programmers avoid using them but if your code is organized you’ll have no problem. Understanding the lodev.org tutorial on ray casting was not easy. Loads of sleepless nights trying to figure it out on my own, however, after perusing the different programming languages I could have used, I landed on C.</p><p>ABOUT ME.</p><p>I am Deborah Ogutu, first year at ALX doing Software Engineering. I’m about to start specialisations in backend developing next year. I am currently based in Nairobi, Kenya. I am passionate about harnessing the power of technology to solve real world problems and touch as many lives as possible. I would love to fuse my interest with Software Engineering in the automative industry.</p><p>LINKS.</p><p>Github: <a href="https://github.com/ogutu333/The-Maze">https://github.com/ogutu333/The-Maze</a></p><p>Linkedln: <a href="https://www.linkedin.com/in/deborah-ogutu-2b0282257">linkedin.com/in/deborah-ogutu-2b0282257</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6753b429e9e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[THE WHAT, WHY AND HOW OF TYPING https://www.google.com AND PRESSING ENTER.]]></title>
            <link>https://medium.com/@ogutu333/the-what-why-and-how-of-typing-https-www-google-com-and-pressing-enter-54f9e4ee3ba5?source=rss-825ad0895b02------2</link>
            <guid isPermaLink="false">https://medium.com/p/54f9e4ee3ba5</guid>
            <dc:creator><![CDATA[Deborah Ogutu]]></dc:creator>
            <pubDate>Sun, 14 May 2023 22:20:12 GMT</pubDate>
            <atom:updated>2023-05-14T22:20:12.784Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>INTRODUCTION.</strong></p><p>Ever since the internet became available to everyone, many people have wondered exactly how we can go from the comfort of our own houses, to just about anywhere in the world with just one click. For years that has been a question, that for many, has remained a mystery. In this article, I want to take you a step further into what happens when you type any URL in your web browser and press enter.</p><p>Seen a set of four octets (8 binary bits), something like 123.45.67.89? That’s what’s referred to as an IP address, specifically version 4 (IPv4). Version 6 or IPv6 is much more complex but interesting to delve into, but that’s for another blog post. Computers communicate to each other through IPs, but as you guessed, humans aren’t good at cramming these numbers. Imagine having to know the exact IP of every site you visit.</p><p><strong>DNS REQUEST.</strong></p><p>DNS or (Domain Name System) is a naming system used to keep records of computers or services over the internet communicating to each other using the Internet Protocol. DNS simply translates domain names into IP addresses, for example, google.com would be 216.58.210.142. It’s basically a phonebook for the internet. Therefore, when a user types “<a href="https://www.google.com/">https://www.google.com</a>” in their browser, a DNS request is made and performs a DNS lookup.</p><p>The browser checks if the domain is in its cache. If not found, the browser calls a function to do the lookup which checks if the hostname can be resolved by reference in the local hosts file before trying to resolve the hostname through DNS. If it’s not cached or found in the hosts file, a request to the DNS server is made configured in the local router or the ISP’s (Internet Service Provider’s) caching DNS server.</p><p>The DNS server then follows the ARP (Address Resolution Protocol) Process to perform a lookup using the MAC address and route tables to find the target IP.</p><p>After the network library has the IP address of either our DNS server or the default gateway the DNS client establishes a socket to UDP (User Datagram Protocol) port 53 on the DNS server, using a source port above 1023. If the response size is too large, TCP (Transmission Control Protocol) will be used instead. If the local/ISP DNS server does not have it, then a recursive search is requested and that flows up the list of DNS servers until an answer is returned.</p><p>Once the browser receives the IP address of the destination server, it takes that and the given port number from the URL (443 since we are using HTTPS, the use of Secure Socket Layer as opposed to HTTP which runs on port 80 of TCP/IP) and then headers are wrapped to form packets that are forwarded by NAT (Network Address Translation) which translates private network addresses into globally unique addresses.</p><p><strong>TRANSMISSION CONTROL PROTOCOL (TCP)/ INTERNET PROTOCOL (IP).</strong></p><p>This next step step is a set of standardised rules that allow computers to communicate on a network such as the internet. In human terms, we use social protocols to know how to behave and communicate with other people. However, with technology, they have their own ways such as the telegraph using Morse code.</p><p>The server and the client agree on the particular key used and once verified, perform a handshake. No kidding! A TLS (Transport Layer Security) connection from the Client establishes a public key and private key; the Client sends a Hello message to the Server and creates a handshake, using an encrypted symmetric algorithm. A connection between the server and client is established once the client verifies the server via a certificate during the TLS handshake. A finish (FIN) message is sent by the client to the server with the agreed symmetric key. During the TLS handshake, the HTTP version is decided e.g. HTTP/1.1 and HTTP/2.0.</p><p><strong>GET REQUEST.</strong></p><p>A very common HTTP request method which is a way for you to grab data from a data source with the help of the internet.</p><p>The client sends the server a GET request and the server responds with a response code, 200 OK, in our case showing success, and the content in HTML form of <a href="http://www.google.com/">www.google.com</a>. This involves parsing the HTML and the server or web browser repeats this process for each content on the HTML page eg CSS, or image.</p><p><strong>FIREWALL.</strong></p><p>A firewall monitors incoming and outgoing traffic over a network, in essence, whatever rules are set by a particular team to define what’s or who can access particular channels, think of it as a barrier between private and public internet.</p><p><strong>LOAD BALANCER.</strong></p><p>Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers. A load balancer acts as the “traffic cop” sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance. If a single server goes down, the load balancer redirects traffic to the remaining online servers. When a new server is added to the server group, the load balancer automatically starts to send requests to it.</p><p><strong>WEB SERVER.</strong></p><p>A web server is a computer that runs websites. It’s a computer program that distributes web pages as they are requisitioned. The basic objective of the web server is to store, process and deliver web pages to the users. The main job of a web server is to display the website content. It serves static content, like simple HTML pages, images or plain text files using the HTTP or HTTPS protocols.</p><p><strong>APPLICATION SERVER.</strong></p><p>An application server works with a web server to handle requests for dynamic content, from web applications, this is what handles the business logic of an application.</p><p><strong>DATABASE.</strong></p><p>A database is an organized collection of structured information, or data, typically stored electronically in a computer system. A database is usually controlled by a database management system (DBMS). There are two types of databases; Relational and NoSQL or Non-relational which all use DBMS to create, edit, delete and maintain data. In this case, the content of what you search will be stored in a database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54f9e4ee3ba5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>