<?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: Wassim bd</title>
    <description>The latest articles on DEV Community by Wassim bd (@majin-dev).</description>
    <link>https://dev.to/majin-dev</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%2F4058551%2Ff9f51cdb-c510-4c87-a228-6c9d50278080.png</url>
      <title>DEV Community: Wassim bd</title>
      <link>https://dev.to/majin-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/majin-dev"/>
    <language>en</language>
    <item>
      <title>The Data Structure That Finally Made Recursion Click For Me</title>
      <dc:creator>Wassim bd</dc:creator>
      <pubDate>Sun, 02 Aug 2026 04:24:04 +0000</pubDate>
      <link>https://dev.to/majin-dev/the-data-structure-that-finally-made-recursion-click-for-me-3605</link>
      <guid>https://dev.to/majin-dev/the-data-structure-that-finally-made-recursion-click-for-me-3605</guid>
      <description>&lt;p&gt;Data structures and algorithms in C++ was probably the course that pushed me the hardest this year. A lot of it clicked eventually, but one topic in particular — linked lists combined with recursion — took me way longer to understand than I expected. Here's what finally made it make sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why linked lists felt harder than arrays
&lt;/h2&gt;

&lt;p&gt;Coming from arrays, linked lists felt unnecessarily complicated at first. With an array, everything is sitting right next to everything else in memory, and you just grab an element by index. A linked list is different: each element (a "node") holds a value &lt;em&gt;and&lt;/em&gt; a pointer to the next node. To get to the 5th element, you can't just jump there — you have to walk through the first four nodes to reach it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Node&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first this felt like a downgrade from arrays. Why would I want something slower to access? It took a while to appreciate that linked lists trade fast access for cheap insertion/removal — you don't need to shift a bunch of elements around like you would in an array.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where recursion comes in
&lt;/h2&gt;

&lt;p&gt;Recursive functions work naturally with linked lists because a linked list is, structurally, a recursive definition: a list is either empty, or it's a node followed by another (smaller) list. That's basically the definition of recursion already baked into the data structure.&lt;/p&gt;

&lt;p&gt;Here's a simple example — counting the nodes in a list:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;countNodes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Node&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;head&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="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nb"&gt;nullptr&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="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// base case: empty list&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;countNodes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// one node + the rest of the list&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The part that confused me: the call stack
&lt;/h2&gt;

&lt;p&gt;I could write recursive functions like the one above without fully getting &lt;em&gt;why&lt;/em&gt; they worked. What clicked for me was visualizing the call stack. Every recursive call to &lt;code&gt;countNodes&lt;/code&gt; doesn't run and finish immediately — it pauses, waits for &lt;code&gt;countNodes(head-&amp;gt;next)&lt;/code&gt; to return a value, and only then adds 1 to it.&lt;/p&gt;

&lt;p&gt;So if you have a list &lt;code&gt;A -&amp;gt; B -&amp;gt; C -&amp;gt; nullptr&lt;/code&gt;, the calls stack up like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;countNodes(A) waits on countNodes(B)
  countNodes(B) waits on countNodes(C)
    countNodes(C) waits on countNodes(nullptr)
      countNodes(nullptr) returns 0
    countNodes(C) returns 1 + 0 = 1
  countNodes(B) returns 1 + 1 = 2
countNodes(A) returns 1 + 2 = 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once I actually traced through it call by call like that, instead of just trusting that the code "worked," recursion stopped feeling like magic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the base case matters so much
&lt;/h2&gt;

&lt;p&gt;I also learned the hard way (with a stack overflow crash) what happens if you forget the base case, or write it wrong. Without &lt;code&gt;if (head == nullptr) return 0;&lt;/code&gt;, the function keeps calling itself forever since there's nothing to stop it. Every recursive function needs a condition that eventually stops the calls — otherwise you're just building an infinitely tall stack until the program crashes.&lt;/p&gt;

&lt;h2&gt;
  
  
  My takeaway
&lt;/h2&gt;

