<?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: Turkan İsayeva</title>
    <description>The latest articles on DEV Community by Turkan İsayeva (@codebyturkan).</description>
    <link>https://dev.to/codebyturkan</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%2F3155485%2F7473704d-a949-415c-9e2d-eb8cfcc3cae4.jpg</url>
      <title>DEV Community: Turkan İsayeva</title>
      <link>https://dev.to/codebyturkan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codebyturkan"/>
    <language>en</language>
    <item>
      <title>Why You Should Switch from Vanilla JavaScript to React and How React Architecture Works</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Fri, 26 Dec 2025 11:55:24 +0000</pubDate>
      <link>https://dev.to/codebyturkan/why-you-should-switch-from-vanilla-javascript-to-react-and-how-react-architecture-works-3lb9</link>
      <guid>https://dev.to/codebyturkan/why-you-should-switch-from-vanilla-javascript-to-react-and-how-react-architecture-works-3lb9</guid>
      <description>&lt;p&gt;Hey everyone, I want to share something that really clicked for me when I started working with React. If you've ever felt frustrated with vanilla JavaScript and wondered why people switch to React, this will make total sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Vanilla JS: One Big Chunk
&lt;/h2&gt;

&lt;p&gt;Imagine your UI as one huge chunk of code. In vanilla JavaScript, this is often exactly what happens. You have this big file that handles everything , updating the DOM, managing events, tracking data. And here's the problem: when a tiny change happens, say updating a single text field or a counter, the system doesn't know what exactly changed.&lt;br&gt;
So what does it do? Well… nothing smart. It basically goes through the whole UI and updates everything, whether it needs to or not. And let's be honest that's slow, it's messy, and sometimes it's hard even to find where the change should go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enter React: Components, Hooks, and Virtual DOM
&lt;/h2&gt;

&lt;p&gt;Now, React blew my mind because it works completely differently. The first thing I realized is that React thinks of the UI as a collection of components, parent components, child components, and so on. Every small piece of the UI can live in its own little component, and each component remembers its own state using hooks.&lt;br&gt;
Hooks like useState are brilliant because they store values that change over time. And the best part? When a state changes, React doesn't blindly refresh everything; it knows exactly which component needs to update.&lt;br&gt;
But how does React find what changed so quickly? That's where the Virtual DOM comes in. React keeps a lightweight copy of the UI in memory, compares it to the real DOM, and only updates the parts that actually changed. This means: fast, efficient updates, zero overload, and I can finally breathe knowing my tiny changes won't break everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Props: The Communication Network
&lt;/h2&gt;

&lt;p&gt;Another thing that clicked for me is how components talk to each other. In React, data flows through props, like messages traveling through a network. The parent component holds the main state, sends pieces to child components, and children can even trigger updates back to the parent.&lt;br&gt;
This setup reminded me of a mini social network inside my UI: everyone knows what to send, who to update, and nothing gets lost in the chaos.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;React isn't just a library; it's a whole mindset shift. It taught me to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Break my UI into manageable, reusable components&lt;/li&gt;
&lt;li&gt;Track only what really changes&lt;/li&gt;
&lt;li&gt;Let React handle the heavy lifting of updates&lt;/li&gt;
&lt;li&gt;Focus on building features, not hunting down bugs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Honestly, once you see it in action, it's hard to go back. You start appreciating the elegance of localized updates, the beauty of hooks, and the efficiency of Virtual DOM diffing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architectural Pov:
&lt;/h2&gt;

