<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alaa Mekibes</title>
    <description>The latest articles on DEV Community by Alaa Mekibes (@alaa-mekibes).</description>
    <link>https://dev.to/alaa-mekibes</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2519046%2F017c8a64-e732-4309-8153-b33f28799742.jpeg</url>
      <title>DEV Community: Alaa Mekibes</title>
      <link>https://dev.to/alaa-mekibes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alaa-mekibes"/>
    <language>en</language>
    <item>
      <title>Sakani: Building an Algerian Real Estate Platform with the MERN Stack</title>
      <dc:creator>Alaa Mekibes</dc:creator>
      <pubDate>Sun, 30 Aug 2026 17:08:21 +0000</pubDate>
      <link>https://dev.to/alaa-mekibes/sakani-building-an-algerian-real-estate-platform-with-the-mern-stack-nom</link>
      <guid>https://dev.to/alaa-mekibes/sakani-building-an-algerian-real-estate-platform-with-the-mern-stack-nom</guid>
      <description>&lt;p&gt;I built Sakani as a learning project to practice a full MERN stack setup end to end: a React frontend talking to a Node/Express/MongoDB backend, with proper auth, image uploads, and validation on both sides.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Sakani does
&lt;/h2&gt;

&lt;p&gt;It's a real estate listing platform. Users can sign up, browse properties with filters, view property details, and if they're logged in, list their own properties, edit them, and receive inquiries from interested buyers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The backend: Express, MongoDB, and MVC
&lt;/h2&gt;

&lt;p&gt;The backend is a REST API built with Node.js, Express 5, TypeScript, and MongoDB through Mongoose. I structured it around the classic &lt;strong&gt;MVC pattern&lt;/strong&gt;, adapted for an API where there's no view layer, just JSON responses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Request → Route → Middleware → Controller → Model → Database
                                    ↓
                             JSON Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Models&lt;/strong&gt; (&lt;code&gt;src/models/&lt;/code&gt;) define the MongoDB schemas: &lt;code&gt;user&lt;/code&gt;, &lt;code&gt;property&lt;/code&gt;, &lt;code&gt;inquiry&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Controllers&lt;/strong&gt; (&lt;code&gt;src/controllers/&lt;/code&gt;) hold the business logic. They never touch the database directly, they always go through a model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Routes&lt;/strong&gt; (&lt;code&gt;src/routes/&lt;/code&gt;) map HTTP methods and paths to controllers, and chain middleware in front of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Middleware&lt;/strong&gt; (&lt;code&gt;src/middleware/&lt;/code&gt;) handles auth checks, Zod validation, file uploads, and error handling, all reusable across routes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's what a typical route looks like, stacking middleware before the actual logic runs:&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="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;authMiddleware&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;           &lt;span class="c1"&gt;// 1. verify JWT&lt;/span&gt;
    &lt;span class="nx"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;images&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;   &lt;span class="c1"&gt;// 2. handle file upload&lt;/span&gt;
    &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;         &lt;span class="c1"&gt;// 3. validate body with Zod&lt;/span&gt;
    &lt;span class="nx"&gt;propertyController&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;create&lt;/span&gt; &lt;span class="c1"&gt;// 4. run business 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 few things I focused on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Auth&lt;/strong&gt;: JWT stored in an &lt;code&gt;httpOnly&lt;/code&gt; cookie, so it can't be read or stolen by client-side JavaScript. Passwords are hashed with &lt;code&gt;bcryptjs&lt;/code&gt; before ever touching the database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image uploads&lt;/strong&gt;: &lt;code&gt;multer&lt;/code&gt; handles incoming files, and &lt;code&gt;multer-storage-cloudinary&lt;/code&gt; sends them straight to Cloudinary without saving anything to local disk first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validation&lt;/strong&gt;: every request body, query, and param that matters gets checked with Zod through a small reusable &lt;code&gt;validate()&lt;/code&gt; middleware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consistent responses&lt;/strong&gt;: every endpoint returns the same shape through an &lt;code&gt;ApiResponse&lt;/code&gt; helper, so the frontend always knows what to expect, whether it's a success, a validation failure, or an error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom errors&lt;/strong&gt;: instead of scattering status codes everywhere, I use error classes like &lt;code&gt;NotFoundError&lt;/code&gt;, &lt;code&gt;ConflictError&lt;/code&gt;, and &lt;code&gt;UnauthorizedError&lt;/code&gt; that a global error handler catches and turns into proper responses.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The frontend: React, TanStack Router, and TypeScript
