<?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: Rinon Tendrinomena</title>
    <description>The latest articles on DEV Community by Rinon Tendrinomena (@rinonten).</description>
    <link>https://dev.to/rinonten</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%2F645317%2F15a85b49-f68b-4e55-bb84-a3910b09e520.jpeg</url>
      <title>DEV Community: Rinon Tendrinomena</title>
      <link>https://dev.to/rinonten</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rinonten"/>
    <language>en</language>
    <item>
      <title>Coupling, Decoupling, and Cohesion</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Mon, 09 Feb 2026 16:29:56 +0000</pubDate>
      <link>https://dev.to/rinonten/coupling-decoupling-and-cohesion-5d52</link>
      <guid>https://dev.to/rinonten/coupling-decoupling-and-cohesion-5d52</guid>
      <description>&lt;p&gt;In software development, especially when writing JavaScript, two big ideas help make your code easier to work with, change, and understand: &lt;strong&gt;cohesion&lt;/strong&gt; and &lt;strong&gt;coupling&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think of your code like building with toys or organizing a kitchen. These concepts decide whether your project feels smooth or turns into a big mess.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cohesion – "Keep related things together"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cohesion&lt;/strong&gt; means how well the code inside one file, function, or module belongs together.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High cohesion&lt;/strong&gt; = everything inside does one clear job
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low cohesion&lt;/strong&gt; = it's a random mix of unrelated stuff&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analogy&lt;/strong&gt;: Imagine your kitchen drawer.&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%2Ft1sedkku0ktfeyp5v6zm.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1sedkku0ktfeyp5v6zm.jpeg" alt="Kitchen drawer to explain coupling and cohesion" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A messy junk drawer (low cohesion) has spoons, batteries, tape, old receipts, and a phone charger all mixed up. Finding anything takes forever.&lt;/p&gt;

&lt;p&gt;A well-organized drawer (high cohesion) has only cooking tools in one place, only cleaning stuff in another. Easy to find, easy to use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript example – low cohesion (avoid this):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// utils.js – does everything (bad!)&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;calculateTotal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;tax&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;price&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;sendEmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&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="s2"&gt;`Email sent to &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserAge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;birthYear&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;getFullYear&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;birthYear&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;saveToLocalStorage&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;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&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;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file does math, emailing, age calculation, and storage. Hard to understand, hard to test, hard to fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;High cohesion (better):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// priceCalculator.js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;calculateTotal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;taxRate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;taxRate&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;price&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;tax&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;applyDiscount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;percent&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;total&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;percent&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&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;One file = one job (price math). Clean and focused.&lt;/p&gt;

&lt;h3&gt;
  
  
  Coupling – "How much do modules know about each other?"
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Coupling&lt;/strong&gt; measures how connected two pieces of code are. How much one part depends on the insides of another.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High / tight coupling&lt;/strong&gt; = modules are glued together
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low / loose coupling&lt;/strong&gt; = modules talk nicely but don't know too much about each other&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Analogy&lt;/strong&gt;: Lego bricks vs superglued blocks.&lt;/p&gt;

&lt;p&gt;Lego bricks snap together easily and you can pull them apart to rebuild (low coupling).&lt;/p&gt;

&lt;p&gt;If you put superglue between every brick, you can't change anything without breaking the whole thing (high coupling).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Another visual – good vs bad coupling:&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%2F7913prfa54krvpqfisb4.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%2F7913prfa54krvpqfisb4.png" alt="Cohesion vs coupling" width="300" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Left side (messy): everything connected to everything → hard to change.&lt;br&gt;&lt;br&gt;
Right side (clean): small groups connected only when needed → easy to work with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript example – tight coupling (bad):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// userService.js&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;getUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Directly knows it's using localStorage (tight!)&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`user_&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;saveUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`user_&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code is glued to &lt;code&gt;localStorage&lt;/code&gt;. If you want to switch to a server or IndexedDB later, you have to change this file &lt;strong&gt;and&lt;/strong&gt; every place that uses &lt;code&gt;UserService&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Loose coupling (good) – using dependency injection:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// storage.js (interface-like)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LocalStorageService&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="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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&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="nf"&gt;set&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;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&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;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// userService.js&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;storageService&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;storage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;storageService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// just uses the interface&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;getUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;storage&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="s2"&gt;`user_&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;saveUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`user_&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;storage&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;LocalStorageService&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;userService&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;UserService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;UserService&lt;/code&gt; doesn't care &lt;strong&gt;how&lt;/strong&gt; storage works. You can easily swap it for:&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;ApiStorageService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;get&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="cm"&gt;/* fetch from API */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;set&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;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* send to API */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is &lt;strong&gt;decoupling&lt;/strong&gt; – removing the strong glue between parts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decoupling – The Action of Making Coupling Loose
&lt;/h3&gt;

&lt;p&gt;Decoupling means actively reducing how much modules depend on each other's details.&lt;/p&gt;

&lt;p&gt;Common ways in JavaScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use function parameters instead of global variables&lt;/li&gt;
&lt;li&gt;Pass dependencies (dependency injection)&lt;/li&gt;
&lt;li&gt;Use interfaces / simple objects instead of concrete classes&lt;/li&gt;
&lt;li&gt;Events / callbacks instead of direct calls&lt;/li&gt;
&lt;li&gt;Separate files by responsibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Should You Care?
&lt;/h3&gt;

&lt;p&gt;Good cohesion + low coupling = your code is like Lego:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to understand (one file = one clear idea)&lt;/li&gt;
&lt;li&gt;Easy to change (swap one piece without breaking others)&lt;/li&gt;
&lt;li&gt;Easy to test (test small parts alone)&lt;/li&gt;
&lt;li&gt;Easy for teams (different people work on different pieces)&lt;/li&gt;
&lt;li&gt;Easy to grow (add new features without chaos)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Bad cohesion + high coupling = your code is like a house of cards made of superglue:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tiny change breaks many places&lt;/li&gt;
&lt;li&gt;Hard to test&lt;/li&gt;
&lt;li&gt;New developers get scared&lt;/li&gt;
&lt;li&gt;Bugs hide everywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Rule to Remember
&lt;/h3&gt;

&lt;p&gt;Aim for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High cohesion&lt;/strong&gt; inside each module (one job per file/function)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Low coupling&lt;/strong&gt; between modules (talk through simple contracts, not internals)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next time you write JavaScript, ask yourself:&lt;/p&gt;

&lt;p&gt;"Does this function/file do one main thing?" → Cohesion&lt;br&gt;&lt;br&gt;
"Does it know too much about other parts?" → Coupling&lt;/p&gt;

&lt;p&gt;Keep practicing these ideas – your future self (and teammates) will love you for it!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>coupling</category>
      <category>decoupling</category>
    </item>
    <item>
      <title>🚀 I Built a Developer Resources Platform — Join Me and Share What Helps You Learn</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Wed, 24 Dec 2025 13:02:16 +0000</pubDate>
      <link>https://dev.to/rinonten/i-built-a-developer-resources-platform-join-me-and-share-what-helps-you-learn-3aoi</link>
      <guid>https://dev.to/rinonten/i-built-a-developer-resources-platform-join-me-and-share-what-helps-you-learn-3aoi</guid>
      <description>&lt;p&gt;As developers, we all collect links.&lt;/p&gt;

&lt;p&gt;Articles, docs, videos, tools, GitHub repos, blog posts…&lt;br&gt;&lt;br&gt;
Most of them end up buried in bookmarks, Notion pages, or forgotten browser tabs.&lt;/p&gt;

