<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuel Gatwech</title>
    <description>The latest articles on DEV Community by Emmanuel Gatwech (@junubiman).</description>
    <link>https://dev.to/junubiman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F100308%2F9b8917a1-bd74-4d76-b71a-27d7ba0017a2.png</url>
      <title>DEV Community: Emmanuel Gatwech</title>
      <link>https://dev.to/junubiman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/junubiman"/>
    <language>en</language>
    <item>
      <title>Introducing: Planet Of The Bugs</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Sun, 30 Apr 2023 06:09:08 +0000</pubDate>
      <link>https://dev.to/junubiman/first-act-my-first-ai-journey-62f</link>
      <guid>https://dev.to/junubiman/first-act-my-first-ai-journey-62f</guid>
      <description>&lt;h1&gt;
  
  
  Planet Of The Bugs
&lt;/h1&gt;

&lt;p&gt;As a software developer, you might have experienced situations where your code just doesn't work as expected, and you find yourself spending hours trying to figure out why or you may find yourself falling into the trap of copying and pasting code from Stack Overflow or GitHub without fully understanding the implications it could bring. This can introduce bugs or even security vulnerabilities that can be detrimental to the project. However, with a solid understanding of debugging techniques, developers can quickly identify and fix these issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Need for Debugging Skills&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Debugging is an essential skill for any developer, but it's often overlooked in traditional programming courses and tutorials. That's where Planet of the Bugs comes in - an interactive learning platform that teaches developers to debug and troubleshoot problems. Our aim is to save developers from numerous headaches caused by bugs such as memory leaks, and dependency incompatibilities.&lt;/p&gt;

&lt;p&gt;This project and Hackathon use the &lt;code&gt;dev&lt;/code&gt; branch as the active branch. Please note that the &lt;code&gt;main&lt;/code&gt; branch is outdated and does not reflect the current status of the project.&lt;/p&gt;

&lt;p&gt;| Project Links | Contributor Profiles | Inspirations |&lt;br&gt;
| &lt;a href="https://github.com/Emmanuel-Melon/planet-of-the-bugs/tree/dev"&gt;GitHub Repository&lt;/a&gt; | &lt;a href="https://www.linkedin.com/in/emmanuel-gatwech/"&gt;Emmanuel Gatwech&lt;/a&gt; | &lt;a href="https://www.trywilco.com/"&gt;TryWilco&lt;/a&gt; |&lt;br&gt;
| &lt;a href="http://planetofthebugs.xyz/"&gt;Website&lt;/a&gt; | &lt;a href="https://www.linkedin.com/in/maiz27/"&gt;Magid Faiz&lt;/a&gt; | &lt;a href="https://codesandbox.io/"&gt;CodeSandBox&lt;/a&gt; |&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note: Please use the dev branch for running the app or viewing the latest code changes. The main branch is currently suspended, so kindly avoid it.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem 🕵🏾
&lt;/h2&gt;

&lt;p&gt;Most learning platforms only teach you how to code, but when you get a job or work on a real-life project, debugging takes a huge amount of effort, and most developers lack these skills. Many don't know how to use debuggers, how to spot code smells, or what patterns to avoid to prevent bugs from occurring. Common bugs such as auth bugs, memory leaks, and async bugs can cause significant issues and leave developers feeling frustrated and overwhelmed.&lt;/p&gt;

&lt;p&gt;Planet of the Bugs is designed to bridge this gap and provide developers with the knowledge and skills they need to write secure and robust software.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Platform 💡
&lt;/h2&gt;

&lt;p&gt;It's a unique and innovative learning platform that offers a comprehensive approach to debugging and troubleshooting. It aims to combine the power of AI-generated fake bug scenarios with real-world problem-solving opportunities. This app is designed to help developers of all levels hone their skills, improve their chances of success in the software development industry, and advance their careers.&lt;/p&gt;

&lt;p&gt;Planet of the Bugs uses AI to generate fake bug scenarios for developers to learn debugging skills and the fundamentals of writing secure and robust software. By using AI, the app can provide an endless supply of unique scenarios, allowing developers to practice and hone their skills.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inspiration
&lt;/h3&gt;

&lt;p&gt;The app was largely influenced by my own personal experiences studying computer science at University and a Bootcamp after that saw well as working remotely for the past 4 years.&lt;br&gt;&lt;br&gt;
I got my aha moment when I discovered these sites &lt;a href="https://codecrafters.io/"&gt;Codecrafters&lt;/a&gt;, &lt;a href="https://exercism.org"&gt;Exercism&lt;/a&gt;, &lt;a href="https://www.codewars.com/"&gt;Codewars&lt;/a&gt;, &lt;a href="https://www.codingame.com/home"&gt;Coding Game&lt;/a&gt;, and &lt;a href="https://frontendmasters.com/"&gt;Frontend Masters&lt;/a&gt;. I highly recommend you sign up because of how great their content is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The platform is built around these core two concepts:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Theoretical knowledge 🤔
&lt;/h3&gt;

&lt;p&gt;By providing a practical and collaborative environment for learning and practicing debugging skills, we believe that Planet of the Bugs can help developers become more confident and skilled in their craft.&lt;/p&gt;

&lt;h3&gt;
  
  
  Practical Knowledge 👩🏾🔧
&lt;/h3&gt;

&lt;p&gt;solving real-world problems from Github that will be recommended by the AI according to the user's skill and level of experience. This unique approach helps developers gain practical experience in solving complex issues that they may encounter in their daily work or when they finally get jobs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tech Stack
&lt;/h3&gt;

&lt;p&gt;The app uses Sveltekit for the front-end end GraphQL for the API, and MindsDB for the AI models. Sveltekit is a lightweight and efficient frontend framework that allows for quick and easy development, while GraphQL provides a powerful and flexible API for data manipulation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Features 🕸
&lt;/h2&gt;

&lt;p&gt;The app is packed with exciting features designed to help both companies and developers achieve their goals! With cutting-edge AI technology, we've created a unique bug scenario generator that recommends personalized debugging strategies based on user behavior. This allows developers to improve their skills and become proficient at debugging, giving them a competitive edge in the software development industry.&lt;/p&gt;

&lt;h3&gt;
  
  
  Markdown Editor 📠
&lt;/h3&gt;

&lt;p&gt;The Smart Markdown Editor in Planet of the Bugs is not just for documentation, it's also a powerful content management system (CMS) for creating course content. The editor makes it easy to create, edit, and publish content without needing to know HTML or other complex programming languages.&lt;/p&gt;

&lt;p&gt;With the Smart Markdown Editor, you can create interactive tutorials, exercises, and quizzes that engage learners and help them develop their debugging skills. The editor allows you to add images, code snippets, and other multimedia elements to your content, making it more engaging and dynamic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built-in Code Editor 💻
&lt;/h3&gt;

&lt;p&gt;Here at Planet of the Bugs, we understand the importance of having a text editor that can handle any type of code. That's why we built our editor on top of the powerful Monaco editor. With our text editor, you can write and run any type of code with ease. Whether you're working with JavaScript, Python, or any other programming language, our editor has got you covered.&lt;/p&gt;

&lt;p&gt;The benefits of our text editor go beyond just being able to handle any code. It also has features like syntax highlighting, auto-completion, and code snippets that make writing code faster and more efficient. Plus, with the ability to run your code right from the editor, you can test and debug your code in real time without having to switch between different applications.&lt;/p&gt;

&lt;p&gt;Our text editor is an essential tool for any developer, whether you're a beginner just starting out or an experienced pro. With its powerful features and ease of use, you can focus on what matters most - writing great code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-Time Collaboration (WIP)
&lt;/h3&gt;

&lt;p&gt;The platform currently supports real-time collaboration in the form of audio calls for pair programming/debugging. This feature will allow developers to work together to solve problems in real time, making the learning experience more interactive and engaging.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-Life Experience 🚀
&lt;/h3&gt;

&lt;p&gt;The platform integrates with Github, allowing developers to receive updates about issues and bugs in the areas they've trained on. AI is used to provide issue and repo recommendations, enabling developers to practice solving issues from real-world projects on GitHub.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI Integration via MindsDB 🤖
&lt;/h3&gt;

&lt;p&gt;MindsDB provides AI models for generating fake bug scenarios and recommendations based on user behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Course Creation 👨🏾🏫
&lt;/h3&gt;

&lt;p&gt;We know that AI models are not always perfect, so we created a Markdown editor to give users the option to create courses in order to practice solving bugs in the stacks they are interested in learning. There is a CMS with a markdown editor for course creation, and a text editor built on top of Monaco to run code snippets. The app also uses a third-party library to import npm packages.&lt;/p&gt;

&lt;h3&gt;
  
  
  A bounty Program 🤑
&lt;/h3&gt;

&lt;p&gt;A bounty hunting program to help companies crack bugs: We want to help companies find and fix bugs in their software. That's why we're planning to launch a bounty-hunting program that will reward developers for finding and fixing bugs in real-world projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Community Building 🥑
&lt;/h3&gt;

&lt;p&gt;In addition, experts who have encountered bugs and sticky situations in the past can create courses on the platform to teach new developers how to avoid and fix such bugs. This approach allows new developers to learn from the mistakes of experienced developers and gain valuable insights into how to write secure and robust software.&lt;/p&gt;

&lt;p&gt;The ability to create teams is another powerful feature of the platform. A tech lead could create a team and then a course to train their team on the company's stack. The code will be executed locally via a CLI, and the company's code will not be used in training any AI nor shared with the public unless explicitly allowed.&lt;/p&gt;

&lt;h4&gt;
  
  
  Leaderboards 🥇
&lt;/h4&gt;

&lt;p&gt;Who doesn't love a bit of friendly competition? With the leaderboards feature, you can see how you stack up against other developers on the platform. Show off your skills and climb the ranks to be crowned the ultimate bug-squasher. Plus, top contributors will be rewarded with some seriously cool prizes, so keep on crushing those bugs!&lt;/p&gt;

&lt;h4&gt;
  
  
  Connections 🙌🏾
&lt;/h4&gt;

&lt;p&gt;But our platform is not just about learning debugging skills. It's also about collaboration and community. Our platform encourages developers to work together to solve bugs and learn from each other's experiences. With features like team creation and personalized training, we're creating a space where developers can come together to improve their skills and build stronger teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Plans 🕺🏾
&lt;/h2&gt;

&lt;p&gt;We're excited to see the impact that our platform can have on the developer community and we look forward to continuing to improve and expand our offerings we have big plans for Planet of the Bugs!&lt;/p&gt;

&lt;p&gt;Our current goal is to continue expanding the platform and reaching as many developers as possible. We want to make sure that our app is serving the needs of the dev community in the best way possible, and I am always open to feedback and suggestions from users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are some of the features we're planning to add:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  CLI for Local Development
&lt;/h3&gt;

&lt;p&gt;While our online editor is a great place to practice debugging, we recognize that developers may want to work on real projects locally. That's why we're planning to develop a CLI that allows users to clone or work on projects locally and track their progress in a similar fashion to websites such as &lt;a href="https://codecrafters.io/"&gt;Codecrafters&lt;/a&gt;, &lt;a href="https://exercism.org"&gt;Exercism&lt;/a&gt;, &lt;a href="https://www.codewars.com/"&gt;Codewars&lt;/a&gt;, &lt;a href="https://www.codingame.com/home"&gt;Coding Game&lt;/a&gt;, and &lt;a href="https://frontendmasters.com/"&gt;Frontend Masters&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sandboxed environments come with limitations, and the app aims to provide users with a more realistic development environment for practicing debugging.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Personalized training 🏋🏾
&lt;/h3&gt;

&lt;p&gt;Personalized training for teams: Finally, we recognize that different teams have different needs when it comes to training. That's why we're planning to offer personalized training for teams, tailored to their specific stacks and challenges&lt;/p&gt;