&lt;/h2&gt;

&lt;p&gt;The frontend is React 19 with TypeScript, built with Vite, and it leans heavily on the TanStack ecosystem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;TanStack Router&lt;/strong&gt; for file-based routing. The folder structure under &lt;code&gt;src/routes/&lt;/code&gt; defines the actual routes, and a Vite plugin auto-generates the route tree on every save.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TanStack Form&lt;/strong&gt; for handling forms like create/update property and login/signup, paired with Zod for validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TailwindCSS + DaisyUI&lt;/strong&gt; for styling, so I get ready-made components like navbars and cards without writing everything from scratch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some of the pieces I'm proud of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A centralized &lt;code&gt;api.ts&lt;/code&gt; fetch wrapper&lt;/strong&gt;, so every request in the app goes through the same place and automatically includes cookies for auth. It exposes simple methods like &lt;code&gt;api.get()&lt;/code&gt;, &lt;code&gt;api.post()&lt;/code&gt;, and &lt;code&gt;api.upload()&lt;/code&gt; for multipart image uploads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route-level auth protection&lt;/strong&gt;, where a route simply declares what it needs and gets redirected if the condition fails:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;beforeLoad&lt;/span&gt;&lt;span class="p"&gt;:&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="o"&gt;=&amp;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="o"&gt;!&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;isAuthenticated&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/login&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A global &lt;code&gt;AuthContext&lt;/code&gt;&lt;/strong&gt; that fetches the current user on app load to restore the session from the cookie, so refreshing the page doesn't log you out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search param validation&lt;/strong&gt;, so filters on the properties page are validated with a Zod schema, and anything invalid is just silently ignored instead of crashing the page.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How the two sides talk to each other
&lt;/h2&gt;

&lt;p&gt;The frontend never touches MongoDB directly, obviously. Every interaction goes through the REST API: things like listing properties with filters, creating a property with images, or sending an inquiry to a property owner. The API responses are typed on the frontend through shared interfaces, so what the backend sends and what the frontend expects stay in sync.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How to structure a real backend around MVC instead of dumping everything into route handlers&lt;/li&gt;
&lt;li&gt;How to handle authentication properly with JWT in httpOnly cookies instead of localStorage&lt;/li&gt;
&lt;li&gt;How to wire up image uploads that go straight to a cloud storage service without touching my own server's disk&lt;/li&gt;
&lt;li&gt;How file-based routing works in TanStack Router and how to protect routes based on auth state&lt;/li&gt;
&lt;li&gt;How to keep validation consistent by using the same Zod schemas as the single source of truth for what "valid data" means&lt;/li&gt;
&lt;li&gt;How much smoother frontend and backend development get when responses follow one consistent shape&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;If you're learning MERN, I'd recommend picking a real-world domain like this one (listings, bookings, marketplaces) since it naturally forces you to deal with auth, file uploads, filtering, and relationships between resources, all the stuff that makes a project feel like more than a to-do list.&lt;/p&gt;

&lt;p&gt;Frontend: &lt;a href="https://github.com/alaa-mekibes/sakani-frontend-react" rel="noopener noreferrer"&gt;github.com/alaa-mekibes/sakani-frontend-react&lt;/a&gt;&lt;br&gt;
Backend: &lt;a href="https://github.com/alaa-mekibes/sakani-backend-mongoose" rel="noopener noreferrer"&gt;github.com/alaa-mekibes/sakani-backend-mongoose&lt;/a&gt; 🏠&lt;/p&gt;

</description>
      <category>mern</category>
      <category>webdev</category>
      <category>programming</category>
      <category>typescript</category>
    </item>
    <item>
      <title>I Built an IPv4 Subnet Calculator with Vanilla JS and OOP</title>
      <dc:creator>Alaa Mekibes</dc:creator>
      <pubDate>Sat, 29 Aug 2026 15:00:15 +0000</pubDate>
      <link>https://dev.to/alaa-mekibes/i-built-an-ipv4-subnet-calculator-with-vanilla-js-and-oop-oji</link>
      <guid>https://dev.to/alaa-mekibes/i-built-an-ipv4-subnet-calculator-with-vanilla-js-and-oop-oji</guid>
      <description>&lt;p&gt;Subnetting is one of those networking topics that sounds simple until you actually have to calculate a network address, broadcast address, and usable host range by hand. So I built a tool to do it for me, and along the way used it to practice Object-Oriented Programming in plain JavaScript: the &lt;strong&gt;IPv4 Subnet Calculator&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;No frameworks, no libraries. Just HTML, CSS, and JavaScript classes, running entirely in the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;You give it an IP address in CIDR notation, something like &lt;code&gt;198.51.100.7/18&lt;/code&gt;, and it gives you back:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network address&lt;/li&gt;
