<?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: Emmanuel (Emmo00)</title>
    <description>The latest articles on Forem by Emmanuel (Emmo00) (@emmo00).</description>
    <link>https://forem.com/emmo00</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%2F1376028%2Fde7adeef-631e-480c-90c1-de950ac02fa6.jpg</url>
      <title>Forem: Emmanuel (Emmo00)</title>
      <link>https://forem.com/emmo00</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/emmo00"/>
    <language>en</language>
    <item>
      <title>🚀 From Student to Web3 Builder: My Journey, My Project, and Why It Matters</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Fri, 25 Apr 2025 04:22:05 +0000</pubDate>
      <link>https://forem.com/emmo00/from-student-to-web3-builder-my-journey-my-project-and-why-it-matters-18b2</link>
      <guid>https://forem.com/emmo00/from-student-to-web3-builder-my-journey-my-project-and-why-it-matters-18b2</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hi, I’m Emmanuel Nwafor&lt;/strong&gt;, a computer science student at the University of Nigeria, Nsukka — and a curious mind who fell in love with software development. Like &lt;em&gt;not&lt;/em&gt; many others, I started with the basics of back-end development — arguably the best way to begin a software engineering journey — and eventually dabbled in other areas of tech.&lt;br&gt;&lt;br&gt;
&lt;em&gt;[I also wanted to be a writer, so I hope you enjoy this piece].&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I remember when I built my first API server with Node.js — that was when I realized I’d actually found something I liked doing. For once, I wasn’t overthinking my crush at the time. Turns out, &lt;em&gt;I wasn’t sad, or lonely, or ugly😐 — I just needed to build.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Well, enough of the self-glazing 😅. Let’s talk about something else.&lt;/p&gt;




&lt;h3&gt;
  
  
  🌐 Why I Chose Web3
&lt;/h3&gt;

&lt;p&gt;What pulled me into Web3 wasn’t just the buzz or the promise of pay that overwhelmingly surpassed what I was already making as a back-end web developer 👀.&lt;/p&gt;