&lt;p&gt;Linked lists and recursion reinforced each other for me: understanding recursion made linked list operations (counting, searching, reversing) way easier to write, and working through linked lists by hand made recursion finally feel concrete instead of abstract. If recursion still feels like a black box, I'd suggest picking a small linked list problem and literally tracing the call stack on paper, call by call — that's what did it for me.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Final-year software engineering student, writing about what I'm learning in my courses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>datastructures</category>
      <category>beginners</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>What I Learned Writing Assembly After Only Knowing Java and JavaScript</title>
      <dc:creator>Wassim bd</dc:creator>
      <pubDate>Sun, 02 Aug 2026 04:22:56 +0000</pubDate>
      <link>https://dev.to/majin-dev/what-i-learned-writing-assembly-after-only-knowing-java-and-javascript-3fj4</link>
      <guid>https://dev.to/majin-dev/what-i-learned-writing-assembly-after-only-knowing-java-and-javascript-3fj4</guid>
      <description>&lt;p&gt;Before this semester, the lowest-level language I'd written was Java, with some JavaScript on top. Then my computer architecture course threw RISC-V assembly at me, and it completely changed how I think about what's actually happening when my code runs. Here's what stood out to me.&lt;/p&gt;

&lt;h2&gt;
  
  
  No more "just call a function"
&lt;/h2&gt;

&lt;p&gt;In Java or JavaScript, you write something like:&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;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don't think about what happens underneath — you just call &lt;code&gt;add(2, 3)&lt;/code&gt; and move on. In RISC-V assembly, there's no &lt;code&gt;add()&lt;/code&gt; function waiting for you. You work directly with registers (small storage slots inside the CPU) and explicit instructions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;li a0, 2      # load value 2 into register a0
li a1, 3      # load value 3 into register a1
add a0, a0, a1  # a0 = a0 + a1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every single step is spelled out. There's no hidden machinery doing work for you — you &lt;em&gt;are&lt;/em&gt; the machinery, in a sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variables aren't really "variables" anymore
&lt;/h2&gt;

&lt;p&gt;In JavaScript, a variable is a name that holds a value, and you don't worry about where that value physically lives. In assembly, you're constantly aware of &lt;em&gt;where&lt;/em&gt; things are: which register holds which value, or where in memory something's stored. You run out of registers fast, so you have to be deliberate about what you keep close (in a register) versus what you push to memory.&lt;/p&gt;

&lt;p&gt;This made me appreciate something I never thought about before: every time I write &lt;code&gt;let x = 5;&lt;/code&gt; in JavaScript, the language is quietly handling register allocation and memory management for me. In assembly, that's my job.&lt;/p&gt;

&lt;p&gt;There's actually a lot more to registers alone than I can fit here — what each one is typically used for, how many you actually get to work with, which ones are "yours" to use freely versus reserved for specific purposes. That's probably worth its own post at some point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functions calls are a whole production
&lt;/h2&gt;

&lt;p&gt;Calling a function in a high-level language feels free. In RISC-V, a function call means manually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Saving the values in registers you care about (so the function you're calling doesn't overwrite them)&lt;/li&gt;
&lt;li&gt;Setting up the arguments in specific registers&lt;/li&gt;
&lt;li&gt;Jumping to the function's instructions&lt;/li&gt;
&lt;li&gt;Making sure the function knows where to return to&lt;/li&gt;
&lt;li&gt;Restoring everything once it's back&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seeing this made me understand why function calls have a performance cost — something that's usually invisible in JS or Java, where it just feels instant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Control flow without if/else
&lt;/h2&gt;

&lt;p&gt;There's no &lt;code&gt;if&lt;/code&gt; statement in RISC-V. Instead, you use branch instructions that jump to different parts of the code based on a comparison:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bge a0, a1, label   # if a0 &amp;gt;= a1, jump to "label"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Writing an &lt;code&gt;if/else&lt;/code&gt; block or a loop in JavaScript suddenly felt like a small miracle once I saw how many branch instructions and labels it takes to build the same logic manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this actually helped me as a web dev
&lt;/h2&gt;