&lt;li&gt;Broadcast address&lt;/li&gt;
&lt;li&gt;Subnet mask&lt;/li&gt;
&lt;li&gt;Wildcard mask&lt;/li&gt;
&lt;li&gt;First and last usable host&lt;/li&gt;
&lt;li&gt;Total usable hosts&lt;/li&gt;
&lt;li&gt;Both decimal and binary formats&lt;/li&gt;
&lt;li&gt;The IP address type (private, public, loopback, and so on)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also export the result as a PDF if you need to save or share it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why OOP for a calculator?
&lt;/h2&gt;

&lt;p&gt;Instead of writing one big function that does everything, I structured the logic around classes:&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;class&lt;/span&gt; &lt;span class="nc"&gt;IpAddress&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// Base class for IP address operations&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;NetworkComponents&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;IpAddress&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="cm"&gt;/*
- Handles common network components
- Calculates network address
- Handles subnet mask operations
- Calculates wildcard mask
- Calculates broadcast address
- Determines first/last usable hosts
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;IpAddress&lt;/code&gt; handles the basics, parsing the IP, converting between decimal and binary. &lt;code&gt;NetworkComponents&lt;/code&gt; extends it and adds all the subnetting logic on top. This kept things organized: if I needed to fix how the broadcast address was calculated, I knew exactly where to look, without touching the parsing code.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the actual calculation works
&lt;/h2&gt;

&lt;p&gt;Here's the logic, explained simply, step by step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Parse the input&lt;/strong&gt;: split the CIDR string (&lt;code&gt;198.51.100.7/18&lt;/code&gt;) into the IP octets and the prefix length.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Convert to binary&lt;/strong&gt;: turn the IP into its binary form. The first &lt;em&gt;n&lt;/em&gt; bits (based on the prefix) are the network part, the rest are the host part.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build the subnet mask&lt;/strong&gt;: set the first &lt;em&gt;n&lt;/em&gt; bits to &lt;code&gt;1&lt;/code&gt; and the rest to &lt;code&gt;0&lt;/code&gt;. So &lt;code&gt;/18&lt;/code&gt; gives &lt;code&gt;255.255.192.0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build the wildcard mask&lt;/strong&gt;: it's just the reverse of the subnet mask, subtract each octet from &lt;code&gt;255&lt;/code&gt;. So &lt;code&gt;255.255.192.0&lt;/code&gt; becomes &lt;code&gt;0.0.63.255&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get the network address&lt;/strong&gt;: keep the network part of the IP, and set all host bits to &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get the broadcast address&lt;/strong&gt;: keep the network part, but set all host bits to &lt;code&gt;1&lt;/code&gt; instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Count the hosts&lt;/strong&gt;: &lt;code&gt;2^(number of host bits) - 2&lt;/code&gt;. The minus 2 accounts for the network and broadcast addresses, which can't be assigned to devices.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Detecting the IP address type
&lt;/h2&gt;