&lt;h3&gt;
  
  
  Smart Markdown Editor (Similar to Hashnode's)
&lt;/h3&gt;

&lt;p&gt;We want to make it easy for developers to create and share courses on Planet of the Bugs. That's why we're planning to add a smart markdown editor that will make it easy to format and style your content.&lt;/p&gt;

&lt;h3&gt;
  
  
  Built-in AI assistant for &lt;code&gt;Rubber-Duck Debugging&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Built-in AI assistant for Rubber-Duck Debugging: Sometimes, all you need to do is talk through a problem with someone else to find the solution. That's why we're planning to add a built-in AI assistant that will act as a rubber-duck debugger, helping you work through your problems step-by-step.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Job Board 💼
&lt;/h3&gt;

&lt;p&gt;We know that job boards are very cliche but we still decided to build one because we realized it would bring about many benefits for both, companies and developers.&lt;/p&gt;

&lt;h4&gt;
  
  
  For Organizations 🏢
&lt;/h4&gt;

&lt;p&gt;We know how frustrating it can be for companies to find the right fit for their team, especially with all the challenges of the current hiring process such as bias, false positives, bad recommendations, and other factors. That's why we want to lend a hand and help companies make data-driven hiring decisions that will benefit both them and their potential employees.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Happy Hiring!:&lt;/em&gt;&lt;/strong&gt; Hiring developers who are already familiar with your products and codebases, and who have experience with your technology. By doing so, you can save time and resources on training and ensure a seamless onboarding process. So, consider hiring developers who have contributed to your codebase before and who can hit the ground running.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;It's a Match!:&lt;/em&gt;&lt;/strong&gt; Besides being familiar and experienced with your codebases, you can trust that these individuals have a passion for your company's vision and are more likely to stay with your organization for the long haul.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;The Right Fit for Every Position:&lt;/em&gt;&lt;/strong&gt; We believe in giving everyone an equal opportunity to showcase their skills and passion. Our job board will be 100% merit-based, ensuring that all developers, regardless of their background, have a chance to find their dream job. This benefits both developers and organizations, as companies will have access to a wider pool of talented and dedicated individuals who are passionate about their products and mission.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;You Deserve the Best:&lt;/em&gt;&lt;/strong&gt; By posting job openings exclusively for our top contributors, organizations will have access to some of the best and most committed developers in the community.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  For Developers 👨🏿💻
&lt;/h4&gt;

&lt;p&gt;We understand how daunting the job search process can be for developers, especially with the current challenges such as biased hiring practices, lack of opportunities, and inadequate job recommendations. That's why we want to make the process easier and more equitable for developers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Find Your Dream Job:&lt;/em&gt;&lt;/strong&gt; Gain access to opportunities from organizations that genuinely appreciate your skills and enthusiasm. This increases your chances of securing your dream job and joining a company that aligns with your career goals. Furthermore, with a glimpse into company culture, you can be confident that it's the right fit for you!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Dedication Earns Recognition:&lt;/em&gt;&lt;/strong&gt; We understand that as a dedicated developer, you've invested countless hours in honing your skills to become the best in your field. At our platform, we recognize and reward your expertise for your hard work. By contributing to our platform and showcasing your skills, you can stand out in the competitive job market and increase your chances of landing your dream job.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Giving Is Receiving:&lt;/em&gt;&lt;/strong&gt; Showcase your skills and build a strong online presence by creating custom courses easily. But that's not all - by sharing your expertise, you can gain recognition and even earn through monetization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Make Valuable Connections:&lt;/em&gt;&lt;/strong&gt; Make genuine connections with top companies and leaders. Grow personally and professionally. Connect with like-minded professionals, gain industry insights, and find mentors who can guide you to success.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  Development Process
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;"Every Castle started at the basement" - Lupe Fiasco&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  GitHub GraphQL AP
&lt;/h3&gt;

&lt;p&gt;The GitHub GraphQL API is really easy to use and explore. Their &lt;a href="https://docs.github.com/en/graphql/overview/explorer"&gt;explorer&lt;/a&gt; is simple and intuitive, and it helped me find some great repositories that I could use to train MindsDB models.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fuz6ji1c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1682844839164/eeaf5fcd-981b-4ad9-a077-b12ac517dad7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fuz6ji1c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1682844839164/eeaf5fcd-981b-4ad9-a077-b12ac517dad7.png" alt="" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  MindsDB Integration
&lt;/h3&gt;

&lt;p&gt;I couldn't integrate the &lt;a href="https://github.com/mindsdb/mindsdb-js-sdk"&gt;mindsdb-js-sdk&lt;/a&gt; due to time constraints, but I was able to create some models and make repository recommendations using the data from the GitHub API. I plan to improve the SDK integration soon and also add a ChatGPT bot for generating bug scenarios and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Issue and repo recommendations via MindsDB&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
With MindsDB, we can give our users sweet repo and GitHub recommendations. You can check out our current explore page to see what we're working with. And don't worry, we'll be adding more AI magic and spicing up the UX/UI as we go!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L1tHzV7V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1682845327924/66bb5218-fc63-42dd-a918-e705410cec0c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L1tHzV7V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1682845327924/66bb5218-fc63-42dd-a918-e705410cec0c.png" alt="" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Future Goals: Investing in Community Growth
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Learning more about AI
&lt;/h3&gt;

&lt;p&gt;As someone who is passionate about technology, I have always been fascinated by the potential of artificial intelligence. I believe that AI has the power to revolutionize the way we live and work, and I am eager to learn more about how it works and how it can be applied to different industries. My current goal is to continue exploring the world of AI and building my knowledge and skills in this area.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary 🏾
&lt;/h2&gt;

&lt;p&gt;The Planet of the Bugs platform is designed to help developers learn and master the art of debugging and troubleshooting by using AI-generated fake bug scenarios. The app uses advanced machine learning algorithms to create endless supplies of unique scenarios, allowing developers to practice and hone their skills in a safe and secure environment.&lt;/p&gt;

&lt;p&gt;It's a unique and innovative learning platform that offers a comprehensive approach to debugging and troubleshooting. It aims to combine fake bug scenarios and real-world problem-solving opportunities via issues provided by our GitHub integration to create a comprehensive environment to help developers hone their skills and advance their careers in the tech industry.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources 📚
&lt;/h2&gt;

&lt;p&gt;Thank you so much for reading this article! You can find the app's source code on this &lt;a href="https://github.com/Emmanuel-Melon/planet-of-the-bugs"&gt;GitHub Repository&lt;/a&gt; and demo right &lt;a href="http://planetofthebugs.xyz"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Special s/o to the following platforms/ people:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://joyofcode.xyz/"&gt;Joy of Code&lt;/a&gt;: For helpful Svelte tips and tutorials.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://sveltesociety.dev/"&gt;Svelte Society&lt;/a&gt;: For the amazing collection of resources and recipes!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://hashnode.com/"&gt;Hashnode&lt;/a&gt; &amp;amp; &lt;a href="https://mindsdb.com/"&gt;MindsDB Community&lt;/a&gt;: Thanks to the awesome MindsDB team (specially Zoran &amp;amp; for this incredible hackathon and for introducing me to the powerful potential of MindsDB.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>The Planet of The Bugs, Book 1</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Sun, 26 Feb 2023 20:24:00 +0000</pubDate>
      <link>https://dev.to/junubiman/the-planet-of-the-bugs-book-1-55nm</link>
      <guid>https://dev.to/junubiman/the-planet-of-the-bugs-book-1-55nm</guid>
      <description>&lt;h1&gt;
  
  
  The Planet of The Bugs 🪐 &lt;strong&gt;- First Act&lt;/strong&gt;
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;"With great power comes great responsibility." - Uncle Ben&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the &lt;a href="https://eman.hashnode.dev/series/renderland"&gt;Renderland&lt;/a&gt; saga, we learned about Renderland's history, its new savior, and the invaders who sought to destroy it. The planet was invaded by an intelligent species of &lt;code&gt;bugs&lt;/code&gt;. They came in different shapes and sizes and wreaked havoc on the planet.&lt;/p&gt;

&lt;p&gt;This part will trace back the origin and history of those bugs and how they came into existence. We will explore multiple debugging techniques.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Origins of the Bugs &lt;strong&gt;👾&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;I was back on earth watching &lt;a href="https://www.imdb.com/title/tt0063442/"&gt;Planet of The Apes&lt;/a&gt; when my TV started peeping and glitching the screen turned blue. I tried switching it off, but suddenly got sucked into a portal and found myself in Renderland again!&lt;/p&gt;

&lt;p&gt;I was greeted by the federation's chairman, &lt;a href="https://eman.hashnode.dev/web-performance-renderlands-saga-book-2#heading-the-chairman"&gt;Dennis Ritchie&lt;/a&gt; who then started briefing me about an imminent danger. The once-defeated bugs have been regrouping and are seeking revenge!&lt;/p&gt;

&lt;p&gt;Years have passed since the battle on Renderland and the bugs have been evolving, they are more complex now, reproduce and spread at incredible speeds, and have adopted and can even hide in plain sight!&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a software bug?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;💡 How do bugs occur?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The chairman then began narrating some of the most common causes of bugs he had witnessed during his days. Things have changed and the list might be a lot bigger.&lt;/p&gt;

&lt;p&gt;Dennis explained that bugs were a natural result of the complex systems and languages used to build programs. Sometimes, the simplest mistakes, like a misplaced semicolon, could cause a catastrophic failure. Other times, bugs arose from the very design of the program, or due to miscommunication between the stakeholder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Here are some of the common reasons why bugs occur in programs:&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Human Errors
&lt;/h4&gt;

&lt;p&gt;Human errors refer to mistakes made by people during the software development process, such as incorrect data entry, incorrect interpretation of requirements, and programming mistakes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Miscommunication or no communication during initial project discussions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lack of collaboration or communication blockers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Communication or Miscommunication might result in unwanted outcomes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scope creep, team conflicts, and unrealistic deadlines.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to mitigate such errors&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Creating specification documents and agreeing on deliverables before embarking on development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thorough self-review of code before pushing and further reviews by teammates/managers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Participating in pair programming and utilizing methodologies such as QA.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface User {
    id: int;
    email: string
}

// assume we would like to add more info the user object before we send a response
const returnUserByID = async (id: User["id"]): User =&amp;gt; {
    const user = fetch(`/users/${id}`);

// this function will return `undefined` because JavaScript automatically inserts semicolons after every return statement.
    return 
    {
        ...user,
        online: false
    };
}

// this should be the right way to return a way object
    return {
        ...user,
        online: false
    };

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Syntactical and Programmaticals
&lt;/h4&gt;

&lt;p&gt;These bugs arise due to a lack of understanding of the programming language in use i.e syntactical errors or implementing the wrong types.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lack of understanding of certain/advanced programming language features.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copying code from sources such as StackOverflow or ChatGPT (what works for others might not work for you).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using deprecated features and ignoring compiler warnings.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to mitigate such errors&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Reading documentation and ensuring that you're adhering to the API protocols. Each API has a list of standard inputs, outputs, and metadata. Make sure none is violated and that the API is being used as intended.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When working on a large codebase, you could identify patterns from other parts of the system. Try asking existing team members for an explanation of these patterns, no need to re-implement the wheel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You could become proactive and suggest updating the contributing doc for your project! (This will give you extra points!)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;might arise due to issues interpreting the project requirements and relying on assumptions rather than communicating before the development.&lt;/p&gt;

&lt;h4&gt;
  
  
  Compatibility:
&lt;/h4&gt;

&lt;p&gt;Compatibility issues arise when you try running a program on an unsupported platform. For instance, this &lt;a href="https://caniuse.com/"&gt;site&lt;/a&gt; shows how many browsers support CSS Grid natively supported in each browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C2TA32Ah--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677381895654/3652a070-be6b-4d8d-8db5-31bca34c3dcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C2TA32Ah--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677381895654/3652a070-be6b-4d8d-8db5-31bca34c3dcd.png" alt="" width="800" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to avoid compatibility bugs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make sure you run your programs in a consistent/ predictable environment such as &lt;a href="https://dev.to/junubiman/understanding-docker-and-containers-2437"&gt;Docker&lt;/a&gt; or &lt;a href="https://github.com/nvm-sh/nvm"&gt;&lt;code&gt;NVM&lt;/code&gt;&lt;/a&gt; which lets you switch between Node versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Suggesting polyfills or alternatives for systems that don't support some of the required dependencies. Also using nightly releases of certain software pieces such as &lt;a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html"&gt;Nightly Rust&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Document the installation/ setup instructions in your README.md file for future reference and new contributors.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Note on software release patterns&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stable Version, Release Candidate, Beta, Alpha Release, etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  Environment Bugs
&lt;/h4&gt;

&lt;p&gt;These are often caused by hardware or software failures, such as crashes, memory errors, and network issues when working with external services.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Search Party 🥷
&lt;/h2&gt;

&lt;p&gt;We decide to form a search party that consists of the federation's top heroes. Together, we'll go out on a hunt, traditionally known as &lt;code&gt;debugging&lt;/code&gt; which is the process of identifying, analyzing, and resolving errors or bugs in computer programs. The goal of debugging is to identify the root cause of a problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Identifying Bugs 🔎
&lt;/h3&gt;

&lt;p&gt;To prove a bug exists, we need to reproduce it. This step may involve running the program multiple times to confirm the existence of the bug. It involves comparing the &lt;code&gt;current&lt;/code&gt; and &lt;code&gt;desired&lt;/code&gt; behavior of the program.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Current Behavior:&lt;/strong&gt; Modal closes before confirming user info.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Desired Behavior:&lt;/strong&gt; Modal closes after confirming user info.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bugs are affected by factors such as the &lt;code&gt;environment&lt;/code&gt; (hosted vs local), and it's hosted, there could be multiple instead of a hosted environment (&lt;code&gt;staging&lt;/code&gt;, &lt;code&gt;QA&lt;/code&gt;, and &lt;code&gt;production&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reproducing a bug involves 💡&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Replicating the same environment that bug occured i (Operating System, Version)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Producing detailed description of the steps that led to this bug i.e login, click &lt;code&gt;create&lt;/code&gt; button and fill out the new form, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you contribute to open-source projects, you'd find issue templates such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/calcom/cal.com/issues/new?assignees=&amp;amp;labels=bug&amp;amp;template=bug_report.md&amp;amp;title="&gt;New Bug Template&lt;/a&gt; from &lt;a href="https://cal.com/"&gt;Cal.com&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This &lt;a href="https://github.com/excalidraw/excalidraw/issues/6225"&gt;issue&lt;/a&gt; from &lt;a href="https://excalidraw.com/"&gt;Exalidraw&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Isolating Bugs 🔐
&lt;/h4&gt;

&lt;p&gt;After locating the bug, the next step is to isolate it. This involves understanding the conditions under which the bug occurs and identifying any relevant info.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Find out where the bug is and how much of the system it affects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Think about any recent changes that might be connected to the bug.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use debugging tools such as log files, tracing, or a debugger to pinpoint the source of the bug.Resolving Bugs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Fixing the Bug 🧹
&lt;/h4&gt;

&lt;p&gt;Once the bug has been located and isolated, the next step is to fix it. This may involve rewriting code, changing input values, or making other modifications to the software program.&lt;/p&gt;

&lt;p&gt;This could be as simple as changing a single line of code or as complex as re-engineering the entire software system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hero has also discovered that debugging is an iterative process, where they must test and refine their code until all the bugs have been resolved.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  The Bug Hunter Training 🎯 - Second Act
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times. Bruce Lee&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;In order to defeat the newly evolved bugs, our hero needs to train further and learn new skills.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Dennis_Ritchie"&gt;Dennis Ritchie&lt;/a&gt; shares programming and debugging techniques that have been practiced for centuries planet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Console Training 🎮
&lt;/h2&gt;

&lt;p&gt;This is the simplest and most commonly used debugging method. Used by beginners and experienced developers. It's a very powerful tool and this section will help equip our heroes with newer skills and techniques.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The chairman has cast a simple spell to summon all the children of this technique.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(Object.keys(console)); // outputs an array of methods
/**
['debug', 'error', 'info', 'log', 'warn', 'dir', 'dirxml', 'table', 'trace', 'group', 'groupCollapsed', 'groupEnd', 'clear', 'count', 'countReset', 'assert', 'profile', 'profileEnd', 'time', 'timeLog', 'timeEnd', 'timeStamp', 'context', 'createTask', 'memory']
*/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Some of these methods aren't built into JavaScript. For instance, the&lt;/strong&gt; &lt;code&gt;memory&lt;/code&gt; &lt;strong&gt;method is provided by Google Chrome.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Console.log
&lt;/h3&gt;

&lt;p&gt;This method is used to print out information to the console. It's the simplest and probably the first one we learn in JavaScript. It's very customizable and you could do a lot with it.&lt;/p&gt;

&lt;p&gt;You could customize it by passing CSS rules. For instance, Facebook displays a message to warn users when they open the DevTools while browsing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uXk2Cz5_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677400000691/594d600a-904d-4450-9c14-91295a7f33ac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uXk2Cz5_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677400000691/594d600a-904d-4450-9c14-91295a7f33ac.png" alt="" width="800" height="693"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("hello, world!");
// styling output
const style = 'background-color: maroon; color: white; border: 5px solid #333; font-size: 2em; padding: 0.5rem'

console.log("%cHello, World", style);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You could also pass multiple arguments and substitute strings as well!&lt;/p&gt;

&lt;h3&gt;
  
  
  Console.error
&lt;/h3&gt;

&lt;p&gt;This is used to display error messages on the console. You might wonder, why to use this method instead of the good o' &lt;code&gt;log&lt;/code&gt;? Because this method comes with additional enhancements such as an error &lt;a href="https://en.wikipedia.org/wiki/Stack_trace"&gt;Stack Trace&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The Stack Trace shows the sequence of function calls that led to the error and can be very helpful for debugging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 The stack trace may not be available in some environments, like certain versions of Internet Explorer.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { LicenseNotError } from "utils/errors";
const retrieveImages = async (userId: User["id"]): Promise&amp;lt;User&amp;gt; =&amp;gt; {
    try {
        const licencseInfo = await getLicencseInfo(userId);
        if(licencseInfo === null) {
            throw new LicenseNotError("Not Found"); // custom error
        }
    } catch (error) {
        // automatically displays a stack trace
        console.error(error);
    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's recommended to use this &lt;code&gt;level&lt;/code&gt; if you're collaborating with others or developing a library or public API. It will help other developers trace the origin of the bug.&lt;/p&gt;

&lt;h3&gt;
  
  
  Console.table
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const levels = [
{
    name: "memory",
    description: "provides memory usage info on a web page",
    arguments: ""
},
{
    name: "info",
    description: "used to display an informational messages",
},
{
    name: "warning",
    description: "used to display warninings"
},
{
    name: "error",
    description: "Used to log error messages. It allows you to include additional data such as a stack trace."
}
];

console.table(levels);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should output the following table:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wWdyNmJt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677399769997/2db337ad-5abe-423d-bc6c-619126898ced.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wWdyNmJt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677399769997/2db337ad-5abe-423d-bc6c-619126898ced.png" alt="" width="800" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Useful for displaying tabular information such as a list of users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Console.group
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const label = 'The ancinent debugging techniques are';
  console.group(label);
  console.info('Identifying Bugs');
  console.info('Isolating Bugs');
  console.info('Resolving Bugs');
  console.groupEnd(label);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bqQyllzw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677430501887/256f8f3f-9a28-4703-9781-32b2061004c0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bqQyllzw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677430501887/256f8f3f-9a28-4703-9781-32b2061004c0.png" alt="" width="800" height="693"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Console.dir
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const wrapper = document.getELementById("_next");
   console.log(wrapper)
  const label = 'The ancinent debugging techniques are';
  console.dir(label);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will output the following:&lt;/p&gt;

&lt;p&gt;Useful for displaying related information. For instance, you could use it to print out nested values or the values in an array of objects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Filtering Levels
&lt;/h3&gt;

&lt;p&gt;There are several options to filter logs such as &lt;code&gt;level&lt;/code&gt;, &lt;code&gt;source&lt;/code&gt;, text or regular expression.&lt;/p&gt;

&lt;p&gt;Popular frontend frameworks and libraries make use of these logging levels to display different types of messages. For example, React does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;console.error&lt;/code&gt; to highlight errors in code, they often include a &lt;code&gt;stack trace&lt;/code&gt; to help find issues quickly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use &lt;code&gt;warn&lt;/code&gt; to display warnings such as when you forget to include dependencies in an &lt;code&gt;useEffect&lt;/code&gt; array.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They use &lt;code&gt;source&lt;/code&gt; based filtering to show you where each console.log came from.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Console Best Practices &amp;amp; Tips
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use the appropriate logging level so you could easily filter and search for logs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clicking on the source of a log will take you to the file the log lives in.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Debugger Training 💻
&lt;/h2&gt;

&lt;p&gt;After learning the basic debugging principles and passing the console exam, the hunters now move on to the second stage of the training. In this stage, they will learn how to use a very powerful weapon known as a debugger. A debugger consists of the following:&lt;/p&gt;

&lt;h3&gt;
  
  
  Breakpoints
&lt;/h3&gt;

&lt;p&gt;A breakpoint is a signal to the debugger that tells it to pause the execution of the program at a specific point. This allows the developer to inspect the state of the program at that point and step through the code line by line to identify bugs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step-through execution:
&lt;/h3&gt;

&lt;p&gt;This feature allows the developer to step through the code one line at a time, examining the state of variables and the program as a whole as they go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Variable inspection:
&lt;/h3&gt;

&lt;p&gt;Debugging environments usually provide a way for developers to view the values of variables and data structures at any point in the program's execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Call stack inspection:
&lt;/h3&gt;

&lt;p&gt;Debuggers also allow developers to examine the call stack, which shows the sequence of function calls that led to the current point in the program's execution. This helps developers trace the flow of control and identify where bugs may be occurring.&lt;/p&gt;

&lt;h3&gt;
  
  
  Log analysis:
&lt;/h3&gt;

&lt;p&gt;Debugging environments may also provide tools for analyzing log files, which can help developers identify issues that are difficult to reproduce or diagnose.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hunter Code of Conduct
&lt;/h3&gt;

&lt;p&gt;You have now passed your basic hunter exam. Go out there and gain more skills and become the best hunter you could become!&lt;/p&gt;

&lt;p&gt;And of course, after completing the Bug Hunter training, each Hunter had to swear an oath.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Document every bug along with the necessary information to help others verify and reproduce.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Submit error/ bug reports when possible.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Bug Bounties - Third Act
&lt;/h1&gt;

&lt;p&gt;Practice is the best way to learn! You could try exploring Open Source projects for bugs. This will help you gain practical skills. There are also several bug bounty programs that you can participate in and hopefully earn some cash. Best of luck hunters!&lt;/p&gt;

&lt;h2&gt;
  
  
  Preventing Bugs
&lt;/h2&gt;

&lt;p&gt;We have explored how to identify and deal with various bugs, this section will explore prevention methods.&lt;/p&gt;

&lt;h4&gt;
  
  
  Preventing Bugs
&lt;/h4&gt;

&lt;p&gt;Preventing bugs is a crucial step in building robust software.&lt;/p&gt;

&lt;h3&gt;
  
  
  The 3 Questions Method
&lt;/h3&gt;

&lt;p&gt;I usually ask myself 3 simple questions whenever I try to solve problems at work and on personal projects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OcOyPxaP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677076205235/885ade8a-1277-466d-be37-c405c83ace9e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OcOyPxaP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1677076205235/885ade8a-1277-466d-be37-c405c83ace9e.png" alt="" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  What?
&lt;/h4&gt;

&lt;p&gt;Understanding a problem is 50% of the solution. This helps me understand the problem I am dealing with at a deeper level. This is where I'll ask questions and try to clarify everything before I attempt anything.&lt;/p&gt;

&lt;h4&gt;
  
  
  How?
&lt;/h4&gt;

&lt;p&gt;After formulating a good understanding of the problem, I'd then start exploring the possible solutions and comparing them.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why?
&lt;/h4&gt;

&lt;p&gt;Why choose approach A over approach B or C?&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The other parts of the saga will explore each concept in detail. Stay tuned!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Planet of The Bugs, The Markup Tribes (Explores HTML and CSS)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Planet of The Bugs, The Scripts Tribe&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Planet of The Bugs, The Web (Explores Networking, CORs)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Resources 📚&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.chrome.com/docs/devtools/console"&gt;Chrome Developers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Eman's Journey - Dev Retro 2022</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Thu, 22 Dec 2022 19:16:10 +0000</pubDate>
      <link>https://dev.to/junubiman/emans-journey-dev-retro-2022-ah4</link>
      <guid>https://dev.to/junubiman/emans-journey-dev-retro-2022-ah4</guid>
      <description>&lt;h2&gt;
  
  
  The Civil War
&lt;/h2&gt;

&lt;p&gt;I had a relatively privileged upbringing, attending private schools and doing well academically. In 2013, I completed high school and traveled to Juba to get a new passport and prepare my documents for university admission. This was an exciting and important time in my life as I prepared to take the next step in my education and embark on a new journey.&lt;/p&gt;

&lt;p&gt;Unfortunately, a &lt;a href="https://en.wikipedia.org/wiki/South_Sudanese_Civil_War"&gt;civil war&lt;/a&gt; broke out in my country, causing a dramatic shift in the political landscape and leaving a lasting impact to this day. Millions of people, including my family and myself, were forced to leave our homes and seek refuge in Uganda.&lt;/p&gt;

&lt;p&gt;The war led to the collapse of the economy, resulting in widespread financial losses and hardship. The war and its aftermath were difficult times for my family and many others in my country.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Computer Science?
&lt;/h2&gt;

&lt;p&gt;I was given the opportunity to study Computer Science in Zimbabwe through a scholarship. Although I was unfamiliar with the field, I had no other options and therefore accepted the offer. The scholarship presented itself as a chance for me to not only further my education, but also to create a better future for myself and my family potentially.&lt;/p&gt;

&lt;p&gt;I arrived in Harare, Zimbabwe on September 11, 2015, nearly a month after the beginning of the semester. I had no idea what computer science was and I had never heard of any programming languages.&lt;/p&gt;

&lt;p&gt;Everything the lecturer said felt like a foreign language to me and I scored 2 out of 50 on my first programming test!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://twitter.com/bucky_roberts"&gt;Bucky Roberts&lt;/a&gt; 🚀
&lt;/h3&gt;

&lt;p&gt;I came across a fellow named Bucky Roberts on YouTube, he had a channel called &lt;a href="https://www.youtube.com/@thenewboston"&gt;TheNewBoston&lt;/a&gt;, and he provided simple and entertaining explanations of programming principles. I began staying up all night watching his tutorials and eventually, my understanding of programming improved significantly. In a few weeks, I became the person that my classmates would turn to for help with programming questions.&lt;/p&gt;

&lt;p&gt;This is the &lt;a href="https://www.youtube.com/watch?v=3DeLiClDd04&amp;amp;list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq&amp;amp;index=2"&gt;video&lt;/a&gt; that made me fall in love with programming.&lt;/p&gt;

&lt;h3&gt;
  
  
  First Semester
&lt;/h3&gt;

&lt;p&gt;I enjoyed studying Operating Systems and Programming in C and found myself spending a lot of time on these two subjects. I took the exams for the first semester and passed 5 out of 7 modules, but I didn't do well in Communication Skills and Analogue Electronics.&lt;/p&gt;

&lt;p&gt;Due to financial constraints, we were unable to go back home for the holidays and had to stay on campus. It ended up being a good thing because the other students went back to their homes and the internet speeds were much faster. I took advantage of this opportunity by spending countless hours watching programming tutorials on YouTube and illegally downloading courses from &lt;a href="https://frontendmasters.com/"&gt;FrontEnd Masters&lt;/a&gt; and &lt;a href="http://Lynda.com"&gt;Lynda.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In the second semester, I became passionate about programming and ended up learning more than what was required for the course. I was always striving to improve my skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://developers.facebook.com/developercircles/"&gt;Facebook Developer Circles&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;In 2017, the Facebook Developer Circles program was launched in Harare, and I had the opportunity to attend the ceremony with some of my university colleagues. I was blown away by what I saw and experienced.&lt;/p&gt;

&lt;p&gt;It was a different feeling compared to my school days, I met developers who were creating real-world applications, which was something new to me as I was only familiar with basic hello world programs and exercises from my C Programming textbook.&lt;/p&gt;

&lt;p&gt;The meetup exposed me to concepts such as development servers, APIs, and the differences between frontend and backend development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gwJ_4cjz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671712386713/aOKDvmxMM.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gwJ_4cjz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671712386713/aOKDvmxMM.jpg" alt="" width="600" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was very inspired by &lt;a href="https://www.linkedin.com/in/achim-munene/"&gt;Achim Munene&lt;/a&gt; (Far right) and &lt;a href="https://www.linkedin.com/in/kudzai-chasinda/"&gt;Kudzai Chase&lt;/a&gt;. There was a Hackathon and Kudzai won an award for a bot he built. was the day I decided I wanted to become like them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dropping Out 🤦🏿
&lt;/h2&gt;

&lt;p&gt;In 2017, I experienced several challenges and made a series of wrong decisions during my second year of university that ultimately led to the loss of my scholarship. These challenges included alcohol dependency, undiagnosed ADHD, depression related to past experiences with war and trauma, and an intense focus on programming that caused me to neglect other courses. As a result, it became difficult for me to maintain my scholarship and continue my studies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yQ5gtguW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671711724468/SAjgQ1015.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yQ5gtguW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671711724468/SAjgQ1015.png" alt="" width="800" height="671"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I used this laptop to learn programming and borrowed the screen from a friend in the Electronics Engineering department who used it for experiments.&lt;/p&gt;




&lt;h2&gt;
  
  
  Back to Uganda 🇺🇬
&lt;/h2&gt;

&lt;p&gt;In 2019, I returned to Uganda after a difficult period of time in university. I knew that it was unlikely that I would receive another scholarship, and my family was unable to provide financial support. However, my older brother was able to send me $400, which I used to purchase a used Lenovo laptop. This allowed me to start coding again after a 2-year break, during which I had forgotten much of what I had learned. It was a challenging time, but I was determined to keep working towards my goals and was eventually able to pick up where I left off and continue learning and growing as a programmer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Overcoming my challenges
&lt;/h3&gt;

&lt;p&gt;To experience personal growth, I realized that I needed to make sacrifices and put in extra effort to improve myself.&lt;br&gt;&lt;br&gt;
After returning to Uganda and committing to making changes in my life, I took the following actions to work towards becoming the best version of myself:&lt;/p&gt;

&lt;h4&gt;
  
  
  Talking to Professionals
&lt;/h4&gt;

&lt;p&gt;In order to better understand and address my situation, I sought out the advice of medical professionals and found their guidance to be extremely valuable.&lt;/p&gt;

&lt;h4&gt;
  
  
  Cutting Off bad habits
&lt;/h4&gt;

&lt;p&gt;In 2019, I made the decision to stop consuming alcohol and staying up late. To better manage my time and career, I used Trello boards to organize my plans and set specific goals for myself, including learning certain skills. By making these changes, I was able to better focus on my goals and make progress toward achieving them.&lt;/p&gt;

&lt;h4&gt;
  
  
  Imposter Syndrome
&lt;/h4&gt;

&lt;p&gt;I spent a lot of time watching tutorials and felt like I was making a lot of progress. I was able to follow along with the instructors and solve any code challenges they presented, but I struggled to build anything on my own. Despite being able to grasp concepts quickly, I found it challenging to apply what I had learned to my projects. As a result, my GitHub profile remained largely empty until this point. It was frustrating to be able to understand the material but struggle to put it into practice.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;a href="https://hashnode.com/post/brian-holt-is-hosting-an-ama-on-hashnode-cjpwgbfbj00p42ns295vb4xo9"&gt;Brian Holt is Hosting an AMA on Hashnode!!&lt;/a&gt;
&lt;/h5&gt;

&lt;p&gt;I knew Brian Holt from &lt;a href="https://frontendmasters.com/"&gt;Frontend Masters&lt;/a&gt; and I owe him a debt of gratitude for teaching me React and also encouraging me to break out of the tutorial hell and overcome my imposter syndrome.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sVGaly14--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671706664693/a8Iss18tJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sVGaly14--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671706664693/a8Iss18tJ.png" alt="" width="800" height="754"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It is said that an image is worth a thousand words.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The green dots in the image represent countless hours of hard work and effort. I was determined to make the most of my circumstances and work towards my goals. I was willing to put in the time and effort needed to achieve success, even when the path ahead was uncertain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ipgHdWls--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671714102584/aMKZcS_Fe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ipgHdWls--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1671714102584/aMKZcS_Fe.png" alt="" width="800" height="1422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A Second Chance 🙌🏿
&lt;/h2&gt;

&lt;p&gt;Thanks to my participation in the Facebook Developer Circles program, I was awarded a scholarship to pursue a diploma in web development. This opportunity allowed me to learn and grow in my field, and it significantly impacted my career by helping me reach the next level of professional development. I am grateful for this opportunity and the knowledge and experience it provided.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://openclassrooms.com/"&gt;OpenClassrooms&lt;/a&gt; 🎓
&lt;/h3&gt;

&lt;h5&gt;
  
  
  I received a diploma in front-end development from OpenClassrooms, a leading online learning platform in Europe. The program is designed to provide students with hands-on, project-based learning experiences that teach relevant and in-demand skills. To earn the accredited diploma, which is recognized at level 6 of the European Qualifications Framework (EQF), students are required to complete nine real-world projects that cover a range of topics including database modeling, software design, interface design, and API development.
&lt;/h5&gt;

&lt;p&gt;Completing the diploma program gave me a huge boost in confidence, and I began to contribute to open-source projects and volunteer in local developer communities. I would either facilitate programming workshops or act as a coach for complete beginners looking to learn how to code. These experiences allowed me to share my skills and knowledge with others, while also continuing to learn and grow as a developer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;During my studies at OpenClassrooms, I worked on the following projects.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Emmanuel-Melon/la-revue"&gt;La Revue&lt;/a&gt; (React.js, Google Maps APIs, Express.js).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Emmanuel-Melon/shadows_of_mordor"&gt;Shadows of Mordor&lt;/a&gt; (jQuery, HTML5, CSS).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Emmanuel-Melon/Quote-Generator"&gt;Quote Generator&lt;/a&gt; (HTML, JavaScript, Sass).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Emmanuel-Melon/Express-Food"&gt;Express Food&lt;/a&gt; (MySQL, PHPMyAdmin).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also had the pleasure of becoming friends with some amazing individuals such as &lt;a href="https://www.linkedin.com/in/mahfoudh-arous/"&gt;Mahfoudth Arous&lt;/a&gt;, Yahya, &lt;a href="https://www.linkedin.com/in/saudonna/"&gt;Donna&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/chiamaka-osuji/"&gt;Chaimaka Osuji&lt;/a&gt;, who wrote a very kind message to me earlier this year.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.outreachy.org/"&gt;Outreachy&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;I later learned about Outreachy, an online internship program that offers opportunities to work on open-source projects. If you're just starting in programming, I highly recommend applying for this program.&lt;/p&gt;

&lt;p&gt;I applied and chose a project called "Mozilla's Tokenserver - From Python to Rust" to work on. At the time, I was learning Rust and thought this would be a great opportunity to put my skills to the test. By the end of the contribution period, I had submitted a total of seven pull requests. I vividly still remember these two.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/mozilla-services/syncstorage-rs/pull/530"&gt;fix remove truncating tasks in mysql/db code&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/mozilla-services/syncstorage-rs/pull/562"&gt;Convert misc actix-web frontend calls to async await&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  My First Job 🚀
&lt;/h3&gt;

&lt;p&gt;In June 2020, I was able to secure my first job thanks to my contributions to open-source projects and involvement in the local developer community. The job involved working on a project called &lt;a href="https://medx.international/labxpert"&gt;LabXpert&lt;/a&gt;, a comprehensive laboratory information system designed to streamline and improve the medical testing process from sample collection to the release of results. This was a great opportunity for me to apply my skills and knowledge to a real-world project, and I was excited to be able to make a positive impact on the quality and efficiency of the testing process.&lt;/p&gt;

&lt;h4&gt;
  
  
  Summary 🏾
&lt;/h4&gt;

&lt;p&gt;The project I was working on was very dynamic, requiring me to constantly adapt to changes. I learned that it is often more effective to abandon initial, complex plans that may include unnecessary or flashy elements and instead focus on quickly delivering the product and getting feedback from users.&lt;/p&gt;

&lt;h4&gt;
  
  
  Things I have learned 👨🏿💻
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Becoming familiar with development practices such as containerization, multi-environment deployments, and working with CI/CD pipelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Examining the pros and cons of using existing infrastructure versus creating custom solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Determining which features are most important and focusing on delivering value to users.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Skills Gained 💪🏾
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;MongoDB (Aggregation Framework, Advanced Data Modelling).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Redis, Messaging Queue, Event Sourcing, and Event-Driven Architecture.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker, Portainer, Gitlab CI/CD, Traefik, and Firewalls.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TypeScript, Redux, Progressive Web Apps, and Web Workers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://www.gitstart.com/"&gt;GitStart&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;After working on LabXpert for 10 months, I was offered a new role with a remote startup in the USA that offered a higher salary than my previous job. This allowed me to better support my family financially.&lt;/p&gt;

&lt;p&gt;In this new position, I worked on large-scale commercial and open-source projects with distributed remote teams. It was a great opportunity for me to continue developing my skills and experience in the field.&lt;/p&gt;

&lt;h4&gt;
  
  
  Summary 🏾
&lt;/h4&gt;

&lt;p&gt;Working at GitStart has taught me the importance of being proactive in ensuring that projects are completed efficiently and effectively, as well as the importance of putting the team's goals ahead of my own. This includes taking the initiative to address any issues or challenges that may arise, setting up regular check-ins and updates, and seeking out resources or support when needed. I have also learned how to delegate responsibilities when necessary, and how to step up when my team lead is absent. Overall, my time at GitStart has allowed me to develop valuable skills related to teamwork and project management.&lt;/p&gt;

&lt;h4&gt;
  
  
  Things I have learned 👨🏿💻
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Gaining experience with Mongorepos and Microservices, as well as learning how to properly structure projects.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conducting self-reviews of my code and documenting discussions in Pull Requests or public channels, rather than private direct messages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Exploring the inner workings of popular open-source projects such as React.js and &lt;a href="https://cal.com/"&gt;Calcom&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Developing technical writing skills, giving tech talks, and working together as a team to grow and improve.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Skills Gained 💪🏾
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GraphQL (Apollo and Relay).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced SQL (PostgreSQL), Prisma, and Hasura.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced TypeScript, Abstract Syntax Trees, and Compilers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;i18n, State Machines, and more about state management in web applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hashnode
&lt;/h3&gt;

&lt;p&gt;I have participated in three hackathons from Hashnode this year, and I have emerged as a winner in two of them.&lt;/p&gt;

&lt;p&gt;Although I was not successful in my last hackathon attempt, it inspired me to keep working on my app and turn it into a full startup. I have joined forces with a poet from Rwanda and a UX/UI designer from Germany, and together we are building a company called Inspirers.&lt;/p&gt;

&lt;h4&gt;
  
  
  Inspirers 🚀
&lt;/h4&gt;

&lt;p&gt;Inspirers is an app that connects you with experts who have achieved success in various fields and can provide guidance and inspiration. Through the app, you can learn about their stories, methods, and tools and see how they were able to achieve their goals. You can then adopt elements that fit your personality and add your creative twist to them as you work towards your own goals.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ways to increase productivity
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To effectively manage my time, I maintain a calendar and schedule blocks of time for meetings, writing, and coding. I use tools such as Google Calendar and &lt;a href="http://calendly.com/"&gt;Calendly&lt;/a&gt; to assist with this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Listening to Lofi music and using the Pomodoro technique has been extremely beneficial for me. I use an app called &lt;a href="https://llamalife.co/"&gt;Llama Life&lt;/a&gt; for this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using an external monitor and being able to efficiently manage multiple apps and windows has greatly improved my productivity. I use an app called &lt;a href="http://rectangleapp.com"&gt;Rectangle&lt;/a&gt; to help me with this task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To streamline my workflow, I use two different web browsers (Firefox and Google Chrome) simultaneously. I have installed the extensions &lt;a href="https://www.gettoby.com/"&gt;Toby&lt;/a&gt; and &lt;a href="https://daily.dev/"&gt;dailydev&lt;/a&gt; in one of the browsers, with Firefox being used for documentation and quick reference, and Chrome for my daily tasks. Toby allows me to save my tabs for later, and dailydev provides me with a curated feed of articles related to my interests.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2022 Wins 🎉
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Winning two Hashnode Hackathons.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Earning from technical writing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Traveling for my first international conference.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upgrading my home office.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2023 and beyond 🙌🏿
&lt;/h3&gt;

&lt;p&gt;I have been offered a job as a Frontend Engineer at a software company in Manchester, UK and I will begin working there in January.&lt;/p&gt;

&lt;p&gt;My other 2023 goals include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Returning to college (again 😂).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Launching my Startup (Inspirers).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Relocating to [Redacted].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Repaying the kindness and support that I received early in my career by mentoring other developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More office upgrades!!!!!!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I appreciate you taking the time to read my article. I hope you had a happy and successful year .&lt;/p&gt;

&lt;p&gt;I'm available on the following platforms if you'd like to connect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.linkedin.com/in/emmanuel-gatwech/"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/emmanuel-melon"&gt;GitHub&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://twitter.com/junubiman"&gt;Twitter&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I want to express my gratitude to &lt;a href="https://www.linkedin.com/in/tashamcghie/"&gt;Tasha&lt;/a&gt;, my mentor, who inspired me to start writing.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Docker and Containers</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Tue, 18 Oct 2022 13:32:27 +0000</pubDate>
      <link>https://dev.to/junubiman/understanding-docker-and-containers-2437</link>
      <guid>https://dev.to/junubiman/understanding-docker-and-containers-2437</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Docker is a handy tool for managing application deployments. It's increasingly popular in organizations that need to deploy applications efficiently and securely in the cloud. If you're new to Docker, fear not this post will help you gain a practical understanding of its most commonly used features. There are many decisions to be made when using it, so this article will also serve as a guide on avoiding common mistakes and using Git more efficiently. Let's get started!&lt;/p&gt;

&lt;p&gt;Docker provides an open-source platform for managing application deployments. It's a useful tool for enterprise IT organizations that want to deploy applications efficiently and securely in the cloud.&lt;/p&gt;

&lt;p&gt;If you are new to Docker, it can feel like a daunting task: figuring out where to start, which concepts are essential, and how they all fit together. This article will help you gain a practical understanding of Docker's most commonly used features. A solid grasp of these concepts will help you avoid common mistakes and use Docker more efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Containerization
&lt;/h2&gt;

&lt;p&gt;Containerization is the process of packaging an application and its dependencies (such as system libraries, config files, etc.) into a single unit known as a &lt;code&gt;container.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The main benefit of containerizing your applications is that you can run them anywhere (on a server, laptop, etc.), regardless of the underlying operating system.&lt;/p&gt;

&lt;p&gt;A container is a small independent program that runs in its own environment. Containers are lightweight and easy to create, modify and run. With containers, you can move applications between environments with greater speed and flexibility than traditional virtual machines allow.&lt;/p&gt;

&lt;p&gt;The other benefit of containerizing your applications is that they allow you to build them quickly without worrying about configuring the operating system. Docker and containerization are two ways of providing isolated environments for your applications. The main benefit of containerizing your applications is that developers can run them anywhere (on a server, laptop, etc.), regardless of their underlying operating system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Containers
&lt;/h2&gt;

&lt;p&gt;A container is a small independent program that runs in its environment. Containers are lightweight and easy to create, modify and run. With containers, you can move applications between environments more quickly and flexibly than traditional virtual machines allow.&lt;/p&gt;

&lt;p&gt;Containers are self-contained environments. They can be considered an operating system in their own right, or a sandbox separate from the host operating system. Containers have their filesystem, processes and network interfaces, and they can run on any machine with access to a Docker container's filesystem.&lt;/p&gt;

&lt;p&gt;Containers are nothing more than a combination of a few Linux kernel features at their core.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Containers?
&lt;/h3&gt;

&lt;p&gt;Containers are a great way to package and deploy your software. In this blog post, I'll discuss the merits of containers for deployment and best practices for using them on a modern Linux infrastructure.&lt;/p&gt;

&lt;p&gt;Okay, so now at least you have a pool of servers responding to web traffic. Now you just to worry about keeping the operating system up to date. Oh, and all the drivers connecting to the hardware. And all the software running on the server. And replacing the components of your server as new ones come out. Or maybe the whole server. And fixing failed components. And network issues. And running cables. And your power bill. And who has physical access to your server room. And the actual temperature of the data center. And paying a ridiculous Internet bill. You get the point. Managing your own servers is hard and requires a whole team to do it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Isolation
&lt;/h3&gt;

&lt;p&gt;I've heard people call this "cha-root" and "change root". I'm going to stick to "change root" because I feel less ridiculous saying that. It's a Linux command that allows you to set the root directory of a new process. In our container use case, we just set the root directory where the new container's new root directory should be. And now the new container group of processes can't see anything outside of it, eliminating our security problem because the new process has no visibility outside of its new root.&lt;/p&gt;

&lt;h3&gt;
  
  
  Portability
&lt;/h3&gt;

&lt;p&gt;Suppose you're migrating an application from one environment to another or need to run multiple versions of the same app side by side on different servers. In that case, using containers makes sense because you can efficiently run these apps inside other containers without requiring code changes or worrying about configuring the environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;Let's say you're running a big server that's in your home and you're selling space to other people (that you don't know) to run their code on your server. What sort of concerns would you have? Let's say you have Alice and Bob who are running e-commerce services dealing with lots of money. They themselves are good citizens of the servers and minding their own business. But then you have Eve join the server who has other intentions: she wants to steal money, source code, and whatever else she can get her hands on from your other tenants on the server. If just gave all three them root access to server, what's to stop Eve from taking everything? Or what if she just wants to disrupt their businesses, even if she's not stealing anything?&lt;/p&gt;

&lt;p&gt;Your first line of defense is that you could log them into chroot'd environments and limit them to only those. Great! Now they can't see each others' files. Problem solved? Well, no, not quite yet. Despite the fact that she can't see the files, she can still see all the processes going on on the computer. She can kill processes, unmount filesystem and potentially even hijack processes.&lt;/p&gt;

&lt;p&gt;Enter namespaces. Namespaces allow you to hide processes from other processes. If we give each chroot'd environment different sets of namespaces, now Alice, Bob, and Eve can't see each others' processes (they even get different process PIDs, or process IDs, so they can't guess what the others have) and you can't steal or hijack what you can't see!&lt;/p&gt;

&lt;p&gt;There's a lot more depth to namespaces beyond what I've outlined here. The above is describing just the UTS (or UNIX Timesharing) namespace. There are more namespaces as well and this will help these containers stay isloated from each other.&lt;/p&gt;

&lt;h4&gt;
  
  
  Namespaces
&lt;/h4&gt;

&lt;p&gt;So let's create a chroot'd environment now that's isolated using namespaces using a new command: unshare. unshare creates a new isolated namespace from its parent (so you, the server provider can't spy on Bob nor Alice either) and all other future tenants. Run this:&lt;/p&gt;