&lt;p&gt;I'm not planning to write assembly for my career, but this course changed how I think about high-level code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I have a much better sense of &lt;em&gt;why&lt;/em&gt; certain operations are "cheap" and others are "expensive" — it's less abstract once you've seen the actual instructions behind them.&lt;/li&gt;
&lt;li&gt;Debugging feels different now. When something breaks in JavaScript, I have a mental model of what's happening underneath, instead of just treating it as a black box.&lt;/li&gt;
&lt;li&gt;I have a lot more respect for what languages like Java and JavaScript are doing for me automatically — memory management, function call overhead, type handling — all of that is work I used to take for granted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My takeaway
&lt;/h2&gt;

&lt;p&gt;Assembly stripped away every convenience I didn't know I was relying on. It's slower to write and a lot less forgiving, but it made the "magic" of high-level languages a lot less mysterious. If you've only ever worked in high-level languages, I'd genuinely recommend trying even a small assembly exercise — it changes how you read your own code afterward.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Final-year software engineering student, writing about what I'm learning in my courses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>assembly</category>
      <category>computerscience</category>
      <category>beginners</category>
      <category>riscv</category>
    </item>
    <item>
      <title>Java References vs Values: The Mistake That Confused Me</title>
      <dc:creator>Wassim bd</dc:creator>
      <pubDate>Sun, 02 Aug 2026 04:14:57 +0000</pubDate>
      <link>https://dev.to/majin-dev/java-references-vs-values-the-mistake-that-confused-me-a46</link>
      <guid>https://dev.to/majin-dev/java-references-vs-values-the-mistake-that-confused-me-a46</guid>
      <description>&lt;p&gt;When I started learning object-oriented programming in Java, I hit a wall that I think a lot of beginners hit: I thought I understood how variables worked, until objects entered the picture. Here's the mistake I made and what actually clarified it for me.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mistake
&lt;/h2&gt;

&lt;p&gt;In Java, primitive types (int, double, boolean, char, etc.) work exactly how you'd expect — when you assign one variable to another, you get a copy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 5&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Changing &lt;code&gt;b&lt;/code&gt; doesn't touch &lt;code&gt;a&lt;/code&gt;. Simple enough. But then I ran into this with objects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Rex"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;dog2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;dog2&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Max"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dog1&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Max ??&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I expected &lt;code&gt;dog1.name&lt;/code&gt; to still be "Rex", the same way &lt;code&gt;a&lt;/code&gt; stayed 5 earlier. But it printed "Max" instead. That's the moment it clicked that objects don't work the same way as primitives.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's actually happening
&lt;/h2&gt;

&lt;p&gt;With objects, the variable doesn't hold the object itself — it holds a &lt;strong&gt;reference&lt;/strong&gt; (basically an address) pointing to where the object lives in memory. When I wrote &lt;code&gt;Dog dog2 = dog1;&lt;/code&gt;, I didn't copy the dog. I copied the &lt;em&gt;address&lt;/em&gt;. So &lt;code&gt;dog1&lt;/code&gt; and &lt;code&gt;dog2&lt;/code&gt; were both pointing at the exact same object in memory. Changing &lt;code&gt;dog2.name&lt;/code&gt; changed the only Dog object that existed — the one both variables were pointing to.&lt;/p&gt;

&lt;p&gt;It's the difference between copying a letter versus copying the address written on an envelope. If you copy the address and someone repaints the house at that address, both copies of the address now point to a freshly painted house — because there was only ever one house.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters in practice
&lt;/h2&gt;

&lt;p&gt;This isn't just a theory question — it causes real bugs. A common one: passing an object into a method, modifying it inside the method, and being surprised that the original object changed too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;rename&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Buddy"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;Dog&lt;/span&gt; &lt;span class="n"&gt;myDog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Dog&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;myDog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Rex"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;rename&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myDog&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;myDog&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Buddy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since &lt;code&gt;myDog&lt;/code&gt; is a reference, passing it into &lt;code&gt;rename()&lt;/code&gt; passes a copy of the &lt;em&gt;reference&lt;/em&gt;, not a copy of the object. Both point to the same Dog, so modifying it inside the method affects the original.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one exception that confused me more: Strings
&lt;/h2&gt;