&lt;p&gt;One feature I added on top of basic subnetting is a &lt;code&gt;whichType()&lt;/code&gt; method that classifies the IP itself, not just the subnet. It checks the address against the standard ranges in order:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Private&lt;/strong&gt;: &lt;code&gt;10.x.x.x&lt;/code&gt;, &lt;code&gt;172.16.x.x&lt;/code&gt; through &lt;code&gt;172.31.x.x&lt;/code&gt;, &lt;code&gt;192.168.x.x&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loopback&lt;/strong&gt;: &lt;code&gt;127.x.x.x&lt;/code&gt;, used for testing on your own machine&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Link-local&lt;/strong&gt;: &lt;code&gt;169.254.x.x&lt;/code&gt;, used when a device can't get an IP automatically&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multicast&lt;/strong&gt;: &lt;code&gt;224.x.x.x&lt;/code&gt; through &lt;code&gt;239.x.x.x&lt;/code&gt;, used for group communication like streaming&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broadcast&lt;/strong&gt;: &lt;code&gt;255.255.255.255&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reserved&lt;/strong&gt;: a handful of special ranges set aside for documentation, testing, or future use, like &lt;code&gt;0.x.x.x&lt;/code&gt;, &lt;code&gt;192.0.2.x&lt;/code&gt;, and &lt;code&gt;198.51.100.x&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public&lt;/strong&gt;: if none of the above match, it's a normal internet-facing address, like &lt;code&gt;8.8.8.8&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How subnetting actually works at the bit level, instead of just plugging numbers into an online calculator&lt;/li&gt;
&lt;li&gt;How to structure a small project with real class inheritance in vanilla JS, without reaching for a framework&lt;/li&gt;
&lt;li&gt;How to convert between decimal and binary and manipulate bits directly in JavaScript&lt;/li&gt;
&lt;li&gt;How networking concepts like private ranges, loopback, and multicast map to real address rules&lt;/li&gt;
&lt;li&gt;How to add a simple PDF export using nothing but the browser's own print dialog&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;If you're learning subnetting, I'd honestly recommend building your own calculator instead of just using one. Working through the binary conversion, the mask logic, and the address classification by hand is what actually made the concepts stick for me.&lt;/p&gt;

&lt;p&gt;Check out the code here: &lt;a href="https://github.com/alaa-mekibes/IPv4-calculator" rel="noopener noreferrer"&gt;github.com/alaa-mekibes/IPv4-calculator&lt;/a&gt; 🌐&lt;/p&gt;

</description>
      <category>ipv4</category>
      <category>website</category>
      <category>javascript</category>
      <category>oop</category>
    </item>
    <item>
      <title>🐸 I Built a Mini Compiler From Scratch, Here's What I Learned</title>
      <dc:creator>Alaa Mekibes</dc:creator>
      <pubDate>Sat, 29 Aug 2026 00:36:53 +0000</pubDate>
      <link>https://dev.to/alaa-mekibes/i-built-a-mini-compiler-from-scratch-heres-what-i-learned-10c5</link>
      <guid>https://dev.to/alaa-mekibes/i-built-a-mini-compiler-from-scratch-heres-what-i-learned-10c5</guid>
      <description>&lt;p&gt;Compilers always felt like this mysterious black box to me. Code goes in, magic happens, a program comes out. So for a compiler design assignment, I built one myself: &lt;strong&gt;Frog Mini Compiler&lt;/strong&gt;, a compiler for "Frog," a small teaching language given to us for the assignment.&lt;/p&gt;

&lt;p&gt;No frameworks, no compiler-building libraries. Just TypeScript, HTML/CSS, and the three classic phases every compiler goes through: &lt;strong&gt;lexical analysis&lt;/strong&gt;, &lt;strong&gt;syntax analysis&lt;/strong&gt;, and &lt;strong&gt;semantic analysis&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what is "Frog"?
&lt;/h2&gt;

&lt;p&gt;Frog is a simple language defined in our university assignment. It supports variables, printing, if/else statements, and a repeat-until loop. I think it's inspired by Pascal.. here's what a Frog program looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FRG_Begin
FRG_Int i, j #
i := 10 #
If [i &amp;lt; 20]
    FRG_Print "Small number" #
Else
    FRG_Print "Big number" #
FRG_End
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few things to notice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every program starts with &lt;code&gt;FRG_Begin&lt;/code&gt; and ends with &lt;code&gt;FRG_End&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;#&lt;/code&gt; marks the end of an instruction (like a &lt;code&gt;;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:=&lt;/code&gt; is used for assignment&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;##&lt;/code&gt; starts a comment&lt;/li&gt;
&lt;li&gt;Conditions go inside &lt;code&gt;[ ]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The three phases, explained simply
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Lexical Analysis (the Lexer)
&lt;/h3&gt;

&lt;p&gt;This is the first step, and honestly the most satisfying one to build. The Lexer reads your code &lt;strong&gt;character by character&lt;/strong&gt; and groups those characters into meaningful chunks called &lt;strong&gt;tokens&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;i := 10 #&lt;/code&gt; doesn't stay as raw text, it becomes something like: &lt;code&gt;ID(i)&lt;/code&gt;, &lt;code&gt;ASSIGN&lt;/code&gt;, &lt;code&gt;INTNUMBER(10)&lt;/code&gt;, &lt;code&gt;END&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The Lexer also has to be smart about small stuff:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skip whitespace and comments (&lt;code&gt;##&lt;/code&gt;) without producing junk tokens&lt;/li&gt;
&lt;li&gt;Tell the difference between &lt;code&gt;3&lt;/code&gt; (an int) and &lt;code&gt;3.14&lt;/code&gt; (a real number)&lt;/li&gt;
&lt;li&gt;Catch errors, like a string that never gets closed with a &lt;code&gt;"&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically: the Lexer's job is to turn a wall of text into a clean list of tokens the next phase can actually work with.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Syntax Analysis (the Parser)
&lt;/h3&gt;