&lt;p&gt;When I started thinking about React from an architectural standpoint, it hit me: React isn't just a library for updating the UI; it's a networking system for components.&lt;br&gt;
Here's what I mean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In vanilla JavaScript, everything is linear. One big chunk, one way of updating, one chain of events. It's like a single pipe , whatever you push, flows straight through, and everything downstream gets affected.&lt;/li&gt;
&lt;li&gt;In React, it's multi-directional. Components are nodes in a network:&lt;/li&gt;
&lt;li&gt;Parent components send data to children via props&lt;/li&gt;
&lt;li&gt;Children can trigger changes back to parents via callbacks and state updates&lt;/li&gt;
&lt;li&gt;Siblings can indirectly communicate through shared context or lifted state&lt;/li&gt;
&lt;li&gt;Hooks are like local memory nodes at each component. They store the state and keep track of changes; React monitors these nodes and knows exactly which paths to update.&lt;/li&gt;
&lt;li&gt;The Virtual DOM acts like the network manager. It constantly compares the new "state of the network" with the old one and ensures only the affected nodes are updated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, React isn't just about rendering UI efficiently; it's about designing a dynamic, self-aware network of components that communicate smartly and only act when necessary.&lt;br&gt;
From this architectural lens, you can see why React scales so well: each component is modular, autonomous, and connected in a way that feels like a smart, reactive ecosystem rather than a monolithic, rigid structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author's note: I mean, it is not easy, but is it worth it.. ? Hell yeah..&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>frontend</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>AI vs ML vs LLMs - Why We Keep Mixing Them Up (And How to Finally Understand Them)</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Tue, 25 Nov 2025 05:01:32 +0000</pubDate>
      <link>https://dev.to/codebyturkan/ai-vs-ml-vs-llms-why-we-keep-mixing-them-up-and-how-to-finally-understand-them-2918</link>
      <guid>https://dev.to/codebyturkan/ai-vs-ml-vs-llms-why-we-keep-mixing-them-up-and-how-to-finally-understand-them-2918</guid>
      <description>&lt;p&gt;Many people hear “AI” and instantly think of ChatGPT.&lt;br&gt;
But the truth is: AI existed long before ChatGPT, and most AI we used for years wasn’t conversational at all.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AI: The Big Umbrella&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let’s start from the top.&lt;/p&gt;

&lt;p&gt;Artificial Intelligence is the broadest term.&lt;br&gt;
If a system tries to mimic human intelligence — learning, decision-making, perception — it falls under AI.&lt;/p&gt;

&lt;p&gt;AI includes many subfields:&lt;br&gt;
    • Machine Learning&lt;br&gt;
    • Deep Learning&lt;br&gt;
    • Computer Vision&lt;br&gt;
    • Natural Language Processing&lt;br&gt;
    • Robotics&lt;br&gt;
    • Expert systems&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;ML: The Engine Behind Most “Old AI”&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before ChatGPT, the AI powering our world was mostly Machine Learning.&lt;/p&gt;

&lt;p&gt;ML is simply this:&lt;/p&gt;

&lt;p&gt;Models learn patterns from data and make predictions — without being explicitly programmed.&lt;/p&gt;

&lt;p&gt;For almost 20 years, ML quietly powered:&lt;br&gt;
    • Fraud detection&lt;br&gt;
    • Credit scoring&lt;br&gt;
    • Traffic prediction in maps&lt;br&gt;
    • Recommendation engines&lt;br&gt;
    • Face recognition&lt;br&gt;
    • Spam filters&lt;br&gt;
    • Search ranking&lt;/p&gt;

&lt;p&gt;And here’s the interesting part:&lt;br&gt;
These models were not “smart” in a conversational way.&lt;br&gt;
They didn’t talk, write, reason, or code.&lt;/p&gt;

&lt;p&gt;They were mathematical prediction systems:&lt;br&gt;
    • Logistic regression&lt;br&gt;
    • Decision trees&lt;br&gt;
    • Random forest&lt;br&gt;
    • Gradient boosting (XGBoost, LightGBM)&lt;br&gt;
    • Early neural networks&lt;/p&gt;

&lt;p&gt;This was the AI that shaped the modern internet long before LLMs arrived.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;LLMs: The New Evolution of AI
This changed everything.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Suddenly, AI could:&lt;br&gt;
    • Understand text&lt;br&gt;
    • Generate text&lt;br&gt;
    • Reason&lt;br&gt;
    • Summarize&lt;br&gt;
    • Translate&lt;br&gt;
    • Write code&lt;br&gt;
    • Assist with workflows&lt;/p&gt;