&lt;p&gt;Strings in Java are objects too, but they behave a bit differently because they're &lt;strong&gt;immutable&lt;/strong&gt; — once created, a String's content can never change. So this works the way you'd intuitively expect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"hello"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;s2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;s2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"world"&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s1&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// hello&lt;/span&gt;
&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s2&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// world&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looks just like the primitive example, but for a different reason: &lt;code&gt;s2 = "world"&lt;/code&gt; doesn't modify the existing String — it makes &lt;code&gt;s2&lt;/code&gt; point to a brand new String object entirely, leaving the original one (and &lt;code&gt;s1&lt;/code&gt;) untouched.&lt;/p&gt;

&lt;h2&gt;
  
  
  My takeaway
&lt;/h2&gt;

&lt;p&gt;The rule that finally stuck for me: primitives copy their value, but object variables copy their reference (the address), not the object itself. If two variables point to the same object, changing the object through one variable will show up through the other too — unless the object is immutable, like Strings, in which case "changing" it actually creates a new object instead.&lt;/p&gt;

&lt;p&gt;Once I stopped thinking of object variables as "boxes holding values" and started thinking of them as "sticky notes with an address on them," the rest of OOP made a lot more sense.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Final-year software engineering student, writing about what I'm learning in my courses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>oop</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Processes vs Threads: What's the Actual Difference?</title>
      <dc:creator>Wassim bd</dc:creator>
      <pubDate>Sun, 02 Aug 2026 03:39:44 +0000</pubDate>
      <link>https://dev.to/majin-dev/processes-vs-threads-whats-the-actual-difference-4aa2</link>
      <guid>https://dev.to/majin-dev/processes-vs-threads-whats-the-actual-difference-4aa2</guid>
      <description>&lt;p&gt;In my operating systems course, we spent a good chunk of time on processes and threads. I knew the words before, but I didn't really get the difference until I saw them compared side by side. Here's what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's a process?
&lt;/h2&gt;

&lt;p&gt;A process is basically a program that's running. When you open a web browser, a game, or a text editor, the operating system creates a process for it. Each process gets its own chunk of memory, and it's isolated from other processes — one process can't just reach into another process's memory and mess with it.&lt;/p&gt;

&lt;p&gt;Think of a process like a separate apartment. It has its own space, its own stuff, and what happens inside doesn't directly affect the apartment next door.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's a thread?
&lt;/h2&gt;

&lt;p&gt;A thread is a smaller unit of execution that lives &lt;em&gt;inside&lt;/em&gt; a process. A single process can have multiple threads, and all of those threads share the same memory space.&lt;/p&gt;

&lt;p&gt;Going back to the apartment analogy: if a process is the apartment, threads are like roommates living in it. They share the same fridge, the same living room — they can see and use the same stuff, which is convenient but also means they can accidentally interfere with each other if they're not careful.&lt;/p&gt;

&lt;h2&gt;
  
  
  The key differences
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Memory&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Processes have separate, isolated memory.&lt;/li&gt;
&lt;li&gt;Threads within the same process share memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Communication&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Processes need special mechanisms to talk to each other (like pipes or sockets), since they can't directly access each other's memory.&lt;/li&gt;
&lt;li&gt;Threads can communicate more easily since they already share memory — but that also means bugs can happen if two threads try to change the same data at the same time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cost of creation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating a new process is relatively expensive for the OS (new memory space, new resources).&lt;/li&gt;
&lt;li&gt;Creating a new thread is cheaper and faster since it reuses the process's existing resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Isolation and safety&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If a process crashes, it usually doesn't take down other processes.&lt;/li&gt;
&lt;li&gt;If a thread crashes badly enough, it can take down the entire process (and all its other threads) with it, since they all share the same space.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A concrete example
&lt;/h2&gt;