&lt;p&gt;Once I have tokens, I need to check: do they actually follow the grammar rules of Frog? That's the Parser's job.&lt;/p&gt;

&lt;p&gt;Think of the Parser as a strict grammar teacher. It looks at the token stream and expects specific patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After &lt;code&gt;FRG_Int&lt;/code&gt;, it expects at least one identifier, maybe more separated by commas, then a &lt;code&gt;#&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;After &lt;code&gt;If&lt;/code&gt;, it expects &lt;code&gt;[&lt;/code&gt;, then a condition, then &lt;code&gt;]&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;After an identifier, it expects &lt;code&gt;:=&lt;/code&gt; and an expression&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If any of these patterns break, the Parser reports an error with the line number. The tricky part here was writing &lt;code&gt;parseExpression()&lt;/code&gt; and &lt;code&gt;parseFactor()&lt;/code&gt; so they could handle chained operations like &lt;code&gt;x + 5 * 2&lt;/code&gt;, calling themselves recursively to build up the full expression.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Semantic Analysis (the "does this actually make sense" phase)
&lt;/h3&gt;

&lt;p&gt;This is where the real logic lives, and it's also where the code actually &lt;strong&gt;executes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The Semantic Analyzer keeps a &lt;strong&gt;symbol table&lt;/strong&gt;, basically a dictionary that tracks every variable's name, type, whether it's initialized, and its current value. As it walks through the parsed program, it checks things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Was this variable declared before you tried to use it?&lt;/li&gt;
&lt;li&gt;Was it initialized before you tried to print it?&lt;/li&gt;
&lt;li&gt;Are you assigning the right type of value?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And then it just... runs the program. If statements branch based on evaluated conditions, &lt;code&gt;Repeat/until&lt;/code&gt; loops keep executing until the condition is true (capped at 1000 iterations so a bug in my code doesn't freeze the browser), and expressions get evaluated with proper operator precedence: parentheses first, then &lt;code&gt;*&lt;/code&gt;/&lt;code&gt;/&lt;/code&gt;, then &lt;code&gt;+&lt;/code&gt;/&lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tying it together with a simple UI
&lt;/h2&gt;

&lt;p&gt;I wrapped all three phases in a small web interface. You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload a &lt;code&gt;.frog&lt;/code&gt; file or type code directly&lt;/li&gt;
&lt;li&gt;Run each phase on its own (Lexical, then Syntax, then Semantic) to see intermediate results before moving to the next&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seeing the token list, then the parse results, then the final output side by side made the whole "three phases" concept click way more than reading about it ever did.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I actually learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How tokenization really works, not just the theory&lt;/li&gt;
&lt;li&gt;Why grammar rules matter and how a parser enforces them&lt;/li&gt;
&lt;li&gt;How symbol tables track variable state during execution&lt;/li&gt;
&lt;li&gt;How to implement control flow (if/else, loops) by manipulating indices into a parsed statement list&lt;/li&gt;
&lt;li&gt;How to evaluate expressions correctly, respecting operator precedence&lt;/li&gt;
&lt;li&gt;Why compilers are split into phases in the first place: each phase has one job, and that makes the whole thing easier to reason about and debug&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Known limitations
&lt;/h2&gt;

&lt;p&gt;This is a learning project, so it's intentionally simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No functions/procedures&lt;/li&gt;
&lt;li&gt;Only int and real number types&lt;/li&gt;
&lt;li&gt;No string operations beyond printing&lt;/li&gt;
&lt;li&gt;Basic error recovery, it stops at the first semantic error per line&lt;/li&gt;
&lt;li&gt;No optimization phase&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it yourself
&lt;/h2&gt;

&lt;p&gt;If you're curious how compilers work under the hood, I'd genuinely recommend building a tiny one like this. You don't need a fancy language, just pick 5-6 features (variables, print, if, loop) and force yourself to implement all three phases by hand. It's one of those projects where the "aha" moments come fast.&lt;/p&gt;

&lt;p&gt;Check out the code here: &lt;a href="https://github.com/alaa-mekibes/frog-mini-compiler" rel="noopener noreferrer"&gt;github.com/alaa-mekibes/frog-mini-compiler&lt;/a&gt; 🐸&lt;/p&gt;

</description>
      <category>compiler</category>
      <category>typescript</category>
      <category>website</category>
      <category>compiling</category>
    </item>
    <item>
      <title>I Was Confused About Merise for Weeks. Here's Everything I Learned</title>
      <dc:creator>Alaa Mekibes</dc:creator>
      <pubDate>Sun, 22 Mar 2026 19:33:29 +0000</pubDate>
      <link>https://dev.to/alaa-mekibes/i-was-confused-about-merise-for-weeks-heres-everything-i-learned-4b9k</link>
      <guid>https://dev.to/alaa-mekibes/i-was-confused-about-merise-for-weeks-heres-everything-i-learned-4b9k</guid>
      <description>&lt;p&gt;When I started learning database design, my teacher kept saying "MCD, MLD, MPD" and I had no idea what any of that meant. I searched in English and found almost nothing. That's when I realized Merise is a French methodology, and most of the internet doesn't talk about it.&lt;/p&gt;

&lt;p&gt;So I learned it the hard way. This is the guide I wish existed when I started.&lt;/p&gt;

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

&lt;p&gt;Merise is a French software and database design methodology created in the 1970s-80s. It's widely used in France and French-speaking countries, but almost unknown in the English-speaking world where people use ERD or UML instead.&lt;/p&gt;

&lt;p&gt;The core idea of Merise is that you design your database in &lt;strong&gt;3 levels&lt;/strong&gt;, going from abstract to concrete:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Level&lt;/th&gt;
&lt;th&gt;French Name&lt;/th&gt;
&lt;th&gt;English Equivalent&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MCD&lt;/td&gt;
&lt;td&gt;Modèle Conceptuel de Données&lt;/td&gt;
&lt;td&gt;Conceptual Data Model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MLD&lt;/td&gt;
&lt;td&gt;Modèle Logique de Données&lt;/td&gt;
&lt;td&gt;Logical Data Model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MPD&lt;/td&gt;
&lt;td&gt;Modèle Physique de Données&lt;/td&gt;
&lt;td&gt;Physical Data Model&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Think of it like building a house:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MCD&lt;/strong&gt; = the architect's sketch (ideas, no technical details)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MLD&lt;/strong&gt; = the blueprint (structure, measurements)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MPD&lt;/strong&gt; = the actual construction (specific materials, real tools)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Level 1 MCD (Modèle Conceptuel de Données)
&lt;/h2&gt;

&lt;p&gt;MCD is a graphical representation that describes the data of a system and their relationships in an abstract way. You're not thinking about tables or code yet just &lt;strong&gt;what exists&lt;/strong&gt; and &lt;strong&gt;how things relate&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rectangles&lt;/strong&gt; = Entities (contain attributes describing their properties)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ovals&lt;/strong&gt; = Relationships/associations between entities (connected to entities with lines)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cardinalities&lt;/strong&gt; = Indicate the minimum and maximum number of relations between entities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attributes&lt;/strong&gt; = The properties inside each entity&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Cardinality the hardest part:
&lt;/h3&gt;

&lt;p&gt;Cardinality answers: "how many of X can be related to Y?"&lt;/p&gt;

&lt;p&gt;The format is &lt;code&gt;min,max&lt;/code&gt; on each side:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;1,1&lt;/code&gt; → exactly one (mandatory, unique)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0,1&lt;/code&gt; → zero or one (optional, max one)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;1,N&lt;/code&gt; → at least one, can be many&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;0,N&lt;/code&gt; → optional, can be many&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;N,N&lt;/code&gt; → many to many → becomes a junction table in MLD&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&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%2Fqkzqa760pd6hv4gthix3.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%2Fqkzqa760pd6hv4gthix3.png" alt="[School] 1,N -( has )- 1,1 [Course]" width="799" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;1,N&lt;/code&gt; next to School → one school has many courses. &lt;code&gt;1,1&lt;/code&gt; next to Course → one course belongs to exactly one school.&lt;/p&gt;

&lt;h3&gt;
  
  
  The N-N rule:
&lt;/h3&gt;

&lt;p&gt;In MCD, N-N relationships stay as just an oval. You &lt;strong&gt;don't create a table&lt;/strong&gt; for them yet that happens in MLD.&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 2 MLD (Modèle Logique de Données)
&lt;/h2&gt;

&lt;p&gt;MLD is the translation of the MCD into a model adapted to relational databases defining tables, columns, primary keys, foreign keys, and relationships between tables.&lt;/p&gt;

&lt;h3&gt;
  
  
  Structure:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tables&lt;/strong&gt; = Come from entities and associations of the MCD&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Columns&lt;/strong&gt; = Based on the attributes from the MCD&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Primary Key (PK)&lt;/strong&gt; = One or more unique attributes identifying each row&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Foreign Key (FK)&lt;/strong&gt; = Links one table to another&lt;/li&gt;
&lt;li&gt;No data types yet, no indexes that's MPD&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3 rules for converting MCD → MLD:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1) Many-to-One (N:1):&lt;/strong&gt;&lt;br&gt;
The primary key from the N side becomes a foreign key in the other table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Many-to-Many (N:N):&lt;/strong&gt;&lt;br&gt;
A new junction table is created. It contains at minimum two foreign keys pointing to both entities. If the association has its own attributes, they go in this table too.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) One-to-One (1:1):&lt;/strong&gt;&lt;br&gt;
The primary key of one entity becomes a foreign key in the other table.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example the N-N becomes a real table:
&lt;/h3&gt;