&lt;h3&gt;
  
  
  Resource Management
&lt;/h3&gt;

&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;Docker is an open-source project that provides tools for creating and managing application containers. It also enables users to package their applications into containers, which are then run in a virtual machine like an operating system. Docker also provides an API for interacting with the images to create these containers.&lt;/p&gt;

&lt;p&gt;Docker is a tool for building, running, and deploying containers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;/blockquote&gt;

&lt;p&gt;tldr: Docker does a lot more for you than just this like networking, volumes, and other things but suffice to say this core of what Docker is doing for you: creating a new environment that's isolated by namespace and limited by cgroups and chroot'ing you into it.&lt;/p&gt;

&lt;p&gt;Suppose you're migrating an application from one environment to another or need to run multiple versions of the same app side by side on different servers. In that case, using containers makes sense because you can efficiently run these apps inside other containers without requiring code changes or worrying about configuring the environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Images
&lt;/h3&gt;

&lt;p&gt;These pre-made containers are called images. They basically dump out the state of the container, package that up, and store it so you can use it later. So let's go nab one of this image and run it! We're going to do it first without Docker to show you that you actually already know what's going on.&lt;/p&gt;

&lt;h4&gt;
  
  
  Building Images
&lt;/h4&gt;

&lt;p&gt;A Quick Note on COPY vs ADD&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:12-stretch