&lt;p&gt;A web browser is a good real-world example. Each tab you open is often its own separate process — that's actually why one crashing tab doesn't crash your whole browser. But inside each tab's process, there are multiple threads running at once: one might handle rendering the page, another might handle network requests, another might handle user input. They all share the tab's memory, which is why they can work together so smoothly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters (even if you're not doing OS-level programming)
&lt;/h2&gt;

&lt;p&gt;I'm mostly doing web development right now, not systems programming, but understanding this actually helped me make sense of things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why some bugs in concurrent code are so hard to track down (shared memory between threads)&lt;/li&gt;
&lt;li&gt;Why spawning a new process is heavier than spawning a new thread or an async task&lt;/li&gt;
&lt;li&gt;Why some frameworks talk about "worker threads" or "child processes" differently&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My takeaway
&lt;/h2&gt;

&lt;p&gt;Before this course, I used "process" and "thread" almost interchangeably in my head. Now I get that a process is like a container with its own space, and threads are the workers inside that container sharing the same resources. It's a small distinction, but it explains a lot about how modern software actually runs.&lt;/p&gt;

&lt;p&gt;If you're learning this too, I'd say the apartment/roommates analogy is what finally made it click for me — hope it helps you too.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Final-year software engineering student, writing about what I'm learning in my courses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>os</category>
    </item>
    <item>
      <title>Express vs Django: What I Learned Comparing the Two</title>
      <dc:creator>Wassim bd</dc:creator>
      <pubDate>Sun, 02 Aug 2026 00:45:00 +0000</pubDate>
      <link>https://dev.to/majin-dev/express-vs-django-what-i-learned-comparing-the-two-pn4</link>
      <guid>https://dev.to/majin-dev/express-vs-django-what-i-learned-comparing-the-two-pn4</guid>
      <description>&lt;p&gt;As a software engineering student, I recently had to compare Express and Django for a web development course. Both are popular frameworks for building web apps, but they work pretty differently. Here's what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the difference?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Express&lt;/strong&gt; is a framework for Node.js (JavaScript). It's very minimal — it doesn't force you to organize your project in a specific way. You basically start with a blank page and add whatever you need (database, authentication, etc.).&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="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="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello World&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&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;Django&lt;/strong&gt; is a framework for Python. It's the opposite philosophy: it comes with a lot of stuff already built in, like an admin panel, a database system (ORM), and user authentication. You follow its structure instead of building your own.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django.http&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;HttpResponse&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;HttpResponse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello World&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both of these do the exact same thing, but you can already see the difference in approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  A few things I noticed comparing them
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Getting started fast&lt;/strong&gt;&lt;br&gt;
Django feels quicker for basic apps because so much comes ready to use. The admin panel especially — you get a working interface to manage your data without writing it yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Doing things your own way&lt;/strong&gt;&lt;br&gt;
Express doesn't tell you how to structure things. That's nice if you want full control, but it also means more decisions to make when you're just starting out (which database? which auth library?).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript everywhere&lt;/strong&gt;&lt;br&gt;
If you're already using React or Angular on the frontend, Express lets you stick with JavaScript for the backend too. That felt like a big plus to me since I didn't have to switch mental gears between languages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python's ecosystem&lt;/strong&gt;&lt;br&gt;
Django comes with Python, which is huge if your project ever needs data analysis or machine learning down the line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning curve&lt;/strong&gt;&lt;br&gt;
As a beginner, I found Django a bit easier to follow at first, just because it tells you where things go (models, views, templates). With Express, you have more freedom, but you also have to make more decisions on your own.&lt;/p&gt;

&lt;h2&gt;
  
  
  When would you use each one?
&lt;/h2&gt;

&lt;p&gt;From what I've learned so far:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Express&lt;/strong&gt; seems better for real-time apps (like chat apps), or if your team already works in JavaScript everywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Django&lt;/strong&gt; seems better if you want to build something fast with less setup, or if your project touches data/ML.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My takeaway
&lt;/h2&gt;

&lt;p&gt;There's no "best" framework overall — it really depends on the project. I'm still learning both, but comparing them like this helped me understand &lt;em&gt;why&lt;/em&gt; a team would pick one over the other, instead of just knowing the syntax.&lt;/p&gt;

&lt;p&gt;If you're also learning web dev and have thoughts on this, I'd love to hear them in the comments!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Final-year software engineering student at UQAM, writing about what I'm learning in my web development courses.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