&lt;p&gt;In MCD you had:&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%2Fpsuh9q1orgj3hzxx9mia.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%2Fpsuh9q1orgj3hzxx9mia.png" alt="[Teacher] 1,N -( assigned to )- 1,N [Class]" width="799" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In MLD this becomes 3 tables:&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%2Ffoiab7t3lg0ev5o20jkh.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%2Ffoiab7t3lg0ev5o20jkh.png" alt="[Teacher] - [TeacherClass] - [Class]" width="799" height="278"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Teacher (id, name, specialty)
Class (id, name)
TeacherClass (id, teacher_id FK, class_id FK)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;TeacherClass&lt;/code&gt; didn't exist in MCD as a table it was just an oval. Now it's a real table. (we can add some attributes if needed)&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 3 MPD (Modèle Physique de Données)
&lt;/h2&gt;

&lt;p&gt;MPD = MLD + &lt;strong&gt;everything specific to your database engine&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data types (&lt;code&gt;VARCHAR(255)&lt;/code&gt;, &lt;code&gt;INT&lt;/code&gt;, &lt;code&gt;TIMESTAMP&lt;/code&gt;, &lt;code&gt;BOOLEAN&lt;/code&gt;…)&lt;/li&gt;
&lt;li&gt;Constraints (&lt;code&gt;NOT NULL&lt;/code&gt;, &lt;code&gt;UNIQUE&lt;/code&gt;, &lt;code&gt;DEFAULT&lt;/code&gt;…)&lt;/li&gt;
&lt;li&gt;Indexes&lt;/li&gt;
&lt;li&gt;Engine-specific options (PostgreSQL vs MySQL vs SQLite)&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;MLD says:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User (id, email, password, role)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MPD says:&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;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="n"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;gen_random_uuid&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;UNIQUE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;password&lt;/span&gt; &lt;span class="nb"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;role&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="k"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="s1"&gt;'STUDENT'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="nb"&gt;TIMESTAMP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="n"&gt;NOW&lt;/span&gt;&lt;span class="p"&gt;()&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;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_users_email&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you use an ORM like Prisma, your &lt;strong&gt;Prisma schema is your MPD&lt;/strong&gt; because it has types (&lt;code&gt;@db.VarChar(255)&lt;/code&gt;), indexes (&lt;code&gt;@@index&lt;/code&gt;), and database-specific decorators.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Is There No English Documentation?
&lt;/h2&gt;