&lt;p&gt;I wanted to build cool stuff &lt;em&gt;while creating ✨impact✨&lt;/em&gt;, and I feel Web3 provides a certain liberty for that. &lt;strong&gt;Impact&lt;/strong&gt; is the keyword — and in my opinion, that’s what all of us ultimately want to make. Web3 enables individuals to create things that &lt;em&gt;don’t need approval to exist&lt;/em&gt; and &lt;em&gt;can’t be switched off by gatekeepers&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;[we might still be cooked in Web3 if one of these gatekeepers decides to switch off their servers, but we move &lt;a href="https://www.reddit.com/r/CryptoCurrency/comments/vziazb/more_than_50_of_ethereum_is_hosted_on_amazons_aws" rel="noopener noreferrer"&gt;#ReditIsTheOnlySourceOfTruth&lt;/a&gt;]&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So far, so good. It’s been an interesting ride — full of learning, for sure.&lt;br&gt;&lt;br&gt;
&lt;em&gt;[The amount of new vocabulary I had to learn just to grasp beginner-level blockchain concepts is alarming 🫠].&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🧠 Learning from the Cipher Session
&lt;/h3&gt;

&lt;p&gt;This journey accelerated when I joined the &lt;strong&gt;B&amp;lt;&amp;gt;rder/ess &amp;lt;&amp;gt; Metis Cipher Session&lt;/strong&gt;, a mind-stretching experience hosted by &lt;em&gt;[you guessed it]&lt;/em&gt; the B&amp;lt;&amp;gt;rder/ess team in collaboration with Metis and KarlaGod.&lt;/p&gt;

&lt;p&gt;Here are some highlights of what I picked up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Full-stack Solidity development skills&lt;/strong&gt; — &lt;em&gt;[Imagine if this wasn’t on the list 🙂]&lt;/em&gt;&lt;br&gt;&lt;br&gt;
We covered everything from smart contracts to front-end interactions. &lt;em&gt;[Safe to say, I can add Solidity to my LinkedIn profile]&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;How to actually make money as a developer&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Our tutor didn’t just focus on the tech — we also got real-world advice on how to monetize our skills, navigate the ecosystem, and think like builders, not just coders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clarity on the Web3 landscape, from KarlaGod herself🫡&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Karla gave us the &lt;em&gt;real&lt;/em&gt; sauce — how the space works, why community matters, and how to market your project and get funded. Step-by-step clarity. &lt;em&gt;[I can't make this stuff up]&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  🔨 What I’m Building: [Blockchain-powered verification system that ensures transparent, tamper-proof records of land ownership (BPVSTETTPROLO)]
&lt;/h3&gt;

&lt;p&gt;My project is called ✨&lt;strong&gt;LandRegistry&lt;/strong&gt;✨ — a decentralized app that leverages blockchain technology to provide secure, transparent, and efficient land ownership verification.&lt;br&gt;&lt;br&gt;
👉 &lt;a href="https://land-registry-dapp-tau.vercel.app" rel="noopener noreferrer"&gt;Check it out&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;The problem:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Land ownership disputes are &lt;em&gt;way too common&lt;/em&gt; — especially in regions where records are handwritten, scattered across multiple offices, or worse, mysteriously “missing.”&lt;br&gt;&lt;br&gt;
People lose properties, get scammed, or spend years in court because a piece of paper said one thing, and some government staff or “land agent” said another.&lt;br&gt;&lt;br&gt;
The lack of a reliable, tamper-proof record system means trust is low, fraud is high, and verification is expensive, slow, and largely opaque.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;The solution:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;LandRegistry&lt;/strong&gt; stores land ownership records directly on the blockchain — publicly verifiable, immutable, and timestamped.&lt;br&gt;&lt;br&gt;
Here’s what it offers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tamper-proof verification:&lt;/strong&gt; Once a record is written, not even I can alter it. And that’s the whole point.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open ownership:&lt;/strong&gt; Every change in ownership is logged and visible. No shady backdoor deals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decentralized access:&lt;/strong&gt; You don’t need to know someone in the ministry to verify or register land — you just need a wallet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost-effective and secure:&lt;/strong&gt; Cuts out intermediaries and reduces paperwork. No more photocopying a "C of O" ten times.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At its core, the project isn’t just about digitizing land ownership — it’s about &lt;strong&gt;restoring trust&lt;/strong&gt; where it’s been broken for decades.&lt;/p&gt;




&lt;h3&gt;
  
  
  🗓️ Join Me for Demo Day!
&lt;/h3&gt;

&lt;p&gt;I’ll be demoing &lt;strong&gt;LandRegistry&lt;/strong&gt; on &lt;strong&gt;Friday, 4PM WAT&lt;/strong&gt;, alongside other brilliant minds from the Cipher cohort.&lt;/p&gt;

&lt;p&gt;Let’s shape the future of on-chain land ownership — one block at a time.&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>web3</category>
    </item>
    <item>
      <title>Self Guide for Deploying Laravel and React Applications on a VPS</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Wed, 26 Feb 2025 20:48:34 +0000</pubDate>
      <link>https://forem.com/emmo00/self-guide-for-deploying-laravel-and-react-applications-on-a-vps-1o57</link>
      <guid>https://forem.com/emmo00/self-guide-for-deploying-laravel-and-react-applications-on-a-vps-1o57</guid>
      <description>&lt;p&gt;This is a documentation of the steps I took in deploying my Laravel and React application to a VPS. &lt;/p&gt;

&lt;p&gt;If you're reading along, I'm sure it'd be useful irrespective of the application stack. &lt;/p&gt;

&lt;h2&gt;
  
  
  1. Initial VPS Setup
&lt;/h2&gt;

&lt;p&gt;Before deploying your applications, you need to prepare your server environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Update Your System
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Essential Dependencies
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;apache2 unzip curl git &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Laravel Backend Deployment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Add ondrej/php PPA as a software repository.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;add-apt-repository ppa:ondrej/php &lt;span class="c"&gt;# Press enter when prompted.&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install PHP and Required Extensions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;php php-cli php-mbstring php-xml php-bcmath php-tokenizer php-curl php-zip php-mysql &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Composer
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-sS&lt;/span&gt; https://getcomposer.org/installer | php
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;composer.phar /usr/local/bin/composer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set Up MySQL Database
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;mysql-server &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;mysql_secure_installation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a database and user for your Laravel application:&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;sudo &lt;/span&gt;mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Within the MySQL prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;laravel_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;USER&lt;/span&gt; &lt;span class="s1"&gt;'laravel_user'&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;'localhost'&lt;/span&gt; &lt;span class="n"&gt;IDENTIFIED&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="s1"&gt;'your_strong_password'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;GRANT&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;laravel_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="s1"&gt;'laravel_user'&lt;/span&gt;&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="s1"&gt;'localhost'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;FLUSH&lt;/span&gt; &lt;span class="k"&gt;PRIVILEGES&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;EXIT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deploy Your Laravel Application
&lt;/h3&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; /var/www
git clone https://github.com/your-username/your-laravel-project.git laravel
&lt;span class="nb"&gt;cd &lt;/span&gt;laravel
composer &lt;span class="nb"&gt;install
cp&lt;/span&gt; .env.example .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Edit the .env file with your database credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_db
DB_USERNAME=laravel_user
DB_PASSWORD=your_strong_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate the application key and run migrations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan key:generate
php artisan migrate &lt;span class="nt"&gt;--seed&lt;/span&gt;
php artisan config:cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configure Apache for Laravel
&lt;/h3&gt;

&lt;p&gt;Create a new Apache configuration file:&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;sudo &lt;/span&gt;nano /etc/apache2/sites-available/laravel.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;VirtualHost&lt;/span&gt;&lt;span class="sr"&gt; *:80&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="nc"&gt;ServerAdmin&lt;/span&gt; webmaster@yourdomain.com
    &lt;span class="nc"&gt;DocumentRoot&lt;/span&gt; /var/www/laravel/public
    &lt;span class="nc"&gt;ServerName&lt;/span&gt; api.yourdomain.com

    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;Directory&lt;/span&gt;&lt;span class="sr"&gt; /var/www/laravel/public&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="nc"&gt;AllowOverride&lt;/span&gt; &lt;span class="ss"&gt;All&lt;/span&gt;
        &lt;span class="nc"&gt;Require&lt;/span&gt; &lt;span class="ss"&gt;all&lt;/span&gt; granted
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;Directory&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;
    &lt;span class="nc"&gt;ErrorLog&lt;/span&gt; ${APACHE_LOG_DIR}/laravel_error.log
    &lt;span class="nc"&gt;CustomLog&lt;/span&gt; ${APACHE_LOG_DIR}/laravel_access.log combined
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;VirtualHost&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable the site and required modules:&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;sudo &lt;/span&gt;a2ensite laravel.conf
&lt;span class="nb"&gt;sudo &lt;/span&gt;a2enmod rewrite
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set Proper File Permissions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; www-data:www-data /var/www/laravel
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; 775 /var/www/laravel/storage /var/www/laravel/bootstrap/cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. React Frontend Deployment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Build Your React Application
&lt;/h3&gt;

&lt;p&gt;On your local development machine:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Transfer the Build to Your VPS
&lt;/h3&gt;

&lt;p&gt;Using SCP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scp &lt;span class="nt"&gt;-r&lt;/span&gt; build/ username@your-vps-ip:/var/www/react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you could clone your repository and build directly on the server (I'd recommend the former especially if deploying with a CICD pipeline):&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; /var/www
git clone https://github.com/your-username/your-react-project.git react
&lt;span class="nb"&gt;cd &lt;/span&gt;react
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Configure Apache for React
&lt;/h3&gt;

&lt;p&gt;Create a new Apache configuration:&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;sudo &lt;/span&gt;nano /etc/apache2/sites-available/react.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight apache"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;VirtualHost&lt;/span&gt;&lt;span class="sr"&gt; *:80&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="nc"&gt;ServerAdmin&lt;/span&gt; webmaster@yourdomain.com
    &lt;span class="nc"&gt;DocumentRoot&lt;/span&gt; /var/www/react/build
    &lt;span class="nc"&gt;ServerName&lt;/span&gt; yourdomain.com

    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nl"&gt;Directory&lt;/span&gt;&lt;span class="sr"&gt; /var/www/react/build&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="nc"&gt;Options&lt;/span&gt; &lt;span class="ss"&gt;Indexes&lt;/span&gt; &lt;span class="ss"&gt;FollowSymLinks&lt;/span&gt;
        &lt;span class="nc"&gt;AllowOverride&lt;/span&gt; &lt;span class="ss"&gt;All&lt;/span&gt;
        &lt;span class="nc"&gt;Require&lt;/span&gt; &lt;span class="ss"&gt;all&lt;/span&gt; granted

        &lt;span class="c"&gt;# This configuration ensures that React Router works correctly&lt;/span&gt;
        &lt;span class="nc"&gt;RewriteEngine&lt;/span&gt; &lt;span class="ss"&gt;on&lt;/span&gt;
        &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_FILENAME} !-f
        &lt;span class="nc"&gt;RewriteCond&lt;/span&gt; %{REQUEST_FILENAME} !-d
        &lt;span class="nc"&gt;RewriteRule&lt;/span&gt; ^ index.html [L]
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;Directory&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;
    &lt;span class="nc"&gt;ErrorLog&lt;/span&gt; ${APACHE_LOG_DIR}/react_error.log
    &lt;span class="nc"&gt;CustomLog&lt;/span&gt; ${APACHE_LOG_DIR}/react_access.log combined
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nl"&gt;VirtualHost&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable the site:&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;sudo &lt;/span&gt;a2ensite react.conf
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Secure Your Applications with SSL
&lt;/h2&gt;

&lt;p&gt;For production applications, SSL is essential. Let's Encrypt provides free SSL certificates:&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;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;certbot python3-certbot-apache &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;certbot &lt;span class="nt"&gt;--apache&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; yourdomain.com &lt;span class="nt"&gt;-d&lt;/span&gt; api.yourdomain.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts to complete the SSL setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Set Up Process Management for Laravel
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Configure Supervisor for Queue Workers
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;supervisor &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/supervisor/conf.d/laravel-worker.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[program:laravel-worker]&lt;/span&gt;
&lt;span class="py"&gt;process_name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;%(program_name)s_%(process_num)02d&lt;/span&gt;
&lt;span class="py"&gt;command&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;php /var/www/laravel/artisan queue:work --tries=3 --sleep=3&lt;/span&gt;
&lt;span class="py"&gt;autostart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="py"&gt;autorestart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="py"&gt;user&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;www-data&lt;/span&gt;
&lt;span class="py"&gt;numprocs&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;
&lt;span class="py"&gt;redirect_stderr&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;true&lt;/span&gt;
&lt;span class="py"&gt;stdout_logfile&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/var/log/laravel-worker.log&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Activate the configuration:&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;sudo &lt;/span&gt;supervisorctl reread
&lt;span class="nb"&gt;sudo &lt;/span&gt;supervisorctl update
&lt;span class="nb"&gt;sudo &lt;/span&gt;supervisorctl start laravel-worker:&lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set Up Laravel Scheduler
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * * cd /var/www/laravel &amp;amp;&amp;amp; php artisan schedule:run &amp;gt;&amp;gt; /dev/null 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Advanced Configuration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Set Up a Load Balancer (Optional)
&lt;/h3&gt;

&lt;p&gt;For high-traffic applications, consider setting up Nginx as a load balancer in front of Apache:&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;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a configuration file:&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;sudo &lt;/span&gt;nano /etc/nginx/sites-available/loadbalancer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;upstream&lt;/span&gt; &lt;span class="s"&gt;backend&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;server&lt;/span&gt; &lt;span class="nf"&gt;127.0.0.1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8080&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;# Add more servers if you have multiple instances&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;yourdomain.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://backend&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Real-IP&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&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;h3&gt;
  
  
  Configure Redis for Caching (Optional)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;redis-server &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update your Laravel .env file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CACHE_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7. Maintenance and Updates
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Automating Laravel Updates
&lt;/h3&gt;

&lt;p&gt;Create a simple script:&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;sudo &lt;/span&gt;nano /usr/local/bin/update-laravel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add:&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="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /var/www/laravel
git pull
composer &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--no-dev&lt;/span&gt;
php artisan migrate &lt;span class="nt"&gt;--force&lt;/span&gt;
php artisan config:cache
php artisan route:cache
php artisan view:cache
&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; www-data:www-data /var/www/laravel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make it executable:&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;sudo chmod&lt;/span&gt; +x /usr/local/bin/update-laravel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Monitoring Your Application
&lt;/h3&gt;

&lt;p&gt;Install monitoring tools:&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;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;htop net-tools &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Common Laravel Issues
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;500 Internal Server Error&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check Laravel logs: &lt;code&gt;tail -f /var/www/laravel/storage/logs/laravel.log&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Check Apache logs: &lt;code&gt;tail -f /var/log/apache2/laravel_error.log&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Permission Issues&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run: &lt;code&gt;sudo chown -R www-data:www-data /var/www/laravel&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Common React Issues
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;White Screen / Not Loading&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check browser console for errors&lt;/li&gt;
&lt;li&gt;Verify .htaccess file in build directory&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;API Connection Issues&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure your .env file in React has the correct API URL&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;You've now successfully deployed both your Laravel backend and React frontend on a single VPS.&lt;/p&gt;

&lt;p&gt;Remember to regularly back up your database and application files, keep your server updated with security patches, and monitor your application's performance as your user base grows.&lt;/p&gt;

&lt;p&gt;Up until now we have done the deployment manually, but you should definitely consider setting up a CICD pipeline for easy, automated deployment. GitHub Actions is a good recommendation.&lt;/p&gt;

&lt;p&gt;Happy coding!👍🏻&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>react</category>
      <category>vps</category>
      <category>linux</category>
    </item>
    <item>
      <title>Learning a new language/framework</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Sun, 30 Jun 2024 19:43:26 +0000</pubDate>
      <link>https://forem.com/emmo00/learning-a-new-languageframework-1ef7</link>
      <guid>https://forem.com/emmo00/learning-a-new-languageframework-1ef7</guid>
      <description>&lt;p&gt;I recently took up an internship role where I had to use a programming language and framework I was unfamiliar with. The role involved using Laravel as the backend framework and I had to learn it. &lt;a href="https://laravel.com" rel="noopener noreferrer"&gt;Laravel&lt;/a&gt; is a PHP framework for building web applications.&lt;br&gt;
In this post, I'd like to outline some steps I took from being clueless to contributing to the codebase within 2 months.&lt;br&gt;
Don't be alarmed if this timeframe seems too short, this is probably, as I'll talk about in a minute, because I have had a little experience in programming and backend development before then. If you don't fall into this category or you are a total beginner in your field, these tips should still be helpful to you as a developer. Hang tight, let's explore.&lt;/p&gt;

&lt;h2&gt;
  
  
  Having a good programming background
&lt;/h2&gt;

&lt;p&gt;A really smart guy once said, "People need to start learning programming instead of programming languages". I agree with this saying. Programming languages are just tools software developers use to implement their solutions. The underlying way of thinking and problem-solving are still required no matter the number of languages you know.&lt;br&gt;
Knowing a lot of programming languages, although impressive, doesn't mean the person can apply these concepts to build cool and helpful software, especially in this age of rising use of AI tools and companions.&lt;/p&gt;

&lt;p&gt;Understanding concepts like Variables, Data types, control flow, data structures, algorithms, programming paradigms like Object Oriented Programming (OOP) and Functional programming, Design patterns, Testing, concurrency and parallelism, and error handling is a good start. In the real world, or even now, we apply and implement most of these without consciously/intentionally thinking about them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learn the language first
&lt;/h2&gt;

&lt;p&gt;I've heard people say "I'm good with React, but I have issues with JavaScript". This shouldn't be the case. One should be very familiar with a language and how it works before learning any of its frameworks.&lt;br&gt;
Some key questions to ask when learning a new language may include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What does the general &lt;strong&gt;Syntax&lt;/strong&gt; look?&lt;/li&gt;
&lt;li&gt;What are the provided/built-in &lt;strong&gt;Data Types&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;How do I declare &lt;strong&gt;Variables&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Provided &lt;strong&gt;Operators&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;How to implement &lt;strong&gt;Control Flows&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;How to declare &lt;strong&gt;Function&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Manual &lt;strong&gt;Memory Management&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;How to run my programs? &lt;strong&gt;Compiled&lt;/strong&gt; or &lt;strong&gt;Interpreted&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt;Is it a &lt;strong&gt;Static or Dynamic Type&lt;/strong&gt; language?&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;Paradigm&lt;/strong&gt; does it belong?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, You'll notice answers to these questions for any programming language you choose are not the same. You might also get a "Not Quite" or "It depends" answer from some of these in some languages, and understanding these "It depends" scenarios is key.&lt;/p&gt;

&lt;p&gt;For example, answering the question "How do I run my Java Program". You can run your Java program by first compiling it to bytecode with the java compiler: &lt;code&gt;javac MyCode.java&lt;/code&gt;, then running the generated &lt;code&gt;.class&lt;/code&gt; file with &lt;code&gt;java MyCode&lt;/code&gt;. Despite the compilation step, java is "Not Quite" a compiled language. Java is considered both compiled and interpreted. It compiles to bytecode, then the bytecode is interpreted with the Java Virtual Machine (JVM).&lt;/p&gt;

&lt;p&gt;Most of the knowledge you gain in this stage is transferable to other programming languages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Projects
&lt;/h2&gt;

&lt;p&gt;This is a very important step in the process. Building projects is a way for you to exercise the knowledge you've acquired. It also allows you to experiment with the language or framework, which gives you a more in-depth knowledge of the language.&lt;br&gt;
It is okay to start small as no one expects you to build anything too complex as you start, you are only advised to take up challenges.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing Frameworks/Libraries
&lt;/h2&gt;

&lt;p&gt;After getting a grasp of the language through the docs/tutorials and building projects, it's time to choose a framework.&lt;br&gt;
Frameworks are pre-written blocks of code that programmers can incorporate into their projects to save time and effort. Frameworks and libraries make implementation of common tasks very easy because of the provided &lt;em&gt;abstraction&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Choosing a framework to learn can be hard and confusing as you're new to the space, so here are some tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with a Popular one: Learning a popular framework with a vast community and resources makes it easier to find help and learning materials.&lt;/li&gt;
&lt;li&gt;Experiment: Once you're comfortable with one framework, consider exploring others in different domains to broaden your skillset and knowledge.&lt;/li&gt;
&lt;li&gt;Focus on Core Programming Concepts: Regardless of the framework, a solid understanding of programming fundamentals is crucial. The ability to learn new frameworks becomes easier as your programming foundation strengthens.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Start learning the framework
&lt;/h2&gt;

&lt;p&gt;Before diving into the framework, ensure you have a good grasp of the programming language it's built on. This will make understanding the framework's syntax and concepts much smoother.&lt;/p&gt;

&lt;p&gt;Finding the right resources to learn the chosen framework is not always easy, but I always recommend the Official framework documentation. Most frameworks have comprehensive documentation that covers everything from basic concepts to advanced features. Start here to get a solid understanding of the framework's core principles and functionalities.&lt;br&gt;
Other sources for learning about a framework include Tutorials (e.g. YouTube Videos, Blogs, and Articles), Video Courses (like Udemy or Coursera), and Forums.&lt;/p&gt;

&lt;p&gt;Do not waste time in this stage before moving to the next step so you don't get stuck in "Tutorial Hell".&lt;/p&gt;

&lt;h2&gt;
  
  
  Notice the Key concepts
&lt;/h2&gt;

&lt;p&gt;Don't try to learn everything at once. Prioritize understanding of the framework's core functionalities, architecture, and design patterns. This foundational knowledge will be essential as you build more complex projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Projects
&lt;/h2&gt;

&lt;p&gt;Yet again, Build projects. Don't wait until you're an expert to start building. Look for small project ideas that allow you to practice the framework's concepts. This will solidify your learning and boost your confidence.&lt;/p&gt;

&lt;p&gt;Speaking of taking challenges, allow me to introduce the &lt;a href="https://hng.tech/internship" rel="noopener noreferrer"&gt;HNG internship program&lt;/a&gt;. HNG is a company with a mission — we work with the very best techies to help them enhance their skills through our HNG internship program and build their network. HNG Internship is a fast-paced boot camp for learning digital skills. It's focused on advanced learners and those with some pre-knowledge, and it gets people into shape for job offers. To register for this program, click &lt;a href="https://hng.tech/internship" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I hope these tips were helpful. Remember, growth takes time and dedication so set realistic goals, take breaks and you can also find a study buddy to help you in your journey. Stay consistent friends🙋‍♂️.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>learning</category>
      <category>laravel</category>
    </item>
    <item>
      <title>The difference between '||' and '??' in JavaScript.</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Fri, 12 Apr 2024 16:20:23 +0000</pubDate>
      <link>https://forem.com/emmo00/the-difference-between-and-in-javascript-3em3</link>
      <guid>https://forem.com/emmo00/the-difference-between-and-in-javascript-3em3</guid>
      <description>&lt;p&gt;Today, we are going to look at the behavior of two operators in JavaScript - the Logical OR Operator (&lt;code&gt;||&lt;/code&gt;) and the Nullish Coalescing Operator (&lt;code&gt;??&lt;/code&gt;). These operators are usually confused or misunderstood, so let's get right to it.&lt;/p&gt;

&lt;p&gt;They are usually used in writing one-liner "hotwires" (providing default values or fallbacks) and while they might seem similar, they serve different purposes and behave differently, especially in the context of handling &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt; values in JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logical OR Operator &lt;code&gt;||&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The logical OR operator &lt;code&gt;||&lt;/code&gt; is a binary operator that returns the first truthy value it encounters or the last value if none are truthy. &lt;br&gt;
JavaScript considers a value that is not among the following truthy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;false&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;''&lt;/code&gt; (empty string)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;null&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;undefined&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NaN&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is used to test whether at least one of the operands is truthy. if the left-hand operand is truthy, it is returned. If it is falsy, the right-hand operand is evaluated and returned.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Emmanuel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;defaultName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Guest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;defaultName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Emmanuel&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;the &lt;code&gt;name&lt;/code&gt; variable is not falsy, so the &lt;code&gt;displayName&lt;/code&gt; is evaluated to &lt;code&gt;"Emmanuel"&lt;/code&gt;. Now consider this:&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;let&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;defaultName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Guest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;displayName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;defaultName&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Guest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, since &lt;code&gt;name&lt;/code&gt; is an empty string (which is falsy), the || operator evaluates &lt;code&gt;defaultName&lt;/code&gt; and assigns it to &lt;code&gt;displayName&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nullish Coalescing Operator (??)
&lt;/h2&gt;

&lt;p&gt;The nullish coalescing operator (??) is also a logical operator that returns its right-hand side operand when its left-hand side operand is &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;, and otherwise returns its left-hand side operand. Unlike the &lt;code&gt;||&lt;/code&gt; operator, it does not consider other falsy values (&lt;code&gt;false&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;''&lt;/code&gt;, &lt;code&gt;NaN&lt;/code&gt;) as triggering the fallback.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;defaultAge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;userAge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nx"&gt;defaultAge&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, even though age is &lt;code&gt;0&lt;/code&gt; (which is considered falsy), the &lt;code&gt;??&lt;/code&gt; operator does not consider it as a trigger for the fallback because &lt;code&gt;0&lt;/code&gt; is not &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt;. Therefore, &lt;code&gt;userAge&lt;/code&gt; is assigned the value of age, which is &lt;code&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In summary, the &lt;code&gt;||&lt;/code&gt; operator is used to test whether at least one of the operands is truthy, while the ?? operator is used to provide a default value for a variable, but only considers &lt;code&gt;null&lt;/code&gt; or &lt;code&gt;undefined&lt;/code&gt; as falsy.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>node</category>
      <category>coding</category>
    </item>
    <item>
      <title>What is the point of using recursive functions when writing code?</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Fri, 05 Apr 2024 14:29:43 +0000</pubDate>
      <link>https://forem.com/emmo00/what-is-the-point-of-using-recursive-functions-when-writing-code-2k4f</link>
      <guid>https://forem.com/emmo00/what-is-the-point-of-using-recursive-functions-when-writing-code-2k4f</guid>
      <description>&lt;p&gt;Have you ever heard of recursion in programming? It's a cool technique where a function can call itself! It might sound a bit mind-bending at first, but once you understand how it works, it can be an incredibly helpful and interesting to implement in your programs.&lt;/p&gt;

&lt;p&gt;Recursive functions are divided into 3 parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Base case&lt;/li&gt;
&lt;li&gt;logic&lt;/li&gt;
&lt;li&gt;Calling itself&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Consider this implementation of the factorial(!) function:&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;function&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// base case.&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&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;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;factorial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&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="c1"&gt;// call itself. (combined with the logic)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A base case is a crucial component of a recursive function. It is responsible for preventing the function from calling itself repeatedly, which could result in a stack overflow error. Without a base case, the function would keep calling itself infinitely.&lt;/p&gt;

&lt;p&gt;The logic is the part of the function that solves the most basic unit of the bigger problem you are trying to solve with recursion.&lt;/p&gt;

&lt;p&gt;Finally, the recursive function has to call itself. That's what recursion is all about.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Now the advantages: ?!?!?!?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Readability: Recursive functions can often be more readable and easier to understand than iterative(loop) functions, especially for problems that have a natural recursive structure.&lt;/p&gt;

&lt;p&gt;Conciseness: Recursive functions can be more concise than iterative ones, as they don't require explicit loop variables and increment operations&lt;/p&gt;

&lt;p&gt;Modularity: Recursive functions can be more modular than iterative ones, as they can often be divided into smaller subproblems that can be solved recursively.&lt;/p&gt;

&lt;p&gt;Tail-recursion optimization: Some programming languages can optimize tail-recursive functions, which can lead to better performance than iterative functions.&lt;/p&gt;

&lt;p&gt;Tree-like data structures: Recursive functions are particularly well-suited to tree-like data structures, as they can easily traverse the structure using recursive calls.&lt;/p&gt;

&lt;p&gt;However, recursion is not always the best way to implement a solution, here's why:&lt;/p&gt;

&lt;p&gt;Space complexity: Recursive functions can sometimes have higher space complexity than iterative functions, as each recursive call adds a new stack frame to the call stack.&lt;/p&gt;

&lt;p&gt;Stack overflow: Recursive functions can lead to stack overflow errors if the recursion depth becomes too large. This can be mitigated by using tail recursion or by using an iterative solution.&lt;/p&gt;

&lt;p&gt;In conclusion, recursion in programming is a fascinating technique that opens up new avenues for solving problems. By allowing functions to call themselves, recursion offers a powerful approach to tackling complex tasks with elegance and simplicity.&lt;br&gt;
However, it's crucial to recognize that recursion isn't always the optimal solution. &lt;/p&gt;

</description>
      <category>code</category>
      <category>programming</category>
      <category>design</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to use Black and pre-commit for auto text-formatting on commit [setup] [python]</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Fri, 29 Mar 2024 00:36:07 +0000</pubDate>
      <link>https://forem.com/emmo00/how-to-setup-black-and-pre-commit-in-python-for-auto-text-formatting-on-commit-4kka</link>
      <guid>https://forem.com/emmo00/how-to-setup-black-and-pre-commit-in-python-for-auto-text-formatting-on-commit-4kka</guid>
      <description>&lt;p&gt;Hello👋.&lt;/p&gt;

&lt;p&gt;Today we are going to look at how to setup &lt;a href="https://github.com/pre-commit/pre-commit" rel="noopener noreferrer"&gt;Black&lt;/a&gt; (a python code formatter) and &lt;a href="https://github.com/pre-commit/pre-commit" rel="noopener noreferrer"&gt;pre-commit&lt;/a&gt; (a package for handling git hooks in python) to automatically format you code on commit.&lt;/p&gt;

&lt;p&gt;All the Code used in this article can be found on this GitHub repo &lt;a href="https://github.com/Emmo00/black-pre-commit-example-setup" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits
&lt;/h2&gt;

&lt;p&gt;Setting up your project with this (automatic code formatting on every commit) can be very useful and helpful especially when setting up a GitHub repository you expect other contributors. This enforces coding formatting and fosters consistency in coding style.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let's get right to it&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installing Black and pre-commit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First of all, we need to install these packages to our projects. You can use the following command to install them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;black pre-commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You might also need to add these packages to your &lt;code&gt;requirements.txt&lt;/code&gt; file so other contributors can install the need packages by running &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;. You can do this by running &lt;code&gt;pip freeze&lt;/code&gt;, and the coping the output to your &lt;code&gt;requirements.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure pre-commit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The next step is configuring &lt;code&gt;pre-commit&lt;/code&gt;. To do this, create a file called &lt;code&gt;.pre-commit-config.yaml&lt;/code&gt;:&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;touch&lt;/span&gt; .pre-commit-config.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then copy the following configurations to this file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;repos&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;repo&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://github.com/psf/black&lt;/span&gt;
    &lt;span class="na"&gt;rev&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;22.3.0&lt;/span&gt;
    &lt;span class="na"&gt;hooks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;black&lt;/span&gt;
        &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;--line-length=88&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
        &lt;span class="na"&gt;language_version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;python3.11&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Pre-Commit to use Black version 22.3.0 and format all Python files with a line length of 88 characters (you can adjust this to your preference).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run pre-commit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we have our configurations ready, make sure that the current folder you are in is a git/github project (With the &lt;code&gt;.git&lt;/code&gt; folder)&lt;br&gt;
Now, run the following command:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This installs pre-commit hooks to &lt;code&gt;.git\hooks\pre-commit&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: you need an internet commit for the first commit you make. This is to enable pre-commit initialize the environment for black, but once the environment is setup, it'd be reused.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git commit -m "add pre-commit configuration"
[INFO] Initializing environment for https://github.com/psf/black.      
[INFO] Installing environment for https://github.com/psf/black.        
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
black................................................(no files to check)Skipped
[main 6e21eab] add pre-commit configuration
 1 file changed, 7 insertions(+)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it, you are ready to use the automatic code formatter. Just create a python file, run &lt;code&gt;git add .&lt;/code&gt;, and then run &lt;code&gt;git commit -m "Commit message"&lt;/code&gt;. You'd notice that black attempts to format the file you just created. If you get the following message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted test.py

All done! \u2728 \U0001f370 \u2728
1 file reformatted.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just run &lt;code&gt;git add&lt;/code&gt; and &lt;code&gt;git commit&lt;/code&gt; again.&lt;/p&gt;



&lt;p&gt;Enjoy autoformatted code from now on😅. Bye👋&lt;/p&gt;

</description>
      <category>python</category>
      <category>git</category>
      <category>howto</category>
      <category>code</category>
    </item>
    <item>
      <title>Closures 🫂 Memoisation</title>
      <dc:creator>Emmanuel (Emmo00)</dc:creator>
      <pubDate>Fri, 22 Mar 2024 21:34:13 +0000</pubDate>
      <link>https://forem.com/emmo00/closures-memoisation-3gpp</link>
      <guid>https://forem.com/emmo00/closures-memoisation-3gpp</guid>
      <description>&lt;p&gt;In functional programming, closure refers to the ability of a function to access and utilize variables from its lexical scope, even after that scope has finished executing. Now, Lexical scope basically refers to the environment/location a variable is defined/declared within the source code.&lt;/p&gt;

&lt;p&gt;Closures (forever) remember the scope they were declared in for as long as they exist.&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%2F819iwehth5q4sd82et1k.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%2F819iwehth5q4sd82et1k.jpg" alt="Example of closures" width="800" height="620"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example, the code uses a closure to create a function object that provides controlled access to a private variable. The &lt;code&gt;get&lt;/code&gt; method allows you to retrieve the value, and the &lt;code&gt;set&lt;/code&gt; method allows you to update it.&lt;/p&gt;

&lt;p&gt;This may sound obvious, but it can be very useful in implementing a technique called "memoisation"&lt;/p&gt;

&lt;p&gt;Memoization is an optimization technique used in computer science to improve the performance of programs. It's especially useful for improving the performance of functions that are computationally expensive and called multiple times with the same inputs.&lt;/p&gt;

&lt;p&gt;Memoisation can basically be described as when expensive operations are run early, and their results cached for later use in the program.&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%2Fdaoso2oyy75ukh3swyog.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%2Fdaoso2oyy75ukh3swyog.jpg" alt="Example implementation of Memoisation" width="800" height="860"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the above example, the function  &lt;code&gt;square_memoise&lt;/code&gt; uses memoization by avoiding unnecessary computations for repeated function calls with the same arguments, potentially improving performance.&lt;/p&gt;

&lt;p&gt;In conclusion, closures and memoization are powerful tools that enhance the capabilities of functional programming. Closures provide a way to create private variables within functions, leading to better data encapsulation and code organization. Memoization, on the other hand, optimizes program performance by caching the results of expensive calculations, preventing redundant work. By understanding and utilizing these techniques, you can write cleaner, more efficient, and maintainable code.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>algorithms</category>
      <category>design</category>
      <category>functional</category>
    </item>
  </channel>
</rss>
