<?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>Forem: IvanDev</title>
    <description>The latest articles on Forem by IvanDev (@ivansing).</description>
    <link>https://forem.com/ivansing</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%2F1346069%2Fe48e7439-266e-4b2b-81b4-15e3b06c7305.jpeg</url>
      <title>Forem: IvanDev</title>
      <link>https://forem.com/ivansing</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ivansing"/>
    <language>en</language>
    <item>
      <title>Graph-Based Movie Recommendations: A Practical Guide with Python</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Tue, 23 Sep 2025 21:48:29 +0000</pubDate>
      <link>https://forem.com/ivansing/graph-based-movie-recommendations-a-practical-guide-with-python-4all</link>
      <guid>https://forem.com/ivansing/graph-based-movie-recommendations-a-practical-guide-with-python-4all</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;I built a small Python project where I use a well-known algorithm called BFS (Breadth-First Search), which I employ to recommend movies based on the closest match by genre. The BFS algorithm, for example, searches for movies related within N degrees of separation, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;movie_graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The Matrix&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Inception&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Blade Runner&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Dark City&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Inception&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The Matrix&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Interstellar&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Memento&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="c1"&gt;# ... More connections
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see or try to understand, The Matrix is very similar to Blade Runner or Dark City (to some extent), and another film in roughly the same neighborhood would be: Inception is similar to or has connections to The Matrix, Interstellar, and, finally, Memento.&lt;/p&gt;

&lt;p&gt;For the structure, I went with something basic that’s always used for these small projects, so you can understand the prototypes whether it’s for a big or small idea.&lt;/p&gt;

&lt;p&gt;Here we find the README file, the data folder or database in a JSON file, the entry point &lt;code&gt;main.py&lt;/code&gt;, and the &lt;code&gt;src&lt;/code&gt; directory where we put all the files for the program’s logic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;movie_recommender/
├── README.md
├── data
│ └── movies_sample.json
├── main.py └── src
└── src
└── movie_data.py
└── search.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Of course, we need to make our interface as easy and obvious as possible in this case, so the CLI would be the way to go—to keep things simple and not difficult to understand, which is also fun (well, for me anyway :) ).&lt;/p&gt;

&lt;p&gt;So we start with a welcome message, just like we would in any game. After that, we ask what to do—that is, we give options. This is usually done in almost any language with a while loop, which is the easiest way to discard options as they’re chosen, and the game or program continues with a series of questions until we’ve answered everything and the program ends.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is what I mean:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Welcome to Movie Recommender!

Enter a movie title &lt;span class="o"&gt;(&lt;/span&gt;or &lt;span class="nb"&gt;type &lt;/span&gt;to search&lt;span class="o"&gt;)&lt;/span&gt;: inc
Suggestions: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'Inception'&lt;/span&gt;, &lt;span class="s1"&gt;'The Incredibles'&lt;/span&gt;, &lt;span class="s1"&gt;'Incendies'&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

Selected: Inception Inception

What would you like to &lt;span class="k"&gt;do&lt;/span&gt;?
1. Find similar movies Find similar movies
2. See top-rated titles &lt;span class="k"&gt;in &lt;/span&gt;the same genre
3. Explore by actor/director Explore by actor/director

Choice: 1

Movies similar to Inception:
- Interstellar &lt;span class="o"&gt;(&lt;/span&gt;same director, sci-fi&lt;span class="o"&gt;)&lt;/span&gt;
- The Matrix &lt;span class="o"&gt;(&lt;/span&gt;Mind-bending, action&lt;span class="o"&gt;)&lt;/span&gt;
- Memento &lt;span class="o"&gt;(&lt;/span&gt;Christopher Nolan, thriller&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But anyway, just to refresh your memory, the BFS algorithm searches all nodes at one level, and when it’s done with that level, it moves on to the next level until it’s finished. That’s basically it: it visits each node and keeps track of which ones it’s visited until it’s done. Consequently, it uses a Queue (FIFO) data structure → BFS = Goes level by level, meaning the first one in is the first one out, just like a line. Well, this topic is quite extensive, and I’d have to write another article since it takes time to understand how this type of data structure works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tree Structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;      A
     / &lt;span class="se"&gt;\&lt;/span&gt;
    C   B
   / &lt;span class="se"&gt;\ &lt;/span&gt;/ &lt;span class="se"&gt;\&lt;/span&gt;
  G  F E  D
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The BFS = [A] Root&lt;/p&gt;

&lt;p&gt;First level = [B, C]&lt;/p&gt;

&lt;p&gt;Second level = [D, E, F, G]&lt;/p&gt;

&lt;p&gt;BFS Order: A → B → C → D → E → F → G&lt;/p&gt;

&lt;p&gt;What this highly popular algorithm does is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Depth 1: Direct connections (very highly similar movies)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Depth 2: Extended recommendation (movies similar to other similar movies)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As you can imagine, this algorithm is basically everyplace on the internet, from movie recommenders to the products we buy on any e-commerce site—like related items—it’s really quite popular.&lt;/p&gt;

&lt;p&gt;Okay, all this talk is a shame, my friend. Let’s get down to business—briefly:&lt;/p&gt;

&lt;p&gt;First, we create movies_sample.json, which is our small internal or lite database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;movies&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Inception&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;year&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2010&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;genres&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sci-Fi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Thriller&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rating&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;8.8&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;English&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;title&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;28 Days Later&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;year&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2002&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;genres&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sci-Fi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Drama&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Thriller&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rating&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;7.3&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;

&lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="nx"&gt;more&lt;/span&gt;

&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, we define the MovieDatabase class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MovieDatabase&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;  &lt;span class="c1"&gt;# id -&amp;gt; movie info
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connections&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;  &lt;span class="c1"&gt;# id  -&amp;gt; list of connected ids
&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;load_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;filepath&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Load movie data from JSON file&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filepath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c1"&gt;# Extract movies and store them
&lt;/span&gt;            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;movies&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; 

            &lt;span class="c1"&gt;# Extract connections
&lt;/span&gt;            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;connections&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connections&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;movie_id&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;similar_to&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_movie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Return movie info by ID&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_all_movies&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Return list of all movies&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First import json module to extract data, then we initialize the constructor with its variables instantiated. Now that we have the above, we can define methods so that our main class, &lt;code&gt;MovieRecommenderCLI&lt;/code&gt;, can interact with them. The first method is for loading data from the JSON file, from which we extract the data so that we can manipulate it once it’s been extracted. The other two methods are the getters &lt;code&gt;get_movie&lt;/code&gt; and &lt;code&gt;get_all_movies&lt;/code&gt;; as you can see, they are for reading data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MovieSearcher&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        Initialize with a MovieDatabase instance

        Parameters:
            database: MovieDatabase object that contains our movie data
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the next step, we will proceed to create the &lt;code&gt;MovieSearcher&lt;/code&gt; class. This is where we find several algorithms, such as the &lt;code&gt;search_by_title&lt;/code&gt; method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;search_by_title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        Search movies by partial title match (case-insensitive)

        Parameters:
            query: String to search for in movie titles

        Returns:
            List of matching movie dictionaries
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;query_lower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Convert to lowercase for case-insensitive search
&lt;/span&gt;
        &lt;span class="c1"&gt;# Iterate through all movies in database
&lt;/span&gt;        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="c1"&gt;# Check if query appears anywhere in the title
&lt;/span&gt;            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;query_lower&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In which we convert the query to lowercase, iterate through each movie in the database, check if the query appears in the movie’s title (also converted to lowercase), and add the movies to the results list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;search_by_genre&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;genre&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        Find all movies that have a specific genre

        Parameters:
            genre: String genre to search for

        Returns:
            List of movies that contain this genre
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;genre_lower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;genre&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="c1"&gt;# Convert all genres to lowercase for comparison
&lt;/span&gt;            &lt;span class="n"&gt;movie_genres_lower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;genres&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;

            &lt;span class="c1"&gt;# Check if the genre appears in any of the movie's genres
&lt;/span&gt;            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie_genre&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;movie_genres_lower&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;genre_lower&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;movie_genre&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="c1"&gt;# Partial match
&lt;/span&gt;                    &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;  &lt;span class="c1"&gt;# Don't add the same movie twice
&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this, we continue with the next method, &lt;code&gt;search_by_genre&lt;/code&gt;, which does the following: Convert the string parameter &lt;code&gt;genre&lt;/code&gt; to lowercase, iterate through each movie, and check all its genres. We use a partial comparison, such as ("Horror" matches "Slasher Horror"), and finally break after finding the first match to prevent duplicates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;find_recommendations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        Use BFS to find related movies up to a certain depth

        Parameters:
            movie_id: ID of the movie to find recommendations for
            depth: How many &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hops&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; away to search (1 = direct connections only)

        Returns:
            List of recommended movies with their connection distance
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

        &lt;span class="n"&gt;visited&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# Track visited movies
&lt;/span&gt;        &lt;span class="n"&gt;queue&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;  &lt;span class="c1"&gt;# (movie_id, current_depth)
&lt;/span&gt;        &lt;span class="n"&gt;recommendations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;current_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;current_depth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# FIFO for BFS
&lt;/span&gt;
            &lt;span class="c1"&gt;# Skip if we've seen this movie or exceeded depth
&lt;/span&gt;            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;current_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;visited&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;current_depth&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;continue&lt;/span&gt;

            &lt;span class="n"&gt;visited&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="c1"&gt;# Don't include the original movie in recommendations
&lt;/span&gt;            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;current_id&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
                        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;movie&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;distance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;current_depth&lt;/span&gt;
                    &lt;span class="p"&gt;})&lt;/span&gt;

            &lt;span class="c1"&gt;# Add connected movies to queue (if they exist)
&lt;/span&gt;            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;current_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connections&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;connected_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connections&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;current_id&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
                    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;connected_id&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;visited&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="n"&gt;queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;connected_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;current_depth&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;recommendations&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last method is where we apply the BFS algorithm &lt;code&gt;find_recommendations&lt;/code&gt; method, and it works like this:&lt;br&gt;
We start with the movie source at depth 0, then use a queue (FIFO) to process the movies level by level. As explained above, we mark the movies that have been visited (i.e., the nodes) to prevent cycles. From here, we add all unvisited connections to the queue with depth + 1, or another level. And finally, we stop when we have exceeded the specified depth.&lt;/p&gt;

&lt;p&gt;We now have practically the entire program, but the most important element of the project is still the &lt;code&gt;MovieRecommenderCLI&lt;/code&gt; class. This is the brain, where actions or options are thought out, because from there we extract user input as the Command Line Interface of &lt;code&gt;CLI&lt;/code&gt;, which all developers are so proud of for making these types of programs. And tell me, guys? And if you're just starting out, you're going to feel super special for making these &lt;code&gt;CLI&lt;/code&gt;s.&lt;br&gt;
Returning to the topic at hand, here above we see the code and walk through it very briefly as follows:&lt;br&gt;
The CLI interface methods:&lt;br&gt;
It shows us the menu with all the options, handles user input with error checking, formats the output appropriately with its structure, allows searching by title, genre, and obtaining recommendations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;search_by_title_interface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Handle title search interaction&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Enter movie title to search: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;searcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_by_title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Found &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; movie(s):&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_movie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;No movies found with &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; in the title&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;search_by_genre_interface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Handle genre search interaction&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="c1"&gt;# Show avaialable genres
&lt;/span&gt;        &lt;span class="n"&gt;all_genres&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;genre&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;genres&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
                &lt;span class="n"&gt;all_genres&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;genre&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Avalilable genres&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;genre&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;all_genres&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;    . &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;genre&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Enter genre to search: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;searcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_by_genre&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Found &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; movies(s) in &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; genre&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_movie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;No movies found in &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; genre&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;search_by_title_interface&lt;/code&gt; and &lt;code&gt;search_by_genre_interface&lt;/code&gt; methods basically handle the interactions for searching for movies. With these, we collect user input, call the other related methods of the &lt;code&gt;searcher&lt;/code&gt; object, and display the formatted results. The genre search has an extra feature: it displays all the genres before prompting the input, making it more user-friendly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_recommendations_interface&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Handle recommendation interaction&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="c1"&gt;# Show all movies with IDs
&lt;/span&gt;        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Select a movie to get recommendations&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;    [&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;] &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;year&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;movie_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Enter movie ID: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;    

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Movie with ID &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; not found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; 

            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Recommendation type:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1. Similar movies (closest matches)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2. Extended recommendations (includes related to similar)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Choose (1 o 2) [default=1]: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="n"&gt;depth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;


            &lt;span class="n"&gt;source_movie&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Movies similar to: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;source_movie&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;title&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="n"&gt;recommendations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;searcher&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find_recommendations&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;depth&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="c1"&gt;# Sort by distance