&lt;p&gt;Honestly, this frustrated me a lot. Every time I searched "MCD MLD database design" in English, I got nothing useful.&lt;/p&gt;

&lt;p&gt;The reason is simple: &lt;strong&gt;Merise is French&lt;/strong&gt;. It was created by French researchers, taught in French schools, and used by French companies. English-speaking developers grew up with ERD (Entity-Relationship Diagrams) and UML, which are different tools that do roughly the same thing.&lt;/p&gt;

&lt;p&gt;It's not that Merise is bad it's actually very structured and clean. It's just that the internet is mostly in English, and English devs never learned it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If this helped you, drop a comment. And if you know better Merise resources in English, please share them we need more.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>mcd</category>
      <category>mld</category>
      <category>merise</category>
    </item>
    <item>
      <title>The difference between for...of and for...in loops in JavaScript</title>
      <dc:creator>Alaa Mekibes</dc:creator>
      <pubDate>Thu, 04 Dec 2025 22:59:36 +0000</pubDate>
      <link>https://dev.to/alaa-mekibes/the-difference-between-forof-and-forin-loops-in-javascript-dh5</link>
      <guid>https://dev.to/alaa-mekibes/the-difference-between-forof-and-forin-loops-in-javascript-dh5</guid>
      <description>&lt;p&gt;When working with JavaScript, understanding the difference between for...of and for...in loops is crucial for writing clean, efficient code. While they might look similar, they serve different purposes and work with different data structures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With Arrays:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;for...of&lt;/code&gt; gives you the actual elements&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for...in&lt;/code&gt; gives you the indices (as strings)