USER node

WORKDIR /home/node/code

COPY --chown=node:node index.js .

CMD ["node", "index.js"]

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is something very powerful about Docker: you can use images to build other images and build on the work of others.&lt;/p&gt;

&lt;h5&gt;
  
  
  Layers
&lt;/h5&gt;

&lt;h5&gt;
  
  
  Multi Stage Builds
&lt;/h5&gt;

&lt;p&gt;Hey, we're already half-way to ridiculous, let's make our image EVEN SMALLER. Technically we only need npm to build our app, right? We don't actually need it to run our app. Docker allows you to have what it called multistage builds, we it uses one container to build your app and another to run it. This can be useful if you have big dependencies to build your app but you don't need those dependencies to actually run the app. A C++ or Rust app might be a good example of that: they need big tool chains to compile the apps but the resulting binaries are smaller and don't need those tools to actually run them. Or one perhaps more applicable to you is that you don't need the TypeScript or Sass compiler in production, just the compiled files. We'll actually do that here in a sec, but let's start here with eliminating npm.&lt;/p&gt;

&lt;h4&gt;
  
  
  Docker Hub
&lt;/h4&gt;

&lt;h3&gt;
  
  
  Containers 2
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Networking
&lt;/h2&gt;

&lt;p&gt;If you've been using Docker for a while, you've probably seen some things it can do.&lt;/p&gt;

&lt;p&gt;One of the reasons Docker containers and services are so powerful is that you can connect them or connect them to non-Docker workloads. Docker containers and services do not even need to be aware that they are deployed on Docker or whether their peers are also Docker workloads or not. Whether your Docker hosts run Linux, Windows, or a mix of the two, you can use Docker to manage them in a platform-agnostic way.&lt;/p&gt;

&lt;p&gt;This topic defines some basic Docker networking concepts and prepares you to design and deploy your applications to take full advantage of these capabilities.&lt;/p&gt;

&lt;p&gt;Networking in Docker provides several benefits:&lt;/p&gt;

&lt;p&gt;It enables a more straightforward way of provisioning applications on top of existing infrastructure rather than creating a new one from scratch.&lt;/p&gt;

&lt;p&gt;It helps simplify your development workflows by removing the need for setting up networks manually every time you deploy changes through CI/CD pipelines or via manual deployment processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Persistence
&lt;/h2&gt;

&lt;p&gt;So far, we have learned that containers are ephemeral, temporary, and disposable. Docker has a few features that allow use to make containers stateful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bind Mounts
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Volumes
&lt;/h3&gt;

&lt;p&gt;Bind mounts are great for when you need to share data between your host and your container as we just learned. Volumes, on the other hand, are so that your containers can maintain state between runs. So if you have a container that runs and the next time it runs it needs the results from the previous time it ran, volumes are going to be helpful. Volumes can not only be shared by the same container-type between runs but also between different containers. Maybe if you have two containers and you want to log to consolidate your logs to one place, volumes could help with that.&lt;/p&gt;