&lt;/span&gt;                &lt;span class="n"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;distance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;recommendations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;distance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                       &lt;span class="n"&gt;similarity_label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Highly Similar&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
                    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                       &lt;span class="n"&gt;similarity_label&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Also Recommended&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

                    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;  &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;similarity_label&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_movie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;movie&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;  &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

                    &lt;span class="c1"&gt;# Add reason if it's a direct connection
&lt;/span&gt;                    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;distance&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;movie_id&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connections&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="c1"&gt;# Find the connection reason from the original JSON if available
&lt;/span&gt;                        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;    Why: Similar themes and style&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;No recommendations found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;No recommendations found&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;get_recommendation_interface&lt;/code&gt; method is where we also use the BFS algorithm. When we enter &lt;code&gt;depth=2&lt;/code&gt; for its depth to make "extended recommendations," it implements a two-level BFS traversal through your movie's connection graph. This algorithm first finds movies directly connected to the source (distance=1), and then finds movies connected to it (distance=2). The results are sorted by distance and displayed with labels such as "Highly Similar" for direct connections and "Also Recommended" for second-degree connections. The &lt;code&gt;show_all_movies&lt;/code&gt; method simply displays all movies sorted by rating in descending order.&lt;br&gt;
A very important piece of information, at the end of this brief explanation of the code, is that in: &lt;code&gt;self.searcher.find_recommendations(movie_id, depth)&lt;/code&gt;. With &lt;code&gt;depth=2&lt;/code&gt;, it explores the graph level by level, first visiting all immediate neighbors (similar movies), then their neighbors (extended recommendations), thus creating a tree recommendation system that expands beyond the selected movie.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrappping Up: The Main Application Loop
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;show_all_movies&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Display all movies in the database&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;All movies in Database (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; total):&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Sort by rating
&lt;/span&gt;        &lt;span class="n"&gt;sorted_movies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;movies&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                               &lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;rating&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                               &lt;span class="n"&gt;reverse&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;movie&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sorted_movies&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_movie&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;movie&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Main loop for the CLI&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Welcome to Movie Recommender!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;display_menu&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Enter your choice (1-5): &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_by_title_interface&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search_by_genre_interface&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_recommendations_interface&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;4&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show_all_movies&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;choice&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;5&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Thanks for using Movie Recommneder! Goodbye!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="k"&gt;break&lt;/span&gt; 
            &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Invalid choice. Please try again.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;[Press Enter to continue...]&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;



&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cli&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MovieRecommenderCLI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;cli&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final pieces bring everything togheter into a working application. The  &lt;code&gt;show_all_movies&lt;/code&gt;method provides a simple but useful feature, it retrieves all movies from the database, sorts them by ratin in descending order (highest-rated first), and displays them in a formatted list. This gives user a quick overview of the best movies in the system.&lt;/p&gt;

&lt;p&gt;The core also of the application it's the &lt;code&gt;run&lt;/code&gt; method main event loop, orchestrating the entire user experinece. It displays a welcome message, then enters an infinite while loop that continuouly presents the meny and processes user choices as any CLI. Based on the selected option (1-5), it routes to the appropriate interface method, whether that's searching by title, genre, getting recommendations, showing all movies, or exiting the program. Lastly, it pauses after we did all operations with "Press Enter to continue" to let users review results before returning to the main menu.&lt;br&gt;
Finally, the entry point at the bottom &lt;code&gt;if __name__ == "__main__"&lt;/code&gt; is where the magic begins. When the script runs directly, it creates an instance of our &lt;code&gt;MovieRecommenderCLI&lt;/code&gt; class and call its &lt;code&gt;run()&lt;/code&gt; method, launching the interactive command-line interface. Well amazing job, I deserve a I deserve a pat on the back, well done Ivan :)&lt;/p&gt;

&lt;p&gt;Now you can test this final project please check the provided link to clone the project from Github:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ivansing/movie-recommender" rel="noopener noreferrer"&gt;Github repository project&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;As you could see, this was a great little project because it really showed how the BFS algorithm works, more or less. Although I didn’t go into great depth, it’s not difficult, but it does require attention. We were able to create several classes and their methods for searching and recommending using this very useful algorithm, by the way. Well, as homework :) see how this type of algorithm is used all over the internet—it’s really impressive. Just think that this is only one of hundreds, if not thousands, of algorithms out there.&lt;/p&gt;

&lt;p&gt;Thank you for reading this article. I hope you enjoyed it, great community. I want to keep writing more regularly, and I hope I can, so I can share my thoughts on this great topic of computer science.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a full-stack developer, Node.js and Python developer, content writer, entrepreneur, and founder of ByteUp LLC, a software development company.&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>python</category>
      <category>programming</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Building a Command line Game in Python</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Tue, 02 Sep 2025 19:08:21 +0000</pubDate>
      <link>https://forem.com/ivansing/building-an-command-line-game-in-python-1h37</link>
      <guid>https://forem.com/ivansing/building-an-command-line-game-in-python-1h37</guid>
      <description>&lt;p&gt;Hello community, I haven't written articles in a while, but I want to change that. I've been very busy, as always, developing development projects like the example I'm about to show you, which is more educational than anything else.&lt;/p&gt;

&lt;p&gt;This small project was written in Python as part of an assignment I'm doing on Codecademy, as part of a review I need to keep my knowledge fresh or up to date. The project consists of demonstrating how to program in OOP, or object-oriented programming, which in software development is vital for encapsulating part of the programs. In other words, it's essential for creating an abstract program and, more easily, managing program design based on the type of object and its characteristics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;What this program, which I called "Inventory Management RPG," does: It's a role-playing game program, or RPG, where you buy items, and at the same time, the player manages those items. It sounds easy, but really think carefully first and take notes on the concepts, including the type of information, then how many classes should be created, data persistence, and data entry management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt;&lt;br&gt;
The object, as we already know, in this case would be the player with its properties in the game. In this case, we also determine the type of information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name, which is a string;&lt;/li&gt;
&lt;li&gt;health is a string;&lt;/li&gt;
&lt;li&gt;gold is also a string;&lt;/li&gt;
&lt;li&gt;inventory, which is an array where we store the player's items.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that we know the properties and type of information, we can proceed to add methods to this class. For the other classes, which were shop and item, I did the same, adding the type of information and methods. I'm being brief to cover more features and gameplay.&lt;/p&gt;

&lt;p&gt;In addition to this, I used Python 3.6+, file I/O, dictionaries, etc., and other language features to implement the game flow in a logical and understandable way. What was notable is that, like other languages, the one I'm more familiar with, such as JavaScript, only the methods change, but almost all of them use the same methods for file management and data entry.&lt;/p&gt;
&lt;h2&gt;
  
  
  Key Features Implemented
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Dictionary management for the inventory, in which we extract key and value pairs.&lt;/li&gt;
&lt;li&gt;File persistence with the save/load functionality, for which we use file handling operations.&lt;/li&gt;
&lt;li&gt;User input for error handling, which we do at the game's entry in the main.py file, which is the central hub for managing the various classes.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Code Highlights
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;player&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Player&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;shop&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Shop&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We imported the necessary classes so that the main file can interact with these classes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Welcome to Inventory Management RPG!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Type &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;help&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; for available commands!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="n"&gt;player_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Enter your character name: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;player&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Player&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;shop&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Shop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Welcome, &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the entry point where we print a warm welcome to the users, then ask for the player's name, then we instantiate the classes and print a welcome from the user's input previously asked.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;gt; &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;quit&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Thanks for playing&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;break&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;help&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Available commands: help, stats, inventory, shop, buy [item], save, quit&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;stats&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show_stats&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;inventory&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show_inventory&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;shop&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show_items&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;buy &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;item_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;:].&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# Remove "buy " and capitalize
&lt;/span&gt;            &lt;span class="n"&gt;shop&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sell_item&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;user_input&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;save&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save_game&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Unknown command. Type &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;help&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; for available commands.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we continue with the while loop part, which we use as a true condition. To implement if/elif statements, we could also use the match case in Python 3.1, which is similar to the switch statement in JavaScript. For this implementation, we use if/elif, which is more standard in Python in general. The first thing we do is declare the user input variable, removing spaces and using lowercase. After that, we create the various user input options, comparing them with the input string, and then printing the instructions or methods of the player or store class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, if we have the entry point, we invoke it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Difficulties and Solutions
&lt;/h2&gt;

&lt;p&gt;The hardest part of the game may be coming up with the idea for how to make the game, because it's the part where you don't know what you can invent, so you start looking at ideas on the internet. I'd say that's the hardest part. On the other hand, we currently have a lot of help, like AI, but this really is a complement to our ideas; it's not 100% bulletproof. Once we have the mix of ideas in mind, we begin to look at the parts of the game and how to model the data types in the classes, as well as the interconnection of the classes and how to program their methods with the basic tools of the language.&lt;/p&gt;

&lt;p&gt;And finally, the implementation of the ideas themselves, the design of the game or program as it would be in real life, such as when we implement classes with APIs, this is another level.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Improvements
&lt;/h2&gt;

&lt;p&gt;Sometimes when I create my repositories, I forget about them for months, if not years, but one truly loves several projects, and this is one of them. What I would do is add another player, make online RESTFUL API calls. Of course, we'd have to implement a lot of testing, ensuring security is already at an online level. We could create a graphical interface. Truly an online game, and instead of saving data in .txt files, we could save it in NoSQL databases so that players have a central point to save or load data, also using caching.&lt;br&gt;
But sometimes we don't have time, we're busy with work, and for me this is no exception to the rule, I hope it's not for you either (just kidding).&lt;/p&gt;

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

&lt;p&gt;Well, I've talked about a little bit of everything in this experience. Finally, I'm back writing for this great community that we love so much, even if it's been from a distance for months since I last wrote. Yes, I was busy because I was developing my own blog-like platform, &lt;a href="https://trovetrends.com" rel="noopener noreferrer"&gt;https://trovetrends.com&lt;/a&gt;, but I still have a long way to go, but here we go. My shame about you. Regarding our game, let me know if you want me to write more articles like this one. I'll be more attentive, since we only saw the tip of the iceberg of how to build a simple OOP-based game: ideas, design, implementation, difficulties, and future improvements. I have nothing more to add; nothing more to say, in advance: thank you for taking the time to read this short article.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a full-stack developer, Node.js and Python developer, content writer, entrepreneur, and founder of ByteUp LLC, a software development company.&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>cli</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>GraphQL Transforming API Development</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Wed, 15 Jan 2025 17:52:13 +0000</pubDate>
      <link>https://forem.com/ivansing/graphql-transforming-api-development-3mhi</link>
      <guid>https://forem.com/ivansing/graphql-transforming-api-development-3mhi</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Modern web applications demand efficient, flexible, and robust data fetching capabilities. Enter GraphQL, a revolutionary query language that's reshaping how developers think about APIs. Since its public release by Facebook in 2015, GraphGL has gained massive adoption across industries, proving itself as more than just another tech trend.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding GraphQL's Core Concepts
&lt;/h2&gt;

&lt;p&gt;At its heart, GraphQL is a query language for APIs and a runtime for executing those queries against your data. Unlike traditional REST APIs, where the server determines the structure of the response, GraphQL empowers clients to request specific data in a single request. This fundamental shift in approach solves many of the challenges that developers face when building modern applications.&lt;/p&gt;

&lt;p&gt;Think of GraphQL as a sophisticated librarian who knows exactly where every book is located and can fetch precisely what you need. Instead of visiting different shelves of the library (multiple API endpoints), you simply hand the librarian a detailed list of what you're looking for, and they return accurate that, no more, no less.&lt;/p&gt;

&lt;p&gt;The schema-driven nature of GraphQL provides a clear contract between client and server. Every GraphQL service defines a set of types that completely describe the data that can be queried. When a client makes a request, GraphQL validates it against this schema before execution, ensuring that the response will be predictable and consistent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technical Foundation
&lt;/h2&gt;

&lt;p&gt;GraphQL operates on three main types of operations: queries for retrieving data, mutations for modifying data, and subscriptions for real-time updates. Each operation is built around a robust type system that describes the capacities of the API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;friends&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;comments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Comment&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Comment&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ID&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Post&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The schema defines relationships, allowing clients to retrieve nested data like a user's posts or friends in a single query.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resolvers: The Hearth of GraphQL
&lt;/h2&gt;

&lt;p&gt;One of graphQL's most powerful features lies in its resolver functions. These functions determine how the data for each field in your schema is retrieved. Resolvers can fetch data from databases, call other APIs, or perform complex computations, all while being completely invisible to the client.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Resolvers
&lt;/h2&gt;