&lt;p&gt;This is where LLMs (Large Language Models) came in.&lt;/p&gt;

&lt;p&gt;LLMs like ChatGPT, Claude, Gemini, and Llama aren’t just tools, they’re a new category of AI entirely.&lt;br&gt;
They work on language, not just numbers.&lt;br&gt;
They’re trained on massive datasets.&lt;br&gt;
And they’re capable of general-purpose intelligence that older ML models were nowhere near.&lt;/p&gt;

&lt;p&gt;In short:&lt;/p&gt;

&lt;p&gt;ML predicted.&lt;br&gt;
LLMs communicated.&lt;/p&gt;

&lt;p&gt;The Whole Relationship:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;AI is the field.&lt;br&gt;
ML is a major branch inside AI.&lt;br&gt;
LLMs are one specific type of ML model focused on language&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>beginners</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Design Patterns: The Storytelling of Code</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Sun, 24 Aug 2025 14:52:19 +0000</pubDate>
      <link>https://dev.to/codebyturkan/design-patterns-the-storytelling-of-code-39ib</link>
      <guid>https://dev.to/codebyturkan/design-patterns-the-storytelling-of-code-39ib</guid>
      <description>&lt;p&gt;&lt;strong&gt;Content:&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What design patterns are&lt;/li&gt;
&lt;li&gt;Why they exist&lt;/li&gt;
&lt;li&gt;Their categories (creational, structural, behavioral)&lt;/li&gt;
&lt;li&gt;Observer &amp;amp; Factory examples&lt;/li&gt;
&lt;li&gt;A beautiful analogy with writing/art&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When we write code, we’re not just instructing machines; We’re expressing ideas, solving problems, and communicating with other developers. In many ways, &lt;strong&gt;programming is like writing a story&lt;/strong&gt;. Just as writers use alphabets, words, and literary devices, developers use syntax, functions, and design patterns to tell their story in code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Are Design Patterns?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Design patterns are &lt;strong&gt;proven, reusable solutions to recurring problems&lt;/strong&gt; in software development. They aren’t new syntax or frameworks, but &lt;strong&gt;best practices&lt;/strong&gt;, like blueprints that show us how to organize our code more clearly, flexibly, and maintainably.&lt;/p&gt;