&lt;p&gt;We can create volumes on a host system with different namespaces than the client applications running within them. For example, suppose you have an application running inside a container with access to some directory via a volume mounted from within the container. In that case, you can also use that same volume for external access without needing to change any files inside or outside the container itself. This makes it possible for many applications to share a single set of files without compromising security or performance due to conflicting paths between containers (e.g., one container having access to another container's volumes).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Volumes can be resized as needed. -Volumes support snapshotting to create backups of your data at any time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Containers can be started from a volume, allowing for easy debugging and testing of code without starting containers from scratch.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Volumes are more efficient than bind mounts in terms of memory footprint and disk usage. Bind mounts require a directory entry in each container to access files outside the container's path. This adds complexity to your application's underlying codebase, which may introduce bugs or cause other undesirable behavior due to issues with file permissions.&lt;/p&gt;

&lt;p&gt;Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts depend on the host machine's directory structure and OS, volumes are completely managed by Docker. Volumes have several advantages over bind mounts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Volumes allow you to create a temporary file system independent of your host filesystem, which means you can persist data even when your host machine crashes or reboots.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Volumes provide easy access to files from within a container. You can mount a volume directly into your container, allowing you to pull in files from outside of your container (e.g., from S3). This makes it easier to build robust applications that scale based on their runtime requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Volumes allow for quick removal of data once it's no longer needed so that resources aren't wasted when they aren't being used anymore (e.g., persistent volumes delete older versions of files).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Dockerize a Simple Node.js application
&lt;/h2&gt;

&lt;p&gt;Explain the steps in the Dockerfile!&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers"&gt;Local Develpment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.gitignore&lt;/code&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Whether you're considering using containers for your next project or simply want to get a deeper understanding of them, having this information at your disposal will help you make the right decisions regarding containerization. Thank you for reading this article, and good luck with your project!&lt;/p&gt;

&lt;p&gt;Control Groups Chroot Other Stuff&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Web Performance - Renderland's Saga, Book 2</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Fri, 20 May 2022 20:09:37 +0000</pubDate>
      <link>https://dev.to/junubiman/web-performance-renderlands-saga-book-2-14f3</link>
      <guid>https://dev.to/junubiman/web-performance-renderlands-saga-book-2-14f3</guid>
      <description>&lt;h1&gt;
  
  
  The Galactic Federation 👮🏽👽🧝🏾🤖 - Fourth Act
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Despair and frustration will not shake our belief that resistance is the only way to liberation. - Emile Lahoud.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the first &lt;a href="https://dev.to/junubiman/web-performance-renderlands-saga-book-1-2mkp"&gt;part&lt;/a&gt; of the series, we learned about Renderland's history, its new savior, and the invaders who sought to destroy the planet.&lt;/p&gt;

&lt;p&gt;The Galaxy is governed by a federation known as the &lt;code&gt;Feds&lt;/code&gt; or the &lt;code&gt;Federalis&lt;/code&gt;, they are an intergalactic organization that governs thousands of planets and galaxies including the &lt;code&gt;Web Galaxy&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Bugs 👾
&lt;/h3&gt;

&lt;p&gt;A coalition of criminals who were sentenced to and then escaped from the &lt;code&gt;Devil's Planet&lt;/code&gt; intergalactic prison, a maximum-security prison for the galaxy's worst of the worst. The bugs seek to dismantle the &lt;code&gt;Feds&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The attack on Renderland was the first of many attacks that soon followed after. Their primary goal is to destroy the Pillars and Federation's &lt;code&gt;RAIL Model&lt;/code&gt; in Renderland and eventually the entire Federation.&lt;/p&gt;

&lt;h3&gt;
  
  
  RAIL Model 🛤
&lt;/h3&gt;

&lt;p&gt;RAIL is a user-centric performance model developed by the &lt;code&gt;Feds&lt;/code&gt;. It provides a structure for thinking about performance. The model breaks down the user's experience into key actions (for example, tap, scroll, load) and helps you define performance goals for each of them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p7uG89_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653076266009/5eBdEsaAum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p7uG89_---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653076266009/5eBdEsaAum.png" alt="two-Page-2.drawio.png" width="658" height="553"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Response
&lt;/h4&gt;

&lt;p&gt;is the time it takes from user interaction (such as a tap) to paint. Basically its the time between user interactivity and feedback from the interaction&lt;/p&gt;

&lt;p&gt;Based on human perception, it's recommended that user-initiated actions are responded to within 100ms in order to make users feel like their interactions are instantaneous.&lt;/p&gt;

&lt;h4&gt;
  
  
  Animation 🅰
&lt;/h4&gt;

&lt;p&gt;Animation is a technique used to make objects appear like they're moving. The &lt;code&gt;Feds&lt;/code&gt; have defined a budget for each frame in animation which is 16 ms (1000 ms / 60 frames per second 16 ms).&lt;/p&gt;

&lt;p&gt;Browsers generally need an average of 6 ms to render a single frame, that's why the guideline recommends 16 ms per frame.&lt;/p&gt;

&lt;p&gt;Humans view animations that take 16ms or less per frame as fluid, smooth and consistent&lt;/p&gt;

&lt;h4&gt;
  
  
  Idle
&lt;/h4&gt;

&lt;p&gt;Maximize idle time to increase the odds that the page responds to user input within 50 ms. Complete work in 50ms chunks so as to give the user a sense that the page is responsive&lt;/p&gt;

&lt;h4&gt;
  
  
  Load 💔
&lt;/h4&gt;

&lt;p&gt;Loading pages should be seamless and in order to acquire that, the recommended time a page should take to load is 1000ms (1s).&lt;/p&gt;

&lt;p&gt;When pages load slowly, user attention wanders, and users perceive the task as broken. Sites that load quickly have longer average sessions, lower bounce rates, and higher ad viewability.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Chairman 🏾
&lt;/h2&gt;

&lt;p&gt;A bearded elderly man appeared to us in hologram form to assure us that the federation is fully aware of Renderland's situation and is currently mobilizing re-enforcements to rescue the planet. They've shared a list of measures to be taken to hold back the bugs until help arrives.&lt;/p&gt;

&lt;p&gt;It was later revealed that the elderly man was the Federation's chairman and it was non-other than &lt;a href="https://en.wikipedia.org/wiki/Dennis_Ritchie"&gt;Dennis Richie&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is what you can do to stall the bugs until re-enforcements arrive&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code Split&lt;/li&gt;
&lt;li&gt;Compress, Cache, and Minify (CCM)&lt;/li&gt;
&lt;li&gt;Optimize Images&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code Splitting
&lt;/h2&gt;

&lt;p&gt;The natives had the ability to split and control their body parts at will. This makes it possible to split code into various bundles or components which can then be loaded on-demand or in parallel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UOsOHDTl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653065397990/HqSAqz-zM.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UOsOHDTl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653065397990/HqSAqz-zM.png" alt="code-splitting.png" width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 There are two main types of &lt;code&gt;code-splitting&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Route Based 🚏
&lt;/h3&gt;

&lt;p&gt;Route-based code-splitting is a method of delivering code in chunks based on user navigation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Component-Based
&lt;/h3&gt;

&lt;p&gt;Component-based code splitting is a method that's used in component-based frameworks/libraries such as React.js and Vue.js.&lt;/p&gt;

&lt;h2&gt;
  
  
  Caching
&lt;/h2&gt;

&lt;p&gt;Besides &lt;code&gt;Minification&lt;/code&gt;, the natives of Renderland also had the ability to create clones of themselves to be used in &lt;code&gt;Cacheland&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Caching is the process of storing copies of files in a &lt;code&gt;cache&lt;/code&gt;, or temporary storage location so that they can be accessed more quickly. Caching can be done on both the server-side and client-side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 There are two main types of &lt;code&gt;caches&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Server-Side Cache
&lt;/h3&gt;

&lt;p&gt;Server-side caching is beyond the scope of this article but you can utilize a &lt;code&gt;NoSQL&lt;/code&gt; key-value store such as &lt;code&gt;Redis&lt;/code&gt; to perform caching. Redis also provides a &lt;code&gt;Client-Side&lt;/code&gt; caching mechanism but I haven't tried it yet. You can learn more about it &lt;a href="https://redis.io/docs/manual/client-side-caching/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Client-Side Cache
&lt;/h3&gt;

&lt;p&gt;The process of caching assets on the client-side of things. This can be done via &lt;code&gt;HTTP&lt;/code&gt; or a &lt;code&gt;Service Worker&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Browser (HTTP) cache
&lt;/h4&gt;

&lt;p&gt;When a browser visits a page for the first time, it stores copies of assets in its HTTP cache. It then serves non-expired requests from the cache. HTTP deals with time-based (TTL) resources.&lt;/p&gt;

&lt;p&gt;HTTP caching occurs when the browser stores local copies of web resources for faster retrieval the next time the resource is required. As your application serves resources it can attach cache headers to the response specifying the desired cache behavior&lt;/p&gt;

&lt;h5&gt;
  
  
  HTTP Cache Headers
&lt;/h5&gt;

&lt;p&gt;Browser caching can be controlled via HTTP header options that can be set on the server.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Cache-Control&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ETag&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Last-Modified&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Service worker cache
&lt;/h4&gt;

&lt;p&gt;Service Worker caching requires a &lt;code&gt;fetch&lt;/code&gt; event handler in an app's &lt;code&gt;service worker&lt;/code&gt; file. Network requests are intercepted and responses are served from the worker's cache whenever possible.&lt;/p&gt;

&lt;p&gt;It's generally recommended to not &lt;code&gt;re-invent the wheel&lt;/code&gt; when developing production applications. Use &lt;a href="https://developer.chrome.com/docs/workbox/"&gt;Workbox&lt;/a&gt; instead of rolling out your own workers if possible.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HmhaNZxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653064900956/cp1j0VdRk.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HmhaNZxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653064900956/cp1j0VdRk.jpeg" alt="1_oOcY2Gn-LVt1h-e9xOv5oA.jpeg" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Lifecycle
&lt;/h4&gt;

&lt;p&gt;Before you could use a service worker, you must first &lt;code&gt;register&lt;/code&gt; it via the &lt;code&gt;ServiceWorkerContainer.register()&lt;/code&gt; method. The worker's lifecycle begins after it's successfully registered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡Events&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To utilize workers, you'd generally listen for &lt;code&gt;events&lt;/code&gt; on a worker and then respond accordingly.&lt;/p&gt;

&lt;h4&gt;
  
  
  Download
&lt;/h4&gt;

&lt;p&gt;The worker is downloaded into the client.&lt;/p&gt;

&lt;h4&gt;
  
  
  Install
&lt;/h4&gt;

&lt;p&gt;The worker is being installed. If successful, then this is a good time to prepare the worker for usage.&lt;/p&gt;

&lt;h4&gt;
  
  
  Active
&lt;/h4&gt;

&lt;p&gt;Installation is successful and the worker is ready to receive events. The point where this event fires is generally a good time to clean up old caches and other things associated with the previous version of your service worker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Caching &lt;code&gt;strategies&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Cache only
&lt;/h4&gt;

&lt;p&gt;Generally used for content that's considered static to a particular "version" of a website. They're usually cached in the &lt;code&gt;install&lt;/code&gt; event of a service worker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 It's good for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Static content.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Cache, falling back to the network
&lt;/h4&gt;

&lt;p&gt;Generally used for building apps that are intended to be offline-first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 It's good for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Application shell and common resources such as logos.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Network only
&lt;/h4&gt;

&lt;p&gt;This strategy skips the cache and sends requests directly to the server. It's mainly used when your app requires content to always be up to date. It's also ideal for requests that cannot be cached such as &lt;code&gt;POST&lt;/code&gt; or &lt;code&gt;PUT&lt;/code&gt; requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 It's good for:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Payment related applications&lt;/li&gt;
&lt;li&gt;Content that changes frequently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Compression
&lt;/h2&gt;

&lt;p&gt;In the previous part, the bugs have infected &lt;code&gt;unoptimized&lt;/code&gt; assets with a virus that caused them to grow in size which makes it difficult for them to travel and respond to requests.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;A-Team&lt;/code&gt; came up with a temporary technique to reduce their sizes thus reducing their transfer times. This technique is known as &lt;code&gt;compression&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Compression
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;💡 There are mainly two types&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lossless&lt;/strong&gt; means you can retrieve the original data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lossy&lt;/strong&gt; means you might not get the original data due to a change in its quality.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Minification
&lt;/h2&gt;

&lt;p&gt;Minification refers to the process of making assets smaller by removing comments, unnecessary characters, and white spaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Optimize Images
&lt;/h2&gt;

&lt;p&gt;Optimizing images allows the creation and display of images using the best format, size, and resolution according to network and device constraints.&lt;/p&gt;

&lt;h3&gt;
  
  
  Formats
&lt;/h3&gt;

&lt;p&gt;There are new image formats that were developed specifically for the web. They offer greater compression and quality benefits.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/speed/webp"&gt;WebP&lt;/a&gt; is a format created by Google and it was intended as a replacement for &lt;code&gt;jpeg&lt;/code&gt;, &lt;code&gt;PNG&lt;/code&gt;, and &lt;code&gt;gif&lt;/code&gt; formats. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Accessibility
&lt;/h3&gt;

&lt;p&gt;Adding &lt;code&gt;ALT&lt;/code&gt; tags can bring about accessibility benefits and a better user experience for users who fail to load images due to network or device constraints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;figure&amp;gt;
    &amp;lt;img src="awesome-photo.png" alt="An awesome photo!!" /&amp;gt;
&amp;lt;/figure&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A well-written &lt;code&gt;ALT&lt;/code&gt; tag can help your users visualize an image if it fails to load for whatever reason. It can also help images rank higher in search.&lt;/p&gt;

&lt;h3&gt;
  
  
  Aspect ratio and &lt;code&gt;srcset&lt;/code&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;srcset&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;This is an HTML attribute that allows you to specify different image sources to serve depending on factors such as the width of a device or its resolution.&lt;/p&gt;

&lt;h4&gt;
  
  
  Aspect ratio
&lt;/h4&gt;

&lt;p&gt;Not using the appropriate aspect ratio can cause &lt;code&gt;cumulative layout shifts&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lazy-loading
&lt;/h3&gt;

&lt;p&gt;Setting an image's &lt;code&gt;loading&lt;/code&gt; attribute to &lt;code&gt;lazy&lt;/code&gt; can help the browser prioritize when to load the image&lt;/p&gt;

&lt;h2&gt;
  
  
  Rendering Patterns
&lt;/h2&gt;

&lt;p&gt;We've previously discussed the two main rendering patterns, namely &lt;code&gt;Client Side Rendering (CSR&lt;/code&gt;) and &lt;code&gt;Server Side Rendering (SSR)&lt;/code&gt;. Now it's time to introduce some new rendering patterns that combine the best of the two worlds.&lt;/p&gt;

&lt;h4&gt;
  
  
  Static Generation
&lt;/h4&gt;

&lt;p&gt;A static site generator is a tool that generates a full static HTML website based on raw data and a set of templates.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;SSR&lt;/code&gt; with Rehydration 🌨
&lt;/h4&gt;

&lt;p&gt;This pattern uses a &lt;code&gt;pre-built&lt;/code&gt; DOM with components rendered as HTML. The app then loads the remaining data in the client side.&lt;/p&gt;

&lt;h4&gt;
  
  
  CSR with Pre-rendering 🚧
&lt;/h4&gt;

&lt;p&gt;This pattern renders an &lt;code&gt;app shell&lt;/code&gt; to static HTML during build time .&lt;/p&gt;




&lt;h2&gt;
  
  
  The Reinforcements 🚀 - Fifth (Final) Act
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Geography has made us neighbors. History has made us friends. Economics has made us partners. And necessity has made us allies. Those whom nature hath so joined together, let no man put asunder. - John F. Kennedy&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;Render League&lt;/code&gt; and the &lt;code&gt;A-Team&lt;/code&gt; has followed the Federation's advice and they managed to hold some of the bugs back. However, the danger still remains as the bugs were still fixed on destroying the pillars.&lt;/p&gt;

&lt;p&gt;The techniques listed in the previous act could enhance an app's performance but they aren't really sufficient. Modern apps are quite complex and they contain many moving parts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Frameworks
&lt;/h2&gt;

&lt;p&gt;A squad of elite Federation warriors known as the Frameworks has finally arrived at the scene. They were described as evolved forms of &lt;code&gt;Scripts&lt;/code&gt;. They were.&lt;/p&gt;

&lt;p&gt;Dennis Richie has previously mentioned that &lt;code&gt;Scripts&lt;/code&gt; have the ability to transform just like the &lt;code&gt;Super Saiyans&lt;/code&gt; in &lt;a href="https://en.wikipedia.org/wiki/Dragon_Ball"&gt;Dragon Ball&lt;/a&gt;. This transformation gives &lt;code&gt;JS&lt;/code&gt; a set of new powers and abilities that will make it easier to fight the bugs. Dennis revealed that the current form of JS is known as &lt;code&gt;Vanilla&lt;/code&gt; and that it could evolve into much more powerful forms.&lt;/p&gt;

&lt;h3&gt;
  
  
  React.js
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;React is a free and open-source front-end JavaScript library for building user interfaces based on UI components.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At its core lies the mechanism that tracks changes in a component state and projects the updated state to the screen.&lt;/p&gt;

&lt;p&gt;The virtual DOM (VDOM) is a programming concept where an ideal, or virtual, representation of a UI is kept in memory and synced with the real DOM by a library such as ReactDOM. This process is called reconciliation.&lt;/p&gt;

&lt;h4&gt;
  
  
  Code-Splitting
&lt;/h4&gt;

&lt;p&gt;Code splitting in React can be achieved using a bundler like &lt;code&gt;Webpack&lt;/code&gt; or &lt;code&gt;Browserfy&lt;/code&gt;.&lt;/p&gt;

&lt;h5&gt;
  
  
  Before
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import { robot } from './js';

console.log(robot(16, 26));

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  After
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import("./js").then(robot =&amp;gt; {
  console.log(robot.add(16, 26));
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Book 1 introduced a lot of concepts and book 2 expanded upon them. Book 3 shall include practical examples of most of the concepts presented in this article.&lt;/p&gt;

&lt;p&gt;It's highly recommended to spend extra time reviewing and practicing these concepts. Learning by doing is most often the best way to learn IMHO.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NjTw5Z1K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653013166109/PGmJfqLIz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NjTw5Z1K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1653013166109/PGmJfqLIz.png" alt="Screen Shot 2022-05-20 at 05.19.10.png" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources 📚
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://web.dev/offline-cookbook/"&gt;Offline Cookbook&lt;/a&gt; by &lt;a href="https://twitter.com/jaffathecake"&gt;Jake Archibald&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.chrome.com/tags/performance/"&gt;Chrome Developers Blog&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://web.dev/learn-web-vitals/"&gt;Web Dev&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/service-worker-caching-and-http-caching/"&gt;Service worker caching and HTTP caching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aerotwist.com/blog/"&gt;Aero Twist's Blog&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/"&gt;Reach Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;NB: Part 3 of this series will explore the practical aspects of web rendering performance. I decided to break it into parts because I don't want to overwhelm the reader.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fun Fact: This article's story line was inspired by&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This other &lt;a href="https://twitter.com/JemYoung/status/1517574351645667328"&gt;Tweet&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Dragon Ball&lt;/li&gt;
&lt;li&gt;Rick and Morty (Season 1)&lt;/li&gt;
&lt;li&gt;read this &lt;a href="https://twitter.com/adamlbunch/status/1527316680258383874/photo/1"&gt;https://twitter.com/adamlbunch/status/1527316680258383874/photo/1&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;See you in Part 3!&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Web Performance - Renderland's Saga, Book 1</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Sat, 14 May 2022 02:14:00 +0000</pubDate>
      <link>https://dev.to/junubiman/web-performance-renderlands-saga-book-1-2mkp</link>
      <guid>https://dev.to/junubiman/web-performance-renderlands-saga-book-1-2mkp</guid>
      <description>&lt;h1&gt;
  
  
  Where Everything Began - First Act
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;"Knowledge is like money: to be of value it must circulate, and in circulating it can increase in quantity and, hopefully, in value." ~ Louis L'Amour&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In February, I had a task to improve the performance of an NFT marketplace. I had surface knowledge of web performance at the time. I spent an insane amount of time researching and watching tech talks on videos. I decided to write this article to make the journey easier for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Portal 👨🏿💻&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Aimlessly looking for answers with a gazillion tabs open, my PC freezes with no solution in sight. I decide to shut down my PC and then go out for a walk to clear my thoughts.&lt;/p&gt;

&lt;p&gt;I return 30 minutes later to find a strange blue light emitting from my room. It was coming from my PC which was still on but frozen. I try long pressing the power button but I end up getting sucked into the screen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Giant Robot 🤖&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I wake up in a weird-looking room then I immediately get approached by a giant robot with the letters &lt;code&gt;HTML&lt;/code&gt; on its chest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 Robot:&lt;/strong&gt; Hi, I'm &lt;code&gt;HTML5&lt;/code&gt;. I'm glad you woke up, welcome to Renderland!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;👦🏿 Me:&lt;/strong&gt; Where am I?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 Robot:&lt;/strong&gt; You're in &lt;code&gt;Renderland&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;👦🏿 Me:&lt;/strong&gt; Render what???&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Renderland? 🤔&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Renderland is the planet on which &lt;code&gt;Rendering&lt;/code&gt; takes place. It's the closest planet to the &lt;code&gt;screen&lt;/code&gt; and it's what users see and interact with. It's located in the &lt;code&gt;Browser's Solar System&lt;/code&gt; which is also under the &lt;code&gt;The Web Galaxy&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j_kCdj05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1651329501680/th1Cbhxfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j_kCdj05--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1651329501680/th1Cbhxfb.png" alt="Untitled.drawio.png" width="546" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This diagram shows how a typical &lt;code&gt;request&lt;/code&gt; travels through the internet where it finally reaches a &lt;code&gt;server&lt;/code&gt; which sends back a &lt;code&gt;response&lt;/code&gt; to the client.&lt;/p&gt;

&lt;p&gt;The response manifests different entities such as &lt;code&gt;Styles&lt;/code&gt;, &lt;code&gt;Markup&lt;/code&gt;, &lt;code&gt;Scripts&lt;/code&gt;, &lt;code&gt;Fonts&lt;/code&gt;, and other &lt;code&gt;files&lt;/code&gt;. They represent the different life forms on Renderland. They live together to make up the content that you see and interact with.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Citizens of Renderland 🪐
&lt;/h2&gt;

&lt;p&gt;HTML, the planet's elder summoned us all for a meeting under the &lt;code&gt;Sacred Tree&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 Robot 1&lt;/strong&gt; I'm &lt;code&gt;HTML&lt;/code&gt;, you've probably met my grandson, &lt;code&gt;HTLM5&lt;/code&gt;. We're both from the &lt;code&gt;Markup&lt;/code&gt; tribe and we make up the content of pages on the web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 Robot 2&lt;/strong&gt; I'm &lt;code&gt;CSS&lt;/code&gt; from the &lt;code&gt;Styles&lt;/code&gt; tribe, and we give web pages looks and &lt;code&gt;style&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 Robot 3&lt;/strong&gt; I'm &lt;code&gt;JavaScript&lt;/code&gt; but you can call me &lt;code&gt;JS&lt;/code&gt;, I'm from the &lt;code&gt;Scripts&lt;/code&gt; tribe- no relation, and we practice making web pages interactive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 HTML&lt;/strong&gt; A prophecy spoke of a &lt;code&gt;FullSnack Engineer&lt;/code&gt; with a mechanical keyboard and an E mark who'd save Renderland. The Engineer spoke an ancient language called &lt;code&gt;Code&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 JS&lt;/strong&gt; We believe you're the chosen one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Renderland's History 🕰
&lt;/h2&gt;

&lt;p&gt;Long ago, the robots lived in a faraway land known as &lt;code&gt;ServerLand&lt;/code&gt; where they served a group of entities called &lt;code&gt;clients&lt;/code&gt;. The clients lived in &lt;code&gt;ClientLand&lt;/code&gt; and they all had different shapes and sizes.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;Serverland&lt;/code&gt; native is referred to as &lt;code&gt;server&lt;/code&gt; and a &lt;code&gt;Clientland&lt;/code&gt; native is referred to as &lt;code&gt;client&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;request-response-cycle&lt;/code&gt; is a model that describes how clients and servers communicate over a network via a &lt;code&gt;protocol&lt;/code&gt; such as &lt;code&gt;HTTP&lt;/code&gt; or &lt;code&gt;Web Sockets&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rendering
&lt;/h3&gt;

&lt;p&gt;Rendering is the process of turning a web page's assets (HTML, CSS, JSS, and other static assets) into interactive content on the browser. Rendering steps include style, layout, paint, and, in some cases, compositing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Critical Rendering Path (CRP) 🛣
&lt;/h3&gt;

&lt;p&gt;The Critical Rendering Path is the sequence of steps the browser goes through to convert the HTML, CSS, and JavaScript into actually visible pixels on the screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s-nJ80Cx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652433416718/iiDCedfzO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s-nJ80Cx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652433416718/iiDCedfzO.png" alt="tree-CRP.drawio.png" width="763" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  The Render Tree 🌲
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;HTML5&lt;/code&gt; and &lt;code&gt;CSS&lt;/code&gt; then summoned me to the &lt;code&gt;Sacred Tree&lt;/code&gt;. They began explaining the history of the tree and how it came to life.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Document Object Model (DOM)&lt;/strong&gt; describes the structure browsers use to represent HTML elements internally.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSS Object Model (CSSOM)&lt;/strong&gt; describes the structure browsers use to represent CSS styles internally.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Both are represented internally as a tree-like structure that allows programs to interact with the CSS and HTML content of a web page.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Render Tree is the product of combining &lt;code&gt;DOM&lt;/code&gt; and &lt;code&gt;CSSOM&lt;/code&gt; trees. It defines the structure of a web page. The tree contains only the visible elements of a web page.&lt;/p&gt;

&lt;p&gt;The browser calculates the &lt;code&gt;layout&lt;/code&gt; of each visible element and then &lt;code&gt;paints&lt;/code&gt; it on the screen with the help of the Render Tree.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OqYWp5xU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652360366137/yN-93dn75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OqYWp5xU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652360366137/yN-93dn75.png" alt="Untitled Diagram.drawio (5).png" width="673" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Layout (Reflow) 🗺
&lt;/h4&gt;

&lt;p&gt;Browser computes the geometry of the layout and its elements based on the render tree.&lt;/p&gt;

&lt;h4&gt;
  
  
  Paint 🎨
&lt;/h4&gt;

&lt;p&gt;Browser paints pixel by pixel to create the visual representation we see on the screen. Using the Render Tree, the browser engine calculates the position of each visible element of a web page.&lt;/p&gt;

&lt;h4&gt;
  
  
  Rendering in Short
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Assets&lt;/strong&gt; Converting the web page's HTML and CSS code into &lt;code&gt;DOM&lt;/code&gt; and &lt;code&gt;CSSOM&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render Tree&lt;/strong&gt; Constructing the Render Tree by combining &lt;code&gt;DOM&lt;/code&gt; and &lt;code&gt;CSSOM&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layout&lt;/strong&gt; Calculate the size and position of each &lt;code&gt;node&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paint&lt;/strong&gt; painting &lt;code&gt;elements&lt;/code&gt; on the browser's screen for users to view. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Rendering Patterns
&lt;/h3&gt;

&lt;p&gt;The robots then began explaining how &lt;code&gt;rendering&lt;/code&gt; is practiced in Renderland.&lt;/p&gt;

&lt;h4&gt;
  
  
  Server Side Rendering (SSR) 🛠
&lt;/h4&gt;

&lt;p&gt;The most ancient form of Rendering. This pattern generates the full HTML for the page content to be rendered in response to a user request.&lt;/p&gt;

&lt;h4&gt;
  
  
  Client Side Rendering (CSR) 💻
&lt;/h4&gt;

&lt;p&gt;This form of rendering became popular during the &lt;code&gt;Ajax&lt;/code&gt; era in 2005. Ajax which stands for &lt;code&gt;Asynchronous JavaScript and XML&lt;/code&gt; allowed developers to build client-side applications.&lt;/p&gt;

&lt;p&gt;In this pattern, the server renders a skeleton of an HTML container whilst the client handles the logic required to render a web page. The client takes care of fetching, templating, routing, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Guardians of Renderland (The Pillars 👺)
&lt;/h2&gt;

&lt;p&gt;Also known as the &lt;code&gt;Web's Vitals&lt;/code&gt;, they are Renderland's guardians of performance. They measure and report any issues that may affect the performance of a web page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iqDKQ5Ai--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652481438598/pBd_Y0vkV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iqDKQ5Ai--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652481438598/pBd_Y0vkV.png" alt="Screen Shot 2022-05-14 at 01.37.03.png" width="800" height="656"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This screenshot is from &lt;code&gt;Lighthouse's&lt;/code&gt; report on Hashnode's home page.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  First Pillar (First Byte) 1
&lt;/h3&gt;

&lt;p&gt;This Pillar is responsible for reporting the arrival of the very first byte of incoming data. It helps quantity a server's response time by measuring the latency of a round trip to and from said server. It precedes every other Pillar.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Time to First Byte (TTFB)&lt;/strong&gt; The time between the initial request and the arrival of the first byte.&lt;/p&gt;

&lt;h3&gt;
  
  
  Second Pillar (Paint) 🎨
&lt;/h3&gt;

&lt;p&gt;This Pillar measures the time a browser takes to paint pixels on a screen. The shorter the time, the better the performance.&lt;/p&gt;

&lt;h4&gt;
  
  
  First Paint (FP)
&lt;/h4&gt;

&lt;p&gt;The first instance of content that appears on the browser. Think of it as the first drop of water when you open the tap.&lt;/p&gt;

&lt;h4&gt;
  
  
  First Contentful Paint (FCP)
&lt;/h4&gt;

&lt;p&gt;Measures how long it takes the browser to render the first piece of DOM content after a user navigates to your page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 The recommended &lt;code&gt;FCP&lt;/code&gt; score is 1.8 seconds or less&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Largest Contentful Paint (LCP)
&lt;/h4&gt;

&lt;p&gt;The time when the main page content becomes visible. It consists of the initial HTML document + &lt;code&gt;LCP&lt;/code&gt; Resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 The recommended &lt;code&gt;LCP&lt;/code&gt; score is 2.5 seconds or less&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Third Pillar (Time to Interactive) 🎬
&lt;/h3&gt;

&lt;p&gt;Also known as (TTI), represents the state at which a web page is ready to respond to events and user interactions. This is made possible when all the &lt;code&gt;Scripts&lt;/code&gt; tribe members have arrived/loaded.&lt;/p&gt;

&lt;p&gt;TTI is reached only after FCP. Having a huge gap between these two metrics causes serious problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 The recommended &lt;code&gt;TTI&lt;/code&gt; score is 3.8 seconds or less&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Total Blocking Time (TBT)
&lt;/h4&gt;

&lt;p&gt;The total amount of time between FCP and TTI. It means that the event handlers are registered for most visible page elements, and the page responds to user interactions within 50 milliseconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 The recommended &lt;code&gt;TBT&lt;/code&gt; score is 200 milliseconds or less&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Attack on Renderland 👾 - Second Act
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle." - Sun Tzu, The Art of War.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We receive multiple reports from different locations. Web pages are unresponsive, some fail to load and others are painfully slow.&lt;/p&gt;

&lt;p&gt;It was later revealed that Renderland is being invaded by an intelligent species of &lt;code&gt;bugs&lt;/code&gt;. They came in different shapes and sizes and wreaked havoc on the planet.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bugs 👾 vs Pillars 👺
&lt;/h3&gt;

&lt;p&gt;The bugs have directed their first attack on the pillars. Let's see how each metric affects performance.&lt;/p&gt;

&lt;h4&gt;
  
  
  First Pillar (First Byte) 1
&lt;/h4&gt;

&lt;p&gt;The bugs that affect this network usually manifest in the form of &lt;code&gt;network&lt;/code&gt; or &lt;code&gt;device&lt;/code&gt; issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The following factors may affect &lt;code&gt;TTFB&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Network protocol, HTTP/1 instead of HTTP/2 for example.&lt;/li&gt;
&lt;li&gt;Longer network &lt;code&gt;request phases&lt;/code&gt;. You can learn more about this &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Session"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Second Pillar (Paint) 🎨
&lt;/h4&gt;

&lt;p&gt;This metric mainly reports performance issues related to static/viewable content. The bugs that affect this metric usually manifest in the form of unoptimized assets such as &lt;code&gt;HTML&lt;/code&gt;, &lt;code&gt;CSS&lt;/code&gt;, and images.&lt;/p&gt;

&lt;h4&gt;
  
  
  Third Pillar (Interactivity) 🎬
&lt;/h4&gt;

&lt;p&gt;The bugs that affect this pillar mainly focus on &lt;code&gt;scripts&lt;/code&gt; since it focuses on issues related to the interactivity/usability of a web page. Unoptimized JavaScript is the biggest offender in this category because it needs to be parsed and compiled before it's finally executed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Miscellaneous Performance Bottlenecks
&lt;/h3&gt;

&lt;p&gt;These are some of the most common web performance bottlenecks.&lt;/p&gt;

&lt;h4&gt;
  
  
  Blocking Resources
&lt;/h4&gt;

&lt;p&gt;These include the scripts, styles, and HTML imports that block or delay the browser from rendering content to the screen.&lt;/p&gt;

&lt;h4&gt;
  
  
  Bundle Size
&lt;/h4&gt;

&lt;p&gt;This is the amount of JavaScript a user will have to download to load your website. A larger bundle size means users will have to wait longer before they could interact with your site.&lt;/p&gt;

&lt;h4&gt;
  
  
  Network Requests
&lt;/h4&gt;

&lt;p&gt;Enormous network payloads reduce the application's performance. Also, higher latencies make requests take longer to travel to and from the server.&lt;/p&gt;

&lt;h4&gt;
  
  
  DOM/CSSOM Bottlenecks
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Event handlers are costly.&lt;/li&gt;
&lt;li&gt;Layout thrashing and reflows cause re-renders meaning the browser will have to recalculate and re-paint content with every reflow.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Resistance - Final Act
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"With great power comes great responsibility."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As developers, we must make sure that the apps we build are performant and resilient. This section will equip you with new superpowers to assume this role.&lt;/p&gt;

&lt;h3&gt;
  
  
  Measuring Performance
&lt;/h3&gt;

&lt;p&gt;To defeat the &lt;code&gt;bugs&lt;/code&gt;, we need fully understand to how to measure the impact of their attacks on performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 How is performance measured?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Field Testing&lt;/strong&gt; Involves real users loading and interacting with the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lab Testing&lt;/strong&gt; Using tools to simulate a page load in a predictable environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Field Testing
&lt;/h4&gt;

&lt;p&gt;Also known as &lt;code&gt;Real user monitoring (RUM)&lt;/code&gt; refers to the process of recording user interactions on a production website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples of &lt;code&gt;RUM&lt;/code&gt; software: InfluxDB, Google Analytics, CloudFlare, Stackify, etc.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This topic is beyond the scope of this article so we'll jump right into &lt;code&gt;Lab Testing&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Lab Testing
&lt;/h4&gt;

&lt;p&gt;Refers to the process of testing an application in an environment such as &lt;code&gt;development&lt;/code&gt; or &lt;code&gt;staging&lt;/code&gt; before the site is released to the public.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rescuing the Pillars
&lt;/h3&gt;

&lt;p&gt;Learning how to measure the performance of a website was the first step. Now we need to learn how to optimize the metrics we measured.&lt;/p&gt;

&lt;h4&gt;
  
  
  First Pillar (First Byte) 1
&lt;/h4&gt;

&lt;p&gt;This metric indicates how fast or slow a server is. It measures the latency of a round trip to and from a server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Measuring &lt;code&gt;TTFB&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Field&lt;/strong&gt; &lt;a href="https://github.com/GoogleChrome/web-vitals"&gt;Web Vitals Library&lt;/a&gt; or &lt;a href="https://developers.google.com/web/tools/chrome-user-experience-report"&gt;Chrome's User Experience Report&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lab&lt;/strong&gt; The &lt;code&gt;Developer Tools&lt;/code&gt; panel in web browsers or &lt;a href="https://www.webpagetest.org/"&gt;Web Page Test&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to improve &lt;code&gt;TTFB&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better server infrastructure (Using Load Balancers and Caches) for example.&lt;/li&gt;
&lt;li&gt;Pre-connect to required origins for cross-origin resources.&lt;/li&gt;
&lt;li&gt;Using HTTP2 if possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Second Pillar (Paint) 🎨
&lt;/h4&gt;

&lt;p&gt;Asset optimization can play a huge role in improving this performance metric. Let's see how we can accomplish this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Measuring Paint Metrics&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Field&lt;/strong&gt; &lt;a href="https://github.com/GoogleChrome/web-vitals"&gt;Web Vitals Library&lt;/a&gt; or &lt;a href="https://developers.google.com/web/tools/chrome-user-experience-report"&gt;Chrome's User Experience Report&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lab&lt;/strong&gt; The &lt;code&gt;Developer Tools&lt;/code&gt; panel in web browsers or &lt;a href="https://www.webpagetest.org/"&gt;Web Page Test&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  How to improveFCP
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Eliminate render-blocking resources.&lt;/li&gt;
&lt;li&gt;Minify CSS and remove unused JavaScript code.&lt;/li&gt;
&lt;li&gt;Reduce &lt;code&gt;TTFB&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Avoid enormous network loads and &lt;code&gt;pre-load&lt;/code&gt; crucial requests.&lt;/li&gt;
&lt;li&gt;Serve static assets with an efficient cache policy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  How to improve LCP
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Reduce &lt;code&gt;TTFB&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Optimize resource load times, for example compressing images, serving them in different sizes, using a &lt;code&gt;CDN&lt;/code&gt;, etc.&lt;/li&gt;
&lt;li&gt;Optimizing CSS, for example compressing, removing unused CSS and deferring non-critical CSS.&lt;/li&gt;
&lt;li&gt;Shortening the Critical Rendering Path (CRP).&lt;/li&gt;
&lt;li&gt;Deferring non-critical scripts and add scripts to the body of the HTML document.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Third Pillar (Time to Interactive) 🎬
&lt;/h4&gt;

&lt;p&gt;You might be familiar with JavaScript's single thread nature, if not then this &lt;a href="https://medium.com/@nickbulljs/explain-what-single-threaded-javascript-means-like-you-are-5-years-old-4ba0876291e0"&gt;article&lt;/a&gt; might be a great resource for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 What is a Main Thread?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The main thread is where a browser processes user events and paints. The browser uses a single thread to run a page's JavaScript, as well as the Critical Rendering Path. The browser may not respond to user interactions if the main thread is blocked/occupied by another &lt;code&gt;process&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to improve &lt;code&gt;TTI&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  1. Minimizing Main thread's work
&lt;/h5&gt;

&lt;p&gt;We run most of our code on the main thread. Lifting off the burden or delegating some of this work to another &lt;code&gt;Service&lt;/code&gt; can increase the performance of a web page.&lt;/p&gt;

&lt;h5&gt;
  
  
  2. Debouncing Events
&lt;/h5&gt;

&lt;p&gt;Delaying the execution of event handlers can increase performance because it helps the browser avoid fast consecutive events. These events can block frames from completing, and can cause additional and unnecessary layout work.&lt;/p&gt;

&lt;h5&gt;
  
  
  3. Web Workers
&lt;/h5&gt;

&lt;p&gt;Web workers can be used to delegate complex processes and run tasks in the background in a separate thread.&lt;/p&gt;

&lt;h5&gt;
  
  
  4. Minification
&lt;/h5&gt;

&lt;p&gt;Minifying and deferring non-critical &lt;code&gt;CSS&lt;/code&gt;/&lt;code&gt;JavaScript&lt;/code&gt; can increase a web page's performance.&lt;/p&gt;

&lt;h5&gt;
  
  
  5. Code Splitting
&lt;/h5&gt;

&lt;p&gt;Means the browser will only download the JavaScript users need at the time. For example, let's consider a web app with three pages, namely &lt;code&gt;home&lt;/code&gt;, &lt;code&gt;chat&lt;/code&gt; and &lt;code&gt;notifications&lt;/code&gt;. Code-splitting allows you to download only the JavaScript relevant to your home page and then download the remaining assets on-demand or when a user navigates to a page that actually needs.&lt;/p&gt;

&lt;h5&gt;
  
  
  6. Event Delegation
&lt;/h5&gt;

&lt;p&gt;Propagating or bubbling up an event in the hierarchy of the DOM tree can increase a web page's performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Rendering Patterns
&lt;/h3&gt;

&lt;p&gt;We've previously discussed the two main rendering patterns, namely &lt;code&gt;Client Side Rendering (CSR&lt;/code&gt;) and &lt;code&gt;Server Side Rendering (SSR)&lt;/code&gt;. Now it's time to introduce some new rendering patterns that combine the best of the two worlds.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;SSR&lt;/code&gt; with Rehydration 🌨
&lt;/h4&gt;

&lt;p&gt;This pattern uses a &lt;code&gt;pre-built&lt;/code&gt; DOM with components rendered as HTML. The app then loads the remaining data in the client side.&lt;/p&gt;

&lt;h4&gt;
  
  
  CSR with Pre-rendering 🚧
&lt;/h4&gt;

&lt;p&gt;This pattern renders an &lt;code&gt;app shell&lt;/code&gt; to static HTML during build time .&lt;/p&gt;

&lt;h3&gt;
  
  
  Miscellaneous Performance Tips
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Detect and eliminate unnecessary re-renders. &lt;a href="https://github.com/welldone-software/why-did-you-render"&gt;Why did you render&lt;/a&gt; is a great library if you're building an app using &lt;code&gt;React&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Memoize values with React.memo/callbacks.&lt;/li&gt;
&lt;li&gt;Analyze your packages if you're using &lt;code&gt;WebPack&lt;/code&gt;. &lt;a href="https://www.npmjs.com/package/webpack-bundle-analyzer"&gt;WebPack Bundle Analyzer&lt;/a&gt; is a great choice. I've personally used it to improve the performance of an NFT marketplace.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Choosing the right tool for the job is a critical skill for every Software Engineer. Software choices are usually determined by the project's requirements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f8KdYOwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652033091461/H-Y5nfb79.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f8KdYOwx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1652033091461/H-Y5nfb79.png" alt="Screenshot 2022-05-08 at 21.04.40.png" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources 📚
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://frontendmasters.com/courses/web-perf/"&gt;Web Performance Fundamentals&lt;/a&gt; by &lt;a href="https://www.linkedin.com/in/toddhgardner"&gt;Todd Gardener&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.chrome.com/tags/performance/"&gt;Chrome Developers Blog&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://web.dev/learn-web-vitals/"&gt;Web Dev&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=ctavZT87syI"&gt;Annie Sullivan | Lessons learned from performance monitoring in Chrome&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://aerotwist.com/blog/"&gt;Aero Twist's Blog&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://hpbn.co/"&gt;High Performance Networking&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://frontendmasters.com/courses/web-performance/"&gt;JavaScript Performance&lt;/a&gt; by &lt;a href="https://www.stevekinney.net/"&gt;Steve Kinney&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=7Rrv9qFMWNM"&gt;The main thread is overworked &amp;amp; underpaid (Chrome Dev Summit 2019)&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I'm currently working on a few more sagas. Let me know if you're interested in more sagas in the comments below 😁&lt;/p&gt;

&lt;p&gt;NB: Part 2 of this article. will explore the practical aspects of web rendering performance. I decided to break it into two parts because I don't want to overwhelm the reader.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subscribe or follow to get notified!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fun Fact: This article's story line was inspired by&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This &lt;a href="https://twitter.com/sugarpirate_/status/1348044775887233024?s=20&amp;amp;t=09ThzQyOVSVGyDGfmYR38Q"&gt;Tweet&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Lupe Fiasco's The Cool.&lt;/li&gt;
&lt;li&gt;Demon Slayer: Kimetsu no Yaiba.&lt;/li&gt;
&lt;li&gt;Marvel Movies (Thor, Spiderman and Thor 2).&lt;/li&gt;
&lt;li&gt;Attack on Titan.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>TypeScript Utility Types</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Tue, 12 Apr 2022 11:27:48 +0000</pubDate>
      <link>https://dev.to/junubiman/typescript-utility-types-am6</link>
      <guid>https://dev.to/junubiman/typescript-utility-types-am6</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;In this article I'll be going over TypeScript utility types, explain their importance and also include some useful examples and use cases.&lt;/p&gt;

&lt;p&gt;Utility types are built-in types that allow you to &lt;code&gt;transform&lt;/code&gt; existing types into new modified types.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--R5wcaBoV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649719576878/pwjVyV_C1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R5wcaBoV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649719576878/pwjVyV_C1.png" alt="Untitled Diagram.drawio (3).png" width="464" height="85"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Say we have &lt;code&gt;type A&lt;/code&gt; and we'd like to construct a new &lt;code&gt;type B&lt;/code&gt; that may &lt;code&gt;inherit&lt;/code&gt;, &lt;code&gt;modify&lt;/code&gt; or &lt;code&gt;exclude&lt;/code&gt; properties from &lt;code&gt;type A&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We achieve this by using a utility type i.e &lt;code&gt;type B = UtilityType&amp;lt;A, options&amp;gt;&lt;/code&gt; where &lt;code&gt;UtilityType&lt;/code&gt; represents the type to be used and &lt;code&gt;options&lt;/code&gt; describe the type of operation to perform e.g &lt;code&gt;inherit&lt;/code&gt;, &lt;code&gt;modify&lt;/code&gt; or &lt;code&gt;exclude&lt;/code&gt; etc.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Utility types aren't supported by &lt;code&gt;primitives&lt;/code&gt; except strings which offer &lt;code&gt;Intrinsic String Manipulation Types&lt;/code&gt; to manipulate strings.&lt;br&gt;&lt;br&gt;
Utility types are usually used with compound types such as &lt;code&gt;Interfaces&lt;/code&gt; and &lt;code&gt;Union Types&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Before you get started&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The TypeScript &lt;a href="https://www.typescriptlang.org/play"&gt;playground&lt;/a&gt; is an excellent place to experiment with Utility Types. It's highly recommended to practice what you learn in order to solidify your understanding of the topic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Union Types
&lt;/h2&gt;

&lt;p&gt;A union type is a type formed from two or more other types, representing values that may be any one of those types. We refer to each of these types as the union’s members.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Union types basically &lt;code&gt;combine&lt;/code&gt; two or more types.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unions support the following utility types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exclude&lt;/li&gt;
&lt;li&gt;Extract&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This example to demonstrate how to use utility types with unions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Caveat: Union types are &lt;code&gt;case-sensitive&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type ActivityType =
  "Swimming"
  | "Reading"
  | "Coding"
  | "Dancing"
  | "Jogging";

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1 -Extract
&lt;/h3&gt;

&lt;p&gt;Constructs a type by extracting from Type all union members that are assignable to Union.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax &lt;code&gt;Extract&amp;lt;Type, Union&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where &lt;code&gt;Type&lt;/code&gt; is the initial type and &lt;code&gt;Union&lt;/code&gt; represents the entries we'd like to extract.&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type CognitiveActivity = Extract&amp;lt;ActivityType, "Reading" | "Coding"&amp;gt;;
// transformed type: "Reading" | "Coding"
const activity: CognitiveActivity = "Reading"; 
console.log(activity);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2 - Exclude
&lt;/h3&gt;

&lt;p&gt;Constructs a type by excluding from UnionType all union members that are assignable to ExcludedMembers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax &lt;code&gt;Exclude&amp;lt;UnionType, ExcludedMembers&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where &lt;code&gt;UnionType&lt;/code&gt; is the initial type and &lt;code&gt;ExcludedMembers&lt;/code&gt; represents the entries we'd like to exclude.&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type PhysicalActivity = Exclude&amp;lt;ActivityType, "Reading" | "Coding"&amp;gt;;
 // transformed type: "Swimming" | "Dancing" | "Exercise";
const activity: PhysicalActivity = "Swimming";
console.log(activity);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Type Aliases and Interfaces
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Type Aliases: A type alias is a name for any type.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Interfaces: An interface declaration is another way to name an object type.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This example to demonstrate how to use utility types with type aliases and interfaces.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Intersection types are types that combine properties from two or more types. They're usually used in conjunction with the following utility types.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The general syntax is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type A = {

};
type B = A &amp;amp; {
   bKey: string;
}; // includes all the properties in A and B


type ElectronicDevice = {
  name: string;
  USBPorts: USBPORT[];
  screenDimensions: Dimension;
  buttons: Buttons[];
  wifiConnectivity: boolean;
  manufacturer: string;
  memory: number;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This type represents the properties of an electronic device. Electronic devices come in a variety of shapes and sizes but they share a lot of core features such as buttons, memory, ports etc.&lt;/p&gt;

&lt;p&gt;You can test the types in this example on this TypeScript &lt;a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBAogNhAxsATgewHYEtEBEIBuO0AvFAN4BQUUGAhgLYQBcUAzqlhgOYDc1UAKoBlAEIAFNCmBtWIiQHkASgBUA2gF1+NNohQQIGXFiYY2WTLKjHT5zNqgAjAK7Bgl1qNfuzmhwHcsADMsAGFMDCRgLCJQVkc0NAQ6DAcGFOcgumRnfRRWDhQuPgEmBikQVgxnBkcIFH4AX0pKUEgoULo4RGc4OncUKDJxHABrAB54KPRsPEJiABooACJ6JmWaAB8VlzdLZYA+KAAyCgE2lg6unr6BlXAIBwB6J6g0fwwoC7ZKZtaH6zzRAQe7tMjLACC9DgaG4zggG22y2M3CwwC6y34-3awnS0nEAAtMKQoEokFIACbjfBEYGgiBLKbIGY4GnEI6nKg0C6sTrdXr9KT056vd6fb6-FqISzAJx9RCjOooFCVKC4uj4omRIZnGg0FForqsKgCGjNP4XNXuMAAdX6iAJOoUDDRkwQzMwrKBDJWgRC4QwkWQMTRIERK3kkmkbEOWOlZll3AgwEEbHqohAEODsRAOrobBAGEQUAAFDz2JweABKXVQeMcKD6NhgSwkuj+OhoqB0MBhLpwEu5OBLMAaxhsKu8KAvKBZUbQHtYOv9gT6YC5T5NltmCAAOgp-ToTWx0AAchB-Kn6jqyeuUBh6eMLmgglAkym0ygM1nojmDpR61lZxP1Yc9L0-HV3yvL9M2zUMS2yX9Q13C5J0oIA"&gt;playground&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  1 - Pick
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Syntax &lt;code&gt;Pick&amp;lt;Type, Keys&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constructs a type by picking the set of properties Keys (string literal or union of string literals) from Type.&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Calculator = Pick&amp;lt;ElectronicDevice, "name" | "buttons"&amp;gt; &amp;amp; {
  type: CalculatorType;
  // own types
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2 - Record
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Syntax &lt;code&gt;Record&amp;lt;Keys, Type&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constructs an object type whose property keys are Keys and whose property values are Type. This utility can be used to map the properties of a type to another type.&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type DeviceType = "Analogue" | "Digital";

type SmartPhone = Record&amp;lt;DeviceType, ElectronicDevice&amp;gt; &amp;amp; {
  type: CalculatorType;
  // own types
}

const blackberry: SmartPhone = {
    Digital: {

    }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3 - Omit
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Syntax &lt;code&gt;Omit&amp;lt;Type, Keys&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constructs a type by picking all properties from Type and then removing Keys (string literal or union of string literals).&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type StopWatch = Omit&amp;lt;ElectronicDevice, "wifiConnectivity" | "USBPorts"&amp;gt;;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4 - ReturnType
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Syntax &lt;code&gt;ReturnType&amp;lt;Type&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Constructs a type consisting of the return type of function Type.&lt;/p&gt;

&lt;h4&gt;
  
  
  Demo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const getUserByActivity = async (type: string) =&amp;gt; {
  const response = await apiCall(url, params); // fake api call
  return response.data;
}
type NewUser = ReturnType&amp;lt;typeof getUserByActivity&amp;gt;
const user: NewUser = getUserByActivity(activity.type);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;References:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/utility-types.html"&gt;TypeScript Utility Types&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>MongoDB Aggregation Framework</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Fri, 01 Apr 2022 17:11:00 +0000</pubDate>
      <link>https://dev.to/junubiman/mongodb-aggregation-framework-70b</link>
      <guid>https://dev.to/junubiman/mongodb-aggregation-framework-70b</guid>
      <description>&lt;p&gt;In this tutorial series, I'll guide through MongoDB's Aggregation framework and let you harness its powers to become a more efficient MongoDB user.&lt;/p&gt;

&lt;p&gt;I won't assume any prior experience in this article. It's for you if you'd like to take your MongoDB skills to the next level and leverage its aggregation framework to perform even more expressive queries.&lt;/p&gt;

&lt;p&gt;This blog series will dive deep into the aggregation framework as well as introduce you to some of the newly added features to MongoDB.&lt;/p&gt;

&lt;h1&gt;
  
  
  What is the Aggregation Framework?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;Aggregations operations process data records and return computed results. Aggregation operations group values from multiple documents together and can perform a variety of operations on the grouped data to return a single result. In SQL count(*) and with the group by is an equivalent of MongoDB aggregation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why use the aggregation framework?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Expressive Filters
&lt;/h3&gt;

&lt;p&gt;It gives a powerful set of tools to perform a wide variety of operations such as filtering, sorting, and grouping data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Data Transformations
&lt;/h3&gt;

&lt;p&gt;It allows you to transform your data in a very efficient manner. You could utilize aggregation operators to perform calculations and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Statistical Utilities and Data Analysis
&lt;/h3&gt;

&lt;p&gt;You can use MongoDB Aggregation to perform powerful data analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My previous job relied on the MongoDB aggregation framework to deliver statistical data for visualisations and decision making and that's why I grew to appreciate this framework.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There's plenty more that you can do with this powerful tool!&lt;/p&gt;

&lt;h2&gt;
  
  
  How to perform Aggregation in MongoDB?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MapReduce&lt;/li&gt;
&lt;li&gt;Aggregation Pipelines&lt;/li&gt;
&lt;li&gt;Single Purpose Aggregation Functions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Map-Reduce
&lt;/h3&gt;

&lt;p&gt;The official MongoDB documentation site recommends using the Aggregation Pipeline for most use cases due to its simplicity and expressive nature.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An aggregation pipeline provides better performance and usability than a map-reduce operation.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Single Purpose Aggregation Functions
&lt;/h3&gt;

&lt;p&gt;MongoDB also provides db.collection.estimatedDocumentCount(), db.collection.count() and db.collection.distinct().&lt;/p&gt;

&lt;p&gt;All of these operations aggregate documents from a single collection. While these operations provide simple access to common aggregation processes, they lack the flexibility and capabilities of an aggregation pipeline.&lt;/p&gt;




&lt;h3&gt;
  
  
  Aggregation Pipelines
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aD73LMEQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1617457742489/VvNtNb1om.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aD73LMEQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1617457742489/VvNtNb1om.png" alt="autodraw 03_04_2021.png" width="800" height="447"&gt;&lt;/a&gt;A visual representation of a MongoDB Aggregation Pipeline&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.products.aggregate([{ $match: { discounted: true } }]);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A MongoDB query to perform an aggregation operation.&lt;/p&gt;

&lt;h4&gt;
  
  
  What are pipelines?
&lt;/h4&gt;

&lt;p&gt;A pipeline is a data processing method that relies on steps. You must at least have one operation in your database to perform an aggregation query.&lt;/p&gt;

&lt;h5&gt;
  
  
  Aggregation Pipelines
&lt;/h5&gt;

&lt;p&gt;The aggregation pipeline is a framework for data aggregation modeled on the concept of data processing pipelines. Documents enter a multi-stage pipeline that transforms the documents into aggregated results.&lt;/p&gt;

&lt;p&gt;In simple terms, a pipeline is a composition of stages where data from each stage will serve as input to the next stage.&lt;/p&gt;

&lt;p&gt;An aggregation pipeline consists of stages.&lt;/p&gt;

&lt;h6&gt;
  
  
  Stages
&lt;/h6&gt;

&lt;p&gt;A stage is a data processing step. A stage could be used to derive insights from data, make changes, perform comparisons, and more. Logically, I like to categorize aggregation stages into the following&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CRUD Stages&lt;/li&gt;
&lt;li&gt;Data Analysis Stages &lt;/li&gt;
&lt;li&gt;Transformation stages&lt;/li&gt;
&lt;li&gt;Composition Stages&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  The structure and syntax
&lt;/h5&gt;

&lt;p&gt;You can perform an aggregation via the &lt;code&gt;aggregate()&lt;/code&gt; method which is available on your native driver. This example will use TypeScript so make sure you have it installed!&lt;/p&gt;

&lt;p&gt;We aggregate data using the MongoDB &lt;code&gt;aggregate()&lt;/code&gt; method which is also available in mongoose. It accepts an array that represents an aggregation pipeline. This array could accept several objects with each being an aggregation stage.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introducing Neno - Final</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Fri, 01 Apr 2022 02:19:08 +0000</pubDate>
      <link>https://dev.to/junubiman/introducing-neno-final-16hj</link>
      <guid>https://dev.to/junubiman/introducing-neno-final-16hj</guid>
      <description>&lt;h1&gt;
  
  
  Neno
&lt;/h1&gt;

&lt;p&gt;I've introduced the game and a bit of an explanation of the decisions I had to make while developing this game.&lt;/p&gt;

&lt;p&gt;In this article, I'll be going over the different game features.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE: There game is now live at &lt;a href="https://neno.netlify.app/"&gt;Neno&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;I've covered the project structure in the previous &lt;a href="https://dev.to/junubiman/introducing-neno-part-2-2mc3-temp-slug-2995903"&gt;part&lt;/a&gt; of this article series. I also have a &lt;a href="https://github.com/Emmanuel-Melon/Neno/blob/dev/README.md"&gt;README.md&lt;/a&gt; file with in-depth explanations of what each component in the project does.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Copy the content of &lt;code&gt;.example.env&lt;/code&gt; and then paste it in a new &lt;code&gt;.env&lt;/code&gt; file in order to run this project locally.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  DB structure
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLzaaZ8---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648782662135/uHoFYzxRc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLzaaZ8---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648782662135/uHoFYzxRc.png" alt="Screenshot 2022-04-01 at 06.10.32.png" width="800" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Game Components
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Authentication
&lt;/h3&gt;

&lt;p&gt;The game currently supports authentication via (only on localhost due to issues with terms of service policies).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Facebook&lt;/li&gt;
&lt;li&gt;Google&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;I'm currently working on adding email/phone numbers. I'll also add the ability to play as a guest.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yHelPUx3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649191068037/AZq1-MnCQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yHelPUx3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649191068037/AZq1-MnCQ.png" alt="Screenshot 2022-04-05 at 23.37.34.png" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Home
&lt;/h3&gt;

&lt;p&gt;The home screen shows a menu where you can perform the following operations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;View game instructions&lt;/li&gt;
&lt;li&gt;Modify game settings&lt;/li&gt;
&lt;li&gt;Start a new game&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_wlIEZtE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190764544/kWWIWbDuZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_wlIEZtE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190764544/kWWIWbDuZ.png" alt="Screenshot 2022-04-05 at 23.32.29.png" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Mode
&lt;/h3&gt;

&lt;p&gt;Users can create rooms or join an existing room. You can only join public rooms at the moment. &lt;strong&gt;Private rooms will need an invitation code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OuPCuNnV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190734334/1WmaltonR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OuPCuNnV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190734334/1WmaltonR.png" alt="Screenshot 2022-04-05 at 23.30.19.png" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Creating Room
&lt;/h4&gt;

&lt;p&gt;When a user creates a room, they immediately get redirected to the game lobby where they could chat with other room members until the game starts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ovv3ZnOC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648778834874/phKAnjkPf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ovv3ZnOC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648778834874/phKAnjkPf.png" alt="Screenshot 2022-03-31 at 20.46.35.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Joining an existing room
&lt;/h4&gt;

&lt;p&gt;Users can browse a list of active rooms and join a room of their choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_cmTG2z3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190937068/Izky5E7ri.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_cmTG2z3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190937068/Izky5E7ri.png" alt="Screenshot 2022-04-05 at 23.35.19.png" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Game Lobby ⌚️
&lt;/h3&gt;

&lt;p&gt;Users can chat with other members before the game starts. The host can customize the room's settings as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Only the host can customize or start the game.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wNWe4wkW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649191022694/BNARzQh4l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wNWe4wkW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649191022694/BNARzQh4l.png" alt="Screenshot 2022-04-05 at 23.36.45.png" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Game Screen 🎮
&lt;/h3&gt;

&lt;p&gt;Screen where user plays the quiz in real-time with their friends&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5K-Q_UtB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648776214872/ccfi9Z_lN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5K-Q_UtB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648776214872/ccfi9Z_lN.png" alt="Screenshot 2022-04-01 at 04.01.15.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges 😩
&lt;/h2&gt;

&lt;p&gt;I am having difficulties keeping the count down timer for each round in sync between the game players.&lt;/p&gt;

&lt;p&gt;I know I'm supposed to store the timer state in the server but not sure how to keep it in sync. Will be addressing this issue over the weekend.&lt;/p&gt;

&lt;h3&gt;
  
  
  Current Bottlenecks
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Implement words API.&lt;/li&gt;
&lt;li&gt;I need to be able to show a live leaderboard.&lt;/li&gt;
&lt;li&gt;Showing game events such as when a user joins or leaves a room.&lt;/li&gt;
&lt;li&gt;Implementing optimistic ui for a more interactive user experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Planned Improvements 🏆
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fixing the timer synchronisation issue&lt;/li&gt;
&lt;li&gt;Allow users to add friends so they could invite them into rooms they create.&lt;/li&gt;
&lt;li&gt;Implementing a leaderboard feature&lt;/li&gt;
&lt;li&gt;Solo and offline gameplay for when users have no connectivity.&lt;/li&gt;
&lt;li&gt;Animations and audio to make the game more interactive.&lt;/li&gt;
&lt;li&gt;Making it fully responsive (mobile version).&lt;/li&gt;
&lt;li&gt;Serving static assets via s CDN&lt;/li&gt;
&lt;li&gt;Refactor the logic in &lt;code&gt;GameScreen&lt;/code&gt; to &lt;code&gt;useReducer&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Introducing Neno - Part 2</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Thu, 24 Mar 2022 21:49:30 +0000</pubDate>
      <link>https://dev.to/junubiman/introducing-neno-part-2-3e70</link>
      <guid>https://dev.to/junubiman/introducing-neno-part-2-3e70</guid>
      <description>&lt;p&gt;I've introduced the game idea and its rules in the previous &lt;a href="https://dev.to/junubiman/introducing-neno-part-1-241g-temp-slug-8605419"&gt;part&lt;/a&gt; of this series. In this article., I'll be going over the architecture of the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This article is a work in progress and I'll frequently update it.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Game Requirements
&lt;/h1&gt;

&lt;p&gt;The first step to building any real world application is requirements analysis and gathering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt; Building an online word guessing game with an early 2000's/grade school aesthetic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real time
&lt;/h2&gt;

&lt;p&gt;The game is going to be &lt;code&gt;online&lt;/code&gt; meaning we'd need to allow users to play in real time.&lt;/p&gt;

&lt;p&gt;The game allows players to create or join public/private rooms and play with others in real-time. Such functionality is achieved via web sockets.&lt;/p&gt;

&lt;p&gt;I'll be using GraphQL subscriptions to achieve this functionality since we're using Hasura.&lt;/p&gt;

&lt;p&gt;I've enabled authentication via Facebook and Google to make it easier to invite friends for new games.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qVk-gnxy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190530266/tnhV0USD-.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qVk-gnxy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1649190530266/tnhV0USD-.png" alt="Screenshot 2022-04-05 at 23.27.33.png" width="800" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Retro aesthetic
&lt;/h2&gt;

&lt;p&gt;I needed to use a UI library to simplify my development process because I wanted the game to have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistent theme &lt;/li&gt;
&lt;li&gt;Layout components&lt;/li&gt;
&lt;li&gt;Customisable components&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I found Chakra UI to be a good library because it gave me tons of flexibility by allowing me to use my own custom styles in most situations. I've only needed to use Chakra components for accessibility and well designed APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development experience
&lt;/h2&gt;

&lt;p&gt;I chose Next.js as my framework due to it's performance optimisation and easy to follow structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next.js is an opinionated framework for building server rendered applications.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  State management
&lt;/h2&gt;

&lt;p&gt;I want the state of my game to be predictable and I also wanted to limit the number of states that I'd have to deal with.&lt;/p&gt;

&lt;p&gt;For this I'm going to be using &lt;a href="https://xstate.js.org/"&gt;xState&lt;/a&gt; which is a state management library that uses &lt;code&gt;state machines&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you're interested in learning more about state machines checkout this awesome &lt;a href="https://kentcdodds.com/blog/implementing-a-simple-state-machine-library-in-javascript"&gt;article&lt;/a&gt; from Kent C. Dodds.&lt;/p&gt;




&lt;h2&gt;
  
  
  Directory Structure
&lt;/h2&gt;

&lt;p&gt;I've used Next.js which is an opinionated JavaScript framework but I had an option to create my directorates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;📦src
 ┣ 📂Game
 ┣ 📂Rooms
 ┣ 📂User
 ┣ 📂components
 ┣ 📂hooks
 ┣ 📂layout
 ┣ 📂lib
 ┃ ┣ 📂graphql
 ┣ 📂machines
 ┃ ┣ 📂game
 ┃ ┗ 📂player
 ┣ 📂providers
 ┣ 📂utils

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Root
&lt;/h3&gt;

&lt;p&gt;The root consists of configuration files and project directories.&lt;/p&gt;

&lt;h4&gt;
  
  
  Config files
&lt;/h4&gt;

&lt;p&gt;At the very root of my project, I have some config files which I had use to initialize the project.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nvm.rc&lt;/code&gt; to dynamically switch to the desired Node version for this project.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tsconfig.json&lt;/code&gt; for my TypeScript rules&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;codegen&lt;/code&gt; to generate types for my GraphQL schema&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;eslint.rc&lt;/code&gt; to enforce proper code styles and rule`&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.husky&lt;/code&gt; I use it for &lt;code&gt;pre-commit&lt;/code&gt; hooks to ensure that my code adheres to quality standards before pushing it. It mainly &lt;code&gt;lints&lt;/code&gt; and &lt;code&gt;formats&lt;/code&gt; my code before every commit. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Directories
&lt;/h4&gt;

&lt;p&gt;I have structured my directories based on the domain.&lt;/p&gt;

&lt;h4&gt;
  
  
  Components
&lt;/h4&gt;

&lt;p&gt;These are common UI components that are shared between different parts of the application. They include &lt;code&gt;Button&lt;/code&gt;, &lt;code&gt;Inputs&lt;/code&gt; timers etc.&lt;/p&gt;

&lt;h5&gt;
  
  
  Game
&lt;/h5&gt;

&lt;p&gt;Contains game specific components.&lt;/p&gt;

&lt;h5&gt;
  
  
  Rooms
&lt;/h5&gt;

&lt;p&gt;Contains room specific components.&lt;/p&gt;

&lt;h5&gt;
  
  
  Hooks
&lt;/h5&gt;

&lt;p&gt;I have created hooks to help aid abstract my GraphQL operations. This is general structure for many of my network related hooks.&lt;/p&gt;

&lt;p&gt;Here's how the raw &lt;code&gt;gql&lt;/code&gt; mutation looks like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
export const INSERT_ROOM_MEMBER = gql&lt;/code&gt;&lt;br&gt;
  mutation insertRoomMember($member: rooms_members_insert_input!) {&lt;br&gt;
    insert_rooms_members_one(object: $member) {&lt;br&gt;
      id&lt;br&gt;
      role&lt;br&gt;
      roomId&lt;br&gt;
      member {&lt;br&gt;
        id&lt;br&gt;
        lastSeen&lt;br&gt;
        createdAt&lt;br&gt;
        email&lt;br&gt;
      }&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
`;&lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is how it looks like after wrapping the mutation in a hook.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`&lt;br&gt;
export const useInsertRoomMember = () =&amp;gt; {&lt;br&gt;
  const [insertRoomMember, { data, loading, error }] = useMutation&amp;lt;&lt;br&gt;
    InsertRoomMemberMutation,&lt;br&gt;
    InsertRoomMemberMutationVariables&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;(INSERT_ROOM_MEMBER);&lt;br&gt;
  return useMemo(&lt;br&gt;
    () =&amp;gt; ({&lt;br&gt;
      memberLoading: loading,&lt;br&gt;
      memberError: error,&lt;br&gt;
      member: data?.insert_rooms_members_one,&lt;br&gt;
      insertRoomMember: (member: OperationVariables) =&amp;gt; {&lt;br&gt;
        return insertRoomMember({ variables: { member } }).then(&lt;br&gt;
          ({ data }) =&amp;gt; data?.insert_rooms_members_one&lt;br&gt;
        );&lt;br&gt;
      },&lt;br&gt;
    }),&lt;br&gt;
    [loading, error, data?.insert_rooms_members_one, insertRoomMember]&lt;br&gt;
  );&lt;br&gt;
};&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Machines
&lt;/h5&gt;

&lt;p&gt;I use this directory to define state machines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I have created two machines to represent/manage the state of my game.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;player&lt;/code&gt; controls player specific actions&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;game&lt;/code&gt; controls the flow of the game&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Providers
&lt;/h5&gt;

&lt;p&gt;This is for global providers which I use to wrap my entire project. I mainly use two providers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Theme&lt;/code&gt; to control theme of the entire game&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Game&lt;/code&gt; to control the data of the game&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Utils
&lt;/h5&gt;

&lt;p&gt;A set of utility functions to help with the control of the game.&lt;/p&gt;

&lt;h5&gt;
  
  
  Lib
&lt;/h5&gt;

&lt;p&gt;For any 3rd party libraries that I intend to use in my game.&lt;/p&gt;

&lt;p&gt;Here is where I initialise my Apollo Client and point it to my running Hasura instance.&lt;/p&gt;

&lt;p&gt;I've created a few tables and enabled read/write permissions for operations necessary to play the game.&lt;/p&gt;

&lt;h6&gt;
  
  
  Codegen
&lt;/h6&gt;

&lt;p&gt;I have also setup &lt;code&gt;codegen&lt;/code&gt; which is a very useful tool to generate types for your schema.&lt;/p&gt;

&lt;p&gt;I have a &lt;code&gt;codegen&lt;/code&gt; script in my &lt;code&gt;package.json&lt;/code&gt; file which uses apollo-codegen to generates relevant types to be mapped to our GraphQL queries and mutations. These generated types are what we then use in our query and mutation hooks to state the types.&lt;/p&gt;

&lt;p&gt;To specify to the codegen what we would like to generate, a file codegen.js is passed to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Game Logic
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DI9x5McG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648158132204/tiRfBBnXO.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DI9x5McG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1648158132204/tiRfBBnXO.png" alt="Screenshot 2022-03-13 at 20.15.46.png" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Players are required to guess 4 words within 40 seconds.&lt;/li&gt;
&lt;li&gt;Active players are shown along with their results for each round.&lt;/li&gt;
&lt;li&gt;The last player to submit is eliminated while the others proceed to the next round.&lt;/li&gt;
&lt;li&gt;Each round generates a new letter and thus a new set of words to be guessed.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Introducing Neno - Part 1</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Mon, 14 Mar 2022 15:51:10 +0000</pubDate>
      <link>https://dev.to/junubiman/introducing-neno-part-1-5df6</link>
      <guid>https://dev.to/junubiman/introducing-neno-part-1-5df6</guid>
      <description>&lt;h1&gt;
  
  
  Neno
&lt;/h1&gt;

&lt;p&gt;I'll be sharing my progress in building Neno, an online word guessing game. This is going to be my entry for the Hasura x Hashnode Hackathon and my first ever Hackathon entry.&lt;/p&gt;

&lt;h2&gt;
  
  
  A little story 📖
&lt;/h2&gt;

&lt;p&gt;I was reminiscing with my little sister about our childhood and all the fun we had. Life was fun and we had little to no worries.&lt;/p&gt;

&lt;p&gt;We talked about all the games we played as kids and she showed me modern versions of Snake Xenia and Bounce which we used to play on my Nokia 3310.&lt;/p&gt;

&lt;p&gt;Playing those games evoked so much nostalgia it made me feel I should revisit all of our childhood games.&lt;/p&gt;

&lt;p&gt;That's why I decided to bring one of my favourite childhood games into life. We didn't really have a name for it that's why I struggled finding a name for this project 😂&lt;/p&gt;

&lt;p&gt;I ended up naming it "Neno" which translates to "Word" in the Swahili language.&lt;/p&gt;

&lt;p&gt;Neno is a modernised online version of this game. It's played in groups, minimum of 2 and maximum of 8.&lt;/p&gt;

&lt;p&gt;Players are assigned a letter and each member is required to come up with 3 words that start with the letter.&lt;/p&gt;

&lt;p&gt;There's a timer and the fastest player to guess all the words correctly wins the round.&lt;/p&gt;

&lt;h3&gt;
  
  
  Game Modes
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Solo 🙌🏿
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Good for practice &lt;/li&gt;
&lt;li&gt;Test your guessing skills against a timer and see how many words you can guess in 3 minutes&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Tournament 🏆
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The player with the lowest score is eliminated in each round.&lt;/li&gt;
&lt;li&gt;The last remaining player wins the game.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Initial steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tech setup 👨🏿‍💻
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;I created a new &lt;a href="https://hasura.io"&gt;Hasura&lt;/a&gt; project and connected to a &lt;a href="https://www.heroku.com"&gt;Heroku&lt;/a&gt; hosted &lt;a href="https://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; instance.&lt;/li&gt;
&lt;li&gt;I then created a public &lt;a href="https://github.com/Emmanuel-Melon/frodle"&gt;Github Repository&lt;/a&gt; for the project.&lt;/li&gt;
&lt;li&gt;Pick a tech stack for the project (GraphQL Apollo, Next.js, Chakra UI and xState).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Brain storming 🧠
&lt;/h3&gt;

&lt;p&gt;I had a brain storming session where I decided&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The game will be online and will have public/private rooms (max 8 players).&lt;/li&gt;
&lt;li&gt;The game will have a grade school/early 2000s with a modernised touch kind of aesthetic.&lt;/li&gt;
&lt;li&gt;The game will have a chat room where players could chat before and after a game has ended.&lt;/li&gt;
&lt;li&gt;Search for game assets that'll match the desired aesthetic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Next Steps 💡
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Highlight different game components.&lt;/li&gt;
&lt;li&gt;Project setup process on Hasura and Github.&lt;/li&gt;
&lt;li&gt;Code structure an organisation.&lt;/li&gt;
&lt;li&gt;Tech plan for the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let's connect 🤙🏿
&lt;/h2&gt;

&lt;p&gt;I'm active on &lt;a href="https://twitter.com/junubiman"&gt;Twitter&lt;/a&gt;, &lt;a href="https://github.com/Emmanuel-Melon"&gt;Github&lt;/a&gt; and also &lt;a href="https://eman.hashnode.dev/"&gt;Hashnode&lt;/a&gt;!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding how Git works</title>
      <dc:creator>Emmanuel Gatwech</dc:creator>
      <pubDate>Sat, 29 Jan 2022 13:39:47 +0000</pubDate>
      <link>https://dev.to/junubiman/understanding-how-git-works-1nma</link>
      <guid>https://dev.to/junubiman/understanding-how-git-works-1nma</guid>
      <description>&lt;p&gt;This article will help you gain a practical understanding of Git's most commonly used features. Having a solid grasp of these concepts will help you avoid common mistakes and also use Git more efficiently.&lt;/p&gt;

&lt;p&gt;For beginners, it's recommended to read the article from start to finish. Experienced users could use it as a reference guide.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Git?
&lt;/h2&gt;

&lt;p&gt;The official Git website defines it as&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning-fast performance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why should you use Git?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git allows you to track bugs by inspecting the commits that led to them.&lt;/li&gt;
&lt;li&gt;Automate deployments of code via CI/CD pipelines where each commit triggers a new build.&lt;/li&gt;
&lt;li&gt;Git allows you to keep track of changes in your files and manage their versions over time.&lt;/li&gt;
&lt;li&gt;Code quality assurance where you could have pre-commit hooks that ensure your code adheres to a particular standard or style guide.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Structure
&lt;/h2&gt;

&lt;p&gt;A Git project consists of a &lt;code&gt;Repository&lt;/code&gt;, a &lt;code&gt;Working Tree&lt;/code&gt;, and a &lt;code&gt;Staging Area&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does Git work?
&lt;/h3&gt;

&lt;p&gt;A file has to go through these steps to be processed in Git&lt;/p&gt;

&lt;h4&gt;
  
  
  Working Tree
&lt;/h4&gt;

&lt;p&gt;Th Work­ing Tree in Git is the direc­to­ry containing all of your files (track and untracked). Every file and subdirectory is eligible to be added to the staging area.&lt;/p&gt;

&lt;p&gt;Changes in the working tree are tracked by the &lt;code&gt;index&lt;/code&gt; in Git.&lt;/p&gt;

&lt;h4&gt;
  
  
  Staging Area
&lt;/h4&gt;

&lt;p&gt;This is the step when a file is added from the working tree to a special area known as the &lt;code&gt;staging area&lt;/code&gt;. Git recognises this file and keeps track of the changes to it.&lt;/p&gt;

&lt;h4&gt;
  
  
  History
&lt;/h4&gt;

&lt;p&gt;A commit log and HEAD will point to the most recent commit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Repositories
&lt;/h2&gt;

&lt;p&gt;A Git repository also known as a &lt;code&gt;repo&lt;/code&gt; is a container for your project. Initialising a new Git repository creates a hidden directory&lt;code&gt;.git/&lt;/code&gt; inside the project that allows you to keep track of all of your changes and allows you to manage your work using various &lt;code&gt;commands&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I recommend visiting the &lt;code&gt;./git&lt;/code&gt; directory and navigating it to understand how Git represents and manages files internally&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You'll most likely encounter the following objects &lt;code&gt;HEAD&lt;/code&gt;, &lt;code&gt;index&lt;/code&gt;, &lt;code&gt;logs&lt;/code&gt;, and &lt;code&gt;packed-refs&lt;/code&gt; in the &lt;code&gt;.git/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Initialising a git repository&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The distributed nature of Git gives you the ability to collaborate with others on the same project with each having a local copy and a &lt;code&gt;remote&lt;/code&gt; copy that is always kept in sync between all collaborators.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;a href="https://git-scm.com/docs/git-worktree"&gt;Local Repository&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A Remote Repository also known as a &lt;code&gt;remote&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Working Tree
&lt;/h3&gt;

&lt;p&gt;The working directory consists of files that you are currently working on. You can think of a working tree as a file system where you can view and modify files.&lt;/p&gt;

&lt;p&gt;A working tree consists of the files you're currently working on. Files are usually stored in the same directory as the &lt;code&gt;.git/&lt;/code&gt; folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Index
&lt;/h3&gt;

&lt;p&gt;Also known as the staging area is where commits are prepared. The index compares the files in the working tree to the files in the repo. When you make a change in the working tree, the index marks the file as modified before it is committed.&lt;/p&gt;

&lt;h3&gt;
  
  
  State in Git
&lt;/h3&gt;

&lt;p&gt;A file in Git could be in one of the 4 stages&lt;/p&gt;

&lt;p&gt;You can view the state of your repository by running the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git status

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Untracked
&lt;/h4&gt;

&lt;p&gt;Existing in the working directory but has not been staged yet.&lt;/p&gt;

&lt;h4&gt;
  
  
  Staged
&lt;/h4&gt;

&lt;p&gt;Now in the staging area but has not been committed yet.&lt;/p&gt;

&lt;h4&gt;
  
  
  Modified
&lt;/h4&gt;

&lt;p&gt;Has been added to the staging area but was subject to a change. Items have to be re-added to the staging area after every change.&lt;/p&gt;

&lt;h4&gt;
  
  
  Committed
&lt;/h4&gt;

&lt;p&gt;The file is now committed and can be pushed to a remote branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Commits in Git
&lt;/h3&gt;

&lt;p&gt;A commit is a snapshot of what the &lt;code&gt;working tree&lt;/code&gt; looked like at the time. Commits are stored in the &lt;code&gt;./git/objects/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;A commit is represented as a &lt;code&gt;Sha1&lt;/code&gt; hash that contains the following information.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Author&lt;/li&gt;
&lt;li&gt;Date&lt;/li&gt;
&lt;li&gt;Message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Git is Distributed&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Distribution in Git means that everyone gets their own &lt;code&gt;version&lt;/code&gt; to &lt;code&gt;control&lt;/code&gt;. All changes are local to users unless explicitly shared and maybe &lt;code&gt;merged&lt;/code&gt; using a version control provider such as Github or Gitlab.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A distributed version control system is a system that allows you to track changes to files collaboratively.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This allows you to collaborate with others on the same project. Git offers a feature called &lt;code&gt;branching&lt;/code&gt; to separate your work and it's generally recommended to work on a different branch other than the main.&lt;/p&gt;

&lt;h3&gt;
  
  
  Branches in Git
&lt;/h3&gt;

&lt;p&gt;A Git branch is similar to a tree branch. It belongs to the same repository but might contain different data. You can create new branches and more! Branches are managed via &lt;code&gt;references&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YbagtMaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1618246982081/34IIBTMZC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YbagtMaF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1618246982081/34IIBTMZC.png" alt="autodraw 12_04_2021.png" width="800" height="573"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Remote Repository
&lt;/h2&gt;

&lt;p&gt;A remote in Git is a common repository that all team members use to exchange their changes. In most cases, such a remote repository is stored on a code hosting service like GitHub or on an internal server. In contrast to a local repository, a remote typically does not provide a file tree of the project's current state.&lt;/p&gt;

&lt;p&gt;You need a version control provider that supports Git to work with remote repositories. Gitlab and Github are popular options.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remote repositories are useful if you'd like to:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sharing your code with others.&lt;/li&gt;
&lt;li&gt;Collaborating on a project.&lt;/li&gt;
&lt;li&gt;Contributing to other people's projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can create your own remote repo or use an existing repo, I'll show you how to do both.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating a remote repository&lt;/strong&gt; You create a remote by running the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add &amp;lt;origin&amp;gt;&amp;lt; https://github.com/user/repo.git&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command takes two arguments&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name which is &lt;code&gt;origin&lt;/code&gt; in this case&lt;/li&gt;
&lt;li&gt;Url points to the location of the remote repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Using an existing remote repository&lt;/strong&gt; There are generally two ways to do this. You could either clone the project and push code directly, provided that you've been granted access to write into it or use the Git Workflow by forking the project and then making contributions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Cloning
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone &amp;lt;origin&amp;gt;&amp;lt; https://github.com/user/repo.git&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a copy of that repository on your machine with the origin pointing towards this repository.&lt;/p&gt;

&lt;h4&gt;
  
  
  Forking
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Contributing to other people's repositories&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone &amp;lt;origin&amp;gt;&amp;lt; https://github.com/user/repo.git&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Staying in sync
&lt;/h2&gt;

&lt;p&gt;It's important to stay in sync when collaborating on a project and Git provides different ways to do it.&lt;/p&gt;

&lt;p&gt;We'll look at two strategies to keep your work in sync.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fPorsp9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1618264271797/MUNofvIs7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fPorsp9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn.hashnode.com/res/hashnode/image/upload/v1618264271797/MUNofvIs7.png" alt="autodraw 13_04_2021.png" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Git Merge and Rebase
&lt;/h3&gt;

&lt;p&gt;These are two common methods Git uses to keep your files in sync when collaborating with others on a project.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://git-scm.com/docs/git-merge"&gt;Merge&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;You merge by pulling the remote repository changes into your local branch. You have to make sure that your staging area is clear before attempting a merge. The newly added changes will be added via a &lt;code&gt;merge commit&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://git-scm.com/docs/git-rebase"&gt;Rebase&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;Rebasing is integrating changes from one branch into another.&lt;/p&gt;

&lt;h5&gt;
  
  
  Interactive Rebase
&lt;/h5&gt;

&lt;p&gt;This is a type of rebasing where Rebasing files is quite straightforward files in Git is a simple process.&lt;/p&gt;

&lt;h5&gt;
  
  
  Squash
&lt;/h5&gt;

&lt;p&gt;This command allows you to squash the last &lt;code&gt;n commits&lt;/code&gt; into a single commit. This is really nice if you'd like to have a neat commit history. It's usually recommended to use the last commit message but you can totally customise the message.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
commit 5b937deaf4f6ae6f2239a7ac488ece186ff573d3
Author: `&amp;lt;Your Name&amp;gt; &amp;lt;yourname@domain.com&amp;gt;`
Date: Tue Dec 1 10:41:41 2020 +0000

commit 5b937deaf4f6ae6f2239a7ac488ece186ff573d3
Author: `&amp;lt;Your Name&amp;gt; &amp;lt;yourname@domain.com&amp;gt;`
Date: Tue Dec 1 10:41:41 2020 +0000

commit 5b937deaf4f6ae6f2239a7ac488ece186ff573d3
Author: `&amp;lt;Your Name&amp;gt; &amp;lt;yourname@domain.com&amp;gt;`
Date: Tue Dec 1 10:41:41 2020 +0000

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a Git command, it's rather a concept that can be implemented via a rebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ideal for&lt;/strong&gt; This command is useful if you'd like to keep your commit log/history clean by combining all of your commit messages into a single message.&lt;/p&gt;

&lt;h4&gt;
  
  
  Git Stash
&lt;/h4&gt;

&lt;p&gt;Allows you to save work without committing it. You stash changes by running &lt;code&gt;git stash&lt;/code&gt; on the currently active directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stash Pop&lt;/strong&gt; Retrieves the latest stashed changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stash apply &lt;code&gt;&amp;lt;n&amp;gt;&lt;/code&gt;&lt;/strong&gt; where &lt;code&gt;n&lt;/code&gt; is the stashed item. Applies a particular change from your stash list. I use this feature a lot when I'm required to push code for a review while still experimenting with an idea locally.&lt;/p&gt;

&lt;h4&gt;
  
  
  Ideal for
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;experimenting with an idea locally.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Miscellaneous Git Commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Amend&lt;/li&gt;
&lt;li&gt;Revert&lt;/li&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/docs/git-cherry-pick"&gt;Cherry Pick&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Amend
&lt;/h4&gt;

&lt;p&gt;A Git command cannot be edited, the &lt;code&gt;Sha1&lt;/code&gt; hash contains commit-related metadata such as the author and date of creation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amending a commit means creating a new copy of that said commit with a new message.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git amend -m commit.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Revert
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;git commit --amend&lt;/code&gt; allows you to edit your last commit.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;a href="https://git-scm.com/docs/git-stash"&gt;Stash&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The &lt;code&gt;git stash&lt;/code&gt; command allows you to save your changes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Writing better commit messages
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Add a descriptive name related to the task the commit addresses. The name of the commit should summarise the reason for the commit.&lt;/li&gt;
&lt;li&gt;Use active voice, simple descriptions.&lt;/li&gt;
&lt;li&gt;I recommend following the &lt;a href="https://www.conventionalcommits.org/en/v1.0.0-beta.2/#:~:text=Commits%20MUST%20be%20prefixed%20with,bug%20fix%20for%20your%20application."&gt;Conventional Commits Spec&lt;/a&gt;, a specification for adding human and machine readable meaning to commit messages.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Commit messages are pre-fixed with tags such as &lt;code&gt;feat:&lt;/code&gt;, &lt;code&gt;fix:&lt;/code&gt; to insinuate intend behind the commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Official Git Documentation&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.git-tower.com/learn/git"&gt;Git Tower&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