&lt;p&gt;Here's how you can implement resolvers for fetching a user's posts and friends using Prisma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;User&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Fetch posts for this user&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;authorId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;orderBy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;createdAt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;desc&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;friends&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// Fetch user's friends&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;friends&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;in&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;friendIds&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;friends&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These resolvers ensure data is fetched efficiently, only when requested by the client.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Evolution of API Development
&lt;/h2&gt;

&lt;p&gt;Remember the days when REST APIs were the only game in town? Developers would create multiple endpoints, each returning fixed data structures. While this worked well for simple applications, it quickly became cumbersome as applications grew in complexity. Mobile apps needed different data than web clients, and developers found themselves making multiple API calls to gather the required information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solving the N+1 Query Problem
&lt;/h2&gt;

&lt;p&gt;One of the most significant challenges in API development is the N+1 query problem, where fetching related data results in multiple database queries. GraphQL's ability to batch and optimize there queries through DataLoader and similar tools make it a game-changer for performance optimization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consider this implementation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fetching related data often results in multiple database queries, known as the N+1 query problem. GraphQL this through tools like DataLoader, which batches and caches database calls.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DataLoader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dataloader&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userLoader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DataLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userIds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;in&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userIds&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;userIds&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;Post&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;author&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;userLoader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;authorId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach minimizes database queries by batching requests, significantly improving performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Success User Interface
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Netflix's Dynamic User Interface
&lt;/h2&gt;

&lt;p&gt;Netflix leverages GraphQL to power its dynamic user interface across different devices. Their implementation allows them to fetch absolutely the right amount of show information based on the viewing context, whether it's a thumbnail view, detailed view, or search result.&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub's API Revolution
&lt;/h2&gt;

&lt;p&gt;Our beloved repository GitHub's switch to GraphQL for their API v4 marked a significant milestone in the technology's adoption. They found that GraphQL reduced their API response payload sizes dramatically and gave developers more flexibility in accessing GitHub's vast data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementing GraphQL with Node.js and Apollo Server
&lt;/h2&gt;

&lt;p&gt;Let's look at a practical implementation using Node.js and Apollo Server:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install dependencies
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @apollo/server graphql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Define your schema:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;typeDefs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`#graphql
type Query {
  hello: String
}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add resolvers:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;Query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello, GraphQL!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Start the server:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ApolloServer&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@apollo/server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ApolloServer&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;typeDefs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`🚀 Server ready at &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Performance Optimization Through Filed Selection
&lt;/h2&gt;

&lt;p&gt;One of GraphQL's most strong features is its ability to optimize database queries based on requested fields. Consider this example using Prisma:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PrismaClient&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@prisma/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PrismaClient&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUnique&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;select&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;select&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;posts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;select&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;posts&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures that only the required data is retrieved, reducing unnecessary overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Future of GraphQL
&lt;/h2&gt;

&lt;p&gt;Apollo Federation enables teams to split their GraphQL squema across multiple services while presenting a unified API to clients. This approach has been adopted by companies like Walmart and Paypal to scale their GraphQL implementations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-Time Features with Subscriptions
&lt;/h2&gt;