&lt;p&gt;They serve as a &lt;strong&gt;shared language&lt;/strong&gt; among developers. Instead of writing paragraphs to explain, you can simply say &lt;em&gt;“I’ll use the Observer pattern”&lt;/em&gt; and everyone understands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Do We Need Them?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before Patterns&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code was often &lt;strong&gt;messy and repetitive&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Changes in one part could &lt;strong&gt;break everything else&lt;/strong&gt; (tight coupling).&lt;/li&gt;
&lt;li&gt;Adding new features meant &lt;strong&gt;rewriting large chunks of code&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;After Patterns&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code becomes &lt;strong&gt;clean, flexible, and reusable&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Developers solve problems in &lt;strong&gt;standard, battle-tested ways&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Teams can communicate faster using a &lt;strong&gt;shared vocabulary&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types of Design Patterns&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Patterns are usually grouped into three families:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Creational&lt;/strong&gt; – deal with object creation. (e.g., Factory, Singleton)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structural&lt;/strong&gt; – deal with how objects are composed. (e.g., Adapter, Decorator)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Behavioral&lt;/strong&gt; – deal with how objects interact. (e.g., Observer, Strategy, Command)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Observer Pattern (Behavioral)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; How do you make sure that when one object changes, all dependent objects are automatically updated?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Define a &lt;strong&gt;one-to-many relationship&lt;/strong&gt; between a subject and its observers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Example:&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Subject&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="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;observers&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="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;observer&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;observers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;observer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;notify&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;observers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obs&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;obs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&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="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Observer&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;name&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;update&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="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;`&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;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; received: &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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;news&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;Subject&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;alice&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;Observer&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;const&lt;/span&gt; &lt;span class="nx"&gt;bob&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;Observer&lt;/span&gt;&lt;span class="p"&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;news&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;alice&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;news&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;bob&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;news&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;New article published!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Whenever the subject (news) changes, all observers (subscribers) are notified automatically.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Factory Pattern (Creational)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; How can we centralize object creation so adding new types doesn’t break our code everywhere?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Use a factory class that decides which object to create.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Example:&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Admin&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;name&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;role&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Admin&lt;/span&gt;&lt;span class="dl"&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;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Guest&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;name&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;role&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Guest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;this&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="nx"&gt;name&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="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserFactory&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;type&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="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&lt;/span&gt;&lt;span class="dl"&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;Admin&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="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;guest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Guest&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="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Invalid type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;factory&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;UserFactory&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;user1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;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;const&lt;/span&gt; &lt;span class="nx"&gt;user2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;factory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;guest&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="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;user1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Adding a new user type is as simple as editing the factory, not rewriting code everywhere else.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Artistic Analogy: Code as Storytelling&lt;/strong&gt;&lt;br&gt;
Your insight was perfect: &lt;strong&gt;writing code is like writing a story.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Writing / Art&lt;/th&gt;
&lt;th&gt;Coding&lt;/th&gt;
&lt;th&gt;Analogy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alphabet&lt;/td&gt;
&lt;td&gt;Syntax (&lt;code&gt;let&lt;/code&gt;, &lt;code&gt;class&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Building blocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Words&lt;/td&gt;
&lt;td&gt;Variables, expressions&lt;/td&gt;
&lt;td&gt;Small meaning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sentences&lt;/td&gt;
&lt;td&gt;Functions&lt;/td&gt;
&lt;td&gt;Complete thought&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Paragraphs / Chapters&lt;/td&gt;
&lt;td&gt;Classes, modules&lt;/td&gt;
&lt;td&gt;Organized units&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Story / Book&lt;/td&gt;
&lt;td&gt;Software&lt;/td&gt;
&lt;td&gt;Complete system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Literary Devices (metaphor, foreshadowing)&lt;/td&gt;
&lt;td&gt;Design Patterns (Observer, Factory)&lt;/td&gt;
&lt;td&gt;Elegant, reusable structures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Genres (Romance, Sci-fi)&lt;/td&gt;
&lt;td&gt;Frameworks (React, Django)&lt;/td&gt;
&lt;td&gt;Guiding structure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plot&lt;/td&gt;
&lt;td&gt;Algorithms&lt;/td&gt;
&lt;td&gt;Sequence of events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Editing&lt;/td&gt;
&lt;td&gt;Refactoring&lt;/td&gt;
&lt;td&gt;Polishing work&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Just like writers don’t invent a new alphabet every time, developers don’t invent new syntax. Instead, they use &lt;strong&gt;design patterns&lt;/strong&gt; like literary devices, ways to express ideas more &lt;strong&gt;clearly, elegantly, and universally.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So,&lt;/p&gt;

&lt;p&gt;Design patterns are not “new code you must write.” They are &lt;strong&gt;shared wisdom&lt;/strong&gt;, best practices that have stood the test of time.&lt;/p&gt;

&lt;p&gt;Just as a novelist uses foreshadowing or symbolism, a programmer uses Observer or Factory. Both make the story whether on paper or in code &lt;strong&gt;easier to understand, more flexible, and more powerful.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Future Start Here, Join Me!&lt;br&gt;
-Turkan Isayeva&lt;/p&gt;

</description>
      <category>programming</category>
      <category>codequality</category>
      <category>softwareengineering</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Fri, 08 Aug 2025 17:59:30 +0000</pubDate>
      <link>https://dev.to/codebyturkan/react-4eej</link>
      <guid>https://dev.to/codebyturkan/react-4eej</guid>
      <description></description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Why React Cares About Immutability: A Deep Dive into Reference, Reconciliation, and Rendering</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Sun, 03 Aug 2025 17:19:02 +0000</pubDate>
      <link>https://dev.to/codebyturkan/why-react-cares-about-immutability-a-deep-dive-into-reference-reconciliation-and-rendering-327</link>
      <guid>https://dev.to/codebyturkan/why-react-cares-about-immutability-a-deep-dive-into-reference-reconciliation-and-rendering-327</guid>
      <description>&lt;p&gt;&lt;strong&gt;Why React Cares About Immutability: A Deep Dive into Reference, Reconciliation, and Rendering.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you first hear the term &lt;strong&gt;“immutability”&lt;/strong&gt; in React, it might sound like just another fancy concept you’re expected to remember. But this one matters — &lt;strong&gt;a lot&lt;/strong&gt;. Behind the scenes, it’s powering how your UI knows when to update, or when to stay quiet.&lt;/p&gt;

&lt;p&gt;Let’s break it down step by step, with clarity and a little curiosity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Cycle Behind Every React Update&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whenever a React component updates, it’s because something triggered a change in its state or props. But React doesn’t &lt;em&gt;guess&lt;/em&gt; that something has changed, it uses a smart process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;You call &lt;code&gt;setState&lt;/code&gt; or pass new &lt;code&gt;props&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;React &lt;strong&gt;compares the current Virtual DOM&lt;/strong&gt; with the previous one&lt;/li&gt;
&lt;li&gt;It finds &lt;strong&gt;what changed&lt;/strong&gt; and updates the real DOM &lt;strong&gt;only where needed&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This process is called &lt;strong&gt;reconciliation&lt;/strong&gt;, and the way React decides &lt;em&gt;what changed&lt;/em&gt; is surprisingly simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It checks whether the &lt;strong&gt;reference&lt;/strong&gt; of the new state/props is different from the previous one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Why Reference?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In JavaScript, reference comparison is fast and cheap.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;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;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;Turkan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;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;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;Turkan&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;// false (different references)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though the content is the same, these are two separate objects in memory.&lt;/p&gt;

&lt;p&gt;React takes advantage of this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If the reference changes → React re-renders.&lt;br&gt;
If the reference stays the same → React assumes nothing changed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The Mutation Trap&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s where many beginners (and even experienced devs!) fall into a subtle trap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="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;Turkan&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updateUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Daniel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// ❌ mutated directly&lt;/span&gt;
  &lt;span class="nf"&gt;setUser&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="c1"&gt;// ❌ same reference&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though you changed the value inside &lt;code&gt;user&lt;/code&gt;, the reference didn’t change.&lt;br&gt;
React compares old and new state like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newState&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true → no update&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result? &lt;strong&gt;No re-render. No UI update. Confused developer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Immutability to the Rescue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s fix it the React way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updateUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="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;Daniel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="c1"&gt;// ✅new object, new reference&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now React sees:&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="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;newState&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// false → trigger re-render&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the heart of &lt;strong&gt;immutability&lt;/strong&gt; in React:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Don’t modify the original, create a new version instead.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;It’s Not Just Theory. It’s Performance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Immutability helps React:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quickly know what changed&lt;/li&gt;
&lt;li&gt;Skip unnecessary updates&lt;/li&gt;
&lt;li&gt;Keep your UI fast and snappy&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s not about being “functional” or “fancy”.It’s about &lt;strong&gt;making the diffing algorithm efficient.&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;If you’re updating arrays or objects in React, always ask yourself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Am I mutating the old data, or creating a new version?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because React doesn’t care &lt;strong&gt;what’s inside&lt;/strong&gt; ; it only cares &lt;strong&gt;whether the reference changed&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React uses &lt;strong&gt;reference checks&lt;/strong&gt; to detect changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immutability&lt;/strong&gt; ensures new references are created&lt;/li&gt;
&lt;li&gt;This powers &lt;strong&gt;reconciliation&lt;/strong&gt; and efficient rendering&lt;/li&gt;
&lt;li&gt;Mutating state directly breaks this chain → no updates&lt;/li&gt;
&lt;li&gt;Always return &lt;strong&gt;new objects or arrays&lt;/strong&gt; in &lt;code&gt;setState&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>learning</category>
      <category>productivity</category>
    </item>
    <item>
      <title>The Essential Guide to Code Commenting: Best Practices, Types, and Documentation.</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Sat, 02 Aug 2025 16:30:53 +0000</pubDate>
      <link>https://dev.to/codebyturkan/the-essential-guide-to-code-commenting-best-practices-types-and-documentation-4e6c</link>
      <guid>https://dev.to/codebyturkan/the-essential-guide-to-code-commenting-best-practices-types-and-documentation-4e6c</guid>
      <description>&lt;p&gt;When writing code, communication isn’t just between you and the machine, but it’s also between you and other developers (or your future self!). Clear and effective &lt;strong&gt;code commenting&lt;/strong&gt; plays a vital role in making your code understandable, maintainable, and scalable.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What code comments are and why they matter&lt;/li&gt;
&lt;li&gt;Different types of comments: inline vs. block&lt;/li&gt;
&lt;li&gt;The power of &lt;strong&gt;JSDoc&lt;/strong&gt; for inline documentation&lt;/li&gt;
&lt;li&gt;How to balance commenting to avoid clutter&lt;/li&gt;
&lt;li&gt;Advantages of structured documentation over simple comments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What Are Code Comments?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code comments&lt;/strong&gt; are notes written inside your source code to explain what the code does, why certain decisions were made, or how to use a function or module. They don’t affect the program execution but are critical for clarity.&lt;/p&gt;

&lt;p&gt;Comments help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Other developers quickly understand your code&lt;/li&gt;
&lt;li&gt;You recall your own logic months later&lt;/li&gt;
&lt;li&gt;Tools and IDEs provide better assistance (when using structured comments like JSDoc)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Types of Comments: Inline vs. Block&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inline Comments&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Written on a single line, usually beside the code they explain&lt;/li&gt;
&lt;li&gt;Start with &lt;code&gt;//&lt;/code&gt; in JavaScript&lt;/li&gt;
&lt;li&gt;Ideal for brief explanations or notes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&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="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// number of items to process&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Block Comments&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can span multiple lines, enclosed between &lt;code&gt;/*&lt;/code&gt; and &lt;code&gt;*/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Used for longer explanations, function headers, or multi-line notes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&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="cm"&gt;/*
  Calculates the sum of two numbers.
  This function takes two numeric inputs and returns their sum.
*/&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why Use JSDoc? The Power of Structured Inline Documentation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While simple comments are helpful, &lt;strong&gt;JSDoc&lt;/strong&gt; takes documentation to the next level by providing a structured way to describe functions, parameters, return values, and more — all inline with your code.&lt;/p&gt;

&lt;p&gt;Example JSDoc usage:&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="cm"&gt;/**
 * Adds two numbers.
 * @param {number} a - First number
 * @param {number} b - Second number
 * @returns {number} Sum of a and b
 */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Benefits of JSDoc over simple comments:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provides type information for parameters and return values&lt;/li&gt;
&lt;li&gt;Helps IDEs (like VSCode) show helpful hints and autocomplete suggestions&lt;/li&gt;
&lt;li&gt;Enables automatic generation of API documentation with tools like &lt;code&gt;jsdoc&lt;/code&gt; CLI&lt;/li&gt;
&lt;li&gt;Improves readability by enforcing a standard format&lt;/li&gt;
&lt;li&gt;Clarifies the intent and usage of functions better than generic comments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Balancing Comments: When and How Much to Comment?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While commenting is crucial, too many comments can clutter code and reduce readability. Here are some tips for a good balance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write self-explanatory code first:&lt;/strong&gt; Use meaningful variable and function names so that the code itself communicates its purpose. This reduces the need for excessive commenting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Comment the “why,” not the “what”:&lt;/strong&gt; Explain the reason behind complex logic, not obvious code. For example, avoid comments like &lt;code&gt;// adds two numbers&lt;/code&gt; on a simple addition function.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document public APIs and complex functions:&lt;/strong&gt; Use JSDoc or block comments to describe how to use functions, especially if they have multiple parameters or tricky behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid redundant comments:&lt;/strong&gt; Comments that just repeat what the code does add no value and should be removed.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Inline Comment vs. JSDoc: A Quick Comparison&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;Inline Comment (&lt;code&gt;//&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;JSDoc (&lt;code&gt;/** ... */&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Purpose&lt;/td&gt;
&lt;td&gt;Brief notes or reminders&lt;/td&gt;
&lt;td&gt;Structured documentation of code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Format&lt;/td&gt;
&lt;td&gt;Simple, unstructured&lt;/td&gt;
&lt;td&gt;Formal tags like &lt;code&gt;@param&lt;/code&gt;, &lt;code&gt;@returns&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IDE Support&lt;/td&gt;
&lt;td&gt;Basic syntax highlighting&lt;/td&gt;
&lt;td&gt;Enhanced support: hints, autocomplete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Documentation Generation&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Supports automatic API docs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Example: Comparing Inline Comment and JSDoc&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inline Comment&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;// Adds two numbers and returns the result&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;JSDoc Comment&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="cm"&gt;/**
 * Adds two numbers.
 * @param {number} a - First number
 * @param {number} b - Second number
 * @returns {number} Sum of a and b
 */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The JSDoc comment provides richer information and better tool support.&lt;/p&gt;

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

&lt;p&gt;Good commenting is an art. Writing clear, concise, and meaningful comments, especially using tools like &lt;strong&gt;JSDoc&lt;/strong&gt; — makes your code more understandable and maintainable for everyone, including your future self.&lt;/p&gt;

&lt;p&gt;Always strive to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write readable code first&lt;/li&gt;
&lt;li&gt;Use comments to explain “why” and document usage&lt;/li&gt;
&lt;li&gt;Use JSDoc for structured, standardized documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will save time, reduce bugs, and make collaboration much smoother.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Is Everything in JavaScript an Object?</title>
      <dc:creator>Turkan İsayeva</dc:creator>
      <pubDate>Sat, 26 Jul 2025 06:11:27 +0000</pubDate>
      <link>https://dev.to/codebyturkan/is-everything-in-javascript-an-object-32k</link>
      <guid>https://dev.to/codebyturkan/is-everything-in-javascript-an-object-32k</guid>
      <description>&lt;p&gt;While this is a well-known phrase among JS developers, it’s not utterly true. &lt;/p&gt;

&lt;p&gt;JavaScript has two main categories of data types:&lt;/p&gt;

&lt;p&gt;1️⃣. Primitive Types – string, number, boolean, null, undefined, symbol, bigint&lt;br&gt;
 2️⃣. Object Types – Object, Array, Function, Date, RegExp, etc.&lt;/p&gt;

&lt;p&gt;⁉️ So Why Do We Say “Everything is an Object”?&lt;/p&gt;

&lt;p&gt;Even though primitives like strings and numbers are not &lt;br&gt;
objects, they can behave like objects. This is because JavaScript temporarily wraps them in their corresponding object wrapper when you try to access a property or call a method.&lt;/p&gt;

&lt;p&gt;let name = "Turkan";&lt;br&gt;
console.log(name.length); // 6&lt;/p&gt;

&lt;p&gt;Here, "Turkan" is a primitive string, but JavaScript internally wraps it in a String object, so you can use .length and other methods like .toUpperCase().&lt;/p&gt;

&lt;p&gt;‼️ But Remember:&lt;br&gt;
    • Primitives are not objects.&lt;br&gt;
    • typeof null === "object" is a historical bug in JavaScript. null is not an object.&lt;br&gt;
    • Only actual object types can store methods and properties persistently.&lt;/p&gt;

&lt;p&gt;🎬 So,&lt;/p&gt;

&lt;p&gt;“Everything in JavaScript behaves like an object, but not everything is an object.”&lt;/p&gt;

&lt;p&gt;Understanding this distinction helps you write cleaner and more predictable code.&lt;/p&gt;

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