&lt;/li&gt;
&lt;/ul&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apple&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="s1"&gt;banana&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="s1"&gt;cherry&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;for &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;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;data&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;item&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Output:&lt;/span&gt;
&lt;span class="c1"&gt;// apple&lt;/span&gt;
&lt;span class="c1"&gt;// banana  &lt;/span&gt;
&lt;span class="c1"&gt;// cherry&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;apple&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="s1"&gt;banana&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="s1"&gt;cherry&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;for &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;index&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;data&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;index&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Output:&lt;/span&gt;
&lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;span class="c1"&gt;// 1&lt;/span&gt;
&lt;span class="c1"&gt;// 2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;With Strings:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;for...of&lt;/code&gt; gives you each char in the word&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for...in&lt;/code&gt; gives you the indices (as strings)
&lt;/li&gt;
&lt;/ul&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;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;for &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;char&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;text&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;char&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// h, e, l, l, o&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;for &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;index&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;text&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;index&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 0, 1, 2, 3, 4&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;With Objects:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;for ... of doesn't work directly with plain objects (This would throw an error)&lt;/li&gt;
&lt;li&gt;for ... in gives you key value for each element
&lt;/li&gt;
&lt;/ul&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;person&lt;/span&gt; &lt;span class="o"&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;NYC&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// for...in works with objects&lt;/span&gt;
&lt;span class="k"&gt;for &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;key&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;person&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;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;person&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Output: name John, age 30, city NYC&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Reset a Forgotten MariaDB User Password</title>
      <dc:creator>Alaa Mekibes</dc:creator>
      <pubDate>Sat, 14 Dec 2024 15:48:15 +0000</pubDate>
      <link>https://dev.to/alaa-mekibes/how-to-reset-a-forgotten-mariadb-user-password-2lpo</link>
      <guid>https://dev.to/alaa-mekibes/how-to-reset-a-forgotten-mariadb-user-password-2lpo</guid>
      <description>&lt;p&gt;Did you or someone using MariaDB forget the password to an account? Don’t worry! Resetting a MariaDB user password on Linux is super easy. Here’s a quick guide with the commands and step-by-step instructions to help you out.&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%2Fj86t3b172s0948wa2yxe.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%2Fj86t3b172s0948wa2yxe.png" alt="How to reset user password in MariaDB?" width="799" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Change MariaDB password using command line
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Open a terminal.&lt;/li&gt;
&lt;li&gt;Stop the currently running MariaDB database.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl stop mariadb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Restart the database process, but this time use the &lt;code&gt;--skip-grant-tables&lt;/code&gt; option. This lets you connect to the database without needing a password.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mysqld_safe --skip-grant-tables --skip-networking
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, open a new terminal.&lt;/li&gt;
&lt;li&gt;Login to MariaDB as root. Don't worry, it won't ask you about the password.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mariadb -u root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the &lt;code&gt;FLUSH PRIVILEGES&lt;/code&gt; command and then change the root password with the command below. Change this &lt;code&gt;NEW_PASSWORD_HERE&lt;/code&gt; to your new password. Past these commands line by line inside MariaDB Monitor.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW_PASSWORD_HERE';
exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Close your first terminal.&lt;/li&gt;
&lt;li&gt;Stop the current mysqld process properly, and then restart your MariaDB server. Line by line.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo pkill mysqld 
sudo systemctl start mariadb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Congratulations! You’ve successfully changed the password. Now, go ahead and test it out!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mariadb -u root -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>mariadb</category>
      <category>sql</category>
      <category>database</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