&lt;p&gt;GraphQL subscriptions enable real-time updates, perfect for live notifications and collaborative applications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PubSub&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;graphql-subscriptions&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pubsub&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PubSub&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;typeDefs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`#graphql
type Subscription {
  messageAdded: String
}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;resolvers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;Subscription&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;messageAdded&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;pubsub&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asyncIterator&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;MESSAGE_ADDED&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]),&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Getting Started with GraphQL
&lt;/h2&gt;

&lt;p&gt;The beauty of GraphQL lies in its gradual adoption path. You don't need to rewrite your entire application to start using it. Begin implementing GraphQL alongside your existing REST APIs, possibly as a proxy layer. This way allows teams to experience the benefits while minimizing risk.&lt;/p&gt;

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

&lt;p&gt;GraphQL represents more than just a new way to query APIs; it's a paradigm shift in how we think about data fetching and client-server communication. GraphQL's flexible and efficient approach becomes increasingly valuable as applications continue to grow in complexity and scale. Whether you're building new applications or maintaining existing ones, considering GraphQL could be the key to unlocking better performance, developer experience, and user satisfaction.&lt;/p&gt;

&lt;p&gt;Remember, the best way to understand GraphQL is to start using it; there are a lot of resources on its official site. Begin with small experiments, measure the impact, and gradually expand its use as you become more comfortable with the technology. The growing community and robust ecosystem make now the perfect time to embrace GraphQL in your development stack.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://graphql.org/learn/" rel="noopener noreferrer"&gt;GraphQL Official Documentation&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The authoritative source for GraphQL specifications, best practices, and core concepts.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://www.apollographql.com/docs/" rel="noopener noreferrer"&gt;Apollo GraphQL Platform&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Comprehensive guides for implementing GraphQL with Apollo, including server setup and client integration.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://netflixtechblog.com/how-netflix-scales-its-api-with-graphql-federation-part-1-ae3557c187e2" rel="noopener noreferrer"&gt;Netflix Engineering - GraphQL Federation&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Deep dive into Netflix's GraphQL federation implementation and scaling strategies.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://github.blog/2016-09-14-the-github-graphql-api/" rel="noopener noreferrer"&gt;GitHub GraphQL API Case Study&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Detailed exploration of GitHub's migration to GraphQL and their implementation approach.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://graphql.org/learn/best-practices/" rel="noopener noreferrer"&gt;GraphQL Best Practices&lt;/a&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Essential guidelines and patterns for building production-grade GraphQL APIs.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📬 &lt;strong&gt;Subscribe to Our Newsletter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.co/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>graphql</category>
      <category>softwaredevelopment</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Python's Unstoppable Rise, Dominating The Modern Backend Environment</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Fri, 10 Jan 2025 03:35:02 +0000</pubDate>
      <link>https://forem.com/ivansing/pythons-unstoppable-rise-dominating-the-modern-backend-environment-4m20</link>
      <guid>https://forem.com/ivansing/pythons-unstoppable-rise-dominating-the-modern-backend-environment-4m20</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This field of backend development has shown a remarkable transformation over the past decade, with Python emerging as the undisputed leader in this dynamic field. What started as a simple scripting language has advanced into the backbone of modern web applications, AI systems, and data-driven platforms. &lt;/p&gt;

&lt;p&gt;This shift isn't merely a passing trend but represents a fundamental change in how developers and organizations approach their technological infrastructure. I will show some statistics about how, like always, Python is one of my favorite languages, maybe because this was the one that I learned first, and how this fantastic programming language is in the future of AI as data science.&lt;/p&gt;

&lt;p&gt;First of all, let's look at the following graph from the Tiobe index for one of the best statistics we currently have to analyze how Python is still a trending programming language:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21n2qi9amllt8lngtvis.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F21n2qi9amllt8lngtvis.png" alt="Tiobe Index" width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Perfect Storm: Why Python Dominates
&lt;/h2&gt;

&lt;p&gt;Python's ascendancy to the throne of backend development didn't happen by chance. Rather, it's the result of a perfect convergence of factors that have created an unprecedented momentum in the software development world. At its core, Python embodies a philosophy that prioritizes readability and simplicity, making it not just a programming language but a gateway to solving complex problems with elegant solutions.&lt;/p&gt;

&lt;p&gt;The language's intuitive syntax, often described as "executable pseudocode," has revolutionized how developers approach problem-solving. Instead of getting overwhelmed by complex language builts, developers can focus on what truly matters: creating solutions that work. This accessibility has fostered the growth of an extensive talent pool, making it significantly easier for companies to build and maintain robust engineering teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modern Python Backend Frameworks
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa906b2y31l724yrjt87f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa906b2y31l724yrjt87f.png" alt="Performance comparison" width="800" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The maturation of Python's ecosystem has given rise to a sophisticated collection of frameworks, each serving distinct needs while maintaining the language's core principles of simplicity and efficiency. FastAPI, the newest star in this constellation, has redefined what developers expect from a modern web framework. Built on the foundations of Starlette and Pydantic (a high-perfomance web framework for building HTTP based service APIs in Python 3.8+), it delivers a perfect blend of performance and developer experience. The framework's automatic API documentation, built-in type checking, and asynchronous capabilities have set new standards in the industry, challenging the performance metrics of traditional, faster alternatives like Node.js and Go.&lt;/p&gt;

&lt;h2&gt;
  
  
  FastAPI: The New Standard for High-Performance APIs
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqu8v92dl1xmy87tetdzq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqu8v92dl1xmy87tetdzq.png" alt="Bar chart comparison FastAPI" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While FastAPI represents the cutting edge, Django continues to evolve as a comprehensive solution for large-scale applications. Its "batteries-included" approach provides a robust foundation for enterprise-level projects, offering everything from an innovatory admin interface to a powerful ORM system. The recent addition of async views and middleware demonstrates Django's commitment to staying relevant in an increasingly asynchronous world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python in the AI and Data Science Uprising
&lt;/h2&gt;

&lt;p&gt;Perhaps Python's most significant advantage lies in its unparalleled position at the intersection of backend development and artificial intelligence. This unique positioning has created a seamless bridge between traditional backend services and cutting-edge machine learning capabilities. Modern applications can now integrate advanced AI models directly into their backend infrastructure, creating more intelligent and approachable systems.&lt;/p&gt;

&lt;p&gt;Leading technology companies have genuinely embraced this integration. Instagram's use of Django to manage billions of user interactions, Netflix's reliance on Python for content delivery, and Spotify's implementation of Python for data analysis all demonstrate the language's versatility and scalability. These real-world application examples serve as persuasive testimonials to Python's &lt;br&gt;
potentials at the enterprise scale.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Evolution of Backend Development Practices
&lt;/h2&gt;

&lt;p&gt;The modern Python backend development field has advanced to embrace contemporary software engineering practices. Asynchronous programming once considered a specialty, has become mainstream thanks to Python's elegant async/await syntax. This prototype transition has enabled developers to build highly concurrent applications that can handle multiple operations efficiently, which is particularly crucial for applications dealing with real-time data processing and multiple external services.&lt;/p&gt;

&lt;p&gt;The introduction of type hints and static type checking has transformed how developers approach code quality and maintenance. Tools like "mypy" have brought the benefits of static typing to Python's dynamic innovation, enabling early error detection and improved code maintainability. This has been especially transformative for large-scale applications where type safety is paramount.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Horizons
&lt;/h2&gt;

&lt;p&gt;As we look toward the future, Python's role in backend development appears poised for even greater expansion. Projects like Mojo and Pypy are actively addressing performance considerations while the async environment continues to mature and progress.&lt;/p&gt;

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

&lt;p&gt;Python's dominance in backend development represents more than just a technological preference; it's a testament to the power of simplicity, adaptability, and community-driven innovation. As the digital landscape continues to advance, Python's individual ability to bridge traditional backend development with emerging technologies positions it not just as the language of today but as the foundation for tomorrow's technological innovations.&lt;/p&gt;

&lt;p&gt;The future of backend development is being written in Python, one line of elegant code at a time. As we witness the continued convergence of traditional backend services with AI and data science, Python's role appears not just secure but expanding, promising even more exciting developments in the years to come.&lt;/p&gt;

&lt;p&gt;Share your comments and thoughts below in the comments box, and let me know if you like my article and if you want me to write the next article so I can hear your ideas for this great community.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/" rel="noopener noreferrer"&gt;Python.org. (2024). "Python 3.12 Documentation."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fastapi.tiangolo.com/" rel="noopener noreferrer"&gt;FastAPI. (2024). "FastAPI Documentation."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/" rel="noopener noreferrer"&gt;Django Project. (2024). "Django Documentation."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.jetbrains.com/lp/python-developers-survey-2023/" rel="noopener noreferrer"&gt;JetBrains. (2023). "Python Developers Survey Results."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://survey.stackoverflow.co/2023" rel="noopener noreferrer"&gt;Stack Overflow. (2023). "Developer Survey 2023."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://octoverse.github.com/" rel="noopener noreferrer"&gt;GitHub. (2023). "The State of the Octoverse."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fastapi.tiangolo.com/benchmarks/" rel="noopener noreferrer"&gt;Tiangolo. (2024). "FastAPI Benchmarks."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://netflixtechblog.com/" rel="noopener noreferrer"&gt;Netflix Technology Blog. (2023). "Python at Netflix."&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://instagram-engineering.com/" rel="noopener noreferrer"&gt;Instagram Engineering. (2023). "Python at Scale."&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📬 &lt;strong&gt;Subscribe to Our Newsletter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.co/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>python</category>
      <category>backenddevelopment</category>
      <category>fastapi</category>
      <category>programming</category>
    </item>
    <item>
      <title>React Server Components: The Evolution</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Tue, 07 Jan 2025 22:42:46 +0000</pubDate>
      <link>https://forem.com/ivansing/react-server-components-the-evolution-1d6</link>
      <guid>https://forem.com/ivansing/react-server-components-the-evolution-1d6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once I began my path as a software developer around a decade ago, I just coded HTML, CSS, JavaScript, and some Python 2 scripts; during those times, we depended solely on PHP and SQL for server-side client-server communication. After that, the next level was the magic word "React," like reacting to changes by state or effects. That's my understanding, without deepening into the matter, by the rumor that a Facebook engineer made it; this was a bombshell in the way we used to code frontend parts.&lt;/p&gt;

&lt;p&gt;As software development evolved and the backend systems became complex, the React Server Components (RSC) felt that the evolution of our ecosystem was desperately needed. That reminds me of the days when massive JavaScript bundles and "loading" spinners were everywhere. Let's explore how RSC is changing the game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Performance Revolution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The main shift RSC brings isn't just technical but also philosophical. Instead of shipping entire component trees to the client, RSC lets us render components on the server while keeping the interactivity we love about React. I used to migrate dashboard applications to RSC, and it's pretty simple, nothing out of this world, and the clear impact impacts in dashboard applications the size dropped by 60%.&lt;/p&gt;

&lt;p&gt;Here's a real-world example I encountered just recently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="c1"&gt;// Before: Client Component&lt;/span&gt;
 &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ComplexDataGrid&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;heavy-grid-library&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;format&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;date-fns&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Dashboard&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;fetchDashboardData&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ComplexDataGrid&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this traditional client-side approach, several things are happening:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We're importing a heavy data grid library that gets bundled with our client JavaScript.&lt;/li&gt;
&lt;li&gt;We're using &lt;code&gt;useState&lt;/code&gt; to manage our data locally in the browser.&lt;/li&gt;
&lt;li&gt;We're fetching data after the component mounts using &lt;code&gt;useEffect&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The user sees a loading state while data is being fetched.&lt;/li&gt;
&lt;li&gt;All data processing happens in the browser, potentially slowing down the user's device.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, let's look at the RSC version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sql&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@vercel/postgres&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;DataGrid&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./DataGrid&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Dashboard&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;sql&lt;/span&gt;&lt;span class="s2"&gt;`SELECT * FROM dashboard_metrics`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;DataGrid&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The component is async by default - no need for useEffect or useState.&lt;/li&gt;
&lt;li&gt;Direct database access through server-side queries.&lt;/li&gt;
&lt;li&gt;No client-side data fetching code is needed.&lt;/li&gt;
&lt;li&gt;Zero loading states are required for initial data.&lt;/li&gt;
&lt;li&gt;Data processing happens on powerful servers instead of user devices.&lt;/li&gt;
&lt;li&gt;The imported DataGrid component can be much lighter as it only needs to handle display, not data fetching.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The transformation is striking. No more &lt;code&gt;useEffect&lt;/code&gt;, no more client-side data fetching, and most importantly, no more unnecessary shipping of JavaScript to the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-World Benefits&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The impact goes beyond just performance metrics. When working with RSC, I've noticed that the database queries now happen closer to the data source (in the example above is not the best coding practice), the components are simpler and more focused, authentication and authorization patterns become more straightforward and SEO improvements come almost for free, something that in the React world wasn't happening before.&lt;/p&gt;

&lt;p&gt;However, the most significant advantage is the developer experience. Writing components that can directly access your database (safety!) feels like a superpower. It's like having the best of both worlds: the component-based architecture from React, with the performance benefits of server-side rendering the most advanced with Next.js&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Trade-offs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's be honest: RSC isn't perfect. The mental model takes time to grasp, especially understanding the client/server boundary; for me, a kind of complex operation in the black box. I will follow my previous migration example, we hit some roadblocks with third-party libraries that weren't RSC-compatible. The solution? A hybrid approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Client Component for interactivity&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;SearchFilter&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;onSearch&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt; &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;onSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt; &lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Server Component for data fetching&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ProductList&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getProducts&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SearchFilter&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ProductGrid&lt;/span&gt; &lt;span class="nx"&gt;items&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let' s break down what's happening in this hybrid approach:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;use client&lt;/code&gt; directive explicitly marks SearchFilter as a client component.&lt;/li&gt;
&lt;li&gt;SearchFilter handles user interactions (onChange events) which can only happen on the client.&lt;/li&gt;
&lt;li&gt;ProductList remains a server component, fetching data server-side.&lt;/li&gt;
&lt;li&gt;The component composition allows us to mix server and client rendering where appropriate.&lt;/li&gt;
&lt;li&gt;Only the interactive parts (SearchFilter) carry JavaScript to the client.&lt;/li&gt;
&lt;li&gt;The data-heavy parts (ProductGrid with products) are rendered on the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion (The Future is Server-First)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RSC represents more than just a new feature - it's a paradigm conveyed in how we build React applications. The ability to move expensive computations and data fetching to the server while maintaining React's component model is revolutionary.&lt;/p&gt;

&lt;p&gt;For teams building data-heavy applications, RSC offers a path to better performance without sacrificing developer experience. As the environment matures and more libraries become RSC compatible, I expect this pattern to become the default way we build React applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Share Your Experience&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you started using React Server Components in your projects? I'd love to hear from you, challenges and wins in the comments below. &lt;br&gt;
Drop a ❤️ if this article helped you understand RSC better, and don't forget to follow me for more deep dives into modern systems. &lt;/p&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📬 &lt;strong&gt;Subscribe to Our Newsletter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>The Rise of Serverless Architecture and Edge Computing</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Tue, 31 Dec 2024 20:29:04 +0000</pubDate>
      <link>https://forem.com/ivansing/the-rise-of-serverless-architecture-and-edge-computing-2aab</link>
      <guid>https://forem.com/ivansing/the-rise-of-serverless-architecture-and-edge-computing-2aab</guid>
      <description>&lt;p&gt;🎉 Some words before we further read the following article:🥳 I wish everyone a Happy New Year 2025. 🎆 Have a great time with your loved ones!!! ❤️&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;I've seen that over the past few years, the world of software development has been turning into a pace that's hard to keep up with. New technologies have emerged frameworks, and paradigms seem to pop up every other week, but few trends have grabbed my attention as much as Serverless Architectures and Edge Computing. These two concepts are perspectives on why these trends are not just buzzwords but the foundation of a more efficient and scalable future for modern software development.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Exactly is Serverless?
&lt;/h2&gt;

&lt;p&gt;When I first heard this fancy cryptic term, I thought it was out of this world. Somebody was doing all the jobs without servers, but it was more like a magic spell or something; I'm just kidding. How can anything be server-less when, ultimately, there are still servers running somewhere? The term might be misleading, but the philosophy is straightforward: developers shouldn't have to worry about provisioning, scaling, or maintaining servers, as simple as that! Instead, we focus on writing code, and the infrastructure takes care of itself; what a beauty, right?&lt;/p&gt;

&lt;p&gt;Platforms like AWS Lambda, Google Cloud Functions, and Vercel have taken center stage in enabling this shift. They allow developers to write small, focused pieces of code (functions) that execute in response to specific events--whether it's a user clicking a button, an API call, or a database update.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovt2ih5k4ma0y1017gne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fovt2ih5k4ma0y1017gne.png" alt="Serverless vs Edge" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The charm of serverless lies in its scalability. If 10,000 users suddenly hit your app, you don't need to frantically spin up more servers identical to a monolithic infrastructure going vertical all the time. The platform scales your functions automatically. And when no one's using them? You're not paying for idle servers sitting around doing nothing, for this was a game changer.&lt;/p&gt;

&lt;p&gt;But serverless isn't perfect. Cold starts, vendor lock-in, and resource limitations can still pose challenges. Yet, the benefits-reduced operational overhead, pay-as-you-go pricing, and simplified deployment far outweigh the downsides for most use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter Edge Computing: Bringing Servers Closer to Users
&lt;/h2&gt;

&lt;p&gt;While serverless systems have transformed how we deploy backend functions, Edge Computing focuses on where those functions run. In traditional cloud computing, your application might live in a data center halfway across the world from your users and customers. Every request has to travel that distance, adding latency.&lt;/p&gt;

&lt;p&gt;With the advent of edge computing, those computations happen closer to your users. Think of it like having tiny data centers spread across the globe. Platforms like Cloudflare Workers, AWS Lambda@Edge, and Fastly Compute@Edge are pushing this trend forward.&lt;/p&gt;

&lt;p&gt;For developers, this means snappier performance, lower latency, and better user experiences. Imagine you're building an e-commerce app, and your users in Europe can access the backend services from a nearby edge server instead of making a round trip to a data center in South America or the US.&lt;/p&gt;

&lt;p&gt;But edge computing isn't just about speed. It's also about resilience. By distributing workloads across multiple edge nodes, we can reduce the risk of regional outages and single points of failure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6rohm4ut0ux8x6dj4nrt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6rohm4ut0ux8x6dj4nrt.png" alt="Packets in action" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;p&gt;One of the first projects where I experimented with serverless and edge computing was a real-time analytics dashboard for a customer. They wanted to track user behavior across their platform and display analytics with minimal delay. Traditional server setups would have required complex infrastructure planning, but we deployed a solution in record time with AWS Lambda and Cloudflare Workers.&lt;/p&gt;

&lt;p&gt;Every user event triggered a Lambda function, which processed the data and pushed it to our analytics store. The edge workers ensured the data was delivered to the front end instantly, no matter where the user was located; this is really common these days.&lt;/p&gt;

&lt;p&gt;Another project involved building an image optimization pipeline. Every time a user uploaded an image, a serverless function would compress, resize, and optimize it. With edge computing, the optimized was then served to users based on their geographic location, ensuring minimal load times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges and Trade-offs
&lt;/h2&gt;

&lt;p&gt;As a rule, it's not all rainbows and sunshine. Serverless comes with cold starts--the slight delay when a function is invoked after being idle. For latency-sensitive applications, this can be a dealbreaker. Additionally, debugging and monitoring serverless apps require specialized tools since you can't simply SSH into a server.&lt;/p&gt;

&lt;p&gt;Vendor lock-in is another real concern. Once you build an app tightly coupled to AWS Lambda, for example, migrating to antoher platform can be a nightmare.&lt;/p&gt;

&lt;p&gt;Edge computing also introduces its own set of complexities. Not all workloads are suitable for the edge, and deciding which logic runs at the edge versus the central cloud requires careful planning.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Future: A Harmonious Relationship
&lt;/h2&gt;

&lt;p&gt;Despite these challenges, I believe serverless and edge computing are not competing technologies--they're complementary. Serverless focuses on abstracting infrastructure, while edge computing focuses on improving proximity to the end user. Together, they form a powerful duo that allows developers to build scalable, resilient, and highly performant applications.&lt;/p&gt;

&lt;p&gt;In the coming years, I predict we'll see more frameworks and tools that seamlessly integrate these two archetypes. The rise of multi-cloud serverless platforms and global edge networks will further blur the lines between backend and edge workloads.&lt;/p&gt;

&lt;p&gt;For developers, the future looks bright. With serverless and edge computing, we can focus less on infrastructure headaches and more on delivering value to our users.&lt;/p&gt;

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

&lt;p&gt;If you've made it this far, thank you! I'm genuinely excited about where serverless architectures and edge computing are headed, and I'd love to hear your thoughts. Are you already using these technologies in your projects? Have you faced any challenges on your work team?&lt;/p&gt;

&lt;p&gt;Drop a comment below and share your experiences! In addition, if you're interested in staying updated with the latest trends and tutorials in software development, consider subscribing to my newsletter below. I share almost daily articles, insights, tips, and case studies that you won't want to miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS Lambda Documentation: &lt;a href="https://aws.amazon.com/lambda/" rel="noopener noreferrer"&gt;https://aws.amazon.com/lambda/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Google Cloud Functions Documentation: &lt;a href="https://cloud.google.com/functions" rel="noopener noreferrer"&gt;https://cloud.google.com/functions&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Vercel Documentation: &lt;a href="https://vercel.com/docs" rel="noopener noreferrer"&gt;https://vercel.com/docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Cloudflare Workers Documentation: &lt;a href="https://developers.cloudflare.com/workers/" rel="noopener noreferrer"&gt;https://developers.cloudflare.com/workers/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;AWS Lambda@Edge Documentation: &lt;a href="https://aws.amazon.com/lambda/edge/" rel="noopener noreferrer"&gt;https://aws.amazon.com/lambda/edge/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Fastly Compute@Edge Documentation: &lt;a href="https://www.fastly.com/products/compute-at-edge" rel="noopener noreferrer"&gt;https://www.fastly.com/products/compute-at-edge&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📬 &lt;strong&gt;Subscribe to Our Newsletter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>edgecomputing</category>
      <category>webdev</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>TypeScript: The Superhero JavaScript Needed</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Tue, 31 Dec 2024 04:20:47 +0000</pubDate>
      <link>https://forem.com/ivansing/typescript-the-superhero-javascript-needed-15hk</link>
      <guid>https://forem.com/ivansing/typescript-the-superhero-javascript-needed-15hk</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This article dives into TypeScript, not just as a transformative tool that's reshaping how we build modern web applications. I've been working with TypeScript in recent years, and I'm continually amazed by how it has revolutionized web development. Rather than delving into its history, let's explore what makes TypeScript unique and why it's become indispensable in today's development landscape. I won't compare it with other "type" languages like Java, C++ (more popular), and many others; I will just immerse myself in the world of TypeScript and Javascript for a bit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Type Safety and Performance
&lt;/h2&gt;

&lt;p&gt;The heart of TypeScript's power lies in its static typing system, but it's so much more than just adding &lt;code&gt;: string&lt;/code&gt; or &lt;code&gt;: number&lt;/code&gt; to your variables. If you have worked like me for years with JavaScript, this is where TypeScript helps out. What truly sets it apart is how it catches potential issues before reaching production. Is that amazing? I remember the days of debugging (still I do) Javascript applications where a simple type in a property name would slip through testing and cause production crashes. TypeScript eliminates these scenarios entirely. &lt;/p&gt;

&lt;p&gt;Let me show you a practical example that I encounter frequently in my work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;processUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toUpperCase&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// Safe!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This might look simple, but there's profound safety here. In JavaScript, this function would be a ticking time bomb - what if &lt;code&gt;user&lt;/code&gt; is undefined? What if &lt;code&gt;name&lt;/code&gt; is missing? In TypeScript, these concerns vanish because the type system ensures all these properties exist before your code even runs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reliability
&lt;/h2&gt;

&lt;p&gt;What truly amazes me about TypeScript is how it transforms JavaScript development from a minefield of potential runtime errors into a confident, guided experience. The compiler becomes your pair programmer, but not in an intrusive way. Instead of finding out about errors when your users do, TypeScript catches them as you type. It's like having a senior developer looking over your shoulder, pointing out potential issues before they become problems.&lt;/p&gt;

&lt;p&gt;The type system is incredibly sophisticated, yet it feels natural to JavaScript developers. Take this example I worked with recently: I needed to ensure different parts of my application could "speak" to each other. In JavaScript, I'd hope everything matches up. In the other hand, with TypeScript, I get guarantees:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;CanSpeak&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;makeSpeak&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CanSpeak&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;speaker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;speak&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code tells a story about how TypeScript brings clarity to our applications. Any object with a speak method works seamlessly, maintaining JavaScript's flexibility while adding compile time safety. No one couldn't imagine that in the golden years of JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Productivity
&lt;/h2&gt;

&lt;p&gt;Let me share something fascinating about TypeScript's impact on productivity. Last year, I worked on a large-scale applications refactor in those old projects you have ready to make it work. What would have been weeks of careful JavaScript modifications became days of confident changes in TypeScript. The secret? TypeScript intelligent IDE support transforms how we write code. As you type, your editor understands your entire codebase, offering suggestions that feel almost magical.&lt;/p&gt;

&lt;p&gt;The tooling ecosystem is extraordinary, but not in an overwhelming way. Whether you're using webpack, Vite, or esbuild, TypeScript just works. The compiler messages are like having a conversation with a helpful colleague rather than fighting with cryptic errors that happens many often with JavaScript alone. When you make a mistake, TypeScript not only tells you what went wrong but regularly suggests how to fix it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;p&gt;Want to hear something incredible? Microsoft's Office 365, the suite applications millions use daily, is built with TypeScript; I'm stunned. This isn't just a language for small projects - it scales to millions of lines of code while keeping development smooth and maintainable.&lt;/p&gt;

&lt;p&gt;The frontend framework field has been transformed by TypeScript. Angular embraced it fully, making it a requirement. React developers, including myself, once skeptical, now consider TypeScript essential for any serious project. Vue 3's rewrite in TypeScript speaks volumes about the value of the language in building reliable user interfaces.&lt;/p&gt;

&lt;p&gt;But here's what really excites me: TypeScript isn't just for browsers anymore. Companies like Nest.js brought TypeScript's benefits to server-side development. Imagine having the same "type safety" and developer experience across your entire stack. It's a game-changer for full-stack development.&lt;/p&gt;

&lt;p&gt;The financial technology sector has particularly embraced TypeScript. When I learned that companies like Bloomberg and Revolut use TypeScript for their web platforms, it made perfect sense. When handling financial data, you can't afford runtime type errors. TypeScript provides the confidence these applications need.&lt;/p&gt;

&lt;p&gt;Visual Studio Code, the editor I have used for years, is written in TypeScript. It's a testament to the language's capabilities that one of the most popular development tools is built with it. The language's powerful type system makes it perfect for tools that are needed to parse, analyze, and manipulate code.&lt;/p&gt;

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

&lt;p&gt;Through my journey with TypeScript, I've watched it evolve from "JavaScript with types" into an essential tool for modern web development. Its combination of static typing, excellent developer experience, and seamless JavaScript integration makes it invaluable for projects of any size. The learning curve might seem steep at first, especially around the type system, but the benefits become clear quickly: fewer monstrosity bugs, better tooling, and more maintainable code.&lt;/p&gt;

&lt;p&gt;As web applications grow more complex and teams get larger, TypeScript isn't just nice to have - it's becoming a necessity. Whether you're building a small personal project or a large enterprise application, TypeScript provides the elements and safety nets needed for confident, productive development. The future of web development is typed, and TypeScript is leading the way in the scripting language.&lt;/p&gt;

&lt;p&gt;These were just a few lines of code, the tip of the iceberg. In the coming days, we will create a step-by-step tutorial on building an app to help you better understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.typescriptlang.org/docs/" rel="noopener noreferrer"&gt;TypeScript Official Documentation&lt;/a&gt;&lt;/strong&gt; – Microsoft  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals" rel="noopener noreferrer"&gt;Anders Hejlsberg. (2023). TypeScript Design Goals&lt;/a&gt;&lt;/strong&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://code.visualstudio.com/blogs/2018/03/23/text-buffer-reimplementation" rel="noopener noreferrer"&gt;Microsoft Engineering Blog: Visual Studio Code's Architecture&lt;/a&gt;&lt;/strong&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://angular.io/guide/typescript-configuration" rel="noopener noreferrer"&gt;Angular Documentation: Why TypeScript?&lt;/a&gt;&lt;/strong&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://stateofjs.com" rel="noopener noreferrer"&gt;State of JS 2023 Survey: TypeScript Usage Statistics&lt;/a&gt;&lt;/strong&gt;  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For further reading, you can explore the TypeScript Handbook and release notes on the official TypeScript website.&lt;/p&gt;

&lt;p&gt;If you like my articles, please consider following me. If you feel more comfortable, please share your thoughts in the comments below so we can exchange more ideas.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📬 &lt;strong&gt;Subscribe to Our Newsletter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>2024 Tech Year in Review: From AI Revolution to Quantum Leaps</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Fri, 27 Dec 2024 01:37:56 +0000</pubDate>
      <link>https://forem.com/ivansing/2024-tech-year-in-review-from-ai-revolution-to-quantum-leaps-5eef</link>
      <guid>https://forem.com/ivansing/2024-tech-year-in-review-from-ai-revolution-to-quantum-leaps-5eef</guid>
      <description>&lt;p&gt;Hey there, fellow tech enthusiasts! As we are almost at the end of 2024, I wanted to take a moment to share my thoughts on what's been an absolutely incredible year in technology. As a software developer and tech blogger (I was a blogger not too long ago), I found this to be an excellent opportunity to share my thoughts and some knowledge in this area.&lt;/p&gt;

&lt;p&gt;I've had a front-row seat for some mind-blowing developments. Let's dive into what shaped our tech landscape this year.&lt;/p&gt;

&lt;h2&gt;
  
  
  The AI Revolution Continues
&lt;/h2&gt;

&lt;p&gt;This year has been nothing short of revolutionary in the AI space. I don't have time something to see what's new because every minute, there is another AI toll already built; I have no time, and every time I read a book or article from great bloggers, people around this world, technology, the list goes and on all the time. The release of more powerful large language models has transformed how we approach software development. I've personally integrated AI tools into my development workflow, and it's been a game changer for code review, documentation, and even architectural decisions.&lt;/p&gt;

&lt;p&gt;What's really caught my attention is the rise of smaller, more efficient AI models that can run locally. This shift towards edge AI has opened up new possibilities for privacy-focused applications. As a Node.js developer in Python and Java, I've seen how libraries like TensorFlow.js have matured, making it easier than ever to implement AI features in web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Programming Languages: The Shifting Landscape
&lt;/h2&gt;

&lt;p&gt;Speaking of development, the programming language landscape has seen some interesting shifts. Rust continues its unstoppable rise, particularly in systems programming and WebAssembly applications. I've noticed more companies moving performance-critical parts of their Node.js applications to Rust, and the results have been impressive.&lt;/p&gt;

&lt;p&gt;Python, my go-to language for many projects, has maintained its dominance in data science and AI. The improvements in Python 3.12's performance and the growing ecosystem around tools like PyPy have made it even more attractive for large-scale applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cloud Native and Infrastructure Evolution
&lt;/h2&gt;

&lt;p&gt;The cloud-native field has become increasingly more mature. Kubernetes has evolved from being just a container orchestrator to a true cloud-native application platform. Sometimes, I've seen how tools like service meshes and eBPF have transformed observability and security.&lt;/p&gt;

&lt;p&gt;What's particularly exciting is the rise of platform engineering. More organizations are building internal developer platforms to streamline their workflows. &lt;/p&gt;

&lt;h2&gt;
  
  
  Database Technologies: The New Wave
&lt;/h2&gt;

&lt;p&gt;This year has been fascinating for database technologies. Vector databases are a new trend like Milvus and Pinecone, driven by the AI boom, which has introduced new ways to handle similarity search and recommendation systems. &lt;/p&gt;

&lt;p&gt;Traditional databases haven't stood still either. PostgreSQL's latest features around JSON handling and performance improvements have made it an even more compelling choice for modern applications. The emergence of edge databases and improved distributed database systems has also caught my attention.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quantum Computing: From Theory to Practice
&lt;/h2&gt;

&lt;p&gt;While still in the early stages, quantum computing has made remarkable progress this year. The major cloud providers have expanded their quantum offerings, making it easier for developers to experiment with quantum algorithms. I've been following developments in quantum-resistant cryptography, especially given the increasing urgency of preparing our systems for the post quantum era.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web Development Trends
&lt;/h2&gt;

&lt;p&gt;The web development space continues to evolve rapidly. Web Components have gained more traction with more Progressive Web Applications, like desktop apps, but with web technologies, this is not something new but has more advanced features also with no more code and low code platforms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security and Privacy
&lt;/h2&gt;

&lt;p&gt;We can't discuss 2024 without mentioning the increasing focus on security and privacy. Zero-trust architecture has moved from a buzzword to a necessity, and passwordless authentication has begun to reshape how we think about identity management.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;This year has been transformative for our industry. As someone deeply embedded in the tech world, I'm constantly amazed by the pace of innovation. What excites me most is how these technologies are becoming more accessible to developers at all levels.&lt;/p&gt;

&lt;p&gt;Before I wrap up, I want to wish all my readers a very Merry Christmas! May your code be bug-free and your deployments be smooth in the coming year. 🎄✨&lt;/p&gt;

&lt;p&gt;What are your thoughts on these trends? Have you experimented with any of these technologies? I'd love to hear about your experiences in the comments below. If you decide to subscribe, that would also be awesome!&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://python.langchain.com/docs/get_started/introduction" rel="noopener noreferrer"&gt;LangChain Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tensorflow.org/js" rel="noopener noreferrer"&gt;TensorFlow.js Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://platform.openai.com/docs" rel="noopener noreferrer"&gt;OpenAI Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.python.org/3.12/whatsnew/3.12.html" rel="noopener noreferrer"&gt;Python 3.12 Notes&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://doc.rust-lang.org/book/" rel="noopener noreferrer"&gt;Rust Book&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nodejs.org/docs/latest/api/" rel="noopener noreferrer"&gt;Node.js Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://kubernetes.io/docs/home/" rel="noopener noreferrer"&gt;Kubernetes Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://backstage.io/docs" rel="noopener noreferrer"&gt;Backstage Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.postgresql.org/docs/" rel="noopener noreferrer"&gt;PostgreSQL Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.pinecone.io/" rel="noopener noreferrer"&gt;Pinecone Docs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://milvus.io/docs" rel="noopener noreferrer"&gt;Milvus Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📬 &lt;strong&gt;Subscribe to my Newsletter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>programming</category>
      <category>softwaredevelopment</category>
      <category>ai</category>
      <category>quantum</category>
    </item>
    <item>
      <title>Build Lightning-Fast Data Processing in Rust: From Single Thread to Parallel Performance</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Fri, 20 Dec 2024 02:49:11 +0000</pubDate>
      <link>https://forem.com/ivansing/build-lightning-fast-data-processing-in-rust-from-single-thread-to-parallel-performance-gd8</link>
      <guid>https://forem.com/ivansing/build-lightning-fast-data-processing-in-rust-from-single-thread-to-parallel-performance-gd8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Following our deep dive into Rust's capabilities, I'll take you on a hands-on small project. In this project, we'll harness Rust's power, to build to generate a large dataset and compare performance between single-threaded and parallel processing. This example uses two powerful libraries, &lt;code&gt;rand&lt;/code&gt; and &lt;code&gt;rayon&lt;/code&gt;  to get the job done. &lt;/p&gt;

&lt;p&gt;This is your practical guide to seeing Rust's performance metrics in action. If you have been following my previous Rust article: &lt;a href="https://dev.to/ivansing/what-is-rust-and-what-is-for-it-35b4"&gt;"What is Rust, and What is it For?&lt;/a&gt;" This tutorial will show you exactly how these pieces fit together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up the Environment
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Basic understanding of type programming languages&lt;/li&gt;
&lt;li&gt;Code Editor&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Setting Up the Project
&lt;/h2&gt;

&lt;p&gt;For the most popular OS you can go to: &lt;a href="https://www.rust-lang.org/learn/get-started" rel="noopener noreferrer"&gt;Rust Language Page&lt;/a&gt;, and will quite easy installation, for windows subsystem for Linux, and also make the first easy tutorial of your first Rust program.&lt;/p&gt;

&lt;p&gt;Now that you have already installed the Rust and did the checks that is actually in your OS we can proceed with the next part.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Initialize a new Rust project:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm using VS Code it works for me, if you have another code editor no problem just open your terminal and add the following code to start building the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo new rust_performance_demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next move to that folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;rust_performance_demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;File structure&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;├── Cargo.lock
├── Cargo.toml
└── src
    └── main.rs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates some folders and files like: &lt;code&gt;Cargo.toml&lt;/code&gt; file and a &lt;code&gt;src/lib.rs&lt;/code&gt; file.&lt;br&gt;
Add dependencies to &lt;code&gt;Cargo.toml&lt;/code&gt;: Open the &lt;code&gt;Cargo.toml&lt;/code&gt; file and add the following dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;package]
name &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"rust_performance_demo"&lt;/span&gt;
version &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.1.0"&lt;/span&gt;
edition &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2021"&lt;/span&gt;

&lt;span class="o"&gt;[&lt;/span&gt;dependencies]
rand &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.8"&lt;/span&gt;
rayon &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"1.7"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After you added the dependencies build the program this like in Python &lt;code&gt;pip&lt;/code&gt; or in Node &lt;code&gt;npm&lt;/code&gt; for Rust is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we need to modify the file &lt;code&gt;main.rs&lt;/code&gt;inside src folder with the following code step by step code explanation:&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Generating a Dataset&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Inside the main function &lt;code&gt;fn main()&lt;/code&gt;  add the following code steps: The first thing I do in this program is generate a large dataset. I create a vector (a dynamic array) of 50 million random integers, each between 0 and 99. To achieve this, I use the &lt;code&gt;rand&lt;/code&gt; library to generate random numbers and fill up the vector. Here's how I do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;let &lt;/span&gt;size &lt;span class="o"&gt;=&lt;/span&gt; 50_000_000&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;mut rng &lt;span class="o"&gt;=&lt;/span&gt; rand::thread_rng&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;data: Vec&amp;lt;u32&amp;gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;0..size&lt;span class="o"&gt;)&lt;/span&gt;.map&lt;span class="o"&gt;(&lt;/span&gt;|_| rng.gen_range&lt;span class="o"&gt;(&lt;/span&gt;0..100&lt;span class="o"&gt;))&lt;/span&gt;.collect&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Generated a vector of {} elements."&lt;/span&gt;, size&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's happening here? I use the &lt;code&gt;thread_rng()&lt;/code&gt; method to get a random number generator, and I generate 50 million random numbers using &lt;code&gt;rng.gen_range(0..100)&lt;/code&gt;. The &lt;code&gt;map&lt;/code&gt; function is perfect for transforming a range into random numbers, and I collect them all into a vector.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Measuring Single-Threaded Performance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, I calculate the sum of all the numbers in the vector using a single-threaded approach. I use Rust's built-in &lt;code&gt;iter()&lt;/code&gt; method to loop through each element, cast it to a &lt;code&gt;u64&lt;/code&gt;(since the sum can get quite large), and sum everything up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;let &lt;/span&gt;start &lt;span class="o"&gt;=&lt;/span&gt; Instant::now&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;sum_single: u64 &lt;span class="o"&gt;=&lt;/span&gt; data.iter&lt;span class="o"&gt;()&lt;/span&gt;.map&lt;span class="o"&gt;(&lt;/span&gt;|&amp;amp;x| x as u64&lt;span class="o"&gt;)&lt;/span&gt;.sum&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;duration_single &lt;span class="o"&gt;=&lt;/span&gt; start.elapsed&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Single-threaded sum: {}, took: {:?}"&lt;/span&gt;, sum_single, duration_single&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also measure how long this operation takes using &lt;code&gt;std::time::Instant&lt;/code&gt;. The &lt;code&gt;elapsed()&lt;/code&gt; method gives me the duration and print it out both the sum and the time taken.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Measuring Parallel Performance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now comes the exciting part: parallel processing. Rust's &lt;code&gt;rayon&lt;/code&gt; library makes parallelism incredibly simple. Instead of using &lt;code&gt;iter()&lt;/code&gt; to loop through the data, I use &lt;code&gt;par_iter()&lt;/code&gt;(from &lt;code&gt;rayon&lt;/code&gt;), which splits the work across multiple threads automatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;let &lt;/span&gt;start &lt;span class="o"&gt;=&lt;/span&gt; Instant::now&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;sum_parallel: u64 &lt;span class="o"&gt;=&lt;/span&gt; data.par_iter&lt;span class="o"&gt;()&lt;/span&gt;.map&lt;span class="o"&gt;(&lt;/span&gt;|&amp;amp;x| x as u64&lt;span class="o"&gt;)&lt;/span&gt;.sum&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;let &lt;/span&gt;duration_parallel &lt;span class="o"&gt;=&lt;/span&gt; start.elapsed&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Parallel sum: {}, took: {:?}"&lt;/span&gt;, sum_parallel, duration_parallel&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach processes the vector much faster by utilizing all the available CPU cores. Again, I measure and print the time taken.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ensuring Correctness&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's not enough for the parallel version to be faster, it must also produce the same result as the single-threaded version. To confirm this, I use Rust's &lt;code&gt;assert_eq!&lt;/code&gt; macro:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;assert_eq!&lt;span class="o"&gt;(&lt;/span&gt;sum_single, sum_parallel&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the two sums don't match, the program will panic. This ensures that parallelism doesn't compromise accuracy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Printing Results&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally, I print a comparison of the single-threaded and parallel times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;Performance Comparison:"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" - Single-threaded: {:?}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt; - Parallel:       {:?}"&lt;/span&gt;, duration_single, duration_parallel&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Full code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;use rand::Rng&lt;span class="p"&gt;;&lt;/span&gt;
use rayon::prelude::&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
use std::time::Instant&lt;span class="p"&gt;;&lt;/span&gt;

fn main&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    // Generate a large dataset
    &lt;span class="nb"&gt;let &lt;/span&gt;size &lt;span class="o"&gt;=&lt;/span&gt; 50_000_000&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;mut rng &lt;span class="o"&gt;=&lt;/span&gt; rand::thread_rng&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;data: Vec&amp;lt;u32&amp;gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;0..size&lt;span class="o"&gt;)&lt;/span&gt;.map&lt;span class="o"&gt;(&lt;/span&gt;|_| rng.gen_range&lt;span class="o"&gt;(&lt;/span&gt;0..100&lt;span class="o"&gt;))&lt;/span&gt;.collect&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Generated a vector of {} elements."&lt;/span&gt;, size&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    // Measure single-threaded &lt;span class="nb"&gt;sum
    let &lt;/span&gt;start &lt;span class="o"&gt;=&lt;/span&gt; Instant::now&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;sum_single: u64 &lt;span class="o"&gt;=&lt;/span&gt; data.iter&lt;span class="o"&gt;()&lt;/span&gt;.map&lt;span class="o"&gt;(&lt;/span&gt;|&amp;amp;x| x as u64&lt;span class="o"&gt;)&lt;/span&gt;.sum&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;duration_single &lt;span class="o"&gt;=&lt;/span&gt; start.elapsed&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Single-threaded sum: {}, took: {:?}"&lt;/span&gt;, sum_single, duration_single&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    // Measure parallel &lt;span class="nb"&gt;sum
    let &lt;/span&gt;start &lt;span class="o"&gt;=&lt;/span&gt; Instant::now&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;sum_parallel: u64 &lt;span class="o"&gt;=&lt;/span&gt; data.par_iter&lt;span class="o"&gt;()&lt;/span&gt;.map&lt;span class="o"&gt;(&lt;/span&gt;|&amp;amp;x| x as u64&lt;span class="o"&gt;)&lt;/span&gt;.sum&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;let &lt;/span&gt;duration_parallel &lt;span class="o"&gt;=&lt;/span&gt; start.elapsed&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Parallel sum: {}, took: {:?}"&lt;/span&gt;, sum_parallel, duration_parallel&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    // Check correctness
    assert_eq!&lt;span class="o"&gt;(&lt;/span&gt;sum_single, sum_parallel&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;Performance Comparison:"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    println!&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" - Single-threaded: {:?}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt; - Parallel:       {:?}"&lt;/span&gt;, duration_single, duration_parallel&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;


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

&lt;/div&gt;



&lt;p&gt;This gives us a clear view of the performance improvement provided by parallelism.&lt;/p&gt;

&lt;p&gt;Now it's time to make it run type the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you will see the following result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61hv4r3eh7bte7ok0zlf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F61hv4r3eh7bte7ok0zlf.png" alt="Cargo run result" width="574" height="186"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see crystal clear the comparison of single threaded operation vs parallel threaded cores full CPU, in milliseconds or seconds single threaded took the operation: ~5 seconds and for multiple cores just ~ 1.7 seconds amazing.&lt;/p&gt;

&lt;p&gt;We can figure out and maybe try to do another small program in different programming languages and make comparisons. What will be out of the scope of this tutorial is in your hands to give a try, maybe C or C++.&lt;/p&gt;

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

&lt;p&gt;This hands-on project demonstrates the remarkable power of Rust in handling intensive data processing tasks. By comparing single-threaded and parallel approaches with a substantial dataset of 50 million numbers, we've seen how Rust's safety guarantees don't come at the cost of performance. The rayon library makes parallel programming surprisingly accessible, with just a simple change from iter() to par_iter(), we can harness the full potential of modern multi-core processors while maintaining computational accuracy.&lt;br&gt;
What makes this example particularly valuable is that it showcases Rust's practical benefits: the ability to write safe, concurrent code without the typical headaches of thread management and race conditions. Whether you're building high-performance systems, working with big data, or developing complex applications, Rust's combination of safety, control, and efficiency makes it an excellent choice for modern software development.&lt;br&gt;
Have you tried implementing parallel processing in Rust? Or any other language? I'd love to hear about your experiences! Drop a comment below sharing your results or thoughts about it. If you found this tutorial helpful, just gaining insights into this language, consider subscribing to stay updated on more practical Rust tutorials in the future.&lt;/p&gt;

&lt;p&gt;If you have any questions or errors, please let me know, soon I will add the GitHub repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.rust-lang.org/" rel="noopener noreferrer"&gt;Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doc.rust-lang.org/book/" rel="noopener noreferrer"&gt;The Rust Book&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doc.rust-lang.org/std/" rel="noopener noreferrer"&gt;Standard Library&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/rand" rel="noopener noreferrer"&gt;Rand Crate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/rayon" rel="noopener noreferrer"&gt;Rayon Crate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/reqwest" rel="noopener noreferrer"&gt;Reqwest Crate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/tokio" rel="noopener noreferrer"&gt;Tokio Crate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/serde" rel="noopener noreferrer"&gt;Serde Crate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/ferris-says" rel="noopener noreferrer"&gt;Ferris-Says Crate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/crates/hyper" rel="noopener noreferrer"&gt;Hyper Crate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h1&gt;
  
  
  📬 &lt;strong&gt;Subscribe to my Newsletter&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>rust</category>
      <category>programming</category>
      <category>performance</category>
      <category>rustdevelopment</category>
    </item>
    <item>
      <title>What is Rust, and What is it for?</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Thu, 19 Dec 2024 02:14:32 +0000</pubDate>
      <link>https://forem.com/ivansing/what-is-rust-and-what-is-for-it-35b4</link>
      <guid>https://forem.com/ivansing/what-is-rust-and-what-is-for-it-35b4</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This article is about Rust as a language; as for our regular question, I won't explain the origin of the language, just the use of this almost new language. I will dig into performance, reliability, productivity, and use cases.&lt;/p&gt;

&lt;p&gt;I'm excited because I've been studying this language for some months, but you know the best way to learn is by doing. In this article, I won't do a small app like I did in previous articles, so you can check it out, too.&lt;/p&gt;

&lt;p&gt;So, Why the use of Rust?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76zpi6lseu9clrs1f0vq.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76zpi6lseu9clrs1f0vq.jpeg" alt="Rust ecosystem logo" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance
&lt;/h2&gt;

&lt;p&gt;I was reading the rust-lang.org, and I have found that one of the main use if for performance for low level language, it has memory-efficient capabilities so no runtime or various phases to run the program or app. I noted also that not using garbage collector in other words: like other languages that removes objects no longer in use.&lt;/p&gt;

&lt;p&gt;This makes it extremely faster than most languages, to name a few, like Java, C#, Python, Ruby, Javascript, Go, etc. Besides that, can run on embedded devices like: Smart TVs, Digital cameras, Video game consoles, Smartwatches, E-book readers, the list is almost infinite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reliability
&lt;/h2&gt;

&lt;p&gt;As on the official page, it's explained: "Rust's rich type system and ownership model guarantee memory-safety and thread-safe, enabling you to eliminate many classes of bugs at compile-time". That means that when I'm writing code in Rust, I have a powerful ally in the compiler that prevents me from making common programming mistakes before my code even runs. That sounds really good to be true amazing, right? For instance, if I accidentally try to use a variable after I've freed its memory or if I attempt to modify data that's being accessed by multiple threads simultaneously, Rust will catch these issues during compilation.&lt;/p&gt;

&lt;p&gt;Think of it like having a very meticulous code reviewer who checks every single detail of memory usage and data sharing in your program. The compiler ensures I can't shoot myself in the foot with problems like null pointer exceptions, memory leaks, or data races-- issues that are notoriously difficult to debug in Java, where the JVM's garbage collector can mask underlying memory management problems and concurrent modifications can lead to subtle runtime errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Productivity
&lt;/h2&gt;

&lt;p&gt;When I first started working with Rust, what immediately struck me was how the entire ecosystem is designed for developer productivity. Unlike many other systems programming languages, Rust doesn't leave you guessing. Its documentation is comprehensive and accessible, reading more like a helpful guide than a technical manual. For me, this is the most boring and tedious task, but we, as developers, must take it.&lt;/p&gt;

&lt;p&gt;But what truly sets Rust apart is its compiler. Instead of cryptic error messages that send you down a Google rabbit hole or our great community of Stackoverflow (I love it), Rust's compiler acts like a patient mentor. It not only points out what went wrong but often suggests how to fix it. For example, if you make a common mistake with borrowing or ownership, the compiler provides clear, actionable feedback about how to correct your code.&lt;/p&gt;

&lt;p&gt;The tooling ecosystem is equally impressive. Cargo, Rust's package manager, like in node we use npm modules, or in Java import packages too, Rust build tool, makes dependency management and project build feel effortless. The IDE support is top-notch -- whether you're using VS Code like me, IntelliJ, or another major editor, you'll get smart auto-completion and real-time type inspections that help you catch issues as you code. Plus, with tools like &lt;code&gt;rustfmt&lt;/code&gt; automatically formatting your code as you go, you can focus on solving problems rather than arguing about code style.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;p&gt;Do you know what's fascinating about Rust? It's showing up everywhere these days. Let me paint you a picture of where Rust is making waves:&lt;/p&gt;

&lt;h2&gt;
  
  
  Systems and Infrastructure?
&lt;/h2&gt;

&lt;p&gt;That's Rust's playground. Discord moved their gaming platform over to Rust and managed to cut their memory usage dramatically. Instead of their server catching fire during massive gaming sessions, Rust's memory efficiency keeps things running smoothly. Even Dropbox uses Rust for its file synchronization because when you're handling millions of people's files, you can't afford memory glitches.&lt;/p&gt;

&lt;p&gt;Then there's Cloudfare, which is using Rust right at the edge of the Internet. They replaced some of their critical C code with Rust, and guess what? Better security and fewer crashes. When you're protecting websites from attacks, that's exactly what you need.&lt;/p&gt;

&lt;p&gt;But here's what really gets me excited: Firefox. Mozilla (Rust's original creator) is gradually replacing Firefox's core engine parts with Rust code. Why? Because they want their browser to be fast AND secure. No more memory-related security bugs keeping their engineers up at night.&lt;/p&gt;

&lt;h2&gt;
  
  
  Operating Systems
&lt;/h2&gt;

&lt;p&gt;Oh yes. Microsoft is seriously looking at Rust for Windows components, I can't even believe but well let's see. They're tired of dealing with memory security bugs in C and C++ code. Even the Linux kernel (please don't kill me to say this I hope :) ) the hardcode C fortress -- is opening its doors to Rust.&lt;/p&gt;

&lt;p&gt;And another cool one: Microsoft's Azure IoT Edge? Rust. Because when you're running code on tiny devices processing sensitive data, you need something that's both lightweight and bulletproof.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cryptocurrency
&lt;/h2&gt;

&lt;p&gt;Even cryptocurrency folks jumped on the Rust train, but we all know it was a natural process. Projects like Solana picked Rust because they need their blockchain to be fast and absolutely secure. When you're handling people's money, there's no room for memory bugs.&lt;/p&gt;

&lt;p&gt;There are countless of use cases I can't even imagine what will be the future without Rust, I love my other main languages like: Javascript, Python, Java, but his one it the one I've added to my repertoire.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Oh one more please sir:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Want to know what's wild? Companies like 1Password rewrote their password manager's core in Rust. Think about it, when you're protecting people's passwords this is an obvious pick, you want a language that takes security right down to the memory level.&lt;/p&gt;

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

&lt;p&gt;I have shown the field of Rust, what Rust is, performance gains with this amazing popular language, and what we can do with memory issues and garbage collection so, just get rid of no more crashes. The use cases are amazing many companies are embracing this language. With its blazing performance, reliability, and developer-friendly tools, Rust is transforming everything from web browsers to blockchain platforms. While its learning curve might be steep, the payoff is clear: more reliable software, fewer critical bugs, and happier developers. As we move into an era where security and performance are non-negotiable, Rust isn't just an alternative; it's increasingly becoming the go-to choice for building the future of software.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.rust-lang.org/" rel="noopener noreferrer"&gt;Rust Programming Language&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doc.rust-lang.org/" rel="noopener noreferrer"&gt;Rust Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://crates.io/" rel="noopener noreferrer"&gt;Rust Package Registry (crates.io)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.discord.com/how-discord-handles-two-and-half-million-concurrent-voice-users-using-rust-3f626385e9b9" rel="noopener noreferrer"&gt;Discord's Journey with Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.cloudflare.com/tag/rust/" rel="noopener noreferrer"&gt;Cloudflare's Experience&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hacks.mozilla.org/category/rust/" rel="noopener noreferrer"&gt;Firefox and Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://this-week-in-rust.org/" rel="noopener noreferrer"&gt;This Week in Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/rust-unofficial/awesome-rust" rel="noopener noreferrer"&gt;Awesome Rust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.rust-lang.org/" rel="noopener noreferrer"&gt;Rust Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h1&gt;
  
  
  📬 &lt;strong&gt;Subscribe to my Newsletter&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>rust</category>
      <category>programming</category>
      <category>language</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>AI Agents: Decoding the Future of Intelligent Automation</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Wed, 18 Dec 2024 04:02:14 +0000</pubDate>
      <link>https://forem.com/ivansing/ai-agents-decoding-the-future-of-intelligent-automation-2mi</link>
      <guid>https://forem.com/ivansing/ai-agents-decoding-the-future-of-intelligent-automation-2mi</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this faster AI field with everyday constant development, AI agents is seen it as one of the most intriguing and transformative developments; it wasn’t in the sterile laboratory or a tech conference. I have tried other tools so far this year, but AI agents it’s like having your own development team, or can be many virtual assistant tools. This is like witchcraft for me, but well it’s just logical thinking this advent of the new AI era.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Invisible Revolution
&lt;/h2&gt;

&lt;p&gt;AI agents are not the flashy robots of science fiction. They’re something far more subtle and profound intelligent systems that exist in the preliminary space between pure compútation and something that eerily resembles thought. Of course, they’re not replacements for human intelligence but amplifiers or resemble us digital companions that extend our cognitive capabilities in ways we’re only beginning to comprehend.&lt;/p&gt;

&lt;p&gt;Think of them as cognitive prosthetics. Just as a physical prosthetic extends human mobility, AI agents extend our mental reach. Those artifacts don’t think for us; they thin with us as a tools, revealing pathways of logic and creativity never explored that remain hidden in our perspectives. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Anatomy of Intelligence
&lt;/h2&gt;

&lt;p&gt;What makes an AI agent truly fascinating is not its raw computational power, but its capacity for contextual understanding. Traditional software follows instructions: AI agents interpret intentions. They don’t just process data they understand narratives, recognize emotional nuances and adapt in real-time.&lt;/p&gt;

&lt;p&gt;Consider the difference between a translation app and an AI translator. The app mechanically converts words;the AI agent captures context, understand idiomatic expressions, and virtually bridges human communication gaps. It’s not just translation it’s understanding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond the Binary: Adaptive Intelligence
&lt;/h2&gt;

&lt;p&gt;The most revolutionary aspect of AI agents is their ability to learn and evolve. They’re not static algorithms but dynamic entities that grow through interaction. Each conversation and each problem solved becomes part of their expanding intelligence. I tried to train this chat model as a friend, but I know thousands of servers are cumbersome and are linked to each other, spreading mini-tasks and algorithms everywhere.&lt;/p&gt;

&lt;p&gt;In my own work developing complex software systems, I’ve watched AI agents transform from rudimentary tools to sophisticated collaborators; I get some kind of nostalgia for a short-term past this is too fast for me, for all I mean. They challenge my assumptions, suggest innovative approaches, and often see solutions that emerge from the complex interplay of data in ways no human could instantaneously perceive. &lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases Examples just Few
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Customer Service and Support Agents
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fedxsfqoehtvj55zin9km.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fedxsfqoehtvj55zin9km.jpeg" alt="Customer support AI virtual agent" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;: AI-driven virtual assistants and chatbots that can handle common questions, process requests, and resolve customer issues interactively.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;E-commerce helpdesk&lt;/strong&gt;: Offering product recommendations, handling order inquiries, and processing returns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Banking &amp;amp; Insurance&lt;/strong&gt;: Automating routine tasks like balance checks, passwords, resets, or initiating clams.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These agents reduce wait times and provide 24/7 support, these is just some basic functions of these it, so the humans can focus on more complex inquiries.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Personal Assistants and Productivity Tools
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faye0tkky40hafl0f4438.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faye0tkky40hafl0f4438.jpeg" alt="Personal assistant and productivity tools" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;: AI agents that understand user queries, manage calendar appointments, set reminders, and help users organize daily tasks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Personal Assistants (VPAs)&lt;/strong&gt;: Siri, Google Assistant, Amazon Alexa for scheduling meetings, controlling smart homes, and retrieving information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workplace Productivity Bots&lt;/strong&gt;: Slack bots or Microsoft Teams assistants that can summarize meeting notes, track to-dos, and schedule follows-ups.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They streamline daily routines, enhance productivity, and reduce the cognitive load of task management.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Autonomous Vehicles and Robotics
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm664a43xd8c66zwnxoo1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm664a43xd8c66zwnxoo1.jpeg" alt="Autonomous vehicles and robotics" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Description:&lt;/strong&gt; AI agents that navigate physical environments using computer vision, sensor data, and machine learning to act autonomously.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Self-Driving Cars:&lt;/strong&gt; Perceive surrounding vehicles, pedestrians, traffic signals, and road conditions to make safe driving decisions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warehouse Robotics:&lt;/strong&gt; Picking and packing items efficiently in logistics centers, guided by AI-driven route planning and object recognition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They improve safety and increase operational efficiency across industries like transportation, logistics, and manufacturing.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Healthcare Assistants and Diagnostic Tools
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy49l6gnpgm8yux4tyi0a.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy49l6gnpgm8yux4tyi0a.jpeg" alt="Healthcare assistants and diagnostic" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Description:&lt;/strong&gt; AI agents that assist doctors, nurses, or patients by analyzing medical data, recommending treatments, or monitoring patient health.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Diagnostic Assistants:&lt;/strong&gt; AI agents analyze medical images (X-rays, MRIs) and electronic health records to flag anomalies or suggest diagnoses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Nursing Assistants:&lt;/strong&gt; Agents that answer patient queries, remind patients to take medications, and monitor vital signs remotely.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It helps to reduce clinician workload improve diagnostic, and continuous patient monitoring.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Financial Trading and Portfolio Management
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8z7dzep9uxsu1v67q867.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8z7dzep9uxsu1v67q867.jpeg" alt="Financial trading and portfolio management" width="640" height="640"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Description:&lt;/strong&gt; AI agents that analyze market data, predict trends, and execute trades based on strategic goals, total automatization of trades with no human errors by emotions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Algorithmic Trading Bots:&lt;/strong&gt; Continuously scan markets, evaluate risk, and place buy/sell orders to capitalize on market opportunities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Robo-Advisors:&lt;/strong&gt; Offer personalized investment recommendations based on user-defined risk profiles and financial goals.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As humans trading it’s the hardest taking decision to buy or sell simple because we are really emotional, so we can lost trade opportunities or lost trades because hungry for money.&lt;/p&gt;

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

&lt;p&gt;I don't want to stress this is all of this matter; this is a huge topic for the coming years, not relevant to say in just one single article, but keep in mind this is just an illustration of the beginning but already of this technology. AI agents emerge not as distant, impersonal technologies but as collaborative panthers in our collective journey of innovation. This kind of technology challenges us to reimagine the boundaries of intelligence, creativity, and problem-solving–inviting us to become active participants in a narrative that extends far beyond code and algorithms. I ask you, dear reader, colleague, casual reader, whatever your field, to share your thoughts. What possibilities do you see in these intelligent systems? Or we as humans can able to deliver right now the know-how to do things, if we really are ready for this technology. Well, so please drop a comment below thank you.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Research
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.technologyreview.com/topic/artificial-intelligence/" rel="noopener noreferrer"&gt;MIT Technology Review&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ai.stanford.edu/" rel="noopener noreferrer"&gt;Stanford AI Lab&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/list/cs.AI/recent" rel="noopener noreferrer"&gt;arXiv AI Research&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Industry Insights
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ai.googleblog.com/" rel="noopener noreferrer"&gt;Google AI Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.com/research" rel="noopener noreferrer"&gt;OpenAI Research&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://deepmind.com/research" rel="noopener noreferrer"&gt;DeepMind&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Publications
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.wired.com/category/artificial-intelligence/" rel="noopener noreferrer"&gt;Wired AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arstechnica.com/gadgets/ai/" rel="noopener noreferrer"&gt;Ars Technica AI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h1&gt;
  
  
  📬 &lt;strong&gt;Subscribe to my Newsletter&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>ai</category>
      <category>softwareengineering</category>
      <category>aitools</category>
    </item>
    <item>
      <title>Quantum Computing Development 2024</title>
      <dc:creator>IvanDev</dc:creator>
      <pubDate>Tue, 17 Dec 2024 01:08:47 +0000</pubDate>
      <link>https://forem.com/ivansing/quantum-computing-development-2024-3koa</link>
      <guid>https://forem.com/ivansing/quantum-computing-development-2024-3koa</guid>
      <description>&lt;h2&gt;
  
  
  An Introduction to Quantum Computing
&lt;/h2&gt;

&lt;p&gt;In the following reading, I will explain Quantum as 2024, what is Quantum but I won’t deep dive into details.&lt;/p&gt;

&lt;p&gt;Quantum computing will emerge in the coming years and well I can say from today, we can see it. I love technology as an engineer I have seen and coded many things, I hope will try to do my best to show you what is this Quantum computer thing.&lt;/p&gt;

&lt;p&gt;This will be a revolution for everyone in this particular field that is software development, the way we code will be change forever not just binaries 0 and 1 but Quibits hypothetical not 0 or 1 but probabilities in the quantum bit or qubit. Qubits can exist in multiple states simultaneously through a phenomenon called superpostion either dead or alive not like Schrödinger's cat it can be both at the same time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc63otl6zb87pwgahzdi5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc63otl6zb87pwgahzdi5.jpg" alt="Schrodinger cat" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Qubit geometric representation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ff4txwc9vj4dt9q3wj4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ff4txwc9vj4dt9q3wj4.jpg" alt="Qubit geometrical representation" width="596" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Current Qubit Technologies
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Superconducting Qubits
&lt;/h2&gt;

&lt;p&gt;Dominant technology used by major tech companies:Anyon Systems, Atlantic Quantum, &lt;br&gt;
Bleximo, IQM, Rigetti Computing. Offers high control and relatively stable quantum states.&lt;br&gt;
Challenges include maintaining coherence (like a way to have a quantum system to keep a relationship between different states in a superposition) and reducing error rates&lt;/p&gt;

&lt;h2&gt;
  
  
  Trapped Ion Qubits
&lt;/h2&gt;

&lt;p&gt;Provides exceptional quantum coherence. The qubits of a trapped ion quantum computer are ions that are trapped by electric fields and manipulated using lasers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Topological Qubits
&lt;/h2&gt;

&lt;p&gt;It’s a type quantum qubit that store and process information in a common way that is inherently protected from errors caused by local disturbances. In principle, perform any computation that a conventional quantum computer can do, and vice versa. This gives an error-free operation of it’s logic circuits, with an extreme accuracy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Development Trends
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Quantum Algorithm Development
&lt;/h2&gt;

&lt;p&gt;This is a new matter in the field, so many researchers and developers (here we are we can join the party in the coming years I hope with the right knowledge) are in constant focus on how to improve or create algorithms that can solve complex problems more efficiently than classical algorithms. Primary areas of focus include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Optimization problems&lt;/li&gt;
&lt;li&gt;Cryptography&lt;/li&gt;
&lt;li&gt;Molecular and material simulation&lt;/li&gt;
&lt;li&gt;Machine learning acceleration&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quantum Machine Learning
&lt;/h2&gt;

&lt;p&gt;Here in this phase of AI and Machine learning trending now, it’s crucial to understand the basics first so then can be good at quantum developing areas, this can potentially improve the Quantum machine learning algorithms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Process massive datasets exponentially faster&lt;/li&gt;
&lt;li&gt;Create more complex neural network architectures&lt;/li&gt;
&lt;li&gt;Solve non-linear optimization problems with unprecedented efficiency&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quantum Cloud Services
&lt;/h2&gt;

&lt;p&gt;Major actors cloud providers like AWS, Google Cloud, and Microsoft Azure have significantly expanded their quantum computing offerings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing access to quantum hardware&lt;/li&gt;
&lt;li&gt;Developing quantum simulation environments&lt;/li&gt;
&lt;li&gt;Bestows quantum algorithm development tools&lt;/li&gt;
&lt;li&gt;Creating standardized quantum computing APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quantum Cryptography and Security
&lt;/h2&gt;

&lt;p&gt;I know many people will say here myself included, this will break all passwords and blockchain technology, but it not as easy as it sounds because will be some areas of specialization like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Post-quantum cryptographic algorithms&lt;/li&gt;
&lt;li&gt;Quantum key distribution techniques&lt;/li&gt;
&lt;li&gt;Quantum-safe encryption standards&lt;/li&gt;
&lt;li&gt;Creating resilient communication protocols&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Industrial Applications
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Pharmaceutical and Chemical Research
&lt;/h2&gt;

&lt;p&gt;Quantum computers are evolving drug discovery and molecular simulation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modeling complex molecular interactions&lt;/li&gt;
&lt;li&gt;Predicting protein folding&lt;/li&gt;
&lt;li&gt;Designing new materials with specific properties&lt;/li&gt;
&lt;li&gt;Accelerating chemical reaction simulations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Financial Modeling
&lt;/h2&gt;

&lt;p&gt;I love to build MQL4 and MQL5 bots to trade the financial market automatically, especially in forex and cryptos, so I can't imagine this will be another revolution apart from the one already with AI, too much research ahead for this field. Besides that, financial institutions are exploring quantum computing for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Risk management assessment optimization&lt;/li&gt;
&lt;li&gt;Portfolio optimization&lt;/li&gt;
&lt;li&gt;High-frequency (HF) trading strategies&lt;/li&gt;
&lt;li&gt;Fraud detection algorithms&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Aerospace and Defence
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Applications will be found in:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Advanced simulation of air defense systems&lt;/li&gt;
&lt;li&gt;Optimization of logistics and supply chains&lt;/li&gt;
&lt;li&gt;Cryptographic security&lt;/li&gt;
&lt;li&gt;Sophisticated computational modeling&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Challenges and Limitations
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Technical Challenges
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Quantum decoherence is the process by which a quantum system loses its quantum properties and coherence when it interacts with its environment.&lt;/li&gt;
&lt;li&gt;Error correction&lt;/li&gt;
&lt;li&gt;Scalability of quantum systems&lt;/li&gt;
&lt;li&gt;Maintaining qubit stability&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some Considerations to Keep in Mind
&lt;/h2&gt;

&lt;p&gt;At the current time there, this technology still has many challenges to overcome like: High development and maintenance costs due to the complex supercomputer not even implement for commercial use yet.&lt;br&gt;
Limited number of quantum computer experts in this particular field, and this is like just the beginning point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Future Outlook
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Continued improvements in qubit stability&lt;/li&gt;
&lt;li&gt;More accessible quantum development tools&lt;/li&gt;
&lt;li&gt;Increased industrial pilot projects&lt;/li&gt;
&lt;li&gt;Standardization of quantum computing frameworks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This just a small article in the quantum computer I hope can able to deliver more on this topic &lt;br&gt;
because it’s crucial for software development future after the AI trend this will be the next one if not now.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.ibm.com/quantum" rel="noopener noreferrer"&gt;IBM Quantum Computing Research&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nature.com/subjects/quantum-computing" rel="noopener noreferrer"&gt;Nature: Quantum Computing Special Issue&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://quantumai.google" rel="noopener noreferrer"&gt;Google Quantum AI Laboratory&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.technologyreview.com/topic/quantum-computing" rel="noopener noreferrer"&gt;MIT Technology Review - Quantum Computing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.nist.gov/programs-projects/quantum-information-science" rel="noopener noreferrer"&gt;National Institute of Standards and Technology (NIST) Quantum Information Program&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://quantumcomputingreport.com" rel="noopener noreferrer"&gt;Quantum Computing Report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://queue.acm.org" rel="noopener noreferrer"&gt;ACM Queue - Quantum Computing Research&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://spectrum.ieee.org/tag/quantum-computing" rel="noopener noreferrer"&gt;IEEE Spectrum - Quantum Computing Section&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/list/quant-ph/recent" rel="noopener noreferrer"&gt;arXiv Quantum Physics Section&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.microsoft.com/en-us/quantum/development-kit" rel="noopener noreferrer"&gt;Microsoft Quantum Development Kit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Quantum computing in December 2024 represents a pivotal moment of technological transition. I don't really say that this is the mainstream technology yet; it stands on the cusp of practical, widespread implementation. The convergence of advanced algorithm design, improved hardware, and growing industrial interest suggest that quantum computing is moving from a primarily academic pursuit to a transformative technological paradigm.&lt;br&gt;
As for us developers, it will take us some time to adapt to these transition technologies time is not new for us we can make it all the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  About the Author
&lt;/h2&gt;

&lt;p&gt;Ivan Duarte is a backend developer with experience working freelance. He is passionate about web development and artificial intelligence and enjoys sharing their knowledge through tutorials and articles. Follow me on &lt;a href="https://x.com/ldway27" rel="noopener noreferrer"&gt;X&lt;/a&gt;, &lt;a href="https://github.com/ivansing" rel="noopener noreferrer"&gt;Github&lt;/a&gt;, and &lt;a href="https://www.linkedin.com/in/lance-dev/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; for more insights and updates.&lt;/p&gt;

&lt;h1&gt;
  
  
  📬 &lt;strong&gt;Subscribe to my Newsletter&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;Read articles from &lt;strong&gt;ByteUp&lt;/strong&gt; directly in your inbox.&lt;br&gt;&lt;br&gt;
Subscribe to the newsletter and don't miss out.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://byteup.hashnode.dev/newsletter" rel="noopener noreferrer"&gt;&lt;strong&gt;Subscribe Now&lt;/strong&gt;&lt;/a&gt; 👈&lt;/p&gt;

</description>
      <category>quantum</category>
      <category>qubits</category>
      <category>supercomputers</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