&lt;p&gt;So I decided to build something simple but powerful:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A developer resources platform where useful resources are curated, shared, reviewed, and discovered by developers around the world.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;Live app:&lt;/strong&gt; &lt;a href="https://resources.onja.dev/" rel="noopener noreferrer"&gt;https://resources.onja.dev/&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is This App About?
&lt;/h2&gt;

&lt;p&gt;This platform is built to help developers &lt;strong&gt;find the right resources based on their needs&lt;/strong&gt;, without wasting time searching everywhere.&lt;/p&gt;

&lt;p&gt;Each resource includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Title &amp;amp; short description&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type&lt;/strong&gt; (article, video, tool, course, etc.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tech stack&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Source&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Direct link&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Resources are curated from the internet or added manually by the community.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Can You Do as a Developer?
&lt;/h2&gt;

&lt;p&gt;Once you’re logged in, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Like resources&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mark resources as useful / not useful&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mark resources as complete&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recommend resources to friends&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comment and reply to comments&lt;/strong&gt; on each resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter resources&lt;/strong&gt; based on your needs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Save recommendations&lt;/strong&gt; for later&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not just to list links — but to &lt;strong&gt;create signal over noise&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Community-Driven &amp;amp; Open
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Every logged-in user can add a resource&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Resources are &lt;strong&gt;reviewed and approved by admins&lt;/strong&gt; to keep quality high&lt;/li&gt;
&lt;li&gt;The platform is &lt;strong&gt;free to use&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;No paywalls, no ads — just useful content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can also &lt;strong&gt;install it on your computer or phone&lt;/strong&gt; like an app (PWA).&lt;/p&gt;




&lt;h2&gt;
  
  
  Want to Help as an Admin?
&lt;/h2&gt;

&lt;p&gt;I’m actively looking for people who:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enjoy curating quality dev resources&lt;/li&gt;
&lt;li&gt;Want to help developers learn better&lt;/li&gt;
&lt;li&gt;Believe in open, community-driven knowledge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 &lt;strong&gt;If you’d like to join as an admin, just leave a comment below this post&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Tell me why you’re interested, and I’ll reach out.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I Built This
&lt;/h2&gt;

&lt;p&gt;Developers everywhere — especially in growing tech communities — need &lt;strong&gt;easy access to the right learning materials&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This platform is my small contribution to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better learning&lt;/li&gt;
&lt;li&gt;Less wasted time&lt;/li&gt;
&lt;li&gt;Stronger developer communities&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Join In
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Explore the app: &lt;a href="https://resources.onja.dev/" rel="noopener noreferrer"&gt;https://resources.onja.dev/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Add your favorite resources&lt;/li&gt;
&lt;li&gt;Share feedback and ideas&lt;/li&gt;
&lt;li&gt;Comment below if you want to help as an admin&lt;/li&gt;
&lt;li&gt;This is also an open source project so I invite you to join me improving the app.Let me know in the comments section below if you want to contribute to it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If this helps even one developer learn faster, it’s already worth it.&lt;/p&gt;

&lt;p&gt;Thanks for reading — and I’d love to see what resources &lt;strong&gt;you&lt;/strong&gt; find valuable 🚀&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>website</category>
    </item>
    <item>
      <title>Exploring the Latest AI Models and Tools for Developers</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Wed, 01 Oct 2025 14:55:04 +0000</pubDate>
      <link>https://dev.to/rinonten/exploring-the-latest-ai-models-and-tools-for-developers-3cac</link>
      <guid>https://dev.to/rinonten/exploring-the-latest-ai-models-and-tools-for-developers-3cac</guid>
      <description>&lt;h1&gt;
  
  
  Exploring the Latest AI Models and Tools for Developers
&lt;/h1&gt;

&lt;p&gt;The landscape of AI-driven development is evolving rapidly, empowering developers with powerful models and tools. This article dives into the latest base models, coding assistants, coding agents, and app builders, offering a comprehensive look at how they can enhance productivity and innovation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Base Models: The Foundation of AI Power
&lt;/h2&gt;

&lt;p&gt;Base models are the backbone of modern AI applications, trained on massive datasets to handle tasks from coding to multimodal processing. Here are the standout models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude 3.5 Sonnet (Anthropic)&lt;/strong&gt;: A leader in intelligence, this model excels in reasoning, coding, and safety, with enhancements in speed and efficiency. The potential "Sonnet 4.5" evolution hints at even greater agentic capabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GPT-5 (OpenAI)&lt;/strong&gt;: Launched in August 2025, GPT-5 merges speed with intelligence, excelling in coding, UI generation, and complex problem-solving, rivaling human performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini (Google DeepMind)&lt;/strong&gt;: A multimodal family optimized for text, audio, and images, Gemini 2.5 models lead in reasoning and large-scale coding tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grok 4 (xAI)&lt;/strong&gt;: Released in July 2025, this model boasts global intelligence with real-time search and multimodal prowess, ideal for enterprise coding and data tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Llama 4 (Meta)&lt;/strong&gt;: An open-source giant with 405B parameter variants, it shines in multilingual tasks and on-device deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DeepSeek-V3 (DeepSeek AI)&lt;/strong&gt;: A cost-effective open-source model, it dominates coding and math benchmarks, especially for Chinese-language applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Coding Assistants: Your AI Pair Programmers
&lt;/h2&gt;

&lt;p&gt;Coding assistants integrate into development environments, offering real-time support to accelerate coding without full automation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Copilot&lt;/strong&gt;: Suggests code and automates Git tasks, acting as an asynchronous teammate for faster workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cursor&lt;/strong&gt;: A smart editor with autocompletion and an "Agent" mode for complex tasks like debugging and refactoring.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tabnine&lt;/strong&gt;: Offers personalized completions with privacy-focused local deployment, boosting productivity across 30+ languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Q Developer&lt;/strong&gt;: An enterprise tool with context-aware suggestions and cloud-native optimization, perfect for secure, scalable apps.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Coding Agents: Autonomous Development Partners
&lt;/h2&gt;

&lt;p&gt;Coding agents take autonomy further, managing end-to-end tasks with minimal oversight:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code (Anthropic)&lt;/strong&gt;: Integrated with Sonnet 4.5, it handles migrations and bug fixes from the terminal with deep codebase insight.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI Codex&lt;/strong&gt;: Updated in 2025, it writes features, fixes bugs, and collaborates in real-time, running locally or in the cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cline&lt;/strong&gt;: An open-source agent for multi-step workflows like testing and deployment, reducing manual effort with Git integration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Jules&lt;/strong&gt;: Leverages Gemini 2.5 to navigate repositories, generate PRs, and refactor code for high-velocity teams.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  App Builders: From Prompts to Production
&lt;/h2&gt;

&lt;p&gt;App builders turn natural language into fully functional applications, streamlining UI, code, and deployment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lovable&lt;/strong&gt;: Creates scalable apps from prompts, with easy AI feature integration and cloud support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;v0 (Vercel)&lt;/strong&gt;: Generates working apps like dashboards from prompts, accessible to non-developers via its Platform API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bolt&lt;/strong&gt;: Scaffolds full-stack apps with databases and APIs, offering one-click deployments for rapid MVPs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bubble&lt;/strong&gt;: A no-code platform with AI-enhanced workflows, enabling complex apps with databases for non-technical creators.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;The AI ecosystem in 2025 offers a rich toolkit for developers, from foundational models to autonomous agents and app builders. Whether you're fine-tuning a base model, collaborating with a coding assistant, delegating to an agent, or prototyping with an app builder, these technologies are reshaping how we build software. Stay tuned for more updates as this space continues to evolve!&lt;/p&gt;

&lt;p&gt;Blog Source: Grok&lt;/p&gt;

</description>
      <category>ai</category>
      <category>githubcopilot</category>
      <category>openai</category>
      <category>lovable</category>
    </item>
    <item>
      <title>When JS blocks parsing your HTML</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Wed, 17 Sep 2025 06:24:39 +0000</pubDate>
      <link>https://dev.to/rinonten/when-js-blocks-parsing-your-html-29jm</link>
      <guid>https://dev.to/rinonten/when-js-blocks-parsing-your-html-29jm</guid>
      <description>&lt;h2&gt;
  
  
  A browser builds a webpage step by step:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Reads the HTML file top to bottom.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It converts the text into tokens, then into the DOM tree.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the browser encounters a &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;tag without &lt;strong&gt;async&lt;/strong&gt; or &lt;strong&gt;defer&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;It pauses HTML parsing immediately. &lt;/li&gt;
&lt;li&gt;Downloads the JavaScript file (if external).&lt;/li&gt;
&lt;li&gt;Executes that JavaScript. Only after execution finishes does it resume building the DOM.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why does parsing stop?
&lt;/h2&gt;

&lt;p&gt;Because JavaScript can modify the DOM or CSSOM while the page is loading.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;p id="greet"&amp;gt;Hello&amp;lt;/p&amp;gt;
&amp;lt;script&amp;gt;
  document.getElementById("greet").innerText = "Hi from JS!";
&amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the browser kept parsing ahead, it might waste effort building nodes that JS will delete/change anyway.&lt;br&gt;
So it waits to ensure accuracy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;⚡ Example Timeline:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case 1:&lt;/strong&gt; Parser-blocking script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;script src="big-script.js"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;!-- blocks parsing --&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Browser starts parsing &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hits &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; → stops everything.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Downloads + runs &lt;em&gt;&lt;strong&gt;big-script.js&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;4 After execution → continues parsing &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;.&lt;br&gt;
Result: &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; appears later, delaying rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case 2:&lt;/strong&gt; Script with defer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;script src="big-script.js" defer&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Browser keeps parsing DOM without stopping.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;big-script.js&lt;/strong&gt;&lt;/em&gt; downloads in background.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Executes only after DOM is fully parsed.&lt;br&gt;
Page appears faster, no blocking.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  So in short:
&lt;/h2&gt;

&lt;p&gt;“JavaScript blocks parsing” means the browser halts HTML processing whenever it encounters a normal &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag until that script is fully executed.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Detailed Steps in DOM Construction</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Mon, 15 Sep 2025 08:48:35 +0000</pubDate>
      <link>https://dev.to/rinonten/detailed-steps-in-dom-construction-124m</link>
      <guid>https://dev.to/rinonten/detailed-steps-in-dom-construction-124m</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. HTML source code → Bytes&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you request a webpage (&lt;a href="https://example.com" rel="noopener noreferrer"&gt;https://example.com&lt;/a&gt;), the server sends raw bytes across the network (TCP packets).&lt;/li&gt;
&lt;li&gt;These bytes are not text yet — they’re just sequences of numbers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: the string &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; in UTF-8 encoding is sent as bytes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;60 104 49 62
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(&amp;lt; = 60, h = 104, 1 = 49, &amp;gt; = 62 in ASCII/UTF-8).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Bytes → Characters&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The browser needs to decode the bytes into actual characters.&lt;/li&gt;
&lt;li&gt;It uses the character encoding specified by the server &lt;code&gt;(Content-Type: text/html; charset=UTF-8)&lt;/code&gt; or by the HTML &lt;code&gt;&amp;lt;meta charset="utf-8"&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;br&gt;
Bytes &lt;code&gt;60 104 49 62&lt;/code&gt; → Characters &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Characters → Tokens&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now the browser runs the HTML tokenizer.&lt;/li&gt;
&lt;li&gt;The tokenizer scans the characters and groups them into tokens, which represent meaningful chunks of HTML.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types of tokens:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;StartTag token: &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;EndTag token: &lt;code&gt;&amp;lt;/h1&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Text token: &lt;code&gt;Hello World&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Comment token: &lt;code&gt;&amp;lt;!-- note --&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, the browser doesn’t know about parent/child relationships yet — it just has a sequence of tokens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Tokens → Nodes&lt;/strong&gt;&lt;br&gt;
Each token is turned into a node (an object in memory).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of nodes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Element nodes: &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; → an element node named h1.&lt;/li&gt;
&lt;li&gt;Text nodes: &lt;code&gt;Hello World&lt;/code&gt; → a text node containing a string.&lt;/li&gt;
&lt;li&gt;Comment nodes: &lt;code&gt;&amp;lt;!-- note --&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Nodes → DOM Tree&lt;/strong&gt;&lt;br&gt;
The browser’s HTML tree builder arranges these nodes into a tree structure based on nesting rules of HTML&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example input:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;Hello&amp;lt;/h1&amp;gt;
  &amp;lt;p&amp;gt;World&amp;lt;/p&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Becomes a tree:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Document
 └── body (Element)
      ├── h1 (Element)
      │     └── "Hello" (Text)
      └── p (Element)
            └── "World" (Text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now this DOM tree is the structure your JavaScript code can traverse with APIs like &lt;strong&gt;document.getElementById()&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Here's the structure summary:
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;HTML (bytes) → decode → characters → tokenize → nodes → structured DOM tree.&lt;/code&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Technical Terms Every Developer Should Know</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Wed, 19 Feb 2025 13:36:14 +0000</pubDate>
      <link>https://dev.to/rinonten/technical-terms-every-developer-should-know-3da6</link>
      <guid>https://dev.to/rinonten/technical-terms-every-developer-should-know-3da6</guid>
      <description>&lt;p&gt;Whether you’re just starting out or looking to brush up on your knowledge, understanding the key terminology in web development is crucial. In today’s fast-paced tech landscape, frameworks come and go—but the fundamentals remain. In this article, we’ll break down core concepts from front-end and back-end development to the tools and protocols that tie it all together. Read on to deepen your technical vocabulary and set a solid foundation for your web projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  Core Web Technologies
&lt;/h2&gt;

&lt;p&gt;At the heart of every website are three cornerstone technologies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTML (HyperText Markup Language):&lt;/strong&gt; HTML defines the structure of a webpage by using tags like &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt;. It’s the backbone of any web document, forming the skeleton that browsers render for you.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSS (Cascading Style Sheets):&lt;/strong&gt; CSS is used to style the HTML content. It controls layout, colors, fonts, and responsiveness—ensuring your site looks great on any device.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt; JavaScript adds interactivity to web pages. It enables dynamic content, animations, and client-side logic. Modern JavaScript, often enhanced by frameworks and libraries, is a vital skill for any web developer.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;Document Object Model (DOM)&lt;/strong&gt;—an API for HTML and XML documents—lets your JavaScript interact with the page, making dynamic changes possible without a full reload.&lt;/p&gt;




&lt;h2&gt;
  
  
  Networking &amp;amp; Protocols
&lt;/h2&gt;

&lt;p&gt;Understanding how data travels on the web is key to building performant applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP/HTTPS:&lt;/strong&gt; The Hypertext Transfer Protocol (and its secure variant HTTPS) governs how data is transferred between the client and server. Familiarity with HTTP methods (GET, POST, PUT, DELETE) is essential for API communication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DNS (Domain Name System):&lt;/strong&gt; DNS translates human-friendly domain names into IP addresses. This system connects browsers to web servers seamlessly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web Standards:&lt;/strong&gt; Standards ensure that websites work seamlessly across different browsers and devices. Organizations publish specifications for HTML, CSS, and more to maintain interoperability and accessibility.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Front-End Development
&lt;/h2&gt;

&lt;p&gt;Creating compelling user experiences is at the heart of front-end development. Key concepts include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Responsive Design:&lt;/strong&gt; Using CSS media queries and flexible layouts, responsive design ensures your site looks great on any device—from desktops to smartphones.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Front-End Frameworks &amp;amp; Libraries:&lt;/strong&gt; Tools such as React, Angular, and Vue.js simplify building interactive user interfaces by providing reusable components and robust state management systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AJAX &amp;amp; Single-Page Applications (SPAs):&lt;/strong&gt; AJAX enables asynchronous data exchange with the server, allowing for smoother user experiences. SPAs load a single HTML page and dynamically update content, reducing full page reloads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Progressive Web Apps (PWAs):&lt;/strong&gt; PWAs combine the best of web and mobile apps by offering offline functionality and push notifications for an app-like experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Virtual DOM:&lt;/strong&gt; Many modern libraries use a virtual representation of the DOM to optimize rendering, making updates faster and more efficient.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Back-End Development
&lt;/h2&gt;

&lt;p&gt;Behind every dynamic website is a robust back end:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-Side Languages:&lt;/strong&gt; Languages such as Node.js (JavaScript), Python, PHP, Ruby, and Java are used to build the logic that powers web applications. These languages handle tasks like processing requests, interacting with databases, and generating dynamic content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;APIs (Application Programming Interfaces):&lt;/strong&gt; APIs allow different systems to communicate. RESTful APIs and GraphQL are common ways to expose back-end data to front-end applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Databases:&lt;/strong&gt; Choose between SQL databases (like MySQL and PostgreSQL) for structured data and NoSQL databases (like MongoDB or Redis) for more flexible storage needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-Side Rendering (SSR) vs. Client-Side Rendering (CSR):&lt;/strong&gt; SSR generates full HTML on the server, which can improve SEO, while CSR uses JavaScript in the browser to build the page dynamically, offering a smoother user experience after the initial load.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Tools, Processes &amp;amp; Methodologies
&lt;/h2&gt;

&lt;p&gt;Efficient development isn’t just about code—it’s about the tools and practices that help you build, test, and deploy your projects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Version Control (Git):&lt;/strong&gt; Git allows you to track changes, collaborate with team members, and manage multiple versions of your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Package Managers &amp;amp; Bundlers:&lt;/strong&gt; Tools like npm, Yarn, and Webpack help manage dependencies and optimize your code by bundling resources.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Continuous Integration/Continuous Deployment (CI/CD):&lt;/strong&gt; Automate testing and deployment to reduce errors and speed up release cycles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DevOps:&lt;/strong&gt; DevOps practices bridge the gap between development and operations, fostering a culture of collaboration and continuous improvement.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Debugging &amp;amp; Testing Tools:&lt;/strong&gt; Browser developer tools, unit testing frameworks, and integration testing suites are essential for identifying and fixing issues quickly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Additional Key Concepts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Caching &amp;amp; CDNs:&lt;/strong&gt; Storing content closer to users through caching and using Content Delivery Networks (CDNs) improves load times and reduces server strain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Accessibility (a11y):&lt;/strong&gt; Designing with accessibility in mind—following guidelines to ensure that your website is usable by everyone, including people with disabilities—is essential.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SEO (Search Engine Optimization):&lt;/strong&gt; Practices that improve a website's visibility on search engines by ensuring semantic markup, fast load times, and mobile-friendly design.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance Metrics:&lt;/strong&gt; Metrics such as Largest Contentful Paint (LCP), First Contentful Paint (FCP), and Time to Interactive (TTI) help you measure and optimize the user experience in terms of speed and responsiveness.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Microservices Architecture:&lt;/strong&gt; Breaking your application into smaller, independent services that communicate over APIs can improve scalability and maintainability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Semantic Web &amp;amp; Linked Data:&lt;/strong&gt; Technologies such as RDF, OWL, and JSON‑LD enable richer, machine-readable data on the web, paving the way for smarter applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Staying on top of web development isn’t just about keeping up with the latest frameworks—it's about understanding the fundamentals that drive the technology. Whether you’re tweaking a CSS grid or designing a REST API, the more fluent you are in these technical terms, the better you’ll be at building scalable, accessible, and robust web applications.&lt;/p&gt;

&lt;p&gt;By mastering these concepts, you not only improve your coding skills but also enhance your ability to communicate effectively with fellow developers and stakeholders. Take a moment to revisit these terms, explore each category further, and embrace the ongoing learning journey that is web development.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Understand JavaScript Object References and Copying - Brief Explanation</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Fri, 22 Nov 2024 05:56:19 +0000</pubDate>
      <link>https://dev.to/rinonten/understand-javascript-object-references-and-copying-brief-explanation-12hl</link>
      <guid>https://dev.to/rinonten/understand-javascript-object-references-and-copying-brief-explanation-12hl</guid>
      <description>&lt;p&gt;When working with objects in JavaScript, understanding the difference between &lt;strong&gt;object references&lt;/strong&gt; and &lt;strong&gt;object copying&lt;/strong&gt; is crucial. Here’s a detailed overview:&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Object References&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Objects are reference types&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;When you assign an object to a variable, you are assigning a reference to the memory location where the object is stored, not a copy of the object itself.&lt;/li&gt;
&lt;li&gt;Modifying the object through one reference affects all references to the same object.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;obj1&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="s2"&gt;Alice&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;obj2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;obj1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// obj2 now references the same object as obj1&lt;/span&gt;
   &lt;span class="nx"&gt;obj2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bob&lt;/span&gt;&lt;span class="dl"&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;obj1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: "Bob"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Equality checks&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Two variables are equal if they reference the same object in memory, not if their contents are identical.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value&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;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;value&lt;/span&gt;&lt;span class="dl"&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;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="c1"&gt;// Output: false (different references)&lt;/span&gt;
   &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&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;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;a&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: true (same reference)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;Object Copying&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;There are two main types of object copying: &lt;strong&gt;shallow copy&lt;/strong&gt; and &lt;strong&gt;deep copy&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;1. Shallow Copy&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A shallow copy creates a new object, but it only copies the first level of properties. Nested objects or arrays are still referenced, not duplicated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Techniques for Shallow Copy&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Object.assign()&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;original&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="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;details&lt;/span&gt;&lt;span class="p"&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;25&lt;/span&gt; &lt;span class="p"&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;copy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;({},&lt;/span&gt; &lt;span class="nx"&gt;original&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="nx"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&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;30&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;original&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 30 (shared reference)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Spread operator (&lt;code&gt;...&lt;/code&gt;)&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;original&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="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;details&lt;/span&gt;&lt;span class="p"&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;25&lt;/span&gt; &lt;span class="p"&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;copy&lt;/span&gt; &lt;span class="o"&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;original&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="nx"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&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;30&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;original&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 30 (shared reference)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Both methods create a shallow copy, meaning nested objects are still linked.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2. Deep Copy&lt;/strong&gt;
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A deep copy duplicates the entire object, including nested structures. The new object is completely independent of the original.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Techniques for Deep Copy&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;JSON.parse() and JSON.stringify()&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;original&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="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;details&lt;/span&gt;&lt;span class="p"&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;25&lt;/span&gt; &lt;span class="p"&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;copy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;original&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
 &lt;span class="nx"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&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;30&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;original&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limitation&lt;/strong&gt;: This method does not handle functions, &lt;code&gt;undefined&lt;/code&gt;, &lt;code&gt;Infinity&lt;/code&gt;, or special objects like &lt;code&gt;Date&lt;/code&gt; or &lt;code&gt;RegExp&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;StructuredClone()&lt;/strong&gt; (Modern JavaScript):&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;original&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="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;details&lt;/span&gt;&lt;span class="p"&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;25&lt;/span&gt; &lt;span class="p"&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;copy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;structuredClone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;original&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="nx"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&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;30&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;original&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;This method handles most edge cases (e.g., circular references) but is not supported in older environments.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Custom Libraries&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use libraries like &lt;strong&gt;lodash&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;cloneDeep&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lodash/cloneDeep&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;original&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="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;details&lt;/span&gt;&lt;span class="p"&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;25&lt;/span&gt; &lt;span class="p"&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;copy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;cloneDeep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;original&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="nx"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&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;30&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;original&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 25&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Summary Table&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Action&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Assignment (&lt;code&gt;=&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Creates a reference. Changes to one variable affect the other.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shallow Copy&lt;/td&gt;
&lt;td&gt;Creates a new object but retains references for nested objects.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deep Copy&lt;/td&gt;
&lt;td&gt;Creates a completely independent object, including nested structures.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Understanding these concepts helps you avoid unintended side effects when working with objects in JavaScript!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>object</category>
      <category>references</category>
      <category>copying</category>
    </item>
    <item>
      <title>NPM Config: customising how npm works</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Fri, 22 Nov 2024 05:50:37 +0000</pubDate>
      <link>https://dev.to/rinonten/npm-config-customising-how-npm-works-m15</link>
      <guid>https://dev.to/rinonten/npm-config-customising-how-npm-works-m15</guid>
      <description>&lt;p&gt;When we’re working with Node.js and npm, knowing how to adjust your settings can help make your work smoother. npm lets us change its settings through something called npm config, which helps control how npm behaves. These settings are saved in a file called .npmrc.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explain how npm config works, why it’s useful, and how you can use it to make npm fit your needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is &lt;code&gt;npm config&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;npm config&lt;/code&gt; is a way to adjust settings for npm so it works the way you want. You can use it to change things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which website &lt;em&gt;npm&lt;/em&gt; uses to download packages (the registry)&lt;/li&gt;
&lt;li&gt;How &lt;em&gt;npm&lt;/em&gt; saves packages in your project&lt;/li&gt;
&lt;li&gt;Proxy settings for working behind a firewall&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These settings are saved in a file called &lt;code&gt;.npmrc&lt;/code&gt;, and npm looks at this file whenever you run npm commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use &lt;code&gt;npm config&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Some basic &lt;code&gt;npm config&lt;/code&gt; Commands that developers should know about:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can change npm settings using the &lt;code&gt;npm config&lt;/code&gt; command. Here are some basic commands you can use:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Set a new setting:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set &amp;lt;key&amp;gt; &amp;lt;value&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, to change the registry npm uses to download packages, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set registry https://registry.npmjs.org/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Get a setting:&lt;/strong&gt; If you want to see the current value of a setting, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config get &amp;lt;key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- List all settings:&lt;/strong&gt; To see all current npm settings, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Delete a setting:&lt;/strong&gt; If you want to remove a setting, use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config delete &amp;lt;key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Edit the &lt;code&gt;.npmrc&lt;/code&gt; file:&lt;/strong&gt; You can open the .npmrc file directly to make changes by using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config edit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuration Scopes (Where Settings Apply)
&lt;/h2&gt;

&lt;p&gt;npm settings can apply in different places:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Global Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These apply to all projects on your computer and are saved in a file in your home directory &lt;code&gt;(~/.npmrc)&lt;/code&gt;. To make a global setting, add the &lt;code&gt;-g&lt;/code&gt; flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set &amp;lt;key&amp;gt; &amp;lt;value&amp;gt; -g
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Project Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These settings apply only to the project you're working on. npm will look for a &lt;code&gt;.npmrc&lt;/code&gt; file in the project folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. User Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These settings apply to all the projects under your user account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Environment Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These are temporary settings you can use when running npm commands. They’re often used in build pipelines or different environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common npm Configurations
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Registry:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By default, npm uses &lt;code&gt;https://registry.npmjs.org/&lt;/code&gt; to get packages. You can change this to a private registry if needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set registry https://custom-registry.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Proxy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you work behind a proxy (like in some company networks), you can set the proxy with npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set proxy http://proxy.example.com:8080
npm config set https-proxy https://proxy.example.com:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Cache:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;npm saves downloaded packages in a cache to make things faster. You can change where npm stores this cache:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set cache /path/to/npm-cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Strict SSL:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you need to use self-signed certificates, you might have to turn off npm's strict SSL checking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set strict-ssl false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Save Options:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you install packages, npm can save them in your package.json file. You can set npm to always save the exact version of a package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set save-exact true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Authentication Tokens:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're using private registries, you may need to set an authentication token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set //registry.example.com/:_authToken=YOUR_TOKEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Working with Multiple .npmrc Files
&lt;/h2&gt;

&lt;p&gt;You can have different &lt;code&gt;.npmrc&lt;/code&gt; files for different purposes, allowing you to customize npm for global use, specific projects, or even temporary environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- Global Configuration:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This applies to everything and is usually stored in &lt;code&gt;$HOME/.npmrc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- Project Configuration:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;.npmrc&lt;/code&gt; file in your project folder will only apply to that project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- User Configuration:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Settings that apply to all projects for your user account are stored in your home directory(&lt;code&gt;~/.npmrc&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- Environment Variables:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can also override settings by using environment variables, which are useful in CI/CD or development environments.&lt;/p&gt;

&lt;p&gt;The priority order in which these configurations are applied is:&lt;/p&gt;

&lt;p&gt;Command Line Flags: Any settings passed as flags directly into npm commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Project &lt;code&gt;.npmrc&lt;/code&gt;:&lt;/strong&gt; Project-specific settings.&lt;br&gt;
&lt;strong&gt;- User &lt;code&gt;.npmrc&lt;/code&gt;:&lt;/strong&gt; User-specific settings.&lt;br&gt;
&lt;strong&gt;- Global &lt;code&gt;.npmrc&lt;/code&gt;:&lt;/strong&gt; Global settings.&lt;br&gt;
&lt;strong&gt;- Default Settings:&lt;/strong&gt; npm's default configurations.&lt;/p&gt;

&lt;p&gt;This hierarchy ensures that project-specific configurations take precedence, allowing different settings for different projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  Tips for Using npm config
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Different Registries for Different Projects:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're working on multiple projects, you can set a different registry for each by placing a &lt;code&gt;.npmrc&lt;/code&gt; file in each project's root folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Environment Variables:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can set npm config values as environment variables in your terminal session, 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;NPM_CONFIG_REGISTRY=https://registry.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Switching Configurations:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can switch between different &lt;code&gt;.npmrc&lt;/code&gt; files if you're working in different environments (for example, development vs production).&lt;/p&gt;

&lt;p&gt;Understanding and using npm config helps us customize how npm behaves, making it easier to manage different projects, private registries, proxies, and more. Whether we’re working on a single project or many, npm config gives us the flexibility to make npm work exactly how we need it.&lt;/p&gt;

&lt;p&gt;By using &lt;code&gt;.npmrc&lt;/code&gt; files, we can ensure consistent settings across projects and teams, saving us time and making development smoother.&lt;/p&gt;

&lt;p&gt;Since we've just learnt more about npm config today, next time we run into a problem or need something special from npm, check if adjusting the config can help!&lt;/p&gt;

&lt;p&gt;As always, thank you so much for reading and if you find this post helpful, share it with your friends.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>npm</category>
      <category>yarn</category>
      <category>tooling</category>
    </item>
    <item>
      <title>NPM Config: customising how npm works</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Thu, 17 Oct 2024 09:54:04 +0000</pubDate>
      <link>https://dev.to/rinonten/npm-config-customising-how-npm-works-pai</link>
      <guid>https://dev.to/rinonten/npm-config-customising-how-npm-works-pai</guid>
      <description>&lt;p&gt;When we’re working with Node.js and npm, knowing how to adjust your settings can help make your work smoother. npm lets us change its settings through something called npm config, which helps control how npm behaves. These settings are saved in a file called .npmrc.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explain how npm config works, why it’s useful, and how you can use it to make npm fit your needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is &lt;code&gt;npm config&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;npm config&lt;/code&gt; is a way to adjust settings for npm so it works the way you want. You can use it to change things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which website &lt;em&gt;npm&lt;/em&gt; uses to download packages (the registry)&lt;/li&gt;
&lt;li&gt;How &lt;em&gt;npm&lt;/em&gt; saves packages in your project&lt;/li&gt;
&lt;li&gt;Proxy settings for working behind a firewall&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These settings are saved in a file called &lt;code&gt;.npmrc&lt;/code&gt;, and npm looks at this file whenever you run npm commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use &lt;code&gt;npm config&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Some basic &lt;code&gt;npm config&lt;/code&gt; Commands that developers should know about:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can change npm settings using the &lt;code&gt;npm config&lt;/code&gt; command. Here are some basic commands you can use:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Set a new setting:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set &amp;lt;key&amp;gt; &amp;lt;value&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, to change the registry npm uses to download packages, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set registry https://registry.npmjs.org/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Get a setting:&lt;/strong&gt; If you want to see the current value of a setting, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config get &amp;lt;key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- List all settings:&lt;/strong&gt; To see all current npm settings, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Delete a setting:&lt;/strong&gt; If you want to remove a setting, use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config delete &amp;lt;key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;- Edit the &lt;code&gt;.npmrc&lt;/code&gt; file:&lt;/strong&gt; You can open the .npmrc file directly to make changes by using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config edit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuration Scopes (Where Settings Apply)
&lt;/h2&gt;

&lt;p&gt;npm settings can apply in different places:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Global Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These apply to all projects on your computer and are saved in a file in your home directory &lt;code&gt;(~/.npmrc)&lt;/code&gt;. To make a global setting, add the &lt;code&gt;-g&lt;/code&gt; flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set &amp;lt;key&amp;gt; &amp;lt;value&amp;gt; -g
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Project Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These settings apply only to the project you're working on. npm will look for a &lt;code&gt;.npmrc&lt;/code&gt; file in the project folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. User Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These settings apply to all the projects under your user account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Environment Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These are temporary settings you can use when running npm commands. They’re often used in build pipelines or different environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common npm Configurations
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Registry:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By default, npm uses &lt;code&gt;https://registry.npmjs.org/&lt;/code&gt; to get packages. You can change this to a private registry if needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set registry https://custom-registry.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Proxy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you work behind a proxy (like in some company networks), you can set the proxy with npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set proxy http://proxy.example.com:8080
npm config set https-proxy https://proxy.example.com:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Cache:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;npm saves downloaded packages in a cache to make things faster. You can change where npm stores this cache:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set cache /path/to/npm-cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Strict SSL:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you need to use self-signed certificates, you might have to turn off npm's strict SSL checking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set strict-ssl false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Save Options:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you install packages, npm can save them in your package.json file. You can set npm to always save the exact version of a package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set save-exact true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Authentication Tokens:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're using private registries, you may need to set an authentication token:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm config set //registry.example.com/:_authToken=YOUR_TOKEN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Working with Multiple .npmrc Files
&lt;/h2&gt;

&lt;p&gt;You can have different &lt;code&gt;.npmrc&lt;/code&gt; files for different purposes, allowing you to customize npm for global use, specific projects, or even temporary environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- Global Configuration:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This applies to everything and is usually stored in &lt;code&gt;$HOME/.npmrc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- Project Configuration:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;.npmrc&lt;/code&gt; file in your project folder will only apply to that project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- User Configuration:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Settings that apply to all projects for your user account are stored in your home directory(&lt;code&gt;~/.npmrc&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;- Environment Variables:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can also override settings by using environment variables, which are useful in CI/CD or development environments.&lt;/p&gt;

&lt;p&gt;The priority order in which these configurations are applied is:&lt;/p&gt;

&lt;p&gt;Command Line Flags: Any settings passed as flags directly into npm commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Project &lt;code&gt;.npmrc&lt;/code&gt;:&lt;/strong&gt; Project-specific settings.&lt;br&gt;
&lt;strong&gt;- User &lt;code&gt;.npmrc&lt;/code&gt;:&lt;/strong&gt; User-specific settings.&lt;br&gt;
&lt;strong&gt;- Global &lt;code&gt;.npmrc&lt;/code&gt;:&lt;/strong&gt; Global settings.&lt;br&gt;
&lt;strong&gt;- Default Settings:&lt;/strong&gt; npm's default configurations.&lt;/p&gt;

&lt;p&gt;This hierarchy ensures that project-specific configurations take precedence, allowing different settings for different projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  Tips for Using npm config
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Different Registries for Different Projects:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you're working on multiple projects, you can set a different registry for each by placing a &lt;code&gt;.npmrc&lt;/code&gt; file in each project's root folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Environment Variables:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can set npm config values as environment variables in your terminal session, 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;NPM_CONFIG_REGISTRY=https://registry.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Switching Configurations:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can switch between different &lt;code&gt;.npmrc&lt;/code&gt; files if you're working in different environments (for example, development vs production).&lt;/p&gt;

&lt;p&gt;Understanding and using npm config helps us customize how npm behaves, making it easier to manage different projects, private registries, proxies, and more. Whether we’re working on a single project or many, npm config gives us the flexibility to make npm work exactly how we need it.&lt;/p&gt;

&lt;p&gt;By using &lt;code&gt;.npmrc&lt;/code&gt; files, we can ensure consistent settings across projects and teams, saving us time and making development smoother.&lt;/p&gt;

&lt;p&gt;Since we've just learnt more about npm config today, next time we run into a problem or need something special from npm, check if adjusting the config can help!&lt;/p&gt;

&lt;p&gt;As always, thank you so much for reading and if you find this post helpful, share it with your friends.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>npm</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Let's Connect on Twitter! 🚀</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Thu, 26 Sep 2024 04:34:55 +0000</pubDate>
      <link>https://dev.to/rinonten/lets-connect-on-twitter-5077</link>
      <guid>https://dev.to/rinonten/lets-connect-on-twitter-5077</guid>
      <description>&lt;p&gt;Hey fellow devs! 👋 If you're into web development, JavaScript, staying updated on the latest in tech, and other interesting topics, I'd love to connect with you over on Twitter! Please share your twitter handle in the comments section below if you also want others to follow you.&lt;/p&gt;

&lt;p&gt;I will be tweeting about:&lt;/p&gt;

&lt;p&gt;🔥 JavaScript tips &amp;amp; tricks&lt;br&gt;
💡 React and TypeScript insights&lt;br&gt;
🛠️ Cool dev tools and resources I discover&lt;br&gt;
🎯 My latest coding projects and challenges if possible&lt;/p&gt;

&lt;p&gt;Please follow me here: &lt;a href="https://x.com/Tojo_Rinon" rel="noopener noreferrer"&gt;@Tojo_Rinon&lt;/a&gt;. That will mean a lot to me.&lt;/p&gt;

&lt;p&gt;I’d love to keep the conversation going and share knowledge, ideas, and maybe a few coding memes along the way. See you there! 😄&lt;/p&gt;

&lt;p&gt;I would love to follow you if you share your twitter handle with me!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>twitter</category>
    </item>
    <item>
      <title>Understanding Concurrency in React: A Guide to Smoother and More Responsive UIs</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Wed, 21 Aug 2024 08:09:25 +0000</pubDate>
      <link>https://dev.to/rinonten/understanding-concurrency-in-react-a-guide-to-smoother-and-more-responsive-uis-1p70</link>
      <guid>https://dev.to/rinonten/understanding-concurrency-in-react-a-guide-to-smoother-and-more-responsive-uis-1p70</guid>
      <description>&lt;p&gt;As web apps get more complex, keeping them fast and smooth for users can be tough. That’s where &lt;strong&gt;concurrency&lt;/strong&gt; in React comes in. It helps React manage multiple tasks at once, making your app run better and feel more responsive.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Does Concurrency Mean in React?
&lt;/h2&gt;

&lt;p&gt;My short definition is of Concurrency in React is that React can handle several things at the same time. This is especially important with new features like Automatic Batching and Transitions, which help make your app feel smoother.&lt;/p&gt;

&lt;p&gt;Let's take a look at the key ideas behind Concurrency:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Concurrent Rendering:&lt;/strong&gt;&lt;br&gt;
With &lt;strong&gt;concurrent rendering&lt;/strong&gt;, React can handle multiple updates at the same time. If something more urgent happens, like a user clicking a button or switching between tabs, React can pause or interrupt one update to focus on the more important task. For example, if a user accidentally clicks on one tab and then quickly switches to another, React won't wait for the first tab to finish loading. Instead, it will switch to the most recent tab, keeping the app responsive and fast. Check the example made by the React team &lt;a href="https://react.dev/reference/react/useTransition#usetransition" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Automatic Batching:&lt;/strong&gt;&lt;br&gt;
In React 18, &lt;strong&gt;automatic batching&lt;/strong&gt; allows React to group several state changes together and apply them all in one go. This means that instead of updating the app for each individual state change, React combines them into a single update. This reduces the number of renders, making the app more efficient and faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;a. Form Inputs:&lt;/strong&gt;&lt;br&gt;
Suppose you have a form with multiple inputs. If you change the value of several inputs quickly, React will batch these changes into a single update. Without automatic batching, each input change might trigger a separate re-render, slowing down the app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function MyForm() {
  const [name, setName] = useState('');
  const [email, setEmail] = useState('');

  const handleChange = (e) =&amp;gt; {
    setName(e.target.value);
    setEmail('newemail@example.com');
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;input value={name} onChange={handleChange} /&amp;gt;
      &amp;lt;input value={email} onChange={handleChange} /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;In this example, both setName and setEmail will be batched together, so React will only re-render once, instead of twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. Async Operations:&lt;/strong&gt;&lt;br&gt;
If you're handling multiple async operations, such as fetching data and updating state based on the results, automatic batching can combine these updates into one render.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useState, useEffect } from 'react';

function DataFetcher() {
  const [data, setData] = useState(null); // State to store fetched data
  const [loading, setLoading] = useState(true); // State to track loading status
  const [error, setError] = useState(null); // State to handle errors
  const [retry, setRetry] = useState(false); // State to trigger a retry

  useEffect(() =&amp;gt; {
    const fetchData = async () =&amp;gt; {
      setLoading(true); // Start loading
      setError(null); // Clear previous errors

      try {
        const response = await fetch('/api/data');

        if (!response.ok) {
          throw new Error('Network response was not ok');
        }

        const result = await response.json();
        setData(result); // Update data state with the fetched result
      } catch (error) {
        setError(error.message); // Set error state if fetch fails
      } finally {
        setLoading(false); // End loading
      }
    };

    fetchData();
  }, [retry]); // Dependency array includes retry to re-fetch data when retry changes

  const handleRetry = () =&amp;gt; {
    setRetry(prevRetry =&amp;gt; !prevRetry); // Toggle retry state to re-trigger fetch
  };

  return (
    &amp;lt;div&amp;gt;
      {loading &amp;amp;&amp;amp; &amp;lt;p&amp;gt;Loading...&amp;lt;/p&amp;gt;}
      {error &amp;amp;&amp;amp; &amp;lt;p&amp;gt;Error: {error}&amp;lt;/p&amp;gt;}
      {data &amp;amp;&amp;amp; &amp;lt;p&amp;gt;Data: {JSON.stringify(data)}&amp;lt;/p&amp;gt;}
      {!loading &amp;amp;&amp;amp; !error &amp;amp;&amp;amp; !data &amp;amp;&amp;amp; &amp;lt;p&amp;gt;No data available&amp;lt;/p&amp;gt;}
      {error &amp;amp;&amp;amp; &amp;lt;button onClick={handleRetry}&amp;gt;Retry&amp;lt;/button&amp;gt;}
    &amp;lt;/div&amp;gt;
  );
}

export default DataFetcher;

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

&lt;/div&gt;



&lt;p&gt;During the data fetching process, several state updates occur:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;setLoading(true)&lt;/code&gt; before starting the fetch.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setError(null)&lt;/code&gt; to clear any previous errors.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setData(result)&lt;/code&gt; after a successful fetch.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setError(error.message)&lt;/code&gt; if an error occurs.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setLoading(false)&lt;/code&gt; to signal that loading is complete.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Automatic batching combines these updates into a single render cycle. This means React processes these changes all at once, avoiding multiple renders.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Transitions:&lt;/strong&gt;&lt;br&gt;
Transitions let you mark some updates as less urgent. For example, when moving to a new page, React can keep showing the current page while it prepares the new one in the background. This makes the app feel smoother.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples of Transitions:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;a. Page Navigation:&lt;/strong&gt;&lt;br&gt;
When navigating between pages, React can mark the navigation as a transition. This means React will keep showing the current page while it loads and prepares the new page in the background.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useTransition, useState } from 'react';

function App() {
  const [isPending, startTransition] = useTransition();
  const [page, setPage] = useState('home');

  const goToPage = (newPage) =&amp;gt; {
    startTransition(() =&amp;gt; {
      setPage(newPage); // Mark page change as a transition
    });
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={() =&amp;gt; goToPage('home')}&amp;gt;Home&amp;lt;/button&amp;gt;
      &amp;lt;button onClick={() =&amp;gt; goToPage('about')}&amp;gt;About&amp;lt;/button&amp;gt;
      &amp;lt;button onClick={() =&amp;gt; goToPage('contact')}&amp;gt;Contact&amp;lt;/button&amp;gt;

      {isPending ? &amp;lt;p&amp;gt;Loading...&amp;lt;/p&amp;gt; : &amp;lt;PageContent page={page} /&amp;gt;}
    &amp;lt;/div&amp;gt;
  );
}

function PageContent({ page }) {
  if (page === 'home') return &amp;lt;p&amp;gt;Home Page&amp;lt;/p&amp;gt;;
  if (page === 'about') return &amp;lt;p&amp;gt;About Page&amp;lt;/p&amp;gt;;
  if (page === 'contact') return &amp;lt;p&amp;gt;Contact Page&amp;lt;/p&amp;gt;;
  return null;
}

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

&lt;/div&gt;



&lt;p&gt;In this example, clicking on different buttons triggers a page change. React will handle the page change as a transition, keeping the current page visible while preparing the new one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. Filtering a List:&lt;/strong&gt;&lt;br&gt;
When applying filters to a list, you can mark the filtering operation as a transition. This way, React can keep showing the current list while it processes and applies the new filter criteria in the background.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useTransition, useState } from 'react';

function ItemList() {
  const [isPending, startTransition] = useTransition();
  const [filter, setFilter] = useState('');
  const [items, setItems] = useState(allItems);
  const allItems = ['Apple', 'Banana', 'Cherry', 'Date', 'Elderberry'];

  const handleFilterChange = (e) =&amp;gt; {
    const newFilter = e.target.value;
    startTransition(() =&amp;gt; {
      setFilter(newFilter);
      const filteredItems = allItems.filter(item =&amp;gt; item.includes(newFilter));
      setItems(filteredItems);
    });
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;input value={filter} onChange={handleFilterChange} placeholder="Filter items" /&amp;gt;
      {isPending ? &amp;lt;p&amp;gt;Filtering...&amp;lt;/p&amp;gt; : &amp;lt;ul&amp;gt;{items.map(item =&amp;gt; &amp;lt;li key={item}&amp;gt;{item}&amp;lt;/li&amp;gt;)}&amp;lt;/ul&amp;gt;}
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, as you type in the filter input, React marks the filtering process as a transition. The list will update in the background, while the UI remains responsive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Suspense:&lt;/strong&gt;&lt;br&gt;
Suspense lets React pause part of the UI while it waits for data to load. With concurrency, React can still update other parts of the UI, so users aren’t stuck waiting for everything to load.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:(From React docs)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

export default function ArtistPage({ artist }) {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;h1&amp;gt;{artist.name}&amp;lt;/h1&amp;gt;
      &amp;lt;Suspense fallback={&amp;lt;Loading /&amp;gt;}&amp;gt;
        &amp;lt;Albums artistId={artist.id} /&amp;gt;
      &amp;lt;/Suspense&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

function Loading() {
  return &amp;lt;h2&amp;gt;🌀 Loading...&amp;lt;/h2&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, pretend we were fetching the artist details in the Albums component. While resolving the promise for getting the data, the UI will display a loading text. This means that users don't see a black page/UI while waiting for the artist's details to be loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Priority Levels:&lt;/strong&gt;&lt;br&gt;
React gives different tasks different priority levels. Important tasks, like handling user input, are done first, while less important tasks, like background data loading, are done later. This keeps the app fast and responsive.&lt;/p&gt;

&lt;p&gt;Concurrency in React helps keep your app responsive and fast, even as it gets more complex. By using these features, you can build apps that feel quick and smooth, giving users a better experience.&lt;/p&gt;

&lt;p&gt;That's it! As always thanks for reading and I hope you learned more about Concurrency in React. There are more features I didn't write about yet as I don't this post to be very long.&lt;/p&gt;

&lt;p&gt;Your comments and feedback are valuable to me! If you have any suggestions, corrections, or improvements, please feel free to share them.&lt;/p&gt;

</description>
      <category>react</category>
      <category>react18</category>
      <category>concurrency</category>
      <category>usetransition</category>
    </item>
    <item>
      <title>Onja is looking for two developers</title>
      <dc:creator>Rinon Tendrinomena</dc:creator>
      <pubDate>Tue, 14 May 2024 13:01:41 +0000</pubDate>
      <link>https://dev.to/rinonten/we-are-looking-for-two-developers-anb</link>
      <guid>https://dev.to/rinonten/we-are-looking-for-two-developers-anb</guid>
      <description>&lt;p&gt;Hey guys, we need friends here in Madagascar:)&lt;br&gt;
Sorry that I am posting something a bit different today, not a tutorial or an article. But it is still for developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  About Onja
&lt;/h2&gt;

&lt;p&gt;Onja is a social enterprise training underprivileged youth into world-class software developers.&lt;/p&gt;

&lt;p&gt;We find the brightest students in Madagascar who can’t afford to continue their education, and train them in English language and software development. After just two-and-a-half years they are ready to work as remote front-end software developers in international tech teams.&lt;/p&gt;

&lt;p&gt;Once in a job, our developers earn a good salary that helps them support their families and pay forward the opportunity to a new wave of students. They unlock exciting careers that fulfil their potential, and accelerate the development of their nation (see ‘How Onja Works’ below).&lt;/p&gt;

&lt;p&gt;Our first cohort, ‘Wave 1’, consists of nineteen talented and committed graduates who are now working remotely for our partner companies in Europe and the US. With this immensely successful first cohort, and a proven social model, our goal is now to scale our impact: we aim to take on 360 new students over the next four years. &lt;/p&gt;

&lt;p&gt;Our fast-growing team is very united, committed to the mission, and hardworking, but we also maintain a relaxed and peaceful atmosphere that you’ll find everywhere in Madagascar. &lt;/p&gt;

&lt;p&gt;Onja is located in Toamasina, a lively city with beautiful beaches, nice restaurants, and with plenty to do and see. Toamasina is Madagascar’s second largest city (population 300,000) yet is surrounded by plenty of natural beauty, and even has a national park nearby. &lt;/p&gt;

&lt;h2&gt;
  
  
  Available developer positions:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://onja.org/careers/back-end-node.js-course-designer"&gt;Front-end Course &lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Responsibilities:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rebuilding the existing course focusing primarily on React while including HTML, CSS, JavaScript, TypeScript and other related technologies, moving towards a scalable online-style programme. How this can be achieved is very open and will depend on you, another course designer, and some input from the wider team. We imagine it’s likely to include the following:&lt;/li&gt;
&lt;li&gt;Finding existing online material and incorporate useful material into the course&lt;/li&gt;
&lt;li&gt;Creating engaging video lectures, learning activities and course content&lt;/li&gt;
&lt;li&gt;Collaborate with existing Onja lecturers, incorporating their specific experience into your course design.&lt;/li&gt;
&lt;li&gt;Deciding on the criteria used to assess students’ performance and develop assessments.&lt;/li&gt;
&lt;li&gt;As we are a startup social enterprise there will likely be opportunities to wear many hats, contributing to other parts of the organisation.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://onja.org/careers/front-end-course-designerDesigner"&gt;Back-end Node.js Course Designer&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Responsibilities:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Conducting preliminary research to determine which languages and technologies should be included in the course. &lt;/li&gt;
&lt;li&gt;Finding existing online material and incorporating useful material into the course&lt;/li&gt;
&lt;li&gt;Creating engaging video lectures, learning activities and course content&lt;/li&gt;
&lt;li&gt;Collaborate with past Onja lecturers, incorporating their specific experience into your course design.&lt;/li&gt;
&lt;li&gt;Deciding on the criteria used to assess students’ performance and develop assessments.&lt;/li&gt;
&lt;li&gt;As we are a startup social enterprise there will likely be opportunities to wear many hats, contributing to other parts of the organisation. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More details including what we offer should be found by opening the links above.&lt;/p&gt;

&lt;p&gt;If you are interested and want to improve your skills by working with us, head to our website &lt;a href="https://onja.org"&gt;here&lt;/a&gt; or click the link above to apply.&lt;/p&gt;

</description>
      <category>hiring</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>node</category>
    </item>
  </channel>
</rss>
