<?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: Solitaire Infosystems Pvt Ltd.</title>
    <description>The latest articles on DEV Community by Solitaire Infosystems Pvt Ltd. (solitaireinfosystems2011).</description>
    <link>https://dev.to/solitaireinfosystems2011</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F14636%2Fdb87c6c2-5761-4bd5-9762-c51239d9c122.png</url>
      <title>DEV Community: Solitaire Infosystems Pvt Ltd.</title>
      <link>https://dev.to/solitaireinfosystems2011</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/solitaireinfosystems2011"/>
    <language>en</language>
    <item>
      <title>AI Agents vs Python Scripts: What Should Beginner Developers Build First?</title>
      <dc:creator>Neha</dc:creator>
      <pubDate>Thu, 19 Nov 2026 08:45:55 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/ai-agents-vs-python-scripts-what-should-beginner-developers-build-first-4gg4</link>
      <guid>https://dev.to/solitaireinfosystems2011/ai-agents-vs-python-scripts-what-should-beginner-developers-build-first-4gg4</guid>
      <description>&lt;p&gt;&lt;strong&gt;Short answer: build Python scripts first.&lt;/strong&gt; In the AI agents vs Python scripts debate, a script is the right tool whenever you know the steps in advance: renaming files, cleaning a CSV, sending a daily report. An AI agent earns its place only when the next step depends on messy, unpredictable input, like a customer message that can be worded fifty different ways. Most real projects end up using both.&lt;br&gt;
Below: how each one works, the same task built both ways, a decision table, and five scenarios you'll actually run into.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is a Python script?
&lt;/h2&gt;

&lt;p&gt;A traditional Python script does exactly what you tell it, in the order you tell it. Same input, same output, every time. That predictability is the whole point.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;number&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Even"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Odd"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's no judgement involved. The condition is fixed, so the result is too. Scripts are the right fit for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Renaming hundreds of files in one go&lt;/li&gt;
&lt;li&gt;Cleaning Excel or CSV data&lt;/li&gt;
&lt;li&gt;Sending scheduled emails and daily reports&lt;/li&gt;
&lt;li&gt;Calculations and database updates&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is an AI agent?
&lt;/h2&gt;

&lt;p&gt;An AI agent is a program that uses a language model to understand a request, decide which action to take, and call tools (your functions, APIs or databases) to finish the job. The difference in one line: you write a script's path in advance, while an agent chooses its path at runtime.&lt;br&gt;
That flexibility has a price. An agent is only as reliable as the model, the tools you give it, your instructions and the checks you build around it. It can misread a request or pick the wrong tool, so you test it very differently from a script.&lt;br&gt;
Popular options for building agents in Python include the OpenAI API (or any LLM API), LangChain, LangGraph, LlamaIndex and CrewAI.&lt;/p&gt;
&lt;h2&gt;
  
  
  How do they handle the same task?
&lt;/h2&gt;

&lt;p&gt;The task: a customer messages you about their order.&lt;/p&gt;
&lt;h3&gt;
  
  
  Approach A: a rule-based script
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;customer_support&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;lower&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"order status"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Please check your order tracking page."&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="s2"&gt;"refund"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Please visit our refund policy page."&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="s2"&gt;"delivery"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Please check the estimated delivery date."&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Please contact our support team."&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;customer_support&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Where is my order?"&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;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Please contact our support team.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The customer obviously asked about their order, but the exact phrase "order status" wasn't in the message, so the script fell through to the default reply. That's the core weakness of keyword rules: they only match the words you predicted. You could keep adding keywords, but people will always find new ways to ask.&lt;/p&gt;

&lt;h3&gt;
  
  
  Approach B: an agent with one tool
&lt;/h3&gt;

&lt;p&gt;"Where's my package?", "Has my order shipped?" and "Still nothing delivered" all mean the same thing. An agent can recognise that, pull out the order ID and call a lookup function. Here's a minimal version using OpenAI's Responses API with tool calling:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# reads OPENAI_API_KEY from your environment&lt;/span&gt;
&lt;span class="no"&gt;MODEL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"your-model-name"&lt;/span&gt;  &lt;span class="c1"&gt;# any current model that supports tool calling&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_order_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_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;# Stand-in for a real database or API call&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"shipped"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"eta"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2 days"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;tools&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="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"function"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"get_order_status"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Look up the shipping status of an order by its ID."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"parameters"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"object"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"properties"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"string"&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="s2"&gt;"required"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&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="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;MODEL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Where's my package? Order #A1023"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Did the model decide it needs the tool?&lt;/span&gt;
&lt;span class="n"&gt;calls&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"function_call"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;results&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="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"function_call_output"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"call_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;call&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;call_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"output"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get_order_status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"order_id"&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="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Send the tool results back so the model can write the reply&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;MODEL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;previous_response_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;results&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at how the work is split. The model reads the message, decides it needs get_order_status and extracts A1023 as the order ID. Your ordinary Python function does the actual lookup. Then the model turns that result into a reply. The AI interprets; plain code does the work. A full agent repeats this loop until the task is done and adds guardrails such as input validation, retries and logging.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI agent vs Python script: decision table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Python script&lt;/th&gt;
&lt;th&gt;AI agent&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How it runs&lt;/td&gt;
&lt;td&gt;Follows steps you wrote&lt;/td&gt;
&lt;td&gt;Chooses actions at runtime&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Decisions&lt;/td&gt;
&lt;td&gt;Rule-based&lt;/td&gt;
&lt;td&gt;Model-assisted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Output&lt;/td&gt;
&lt;td&gt;Predictable&lt;/td&gt;
&lt;td&gt;Can vary between runs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unexpected input&lt;/td&gt;
&lt;td&gt;Fails or falls to a default&lt;/td&gt;
&lt;td&gt;Usually handles it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speed&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Slower (model calls)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Running cost&lt;/td&gt;
&lt;td&gt;Close to zero&lt;/td&gt;
&lt;td&gt;Model/API usage costs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Testing&lt;/td&gt;
&lt;td&gt;Fixed inputs, fixed outputs&lt;/td&gt;
&lt;td&gt;Needs evaluation across many inputs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Repetitive, well-defined jobs&lt;/td&gt;
&lt;td&gt;Messy input, multi-step decisions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A quick rule of thumb: if you can draw the entire flowchart before you start coding, write a script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which should you use? Five real scenarios
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Daily sales email report → Script.&lt;/strong&gt; Fixed steps, known data source, same format every morning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer support assistant → Agent.&lt;/strong&gt; Questions arrive in unpredictable wording and may need different tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cleaning Excel files → Script.&lt;/strong&gt; Pandas and OpenPyXL handle duplicates, date formats and totals reliably.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research assistant → Agent with search tools.&lt;/strong&gt; It has to decide what to search, compare sources and summarise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monthly business report → Both.&lt;/strong&gt; Python does the maths and builds the PDF; add an LLM only if you want a plain-English summary on top.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Can AI agents and Python scripts work together?
&lt;/h2&gt;

&lt;p&gt;Yes, and most production systems do exactly that. Take a resume screening tool:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Upload:&lt;/strong&gt; Python accepts the PDF files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extract:&lt;/strong&gt; a library such as pypdf pulls out the text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analyse:&lt;/strong&gt; an LLM identifies skills, qualifications and experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate:&lt;/strong&gt; rule-based code checks required fields and flags anything missing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Report:&lt;/strong&gt; Python generates a structured summary.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The AI handles language. Deterministic code handles everything that has to be exact. One caution: resumes contain personal data. Store them securely, and treat the AI's assessment as input for a human reviewer, never as the hiring decision itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mini-project: a smart task manager in three versions
&lt;/h2&gt;

&lt;p&gt;If you're learning Python, this one project teaches both approaches.&lt;br&gt;
&lt;strong&gt;Version 1: plain Python.&lt;/strong&gt; Add, view, complete and delete tasks. Save them to a JSON file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version 2: add AI.&lt;/strong&gt; Let users type "remind me to submit the report before Friday, it's urgent" and have an LLM convert it into structured data (title, due date, priority). Ask it to suggest an order for the day.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version 3: combine them.&lt;/strong&gt; The AI only interprets the request. Your existing Python functions do the adding, completing and deleting.&lt;/p&gt;

&lt;p&gt;A common beginner mistake in Version 3 is letting the model write to the JSON file directly. Keep every file write inside your own functions, so one bad model response can't corrupt your data.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should beginner developers learn first?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Python fundamentals:&lt;/strong&gt; variables, loops, functions, conditionals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data handling:&lt;/strong&gt; lists, dictionaries, JSON, CSV and a basic database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;APIs:&lt;/strong&gt; how to send a request, read a response and handle errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI basics:&lt;/strong&gt; what LLMs, prompts and tokens are, and where models go wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM integration:&lt;/strong&gt; call an LLM API and build a simple chatbot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agents:&lt;/strong&gt; tool calling, workflows, memory, then a framework like LangGraph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Projects:&lt;/strong&gt; build things that mix normal code and AI.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most common trap is jumping straight to step 6. When a tool call fails, you'll be reading a traceback, inspecting JSON and debugging a plain Python function. Those are all step-1 and step-2 skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what should you build first?
&lt;/h2&gt;

&lt;p&gt;A script. Automate one boring task you actually do, get it working end to end, then add a single AI feature to that same project. You'll understand exactly what the model is doing, and you'll know when you don't need it at all.&lt;/p&gt;

&lt;p&gt;What was the first thing you automated, and would you build it as a script, an agent or both today? Tell us in the comments.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written by the team at &lt;a href="https://www.solitaireinfosystems.com" rel="noopener noreferrer"&gt;Solitaire Infosystems&lt;/a&gt;, a software development and IT training company in Mohali that runs Python and AI/ML training for students and freshers.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>beginners</category>
      <category>automation</category>
    </item>
    <item>
      <title>Manual vs Automation Testing: Which Should Beginners Learn First?</title>
      <dc:creator>Nupur</dc:creator>
      <pubDate>Wed, 18 Nov 2026 12:41:35 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/manual-vs-automation-testing-which-should-beginners-learn-first-gk</link>
      <guid>https://dev.to/solitaireinfosystems2011/manual-vs-automation-testing-which-should-beginners-learn-first-gk</guid>
      <description>&lt;p&gt;If you’re choosing between manual vs automation testing as a beginner, start with manual testing. It teaches you what to test and why: writing test cases, spotting edge cases, reporting bugs clearly. Automation comes next, and it isn’t a shortcut. A script can only check what someone has already thought to check.&lt;br&gt;
Below: how the two compare, one login page tested both ways, and a learning order that doesn’t try to cram every tool at once.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is manual testing?
&lt;/h2&gt;

&lt;p&gt;Manual testing means a person checks how an application behaves by using it, without scripts. You act like a user, but with a plan: every action has an expected result, and you record it when the app does something else.&lt;br&gt;
On a shopping site, one manual test pass might cover:&lt;br&gt;
•Signing up with a new account&lt;br&gt;
•Logging in with valid and invalid credentials&lt;br&gt;
•Adding and removing cart items&lt;br&gt;
•Applying a valid coupon, expired or mistyped&lt;br&gt;
•Completing checkout&lt;br&gt;
Types you’ll hear about early on: functional, smoke, regression, exploratory and usability testing.&lt;br&gt;
What manual testing really builds is judgement. The tester who wonders “what happens if someone pastes a space before their email?” finds the bugs nobody wrote a test case for.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is automation testing?
&lt;/h2&gt;

&lt;p&gt;Automation testing uses code to run predefined test cases and compare the results with what’s expected. It pays off when the same checks have to run again and again, like re-testing login after every release.&lt;br&gt;
Beginners often mix up tools and frameworks, so here they are side by side:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;Used for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Selenium&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Browser automation library&lt;/td&gt;
&lt;td&gt;Web apps; works with Java, Python, C#, JavaScript and more&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Playwright&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Browser automation library&lt;/td&gt;
&lt;td&gt;Web apps on Chromium, Firefox and WebKit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cypress&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;JavaScript testing tool&lt;/td&gt;
&lt;td&gt;Web apps, runs inside the browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Appium&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mobile automation tool&lt;/td&gt;
&lt;td&gt;Android and iOS apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;TestNG / JUnit&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Java test frameworks&lt;/td&gt;
&lt;td&gt;Organising, running and reporting tests, often with Selenium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;pytest&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python test framework&lt;/td&gt;
&lt;td&gt;The same job for Python test code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  Manual vs automation testing: what’s the difference?
&lt;/h2&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;Manual testing&lt;/th&gt;
&lt;th&gt;Automation testing&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How tests run&lt;/td&gt;
&lt;td&gt;A person performs each step&lt;/td&gt;
&lt;td&gt;Scripts perform the steps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Coding needed&lt;/td&gt;
&lt;td&gt;No, to begin with&lt;/td&gt;
&lt;td&gt;Yes, in most setups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speed on repeated checks&lt;/td&gt;
&lt;td&gt;Slow&lt;/td&gt;
&lt;td&gt;Fast once scripts exist&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Setup&lt;/td&gt;
&lt;td&gt;A test plan and the app&lt;/td&gt;
&lt;td&gt;Tools, a framework and a test environment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strongest at&lt;/td&gt;
&lt;td&gt;Exploratory, usability and one-off checks&lt;/td&gt;
&lt;td&gt;Regression and repeated checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upkeep&lt;/td&gt;
&lt;td&gt;Test cases change when features change&lt;/td&gt;
&lt;td&gt;Scripts break when the UI changes and need fixing&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Automation doesn’t replace manual testing. Teams use both: scripts guard what already works, and people explore what’s new.&lt;/p&gt;
&lt;h2&gt;
  
  
  How do you test a login page manually and with automation?
&lt;/h2&gt;

&lt;p&gt;Manual scenarios&lt;br&gt;
•Valid username and password → the user lands on the dashboard&lt;br&gt;
•Wrong password → an error message appears&lt;br&gt;
•Empty username → a validation message appears&lt;br&gt;
•Badly formatted email → a warning appears&lt;br&gt;
Automating the first scenario with Python and Selenium 4&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;common&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;by&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;By&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;support&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ui&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;WebDriverWait&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;support&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;expected_conditions&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="no"&gt;EC&lt;/span&gt;

&lt;span class="n"&gt;driver&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Chrome&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Selenium 4.6+ fetches the browser driver itself&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;driver&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;"https://example.com/login"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# replace with your test app&lt;/span&gt;
    &lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find_element&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;By&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"username"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"testuser"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find_element&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;By&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"password"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send_keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"correct-password"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find_element&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;By&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"login-button"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# The real check: times out (fails) if no dashboard&lt;/span&gt;
    &lt;span class="nc"&gt;WebDriverWait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;until&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;EC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;url_contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/dashboard"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"PASS: valid login reaches the dashboard"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;driver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;quit&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 URL and element IDs are placeholders; inspect your own app for the real locators.&lt;br&gt;
Look at the wait line. That’s the test. Without it, the script would “pass” even when login fails, and that’s exactly why test design comes first: you can’t automate a check you haven’t defined.&lt;br&gt;
For waits and locators in more depth, the official Selenium documentation is the place to go.&lt;/p&gt;

&lt;h2&gt;
  
  
  In what order should beginners learn software testing?
&lt;/h2&gt;

&lt;p&gt;1.Testing fundamentals: SDLC, STLC, QA vs QC, the defect life cycle, verification vs validation.&lt;br&gt;
2.Manual testing practice: write test scenarios and test cases, and log bugs with clear steps to reproduce.&lt;br&gt;
3.Basic SQL: SELECT, WHERE, JOIN, INSERT and UPDATE, enough to check the data behind the UI.&lt;br&gt;
4.One programming language: Python or Java. Variables, loops, conditions, functions and OOP basics.&lt;br&gt;
5.One automation tool: Selenium or Playwright. Write small scripts that assert real results.&lt;br&gt;
6.API testing and Git: Postman for APIs; Git and GitHub to version your test code.&lt;br&gt;
7.Projects: test login, registration, cart and contact forms on practice sites, and put the work on GitHub.&lt;br&gt;
The most common mistake is jumping straight to step 5 because automation sounds more employable. People who skip test design end up with scripts that click through pages and check nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;p&gt;Do I need coding for manual testing? No. You need it for automation, and basic SQL helps with both.&lt;br&gt;
Is manual testing still worth learning? Yes. Exploratory and usability testing still need people, and every automated test starts as a test case someone designed.&lt;br&gt;
Should I learn Selenium or Playwright first? Either works. Selenium has been around longer and has a lot of learning material; Playwright is newer and waits for elements automatically. Pick one and go deep before touching the other.&lt;br&gt;
How long before I can move to automation? It depends on how much you practise. A good signal is when you can write clear test cases and bug reports for a feature without help.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;A good tester isn’t someone who can run a test. It’s someone who knows what to test, why it matters and what could break. Build that first, then let scripts handle the repetition.&lt;br&gt;
Solitaire Infosystems is a software development and IT training company in Mohali. If you’re in the Tricity area and want guided, hands-on practice, see our &lt;a href="https://solitairelearning.com/course-detail/software-testing" rel="noopener noreferrer"&gt;software testing training&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>beginners</category>
      <category>selenium</category>
      <category>career</category>
    </item>
    <item>
      <title>7 Free Cybersecurity Labs for Beginners (No Home Lab Needed)</title>
      <dc:creator>Nupur</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:13:47 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/7-free-cybersecurity-labs-for-beginners-no-home-lab-needed-1idm</link>
      <guid>https://dev.to/solitaireinfosystems2011/7-free-cybersecurity-labs-for-beginners-no-home-lab-needed-1idm</guid>
      <description>&lt;p&gt;You can start practising cybersecurity today without building a home lab. Free cybersecurity labs like TryHackMe, PortSwigger Web Security Academy, OverTheWire and picoCTF give you ready-made, legal targets. Most need only a browser. A couple need an SSH client or one Docker command.&lt;br&gt;
That matters because a lot of beginners lose their first month to VirtualBox errors and broken Kali installs. Building a lab is a useful skill. It just isn’t the first one you need.&lt;br&gt;
Below are seven platforms: what each is good for, where to start and the catch with each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do you need before you start?
&lt;/h2&gt;

&lt;p&gt;•A modern browser. Enough for most of this list.&lt;br&gt;
•A terminal with SSH. Built into macOS, Linux and Windows 10/11. Needed for OverTheWire.&lt;br&gt;
•Docker. Only if you want to run OWASP Juice Shop.&lt;br&gt;
•A notes file. Seriously. You’ll need it more than any tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. TryHackMe: guided rooms for complete beginners
&lt;/h2&gt;

&lt;p&gt;TryHackMe teaches through short guided lessons called “rooms”. Each room explains a concept and then gives you a machine to practise on. Its AttackBox is a Linux machine that runs inside your browser, so you don’t need a local VM.&lt;br&gt;
Start with: the free introductory rooms on Linux, networking and web basics.&lt;br&gt;
The catch: free accounts get the AttackBox for one hour a day, and many full learning paths are paid. You can also connect your own machine over OpenVPN for free, but that brings back some setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. PortSwigger Web Security Academy: the deep end of web security
&lt;/h2&gt;

&lt;p&gt;PortSwigger Web Security Academy comes from the team behind Burp Suite and is free. Every topic starts with a written explanation and then gives you labs at three levels: Apprentice, Practitioner and Expert.&lt;br&gt;
It covers SQL injection, cross-site scripting (XSS), CSRF, SSRF, broken access control and authentication flaws in more depth than most paid courses.&lt;br&gt;
Start with: the SQL injection Apprentice labs.&lt;br&gt;
The catch: you can solve the early labs in a browser. Most Practitioner labs expect you to use Burp Suite Community Edition (free, but it needs installing).&lt;/p&gt;

&lt;h2&gt;
  
  
  3. OverTheWire Bandit: Linux skills, one level at a time
&lt;/h2&gt;

&lt;p&gt;OverTheWire runs “wargames” you play over SSH. In Bandit, the beginner game, the password for each level is hidden somewhere on the server. You find it with commands like ls, find, grep and cat, and along the way you learn file permissions and SSH keys.&lt;br&gt;
Your first command:&lt;br&gt;
ssh &lt;a href="mailto:bandit0@bandit.labs.overthewire.org"&gt;bandit0@bandit.labs.overthewire.org&lt;/a&gt; -p 2220&lt;/p&gt;

&lt;p&gt;The catch: it isn’t browser-based. You need a terminal, but no VM.&lt;br&gt;
If you only pick one platform from this list, pick Bandit. Almost every other platform assumes you can move around a Linux shell without thinking about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. picoCTF: Capture The Flag, built for learners
&lt;/h2&gt;

&lt;p&gt;picoCTF was created by security experts at Carnegie Mellon University. Its practice area, picoGym, keeps past challenges open all year in categories like General Skills, Web Exploitation, Cryptography, Forensics, Reverse Engineering and Binary Exploitation. It also includes a browser-based webshell, so you can run Linux commands without installing anything.&lt;br&gt;
Start with: General Skills, then Web Exploitation.&lt;br&gt;
The catch: the difficulty climbs fast in binary exploitation and reverse engineering. Don’t judge yourself by those categories in week one.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. CyberDefenders: the defender’s side
&lt;/h2&gt;

&lt;p&gt;CyberDefenders flips the usual CTF. You don’t break into a machine. You get evidence from an incident, such as network captures, logs or memory and disk images, and answer investigation questions like a SOC analyst would. It’s the most realistic free introduction to digital forensics and incident response on this list.&lt;br&gt;
The catch: only part of the lab library is free (the rest needs a Pro plan). Some labs run in the browser, while others mean downloading the evidence and opening it in tools like Wireshark. Save it for after you’re comfortable with Linux and networking basics.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. OWASP Juice Shop: a whole vulnerable online shop
&lt;/h2&gt;

&lt;p&gt;OWASP Juice Shop is an intentionally insecure web shop. It contains flaws from across the OWASP Top Ten and has a hidden scoreboard that tracks the challenges you solve. It feels closer to testing a real application than one-bug-per-page labs do.&lt;br&gt;
Run it locally (no VM, just Docker):&lt;br&gt;
docker run --rm -p 127.0.0.1:3000:3000 bkimminich/juice-shop&lt;/p&gt;

&lt;p&gt;Then open &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; in your browser.&lt;br&gt;
The catch: you need Docker or Node.js on your machine. The public demo instance is only a preview, and the project asks people not to attack it. Always hack your own copy.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Google Gruyere: a quick web security warm-up
&lt;/h2&gt;

&lt;p&gt;Google Gruyere is a small, deliberately buggy web app from Google, built as a codelab. When you start, it gives you your own sandboxed instance. It walks you through XSS, CSRF, information disclosure and similar bugs, with hints and an explanation of how to fix each one.&lt;br&gt;
The catch: it’s older and much smaller than modern apps. Treat it as a warm-up before PortSwigger or Juice Shop, not as a replacement for them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which free cybersecurity lab should you choose?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Platform&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;th&gt;Runs in&lt;/th&gt;
&lt;th&gt;Free-plan catch&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;TryHackMe&lt;/td&gt;
&lt;td&gt;Complete beginners, guided learning&lt;/td&gt;
&lt;td&gt;Browser (AttackBox) or VPN&lt;/td&gt;
&lt;td&gt;AttackBox 1 hr/day; many paths paid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PortSwigger Academy&lt;/td&gt;
&lt;td&gt;Web application security&lt;/td&gt;
&lt;td&gt;Browser + Burp Suite CE&lt;/td&gt;
&lt;td&gt;Later labs need Burp installed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OverTheWire Bandit&lt;/td&gt;
&lt;td&gt;Linux command line&lt;/td&gt;
&lt;td&gt;Terminal over SSH&lt;/td&gt;
&lt;td&gt;Not browser-based&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;picoCTF&lt;/td&gt;
&lt;td&gt;CTF-style problem solving&lt;/td&gt;
&lt;td&gt;Browser + webshell&lt;/td&gt;
&lt;td&gt;Steep jump in harder categories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CyberDefenders&lt;/td&gt;
&lt;td&gt;Blue team, forensics, incident response&lt;/td&gt;
&lt;td&gt;Browser or downloaded evidence&lt;/td&gt;
&lt;td&gt;Pro labs are paid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OWASP Juice Shop&lt;/td&gt;
&lt;td&gt;Testing a full web app&lt;/td&gt;
&lt;td&gt;Docker/Node.js on your machine&lt;/td&gt;
&lt;td&gt;Local install needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google Gruyere&lt;/td&gt;
&lt;td&gt;Quick web-bug warm-up&lt;/td&gt;
&lt;td&gt;Browser&lt;/td&gt;
&lt;td&gt;Small, older app&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Not sure where to begin? Try this four-week order
&lt;/h2&gt;

&lt;p&gt;•Week 1: OverTheWire Bandit, levels 0 to 10. Get comfortable in the terminal.&lt;br&gt;
•Week 2: TryHackMe free rooms on networking and web basics.&lt;br&gt;
•Week 3: PortSwigger SQL injection and XSS Apprentice labs.&lt;br&gt;
•Week 4: picoCTF General Skills and Web Exploitation, plus one free CyberDefenders lab if the defensive side interests you.&lt;br&gt;
Juice Shop and Gruyere fit in whenever you want a break from structured lessons.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you turn lab practice into real skill?
&lt;/h2&gt;

&lt;p&gt;Finishing challenges isn’t the same as learning from them. These are the habits that make the difference, and the mistakes beginners make most often:&lt;br&gt;
1.Don’t open the walkthrough after five minutes. Give yourself a fixed block (30–45 minutes) before you check hints. Being stuck is where most of the learning happens.&lt;br&gt;
2.Write down the root cause, not just the payload. After each lab, finish this sentence: “This worked because the app…”&lt;br&gt;
3.Learn the fix. For every vulnerability, note how a developer would prevent it: parameterised queries, output encoding, proper access checks. Interviewers ask about this side more often than beginners expect.&lt;br&gt;
4.Keep notes you can reuse. One Markdown file per platform, with commands, tools and the mistakes you made. Over time it becomes your personal cheat sheet.&lt;br&gt;
5.Build a small portfolio, honestly. Publish write-ups only where the platform allows it (many ask you not to share solutions to active challenges). Label them as training labs, not professional security work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are free labs enough to learn cybersecurity?
&lt;/h2&gt;

&lt;p&gt;They’re enough to start and to find out which side of security you enjoy: offensive, web or defensive. They won’t teach you everything on their own. Most learners still need structured study of networking, Linux administration and security concepts, plus someone to review their work and point out gaps. Use the labs to practise what you study, not instead of studying.&lt;/p&gt;

&lt;h2&gt;
  
  
  Over to you
&lt;/h2&gt;

&lt;p&gt;Which of these free cybersecurity labs did you try first, and where did you get stuck? If you know another free platform where beginners can practise without building a lab, share it in the comments.&lt;br&gt;
Security reminder: only test systems you own or are explicitly allowed to test, such as these labs and intentionally vulnerable apps. Never try these techniques on real websites, networks or applications without written permission.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>cybersecurity</category>
      <category>security</category>
    </item>
    <item>
      <title>10 JavaScript ES6+ Features to Learn Before React (With Examples)</title>
      <dc:creator>Neha</dc:creator>
      <pubDate>Mon, 16 Nov 2026 10:10:54 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/10-javascript-es6-features-to-learn-before-react-with-examples-5hgc</link>
      <guid>https://dev.to/solitaireinfosystems2011/10-javascript-es6-features-to-learn-before-react-with-examples-5hgc</guid>
      <description>&lt;p&gt;The JavaScript ES6 features to learn before React are let/const, arrow functions, template literals, destructuring, the spread operator, map()/filter()/find(), default parameters, modules, async/await and optional chaining. React adds very little syntax of its own. Most of what looks strange inside a component is plain modern JavaScript.&lt;br&gt;
That's why so many beginners stall a few lessons into a React tutorial. The instructor writes &lt;code&gt;const [count, setCount] = useState(0)&lt;/code&gt;, says "just destructure the props", drops a &lt;code&gt;.map()&lt;/code&gt; into the JSX and moves on. If those pieces are new to you, React gets the blame for what is really a JavaScript gap.&lt;br&gt;
You don't need to master all of JavaScript first. You need these ten features, and you need to recognise them on sight.&lt;/p&gt;
&lt;h2&gt;
  
  
  Quick reference: what each feature does in React
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Where you'll see it in React&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;let / const&lt;/td&gt;
&lt;td&gt;Declares variables with block scope&lt;/td&gt;
&lt;td&gt;Every component, every hook&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Arrow functions&lt;/td&gt;
&lt;td&gt;Shorter function syntax&lt;/td&gt;
&lt;td&gt;Components, event handlers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Template literals&lt;/td&gt;
&lt;td&gt;Puts variables inside strings&lt;/td&gt;
&lt;td&gt;Dynamic class names, API URLs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Destructuring&lt;/td&gt;
&lt;td&gt;Pulls values out of objects/arrays&lt;/td&gt;
&lt;td&gt;Props, useState&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spread (...)&lt;/td&gt;
&lt;td&gt;Copies and merges arrays/objects&lt;/td&gt;
&lt;td&gt;Updating state&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;map / filter / find&lt;/td&gt;
&lt;td&gt;Transforms and searches arrays&lt;/td&gt;
&lt;td&gt;Rendering lists, search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Default parameters&lt;/td&gt;
&lt;td&gt;Fallback values for arguments&lt;/td&gt;
&lt;td&gt;Default prop values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;import / export&lt;/td&gt;
&lt;td&gt;Splits code across files&lt;/td&gt;
&lt;td&gt;Every component file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;async / await&lt;/td&gt;
&lt;td&gt;Handles data that arrives later&lt;/td&gt;
&lt;td&gt;Fetching API data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Optional chaining (?.)&lt;/td&gt;
&lt;td&gt;Reads nested data safely&lt;/td&gt;
&lt;td&gt;Data that isn't loaded yet&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A quick note on naming: ES6 is the 2015 release of JavaScript. async/await arrived in ES2017 and optional chaining in ES2020, so "ES6+" is the honest label. Every React tutorial uses them, which is why they're on this list.&lt;/p&gt;
&lt;h2&gt;
  
  
  1. let and const: which one should you use?
&lt;/h2&gt;

&lt;p&gt;Before ES6, everything was declared with &lt;code&gt;var&lt;/code&gt;. Its function-level scope and hoisting behaviour cause bugs that are hard to spot, so modern code avoids it.&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="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// fine&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// age = 25; // TypeError: Assignment to constant variable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;const&lt;/code&gt;: your default. Use it whenever you won't reassign the variable.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;let&lt;/code&gt;: use it only when the value genuinely needs to change.
One thing that trips people up: &lt;code&gt;const&lt;/code&gt; stops reassignment, not changes inside an object or array.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Alex"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Sam"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// allowed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In React:&lt;/strong&gt; &lt;code&gt;const [count, setCount] = useState(0);&lt;/code&gt; combines &lt;code&gt;const&lt;/code&gt; with array destructuring in a single line. You'll write it hundreds of times.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Arrow functions: why are there arrows everywhere?
&lt;/h2&gt;

&lt;p&gt;Arrow functions are a shorter way to write functions.&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;// Traditional function&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&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="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Arrow function&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;greetArrow&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello World"&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;// Implicit return (one expression, no braces)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;greetShort&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A classic beginner bug: &lt;code&gt;const greet = () =&amp;gt; { "Hello World" };&lt;/code&gt; returns &lt;code&gt;undefined&lt;/code&gt;. Once you add curly braces, you need &lt;code&gt;return&lt;/code&gt;.&lt;br&gt;
&lt;strong&gt;In React:&lt;/strong&gt; components are often written as arrow functions, and event handlers almost always are: &lt;code&gt;onClick={() =&amp;gt; setCount(count + 1)}&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Template literals: how do you put variables inside strings?
&lt;/h2&gt;

&lt;p&gt;Template literals use backticks and &lt;code&gt;${}&lt;/code&gt; instead of &lt;code&gt;+&lt;/code&gt; concatenation.&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="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Old approach&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ES6 approach&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`Hello ${name}!`&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;In React:&lt;/strong&gt; you'll use them for dynamic class names, like &lt;code&gt;className={`btn ${isActive ? "active" : ""}`}&lt;/code&gt;, and for building API URLs.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Destructuring: how do you pull values out of objects and arrays?
&lt;/h2&gt;

&lt;p&gt;Destructuring extracts values in one line instead of several.&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="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Without destructuring&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;userName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;userAge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// With destructuring&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Arrays work by position&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Blue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Green"&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="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;second&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "Red", "Blue"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In React:&lt;/strong&gt; props arrive as an object, so most components destructure them straight away: &lt;code&gt;function Profile({ name, age }) { ... }&lt;/code&gt;. And &lt;code&gt;useState&lt;/code&gt; returns an array, which is why you see &lt;code&gt;const [value, setValue]&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Spread operator: how do you copy and combine data?
&lt;/h2&gt;

&lt;p&gt;The spread operator (&lt;code&gt;...&lt;/code&gt;) expands the items of an array or the properties of an object into a new one.&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="n"&gt;firstList&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="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&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="n"&gt;secondList&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;firstList&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&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="n"&gt;secondList&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// [1, 2, 3, 4, 5]&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&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="n"&gt;updatedUser&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Mohali"&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 copy is shallow: nested objects inside it are still shared with the original.&lt;br&gt;
&lt;strong&gt;In React:&lt;/strong&gt; this is how you update state without mutating it, for example &lt;code&gt;setUser({ ...user, city: "Mohali" })&lt;/code&gt;. Changing &lt;code&gt;user.city&lt;/code&gt; directly and calling &lt;code&gt;setUser(user)&lt;/code&gt; passes the same object back, and React may not re-render.&lt;/p&gt;
&lt;h2&gt;
  
  
  6. map(), filter() and find(): which array methods matter most?
&lt;/h2&gt;

&lt;p&gt;These three come up constantly in React code.&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;// map(): returns a new array with every item transformed&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;numbers&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="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&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="n"&gt;doubled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// [2, 4, 6]&lt;/span&gt;

&lt;span class="c1"&gt;// filter(): returns every item that passes a condition&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;40&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="n"&gt;high&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// [30, 40]&lt;/span&gt;

&lt;span class="c1"&gt;// find(): returns the first item that passes, or undefined&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Sam"&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="n"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"John"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "John"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In React:&lt;/strong&gt; &lt;code&gt;map()&lt;/code&gt; is how lists get rendered. &lt;code&gt;{students.map((s) =&amp;gt; &amp;lt;li key={s.id}&amp;gt;{s.name}&amp;lt;/li&amp;gt;)}&lt;/code&gt; turns an array of data into an array of elements, and each one needs a unique &lt;code&gt;key&lt;/code&gt;. &lt;code&gt;filter()&lt;/code&gt; powers search boxes and tabs; &lt;code&gt;find()&lt;/code&gt; picks a single selected item.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Default parameters: how do you set fallback values?
&lt;/h2&gt;

&lt;p&gt;A default parameter is used when no value (or &lt;code&gt;undefined&lt;/code&gt;) is passed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;welcome&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Guest"&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="sb"&gt;`Welcome, ${name}!`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&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="nf"&gt;welcome&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="c1"&gt;// Welcome, Guest!&lt;/span&gt;
&lt;span class="nb"&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="nf"&gt;welcome&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Alex"&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;// Welcome, Alex!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In React:&lt;/strong&gt; default prop values work the same way inside destructuring: &lt;code&gt;function Button({ label = "Submit" }) { ... }&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Modules: what do import and export actually do?
&lt;/h2&gt;

&lt;p&gt;Modules let you split code into files and share only what you choose.&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;// math.js: named export&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// greet.js: default export (one per file)&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&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="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// app.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;add&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./math.js"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// named: curly braces, exact name&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;greet&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"./greet.js"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// default: no braces, any name&lt;/span&gt;

&lt;span class="nb"&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="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&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;// 8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In React:&lt;/strong&gt; every component file ends with an export, and every file starts with imports such as &lt;code&gt;import { useState } from "react";&lt;/code&gt;. Mixing up named and default imports is one of the most common "why is this undefined?" errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Promises and async/await: how do you handle data that arrives later?
&lt;/h2&gt;

&lt;p&gt;Calling an API takes time, so &lt;code&gt;fetch()&lt;/code&gt; returns a Promise: a placeholder for a value that will arrive later. &lt;code&gt;async/await&lt;/code&gt; lets you write that waiting in a top-to-bottom style that's easier to read.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUsers&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="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://jsonplaceholder.typicode.com/users"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&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="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`HTTP ${response.status}`&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="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="nb"&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="n"&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="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Could not load users:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&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="nf"&gt;getUsers&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;Note that &lt;code&gt;fetch()&lt;/code&gt; doesn't reject on a 404 or 500, which is why the &lt;code&gt;response.ok&lt;/code&gt; check is there. &lt;code&gt;await&lt;/code&gt; also only works inside an &lt;code&gt;async&lt;/code&gt; function (or at the top level of a module).&lt;br&gt;
&lt;strong&gt;In React:&lt;/strong&gt; this is the pattern you'll use to load data, usually inside &lt;code&gt;useEffect&lt;/code&gt; or through a data-fetching library.&lt;/p&gt;
&lt;h2&gt;
  
  
  10. Optional chaining (?.): how do you avoid "Cannot read properties of undefined"?
&lt;/h2&gt;

&lt;p&gt;Optional chaining stops and returns &lt;code&gt;undefined&lt;/code&gt; when part of a path is missing, instead of throwing an error.&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="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Alex"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Mohali"&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="nb"&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="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// "Mohali"&lt;/span&gt;
&lt;span class="nb"&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="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;contact&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// undefined, no crash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;In React:&lt;/strong&gt; on the first render your API data often hasn't arrived yet, so &lt;code&gt;user?.address?.city&lt;/code&gt; keeps the component from crashing while it waits.&lt;/p&gt;

&lt;h2&gt;
  
  
  What mistakes do beginners make with these in React?
&lt;/h2&gt;

&lt;p&gt;These are the ones that come up again and again when people move from JavaScript practice to their first components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using curly braces in an arrow function and forgetting &lt;code&gt;return&lt;/code&gt;, so nothing renders.&lt;/li&gt;
&lt;li&gt;Mutating state directly (&lt;code&gt;user.city = "Delhi"&lt;/code&gt;) instead of creating a new copy with spread.&lt;/li&gt;
&lt;li&gt;Leaving out the &lt;code&gt;key&lt;/code&gt; prop inside &lt;code&gt;.map()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Writing &lt;code&gt;onClick={handleClick()}&lt;/code&gt;, which runs the function on every render, instead of &lt;code&gt;onClick={handleClick}&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;await&lt;/code&gt; outside an &lt;code&gt;async&lt;/code&gt; function.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What should you practice before starting React?
&lt;/h2&gt;

&lt;p&gt;Reading examples helps, but writing the code yourself is what makes it stick. Try these:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rewrite five &lt;code&gt;var&lt;/code&gt; declarations using &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Convert five traditional functions into arrow functions, including at least two with implicit returns.&lt;/li&gt;
&lt;li&gt;Create a student object and pull out its values with destructuring.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;map()&lt;/code&gt; to turn an array of student names into strings like "Student: Alex".&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;filter()&lt;/code&gt; to keep only the students who scored above 70.&lt;/li&gt;
&lt;li&gt;Create two files and practice named and default imports between them.&lt;/li&gt;
&lt;li&gt;Fetch data from a free API with async/await, including error handling.
If you can do all seven without checking a tutorial, you're ready to start React. For anything you get stuck on, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide" rel="noopener noreferrer"&gt;MDN's JavaScript Guide&lt;/a&gt; is the most reliable reference.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How long should you spend on ES6 before React?
&lt;/h2&gt;

&lt;p&gt;Less time than most people think. If you already know basic JavaScript (variables, functions, loops, objects), a week or two of daily practice on these ten features is usually enough to start. You don't need classes, prototypes or closures in depth on day one, because modern React is written with function components and hooks. Learn the rest as you hit it.&lt;br&gt;
React gets much easier once these patterns stop feeling foreign. Which one confused you most when you started? Tell me in the comments.&lt;br&gt;
&lt;em&gt;Solitaire Infosystems is an IT training and software development company in Mohali. If you'd like structured, project-based practice, see our &lt;a href="https://solitaireinfosystems.com/reactjs-industrial-training-chandigarh/" rel="noopener noreferrer"&gt;React JS training&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>AI Is Your Pair Programmer, Not Your Brain: How to Code Smarter Without Losing Your Skills</title>
      <dc:creator>Nupur</dc:creator>
      <pubDate>Sat, 14 Nov 2026 10:46:22 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/ai-is-your-pair-programmer-not-your-brain-how-to-code-smarter-without-losing-your-skills-5b4b</link>
      <guid>https://dev.to/solitaireinfosystems2011/ai-is-your-pair-programmer-not-your-brain-how-to-code-smarter-without-losing-your-skills-5b4b</guid>
      <description>&lt;p&gt;AI pair programming works best when you do the thinking and the AI does the assisting. Use ChatGPT, GitHub Copilot or Cursor to explain concepts, review your code and speed up repetitive work — but try the problem yourself first, question every suggestion, and never ship code you can’t explain.&lt;br&gt;
That sounds obvious. In practice it’s easy to slip. You paste a task, get 80 lines back, it runs, you move on. Do that for a few months and you get faster at prompting but slower at actually solving problems, which hurts most on the day the AI is confidently wrong.&lt;br&gt;
Here’s a workflow that keeps the speed without costing you the skill.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why shouldn’t you ask AI for the whole solution straight away?
&lt;/h2&gt;

&lt;p&gt;Say you need a login system. The tempting prompt is:&lt;br&gt;
“Create a complete login system using React and Node.js.”&lt;br&gt;
You’ll get plenty of code. But can you say where the password gets hashed, where the token is stored, or what happens after the fifth wrong password? If not, you now own code you can’t maintain or secure.&lt;br&gt;
Break the problem into questions first:&lt;br&gt;
•What does the login form need to collect, and how is it validated?&lt;br&gt;
•How are passwords hashed before they’re stored (bcrypt or Argon2, never plain text)?&lt;br&gt;
•How does the backend verify credentials and issue a token?&lt;br&gt;
•Where does the token live — an httpOnly cookie or localStorage — and what’s the trade-off?&lt;br&gt;
•What stops someone from brute-forcing the login?&lt;br&gt;
Then work through them with the AI one at a time. Each answer is something you understand and can check, instead of one big block you have to trust.&lt;/p&gt;
&lt;h2&gt;
  
  
  Should you try solving it yourself first?
&lt;/h2&gt;

&lt;p&gt;Yes, even if it’s only for ten minutes. A rough attempt tells you what you actually don’t know, which makes your next prompt much sharper.&lt;br&gt;
Take a simple task:&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="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Find the sum of all numbers&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write your own version first:&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="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&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="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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="nb"&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="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 30&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now ask the AI something that builds on your work:&lt;br&gt;
“Explain how my loop works, then show me the same thing with reduce(). When would you pick one over the other?”&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="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&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;Now you’re comparing two approaches you understand, not copying one you don’t.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you get AI to teach you instead of just writing code?
&lt;/h2&gt;

&lt;p&gt;Change what you ask for. When the AI hands you a solution, don’t paste it in yet. Ask:&lt;br&gt;
•Why did you choose this approach?&lt;br&gt;
•What does each part do?&lt;br&gt;
•Is there a simpler version?&lt;br&gt;
•What happens if the input is empty or null?&lt;br&gt;
•Which edge cases could break it?&lt;br&gt;
•Will it still be fast with 100,000 items?&lt;br&gt;
Compare these two prompts. The first gets you code. The second gets you understanding:&lt;br&gt;
“Write a function to remove duplicate values from an array.”&lt;br&gt;
“Explain three ways to remove duplicates from a JavaScript array, compare their time complexity, and tell me when each one makes sense.”&lt;br&gt;
The second answer will usually cover new Set(), filter() with indexOf(), and reduce(), and explain why the Set version is the usual default for large arrays. That reasoning sticks with you long after the snippet is forgotten.&lt;/p&gt;
&lt;h2&gt;
  
  
  How should you use AI for debugging?
&lt;/h2&gt;

&lt;p&gt;Debugging is where the habit matters most. Pasting an error and applying whatever fix comes back works until the fix hides the real problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&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;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nb"&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="nf"&gt;getUserName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&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;// TypeError: Cannot read properties of null (reading 'profile')&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Don’t ask the AI to “fix this”. Ask:&lt;br&gt;
“Why does this throw a TypeError? Explain the root cause and give me two ways to handle it.”&lt;br&gt;
You’ll typically get two options:&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;// Option 1: return a fallback if data is missing&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&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;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&gt;"Guest"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Option 2: fail loudly, because a missing user is a bug&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUserName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;)&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="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"getUserName: user profile is required"&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="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&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;Which one is right depends on whether a missing user is normal in your app or a sign that something upstream broke. That’s a judgment call the AI can’t make without knowing your codebase. Making it is your job.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should you check before using AI-generated code?
&lt;/h2&gt;

&lt;p&gt;AI tools state wrong answers in the same confident tone as right ones. Common problems include logic that solves a slightly different problem, outdated methods, unnecessary packages, vague variable names, missing error handling and security holes. Run through this before you commit anything:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What to check&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Logic&lt;/td&gt;
&lt;td&gt;Does it solve your actual problem, not a similar one?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Readability&lt;/td&gt;
&lt;td&gt;Could a teammate follow it without asking you?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;Does it hold up with larger inputs?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Does it trust user input, leak data or store secrets badly?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dependencies&lt;/td&gt;
&lt;td&gt;Did it add a package you don’t need, or one that’s outdated?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Error handling&lt;/td&gt;
&lt;td&gt;What happens when the network, input or data fails?&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tests   Have you actually run it with different inputs?&lt;/p&gt;

&lt;h2&gt;
  
  
  Why should you write your own tests first?
&lt;/h2&gt;

&lt;p&gt;If the AI writes the code and the tests, it can make the same wrong assumption in both, and everything passes. Decide the test cases yourself first. For an isEven function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;isEven&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nf"&gt;isEven&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// false&lt;/span&gt;
&lt;span class="nf"&gt;isEven&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nf"&gt;isEven&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;span class="nf"&gt;isEven&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;2.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// ? decide this before the AI decides for you&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last case is the useful one. Should it return false, or throw an error? Answering that is part of designing the function. Once your list is ready, ask:&lt;br&gt;
“Review these test cases and tell me which important scenarios I’ve missed.”&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you keep your coding skills sharp while using AI?
&lt;/h2&gt;

&lt;p&gt;Code without AI on purpose, regularly. One focused session a week is enough to notice what you can and can’t do on your own:&lt;br&gt;
•Solve one problem with no assistant open.&lt;br&gt;
•Build a small feature without code generation.&lt;br&gt;
•Debug an error using only the docs and your browser’s dev tools.&lt;br&gt;
•Write a common function from memory.&lt;br&gt;
•Rebuild an old project from scratch.&lt;br&gt;
The point isn’t to avoid AI. It’s to make sure you still can work without it when you need to, like in an interview or when a tool gets something subtly wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does a good AI pair programming workflow look like?
&lt;/h2&gt;

&lt;p&gt;1.Understand: Read the task and state the real problem in your own words.&lt;br&gt;
2.Plan: Sketch the steps before writing anything.&lt;br&gt;
3.Attempt: Write a first version yourself, even a rough one.&lt;br&gt;
4.Collaborate: Ask the AI to review it, explain concepts or suggest improvements.&lt;br&gt;
5.Verify: Run it, test edge cases, and read every line you’re keeping.&lt;br&gt;
6.Reflect: Make sure you could explain the final code to someone else.&lt;br&gt;
You stay in charge of the reasoning. The AI speeds up everything around it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bottom line
&lt;/h2&gt;

&lt;p&gt;Ignoring AI tools isn’t a smart move, and handing them every decision isn’t either. The developers who get the most from AI are the ones who question its suggestions, catch its mistakes and still make the technical calls themselves.&lt;br&gt;
So use it to explore new concepts, skip boilerplate and see other approaches, and keep practising the fundamentals: logic, debugging, data structures, algorithms and system design.&lt;br&gt;
A good AI pair programmer helps you write better code. A good developer knows why that code works.&lt;br&gt;
If you’re learning to code and want to build those fundamentals alongside modern tools, Solitaire Infosystems, a software development and IT training company in Mohali, offers practical, project-based training in MERN stack, React JS, Python and other technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Over to you
&lt;/h2&gt;

&lt;p&gt;How does AI fit into your coding day?&lt;br&gt;
•Do you ask it for complete solutions?&lt;br&gt;
•Do you mostly use it for debugging and code review?&lt;br&gt;
•Or do you try the problem yourself before opening an assistant?&lt;br&gt;
Share what works for you in the comments, especially any habits that have kept your skills sharp.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Build a Data Analytics Pipeline with Python, SQL and Power BI (CSV to Dashboard)</title>
      <dc:creator>Neha</dc:creator>
      <pubDate>Fri, 13 Nov 2026 07:59:49 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/build-a-data-analytics-pipeline-with-python-sql-and-power-bi-csv-to-dashboard-1do0</link>
      <guid>https://dev.to/solitaireinfosystems2011/build-a-data-analytics-pipeline-with-python-sql-and-power-bi-csv-to-dashboard-1do0</guid>
      <description>&lt;p&gt;A data analytics pipeline with Python, SQL and Power BI works in three hand-offs: Python (pandas) cleans the raw file, a SQL database such as MySQL stores the clean rows and does the heavy aggregation, and Power BI connects to that database to show the results as a dashboard that refreshes itself. Once it is built, nobody has to open the CSV by hand again.&lt;/p&gt;

&lt;p&gt;This post walks through that end-to-end analytics pipeline using a small sales dataset, with working code for each stage. It also covers the parts most tutorials skip: duplicate loads, a schema that breaks on real orders, and what Power BI actually needs before scheduled refresh will work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the pipeline look like?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sales_data.csv  →  Python (clean + validate)  →  MySQL (store + aggregate)  →  Power BI (dashboard)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each tool has one job:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Job&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Clean&lt;/td&gt;
&lt;td&gt;Python + pandas&lt;/td&gt;
&lt;td&gt;Remove duplicates, fix types, reject bad rows, recalculate revenue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Store&lt;/td&gt;
&lt;td&gt;MySQL&lt;/td&gt;
&lt;td&gt;Keep one trusted copy of the data, block duplicate loads, run aggregations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Show&lt;/td&gt;
&lt;td&gt;Power BI&lt;/td&gt;
&lt;td&gt;KPIs, trends and filters for people who will never write a query&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can swap MySQL for PostgreSQL or SQL Server. The logic stays the same; only the connection string and a few SQL functions change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: How do you clean raw sales data with Python?
&lt;/h2&gt;

&lt;p&gt;Assume the export has these columns: &lt;code&gt;Order_ID&lt;/code&gt;, &lt;code&gt;Order_Date&lt;/code&gt;, &lt;code&gt;Customer_Name&lt;/code&gt;, &lt;code&gt;Product&lt;/code&gt;, &lt;code&gt;Category&lt;/code&gt;, &lt;code&gt;Quantity&lt;/code&gt;, &lt;code&gt;Unit_Price&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Install the three packages you need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install pandas sqlalchemy pymysql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then clean the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sales_data.csv"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isnull&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="nb"&gt;sum&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;# Exact duplicate rows (the same export pulled twice, for example)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;drop_duplicates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Rows we can't use without an order ID or a product&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Order_ID"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Product"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# "Wireless Mouse " and "wireless mouse" should count as one product&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Product"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Product"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&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="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Category"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Category"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;strip&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="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Dates: set the format your export really uses (e.g. "%d-%m-%Y").&lt;/span&gt;
&lt;span class="c1"&gt;# errors="coerce" turns bad values into NaT instead of crashing.&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Order_Date"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Order_Date"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%Y-%m-%d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"coerce"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dropna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Order_Date"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Numbers: reject text, zero and negative values&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Quantity"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_numeric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Quantity"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"coerce"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Unit_Price"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_numeric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Unit_Price"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"coerce"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Quantity"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Unit_Price"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Recalculate revenue instead of trusting a column someone typed into Excel&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Revenue"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Quantity"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Unit_Price"&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="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{len(df)} clean rows ready to load"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines here deserve a second look.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The date format.&lt;/strong&gt; Many exports from Indian billing tools write dates as DD-MM-YYYY. Leave the format out and pandas may guess, so 03-04-2026 can quietly become 4 March instead of 3 April. Your monthly chart will look plausible and still be wrong. Always set &lt;code&gt;format=&lt;/code&gt; explicitly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;.str.title()&lt;/code&gt;&lt;/strong&gt; fixes casing, but it also turns "iPhone" into "Iphone". If your product names include brands like that, map them with a small dictionary instead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why does data cleaning matter so much?
&lt;/h3&gt;

&lt;p&gt;Because every later stage trusts it. Duplicate transactions double-count revenue, broken dates fall out of monthly totals, and "Laptop" and "laptop " show up as two products in your top-5 chart. Power BI will happily draw a polished chart from bad data. Cleaning is where you stop that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: How do you store the cleaned data in SQL without duplicates?
&lt;/h2&gt;

&lt;p&gt;A common first draft uses &lt;code&gt;Order_ID&lt;/code&gt; as the primary key. It breaks on the first real order with two products in it, because both lines share one order ID. Give each row its own ID, and put a unique key on the combination that really identifies a sale line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;DATABASE&lt;/span&gt; &lt;span class="n"&gt;analytics_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;USE&lt;/span&gt; &lt;span class="n"&gt;analytics_db&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;Sale_ID&lt;/span&gt;        &lt;span class="kt"&gt;INT&lt;/span&gt; &lt;span class="no"&gt;AUTO_INCREMENT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Order_ID&lt;/span&gt;       &lt;span class="kt"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Customer_Name&lt;/span&gt;  &lt;span class="kt"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&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;span class="nc"&gt;Product&lt;/span&gt;        &lt;span class="kt"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Category&lt;/span&gt;       &lt;span class="kt"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Order_Date&lt;/span&gt;     &lt;span class="kt"&gt;DATE&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Quantity&lt;/span&gt;       &lt;span class="kt"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Unit_Price&lt;/span&gt;     &lt;span class="kt"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Revenue&lt;/span&gt;        &lt;span class="kt"&gt;DECIMAL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="n"&gt;uq_order_product&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Order_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;idx_order_date&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Order_Date&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;The index on &lt;code&gt;Order_Date&lt;/code&gt; keeps date-range queries fast once the table grows past a few hundred thousand rows.&lt;/p&gt;

&lt;p&gt;Now load from Python. Credentials come from environment variables, never from the script, and rows go into a staging table first so a re-run doesn't crash or double-load:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sqlalchemy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;

&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s2"&gt;"mysql+pymysql"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"DB_USER"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"DB_PASSWORD"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&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;"DB_HOST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"localhost"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"analytics_db"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;create_engine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;cols&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Order_ID"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Customer_Name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Product"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Category"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Order_Date"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Quantity"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Unit_Price"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Revenue"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;col_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cols&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;cols&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_sql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sales_staging"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;if_exists&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"replace"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"INSERT IGNORE INTO sales ({col_list}) SELECT {col_list} FROM sales_staging"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{result.rowcount} new rows loaded"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;INSERT IGNORE&lt;/code&gt; skips any row that would break the unique key, so loading yesterday's file twice adds nothing. If corrected rows should overwrite old ones, use &lt;code&gt;INSERT ... ON DUPLICATE KEY UPDATE&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;URL.create()&lt;/code&gt; also saves you from a classic bug: a password containing &lt;code&gt;@&lt;/code&gt; or &lt;code&gt;#&lt;/code&gt; breaks a hand-built connection string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Which SQL queries turn rows into business metrics?
&lt;/h2&gt;

&lt;p&gt;Let the database do the aggregation. It is faster than pulling every row into Power BI and summing there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monthly revenue and orders&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="no"&gt;DATE_FORMAT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Order_Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'%Y-%m'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Month&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                     &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Total_Revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="nc"&gt;Order_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Orders&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="no"&gt;DATE_FORMAT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Order_Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'%Y-%m'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nc"&gt;Month&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;Top 5 products by revenue&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="nc"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Quantity&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Units_Sold&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Total_Revenue&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nc"&gt;Product&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nc"&gt;Total_Revenue&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;span class="k"&gt;LIMIT&lt;/span&gt; &lt;span class="mi"&gt;5&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;Headline KPIs&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
    &lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                                   &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Total_Revenue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="nc"&gt;Order_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                       &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Total_Orders&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;ROUND&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;SUM&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Revenue&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;DISTINCT&lt;/span&gt; &lt;span class="nc"&gt;Order_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="nc"&gt;Avg_Order_Value&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note &lt;code&gt;COUNT(DISTINCT Order_ID)&lt;/code&gt;, not &lt;code&gt;COUNT(*)&lt;/code&gt;. With one row per product line, &lt;code&gt;COUNT(*)&lt;/code&gt; counts lines, not orders, and your order count comes out inflated.&lt;/p&gt;

&lt;p&gt;If a query becomes a regular report, save it as a view (&lt;code&gt;CREATE VIEW v_monthly_revenue AS ...&lt;/code&gt;). Power BI lists views alongside tables, so your report reads from one agreed definition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: How do you connect MySQL to Power BI?
&lt;/h2&gt;

&lt;p&gt;One prerequisite catches almost everyone: Power BI Desktop needs the &lt;strong&gt;Oracle MySQL Connector/NET&lt;/strong&gt; installed before the MySQL connector will work. Install it first, then restart Power BI.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Power BI Desktop and select &lt;strong&gt;Get data → MySQL database&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Enter the server (for example &lt;code&gt;localhost&lt;/code&gt;) and the database name &lt;code&gt;analytics_db&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Optionally open &lt;strong&gt;Advanced options&lt;/strong&gt; and paste one of the SQL queries above.&lt;/li&gt;
&lt;li&gt;Sign in with a &lt;strong&gt;read-only&lt;/strong&gt; database user, not the account your Python script uses.&lt;/li&gt;
&lt;li&gt;In the Navigator, tick the &lt;code&gt;sales&lt;/code&gt; table and any views.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Transform data&lt;/strong&gt; and check the column types: &lt;code&gt;Order_Date&lt;/code&gt; should be Date, &lt;code&gt;Revenue&lt;/code&gt; should be a decimal number.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Close &amp;amp; Apply&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  What should the dashboard show?
&lt;/h3&gt;

&lt;p&gt;Define the core measures once in DAX so every visual uses the same logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Total Revenue = SUM ( sales[Revenue] )
Total Orders = DISTINCTCOUNT ( sales[Order_ID] )
Avg Order Value = DIVIDE ( [Total Revenue], [Total Orders] )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then build:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cards&lt;/strong&gt; for Total Revenue, Total Orders and Avg Order Value&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A line chart&lt;/strong&gt; of revenue by month&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A bar chart&lt;/strong&gt; of the top products&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A bar chart&lt;/strong&gt; of revenue by category (easier to compare than a pie once you pass four or five categories)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slicers&lt;/strong&gt; for date range and category&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stop there. One page that answers "how are sales doing, and what is driving it?" beats five pages nobody opens. If people keep asking a question the page can't answer, add a visual for it then.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: How do you automate the pipeline?
&lt;/h2&gt;

&lt;p&gt;Turn Steps 1 and 2 into one script (&lt;code&gt;load_sales.py&lt;/code&gt;), add logging, and let the operating system run it on a schedule.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;

&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;basicConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"pipeline.log"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;INFO&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%(asctime)s %(levelname)s %(message)s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# ... cleaning and loading code from Steps 1 and 2 ...&lt;/span&gt;
    &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Loaded %s new rows"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rowcount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Pipeline failed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Linux, a cron entry runs it every morning at 6:00:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0 6 * * * /usr/bin/python3 /opt/pipeline/load_sales.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Windows, Task Scheduler does the same job. Neither is a Python library; they are operating-system schedulers that run your script. Once you have several dependent jobs that need retries and alerts, a workflow tool like Apache Airflow becomes worth its setup cost. For a single daily load, cron is enough.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Power BI side of automation&lt;/strong&gt; happens in the Power BI service, not Desktop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Publish the report from Power BI Desktop.&lt;/li&gt;
&lt;li&gt;If MySQL runs on your own machine or office server, install an &lt;strong&gt;on-premises data gateway&lt;/strong&gt; (standard mode; personal mode isn't supported for MySQL) and install Connector/NET on that gateway machine too. A cloud-hosted MySQL server that Power BI can reach doesn't need a gateway.&lt;/li&gt;
&lt;li&gt;Set a scheduled refresh for a time after your Python job usually finishes, for example 6:30 if the script runs at 6:00. How many refreshes a day you get depends on your Power BI license.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where do these pipelines usually break?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The same file loaded twice.&lt;/strong&gt; Without a unique key, revenue doubles and nobody notices until finance asks. The staging table and unique key from Step 2 prevent it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Silent date errors.&lt;/strong&gt; Day and month swapped, or blanks turned into 1970-01-01. Check the min and max &lt;code&gt;Order_Date&lt;/code&gt; after every load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three definitions of "revenue".&lt;/strong&gt; Python, SQL and Power BI should follow one rule (with or without tax? before or after discount?). Write it down and compute it in one place.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hardcoded passwords.&lt;/strong&gt; They end up in Git, in screenshots and in blog posts. Use environment variables or a secrets manager.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A refresh that fails quietly.&lt;/strong&gt; Turn on refresh-failure email notifications in the Power BI service and read your &lt;code&gt;pipeline.log&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do I need Apache Airflow for this?&lt;/strong&gt;&lt;br&gt;
No. For one daily job, cron or Task Scheduler is simpler and easier to debug. Airflow pays off when you have many dependent tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use PostgreSQL instead of MySQL?&lt;/strong&gt;&lt;br&gt;
Yes. Change the SQLAlchemy driver (for example &lt;code&gt;postgresql+psycopg2&lt;/code&gt;), use PostgreSQL's date functions in your queries, and pick the PostgreSQL connector in Power BI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Power BI free?&lt;/strong&gt;&lt;br&gt;
Power BI Desktop is a free download, so you can build this whole project at no cost. Publishing and sharing reports with other people in the Power BI service generally needs a paid license.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is this a good portfolio project?&lt;/strong&gt;&lt;br&gt;
It is a solid one, because it shows the full workflow rather than just a chart. Put the code on GitHub, add a screenshot of the dashboard, and explain one data-quality problem you found and how you fixed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What would you add?
&lt;/h2&gt;

&lt;p&gt;A cloud data warehouse? dbt for the SQL layer? A forecasting model on top of the monthly revenue? Tell me in the comments how you would extend this pipeline.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written by the team at &lt;a href="https://www.solitaireinfosystems.com" rel="noopener noreferrer"&gt;Solitaire Infosystems&lt;/a&gt;, a software development and IT training company in Mohali, Punjab, that runs job-oriented programs in Python, ML/AI and other technologies, along with industrial training and internships.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>sql</category>
      <category>powerbi</category>
      <category>dataengineering</category>
    </item>
    <item>
      <title>5 Data Structure Mistakes Freshers Make in Production Code (and How to Fix Them)</title>
      <dc:creator>Nupur</dc:creator>
      <pubDate>Thu, 12 Nov 2026 11:10:05 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/5-data-structure-mistakes-freshers-make-in-production-code-and-how-to-fix-them-20ll</link>
      <guid>https://dev.to/solitaireinfosystems2011/5-data-structure-mistakes-freshers-make-in-production-code-and-how-to-fix-them-20ll</guid>
      <description>&lt;p&gt;The data structure mistakes freshers make most often in production code are: using arrays for every lookup, ignoring time complexity, picking a structure that's slow at the operation you run most, copying large data inside loops, and skipping edge cases (including memory that never gets released). None of them show up in a 10-row test. All of them show up when real users arrive.&lt;br&gt;
A useful way to think about it: choosing a data structure is choosing which operations will be cheap. Pick it for the operation your code runs most often, not for the one you learned first.&lt;/p&gt;
&lt;h2&gt;
  
  
  Data structure mistakes at a glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mistake&lt;/th&gt;
&lt;th&gt;What breaks&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Arrays for repeated lookups&lt;/td&gt;
&lt;td&gt;Every lookup scans the list&lt;/td&gt;
&lt;td&gt;Index once with a &lt;code&gt;Map&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ignoring time complexity&lt;/td&gt;
&lt;td&gt;Hidden nested loops at scale&lt;/td&gt;
&lt;td&gt;Use a &lt;code&gt;Set&lt;/code&gt;, test with big data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrong structure for the main operation&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;shift()&lt;/code&gt; on long queues&lt;/td&gt;
&lt;td&gt;Use a real queue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Copying inside loops&lt;/td&gt;
&lt;td&gt;O(n²) time and memory churn&lt;/td&gt;
&lt;td&gt;Copy once, or not at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skipping edge cases&lt;/td&gt;
&lt;td&gt;Crashes, leaks in long-running servers&lt;/td&gt;
&lt;td&gt;Guard inputs, bound caches&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h2&gt;
  
  
  1. Why is an array the wrong choice for frequent lookups?
&lt;/h2&gt;

&lt;p&gt;Arrays are the first structure most of us learn, so they become the default for everything. Here's a typical user lookup:&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="n"&gt;users&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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;101&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Aman"&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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;102&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Priya"&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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;103&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Rahul"&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="c1"&gt;// O(n): may check every user before finding a match&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;103&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;Run once, this is fine. Run inside a request handler, or for every item in another list, and you're scanning the whole array again and again. Build an index once instead:&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;// Build once: O(n)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;usersById&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&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="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&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="c1"&gt;// Each lookup: O(1) on average&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;usersById&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="mi"&gt;103&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;Notice the &lt;code&gt;Map&lt;/code&gt; stores the whole user object, not just the name. Indexing by ID shouldn't cost you the rest of the record.&lt;br&gt;
How to avoid it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before choosing, ask how the data will be read: in order, by position, or by key.&lt;/li&gt;
&lt;li&gt;Use arrays for ordered data you loop over or access by index.&lt;/li&gt;
&lt;li&gt;Use a &lt;code&gt;Map&lt;/code&gt; when you look things up by key more than a handful of times.&lt;/li&gt;
&lt;li&gt;If the data changes, update the &lt;code&gt;Map&lt;/code&gt; along with the array, or keep only the &lt;code&gt;Map&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2. How does ignoring time complexity slow down your code?
&lt;/h2&gt;

&lt;p&gt;A function can be instant with 10 records and painfully slow with 100,000. Usually the cause is a loop you didn't notice you wrote.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;hasCommonElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arr2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;arr1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&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="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;true&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="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&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;code&gt;includes()&lt;/code&gt; is itself a loop. So this is a nested loop, O(n × m) in the worst case. With 10,000 items in each array, that's up to 100 million comparisons.&lt;br&gt;
A &lt;code&gt;Set&lt;/code&gt; turns the inner search into a constant-time check on average:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;hasCommonElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;arr2&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="n"&gt;lookup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arr2&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="n"&gt;arr1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;lookup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's O(n + m) on average. You can see the difference yourself with fake data:&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="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100_000&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="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;i&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="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;100_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// no overlap: worst case&lt;/span&gt;

&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;time&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hasCommonElement"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;hasCommonElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeEnd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hasCommonElement"&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;How to avoid it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Know which built-in methods loop internally: &lt;code&gt;includes&lt;/code&gt;, &lt;code&gt;indexOf&lt;/code&gt;, &lt;code&gt;find&lt;/code&gt;, &lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;splice&lt;/code&gt; and &lt;code&gt;shift&lt;/code&gt; are all O(n).&lt;/li&gt;
&lt;li&gt;Look for hidden nesting, such as &lt;code&gt;.includes()&lt;/code&gt; inside &lt;code&gt;.map()&lt;/code&gt; or &lt;code&gt;.filter()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Test with realistic sizes. Generating 100,000 fake records takes one line.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Which data structure should you use for the operations you run most?
&lt;/h2&gt;

&lt;p&gt;Every structure is fast at some operations and slow at others. A quick reference for JavaScript:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;You need&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;th&gt;Watch out for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Access by position&lt;/td&gt;
&lt;td&gt;Array&lt;/td&gt;
&lt;td&gt;Inserting or deleting in the middle is O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Last in, first out&lt;/td&gt;
&lt;td&gt;Array with &lt;code&gt;push&lt;/code&gt;/&lt;code&gt;pop&lt;/code&gt; (stack)&lt;/td&gt;
&lt;td&gt;Nothing major; both are fast&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First in, first out&lt;/td&gt;
&lt;td&gt;A queue&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;array.shift()&lt;/code&gt; is O(n)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unique values&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Set&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Objects are compared by reference, not content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lookup by key&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Map&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Plain objects turn every key into a string&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The queue case catches a lot of freshers. A job processor that handles tasks in arrival order often looks 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="c1"&gt;// Each shift() moves every remaining element down one slot&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;processJob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shift&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a few hundred jobs it rarely matters. For a long-running worker with a big backlog, it does. A small queue that moves a pointer instead of the elements:&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="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Queue&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  #&lt;span class="n"&gt;items&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="p"&gt;;&lt;/span&gt;
  #&lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;enqueue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&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="n"&gt;item&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="nf"&gt;dequeue&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// let the old item be garbage-collected&lt;/span&gt;
    &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Compact now and then so the array doesn't grow forever&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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="n"&gt;item&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="nf"&gt;size&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="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;#&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before picking a structure, ask:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Do I need fast lookups by key?&lt;/li&gt;
&lt;li&gt;Will I insert or delete often, and where: start, middle or end?&lt;/li&gt;
&lt;li&gt;Does order of processing matter?&lt;/li&gt;
&lt;li&gt;Do values need to be unique?&lt;/li&gt;
&lt;li&gt;How large can this data realistically get?&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  4. When does copying data become a performance problem?
&lt;/h2&gt;

&lt;p&gt;Copying an array once is fine:&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="n"&gt;updatedUsers&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newUser&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 problem is copying inside a loop. This pattern looks clean and shows up in a lot of fresher code:&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;// Copies the whole accumulator on every pass: O(n²)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;activeUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&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="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;acc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;acc&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="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;With 50,000 users, that's tens of thousands of ever-larger arrays created and thrown away. The fix is shorter:&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="n"&gt;activeUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;active&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 same trap exists for objects. &lt;code&gt;{ ...acc, [u.id]: u }&lt;/code&gt; inside &lt;code&gt;reduce&lt;/code&gt; is also O(n²). Use &lt;code&gt;Object.fromEntries()&lt;/code&gt; or a &lt;code&gt;Map&lt;/code&gt; instead.&lt;br&gt;
Also worth knowing: spread makes a shallow copy. Nested objects are shared, so changing &lt;code&gt;copy[0].name&lt;/code&gt; changes the original too. &lt;code&gt;structuredClone()&lt;/code&gt; makes a deep copy, but it's expensive, so use it when you actually need independent nested data.&lt;br&gt;
How to avoid it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never spread an accumulator inside &lt;code&gt;reduce&lt;/code&gt;, &lt;code&gt;map&lt;/code&gt; or a loop.&lt;/li&gt;
&lt;li&gt;Keep immutable updates in UI state (React, Redux), but copy once per update, not once per item.&lt;/li&gt;
&lt;li&gt;When something feels slow, profile it in Chrome DevTools before guessing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  5. What edge cases break code in production?
&lt;/h2&gt;

&lt;p&gt;Test data is usually tidy. Production data isn't: empty lists, missing fields, duplicates, the wrong types.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getFirstUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;users&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="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&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;Pass an empty array and this throws, because &lt;code&gt;users[0]&lt;/code&gt; is &lt;code&gt;undefined&lt;/code&gt;. A safer version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getFirstUserName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&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;It returns &lt;code&gt;null&lt;/code&gt; rather than a string like &lt;code&gt;"No user found"&lt;/code&gt;. A placeholder string can end up rendered or saved as if it were a real name. Return "nothing" and let the caller decide what to show.&lt;br&gt;
Inputs worth testing every time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An empty array, &lt;code&gt;null&lt;/code&gt; and &lt;code&gt;undefined&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Exactly one item&lt;/li&gt;
&lt;li&gt;Duplicate values&lt;/li&gt;
&lt;li&gt;A very large input&lt;/li&gt;
&lt;li&gt;The wrong type, such as the string &lt;code&gt;"103"&lt;/code&gt; instead of the number &lt;code&gt;103&lt;/code&gt;. This one also bites &lt;code&gt;Map&lt;/code&gt; users: &lt;code&gt;usersById.get("103")&lt;/code&gt; won't find the key &lt;code&gt;103&lt;/code&gt;.
Memory is the other half. This cache looks harmless:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;profileCache&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&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;function&lt;/span&gt; &lt;span class="nf"&gt;getUserProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;profileCache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&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="n"&gt;profileCache&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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;loadProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&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="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;profileCache&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="n"&gt;id&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;In a Node.js server that runs for weeks, it grows with every new ID and never shrinks. Give it a limit. A &lt;code&gt;Map&lt;/code&gt; remembers insertion order, so the first key is always the oldest:&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="no"&gt;MAX_ENTRIES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&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;cacheProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profileCache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="no"&gt;MAX_ENTRIES&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="n"&gt;oldestKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;profileCache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&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="nf"&gt;next&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="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;profileCache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oldestKey&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="n"&gt;profileCache&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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;profile&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;If your keys are objects whose lifetime you don't control, a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap" rel="noopener noreferrer"&gt;WeakMap&lt;/a&gt; lets entries disappear once nothing else references the key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do these mistakes reach production?
&lt;/h2&gt;

&lt;p&gt;The pattern behind all five is the same: the code was only ever run on data the developer typed in by hand. Definitions and Big O tables are easy to memorise. Noticing a hidden loop in your own pull request is a different skill, and it mostly comes from writing real features and having someone review them.&lt;br&gt;
Solitaire Infosystems is a software development and IT training company in Mohali that runs job-oriented training in MERN stack, React JS, Python and other technologies, along with 6-week and 6-month industrial training and stipend-based internships. If you're in Mohali, Chandigarh or the wider Tricity and want guided practice on real projects, you can &lt;a href="https://www.solitaireinfosystems.com" rel="noopener noreferrer"&gt;see the current programs at Solitaire Infosystems&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is the most common data structure mistake beginners make?&lt;/strong&gt;&lt;br&gt;
Using an array for repeated lookups by ID or key. Each &lt;code&gt;find()&lt;/code&gt; scans the list, so the cost grows with your data. A &lt;code&gt;Map&lt;/code&gt; built once gives average O(1) lookups.&lt;br&gt;
&lt;strong&gt;Is a Map faster than a plain object in JavaScript?&lt;/strong&gt;&lt;br&gt;
For data where keys are added and removed often, or keys aren't strings, &lt;code&gt;Map&lt;/code&gt; is usually the better fit. For a fixed shape like a config object, a plain object is fine.&lt;br&gt;
&lt;strong&gt;Do I need to learn every data structure before my first developer job?&lt;/strong&gt;&lt;br&gt;
No. Arrays, &lt;code&gt;Map&lt;/code&gt;, &lt;code&gt;Set&lt;/code&gt;, stacks, queues and basic Big O cover most day-to-day decisions in web development. Trees and graphs matter for specific problems and for interviews.&lt;br&gt;
&lt;strong&gt;How do I check if my JavaScript code is slow?&lt;/strong&gt;&lt;br&gt;
Use &lt;code&gt;console.time()&lt;/code&gt; for a rough number, and the Performance and Memory tabs in Chrome DevTools (or &lt;code&gt;node --inspect&lt;/code&gt;) when you need to see where the time or memory actually goes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;Code that works with ten records has passed the first test, not the last one. Good developers write code that works. Better developers know how it behaves when the data grows.&lt;br&gt;
Which of these have you shipped to production? Tell me in the comments, along with the one that took you longest to find.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>datastructures</category>
    </item>
    <item>
      <title>5 Semantic HTML Tags You're Probably Replacing With a Div (and Why Screen Readers Care)</title>
      <dc:creator>Neha</dc:creator>
      <pubDate>Tue, 03 Nov 2026 07:31:48 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/5-semantic-html-tags-youre-probably-replacing-with-a-div-and-why-screen-readers-care-e89</link>
      <guid>https://dev.to/solitaireinfosystems2011/5-semantic-html-tags-youre-probably-replacing-with-a-div-and-why-screen-readers-care-e89</guid>
      <description>&lt;p&gt;Semantic HTML tags describe what a piece of content &lt;em&gt;is&lt;/em&gt;, not how it looks. Swap &lt;code&gt;&amp;lt;div class="navigation"&amp;gt;&lt;/code&gt; for &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; and nothing changes on screen, but a screen reader user can now jump straight to your menu with one keystroke.&lt;/p&gt;

&lt;p&gt;Five semantic HTML tags do most of that work: &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt;. Below is what each one means, a before/after for each, and the mistakes that show up most often in beginner code reviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick reference
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tag&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;th&gt;How screen readers see it&lt;/th&gt;
&lt;th&gt;Typical use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The page's primary content&lt;/td&gt;
&lt;td&gt;Main landmark&lt;/td&gt;
&lt;td&gt;Everything unique to this page (once per page)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A major block of navigation links&lt;/td&gt;
&lt;td&gt;Navigation landmark&lt;/td&gt;
&lt;td&gt;Site menu, breadcrumbs, table of contents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A self-contained piece of content&lt;/td&gt;
&lt;td&gt;Article (not a landmark)&lt;/td&gt;
&lt;td&gt;Blog post, product card, comment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A themed group with a heading&lt;/td&gt;
&lt;td&gt;Region landmark, only when it has an accessible name&lt;/td&gt;
&lt;td&gt;Parts of a long page&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Related but non-essential content&lt;/td&gt;
&lt;td&gt;Complementary landmark (when top-level)&lt;/td&gt;
&lt;td&gt;Sidebar, related links, callouts&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt;: where the real page starts
&lt;/h2&gt;

&lt;p&gt;Every page repeats the same header, logo and menu. Sighted users skip past them without thinking. Screen reader users can't, unless the HTML tells the browser where the actual content begins.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"main-content"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to Our Website&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Learn more about our services.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- After --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;main&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to Our Website&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Learn more about our services.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; in place, NVDA, JAWS and VoiceOver list it as a landmark users can jump to directly. It's also the natural target for a "Skip to content" link.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule of thumb:&lt;/strong&gt; one visible &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; per page, and never nested inside &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;: a menu that announces itself
&lt;/h2&gt;

&lt;p&gt;A row of links inside a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; works fine visually. To a screen reader it's just a few links, with nothing to say "this is the site menu".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"navigation"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/contact"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Contact&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- After --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;nav&lt;/span&gt; &lt;span class="na"&gt;aria-label=&lt;/span&gt;&lt;span class="s"&gt;"Main"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/about"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;About&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/contact"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Contact&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/nav&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two small details in the "after" version are worth copying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The label is "Main", not "Main navigation".&lt;/strong&gt; Screen readers already announce the role, so &lt;code&gt;aria-label="Main navigation"&lt;/code&gt; gets read out as "Main navigation navigation".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The links sit in a list.&lt;/strong&gt; Users hear "list, 3 items" before they start, so they know how long the menu is.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The label matters most when a page has more than one &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; (header menu, footer links, breadcrumbs). Give each a different label so users can tell them apart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common mistake:&lt;/strong&gt; wrapping every group of links in &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;. A row of social icons or a single "Read more" link doesn't need it. Keep it for major navigation blocks.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;: content that stands on its own
&lt;/h2&gt;

&lt;p&gt;A useful test: if you lifted this block out and dropped it into an RSS feed or another page, would it still make sense? If yes, it's probably an &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;. That covers blog posts, news stories, forum posts, product cards and individual comments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"blog-post"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Understanding JavaScript&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;JavaScript is a popular programming language...&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- After --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Understanding JavaScript&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;JavaScript is a popular programming language...&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; is not a landmark, so it won't appear in a screen reader's landmark list. Its value is structure: each post gets a clear boundary, and the heading inside it becomes the starting point. On a blog listing page with ten posts, that makes skimming much easier.&lt;/p&gt;

&lt;p&gt;Articles can also nest. Comments on a blog post can each be an &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; inside the post's own &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;: a themed chunk with a heading
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; groups content around one topic. A course page, for example, might have sections for Overview, Curriculum, Eligibility and FAQs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"course-details"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Course Details&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Learn the fundamentals of web development.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- After --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;aria-labelledby=&lt;/span&gt;&lt;span class="s"&gt;"course-details-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"course-details-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Course Details&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Learn the fundamentals of web development.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's the part most tutorials skip: &lt;strong&gt;a &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; without an accessible name is treated much like a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; by assistive technology.&lt;/strong&gt; Connect it to its heading with &lt;code&gt;aria-labelledby&lt;/code&gt; and it becomes a named region landmark users can navigate to.&lt;/p&gt;

&lt;p&gt;Don't do this for every section, though. Too many landmarks make the list noisy. Name the sections someone would actually want to jump to, and if you only need a wrapper for styling or a grid, use a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;. That's what it's for.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt;: related, but not the main point
&lt;/h2&gt;

&lt;p&gt;Related posts, author bios, ads, glossary callouts: content connected to the page that could be removed without breaking it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"sidebar"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Related Articles&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/html-basics"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;HTML Basics&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/css-fundamentals"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;CSS Fundamentals&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/javascript-guide"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;JavaScript Guide&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- After --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;aside&lt;/span&gt; &lt;span class="na"&gt;aria-labelledby=&lt;/span&gt;&lt;span class="s"&gt;"related-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"related-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Related Articles&lt;span class="nt"&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/html-basics"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;HTML Basics&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/css-fundamentals"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;CSS Fundamentals&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/javascript-guide"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;JavaScript Guide&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/aside&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A top-level &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt; is exposed as a complementary landmark. The choice is about meaning, not position: a left-hand column holding your site menu is a &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, not an &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt;, while a pull quote in the middle of an article can be one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why screen readers care
&lt;/h2&gt;

&lt;p&gt;A screen reader doesn't see your layout. It reads the accessibility tree the browser builds from your HTML, and semantic tags fill that tree with roles: main, navigation, article, region, complementary. Users rely on those roles to skim a page the way sighted users scan it, jumping between landmarks and headings instead of listening to everything from the top.&lt;/p&gt;

&lt;p&gt;Build the same page entirely from &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s and you'd have to add &lt;code&gt;role="main"&lt;/code&gt;, &lt;code&gt;role="navigation"&lt;/code&gt; and the rest by hand. The W3C's &lt;a href="https://www.w3.org/TR/using-aria/#rule1" rel="noopener noreferrer"&gt;first rule of ARIA use&lt;/a&gt; is to reach for a native HTML element whenever one exists.&lt;/p&gt;

&lt;p&gt;One honest caveat: semantic tags don't make a site accessible on their own. Heading order, descriptive link text, form labels, alt text, keyboard support and color contrast still matter just as much.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to check your own page
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chrome DevTools:&lt;/strong&gt; Elements panel → Accessibility pane. Turn on the full-page accessibility tree to see every role the browser exposes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NVDA (Windows, free):&lt;/strong&gt; press &lt;code&gt;D&lt;/code&gt; to cycle through landmarks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VoiceOver (Mac):&lt;/strong&gt; open the rotor with &lt;code&gt;VO + U&lt;/code&gt; and choose Landmarks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Five minutes with any of these will show you exactly what a screen reader user hears.&lt;/p&gt;

&lt;h2&gt;
  
  
  Semantic HTML checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;One &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; per page, wrapping the content unique to that page&lt;/li&gt;
&lt;li&gt;Major link groups in &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;, each with its own label if there's more than one&lt;/li&gt;
&lt;li&gt;Self-contained content (posts, cards, comments) in &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; only for themed groups with a heading, named with &lt;code&gt;aria-labelledby&lt;/code&gt; when users need to jump to it&lt;/li&gt;
&lt;li&gt;Tangential content in &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt;, chosen for meaning rather than position&lt;/li&gt;
&lt;li&gt;Headings in order (h1 → h2 → h3, no skipped levels)&lt;/li&gt;
&lt;li&gt;Native elements before ARIA roles&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; kept for layout and styling wrappers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these tags change how your page looks. They change how it's understood: by screen readers, by search engines, and by the next developer who opens your code.&lt;/p&gt;

&lt;p&gt;Which of these five do you forget most often? And if you've ever tested your own site with a screen reader, what surprised you? Tell us in the comments.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written by the web development team at Solitaire Infosystems, an IT training and software development company in Mohali, Punjab. HTML, accessibility and front-end fundamentals are part of our &lt;a href="https://dev.to[ADD:%20Solitaire%20web%20designing%20/%20web%20development%20course%20page%20URL]"&gt;web development training&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>a11y</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Dockerize a Multi-Tier Application with Docker Compose</title>
      <dc:creator>Tamana</dc:creator>
      <pubDate>Thu, 29 Oct 2026 10:22:56 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/how-to-dockerize-a-multi-tier-application-with-docker-compose-508n</link>
      <guid>https://dev.to/solitaireinfosystems2011/how-to-dockerize-a-multi-tier-application-with-docker-compose-508n</guid>
      <description>&lt;p&gt;To dockerize a multi-tier application, give each tier its own container, which here means a frontend, a backend and a database, and use Docker Compose to start them together on one private network. The services find each other by service name, the database keeps its data in a named volume, and only the frontend is exposed to your machine.&lt;/p&gt;

&lt;p&gt;That's the short version. The long version is where most beginners get stuck: the API that works on the laptop but not in a container, the database that loses everything after docker compose down -v, the React app that can't find the backend. This guide builds a small React + Node.js + PostgreSQL setup and covers those problems as they come up.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does a multi-tier application look like in Docker?
&lt;/h2&gt;

&lt;p&gt;A three-tier web app has three parts:&lt;/p&gt;

&lt;p&gt;• &lt;strong&gt;Frontend:&lt;/strong&gt; the user interface (React here), built into static files and served by Nginx.&lt;br&gt;
• &lt;strong&gt;Backend:&lt;/strong&gt; the API and business logic (Node.js).&lt;br&gt;
• &lt;strong&gt;Database:&lt;/strong&gt; where the data lives (PostgreSQL).&lt;br&gt;
Each one runs in its own container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser
   |
   v
Frontend (Nginx serving React)  --/api--&amp;gt;  Backend (Node.js)  --&amp;gt;  Database (PostgreSQL)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separate containers mean separate dependencies. You can rebuild the backend without touching the database, read one service's logs without the other two, and swap PostgreSQL versions without reinstalling anything on your machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  How should you structure the project?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-app/
├── frontend/
│   ├── Dockerfile
│   ├── .dockerignore
│   ├── nginx.conf
│   ├── package.json
│   └── src/
├── backend/
│   ├── Dockerfile
│   ├── .dockerignore
│   ├── package.json
│   └── server.js
├── compose.yaml
├── .env            # local only, never committed
└── .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note where the .dockerignore files are. Docker reads .dockerignore from the root of the build context, and since Compose builds from ./frontend and ./backend, each folder needs its own. A single file at the project root would be ignored.&lt;/p&gt;

&lt;p&gt;The database uses the official postgres image, so it doesn't need a Dockerfile.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Writing the backend Dockerfile&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In backend/Dockerfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:24-alpine&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; NODE_ENV=production&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm ci &lt;span class="nt"&gt;--omit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;dev

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;USER&lt;/span&gt;&lt;span class="s"&gt; node&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["node", "server.js"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Line by line:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;• FROM node:24-alpine uses a small image with a pinned Node.js major version.&lt;br&gt;
• ENV NODE_ENV=production comes before the install, and npm ci --omit=dev keeps test and build tools out of the final image.&lt;br&gt;
• Copying package*.json first means Docker caches the dependency layer. Edit server.js and the rebuild skips npm ci.&lt;br&gt;
• USER node runs the app as the non-root user the Node image already includes. The code stays owned by root, so the app can read it but can't modify it. If your app writes files, such as uploads, give it one writable directory.&lt;br&gt;
• EXPOSE 3000 is documentation only. It doesn't publish anything to your machine.&lt;br&gt;
One thing to check in server.js: the server must listen on 0.0.0.0, not 127.0.0.1 or localhost. Inside a container, localhost means only that container, so nothing else can reach it.&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;0.0.0.0&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="o"&gt;=&amp;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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;API on 3000&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;Writing the frontend Dockerfile (multi-stage)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React compiles to static files, so you don't need Node.js at runtime. A multi-stage build does the build with Node and ships only the output with Nginx.&lt;br&gt;
In frontend/Dockerfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:24-alpine&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;build&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm ci
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm run build

&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; nginx:stable-alpine&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; nginx.conf /etc/nginx/conf.d/default.conf&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build /app/dist /usr/share/nginx/html&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 80&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This assumes a Vite project, which outputs to dist. Create React App outputs to build, so change the path if that's what you use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting the browser to reach the backend&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This catches almost everyone. Your React code runs in the user's browser, not inside the frontend container. So fetch('&lt;a href="http://backend:3000'" rel="noopener noreferrer"&gt;http://backend:3000'&lt;/a&gt;) fails because the browser has never heard of backend, and localhost:3000 fails because the backend port isn't published.&lt;/p&gt;

&lt;p&gt;The clean fix is to let Nginx serve the app and forward API calls. In frontend/nginx.conf:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="n"&gt;/usr/share/nginx/html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;index&lt;/span&gt; &lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;# Forward API requests to the backend container&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/api/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://backend:3000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;# Send unknown routes to React so client-side routing works&lt;/span&gt;
    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;try_files&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt; &lt;span class="nv"&gt;$uri&lt;/span&gt;&lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="n"&gt;/index.html&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;Now the frontend calls fetch('/api/users'), with no host and no port. Nginx runs inside the Compose network, where backend resolves, and passes the request on with the /api prefix intact, so define your Express routes under /api. There's no CORS setup because everything is same-origin, and the backend never needs a public port.&lt;/p&gt;

&lt;h2&gt;
  
  
  Connecting the tiers with Docker Compose
&lt;/h2&gt;

&lt;p&gt;In compose.yaml at the project root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;frontend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./frontend&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8080:80"&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;backend&lt;/span&gt;

  &lt;span class="na"&gt;backend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./backend&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;NODE_ENV&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;production&lt;/span&gt;
      &lt;span class="na"&gt;DATABASE_URL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres://appuser:${DB_PASSWORD:?Set DB_PASSWORD}@db:5432/appdb&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;db&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;service_healthy&lt;/span&gt;

  &lt;span class="na"&gt;db&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:16&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;appuser&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${DB_PASSWORD:?Set DB_PASSWORD}&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_DB&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;appdb&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;postgres_data:/var/lib/postgresql/data&lt;/span&gt;
    &lt;span class="na"&gt;healthcheck&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CMD-SHELL"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pg_isready&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-U&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;appuser&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-d&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;appdb"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;5s&lt;/span&gt;
      &lt;span class="na"&gt;timeout&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;3s&lt;/span&gt;
      &lt;span class="na"&gt;retries&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;postgres_data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put the password in a .env file next to compose.yaml. Compose reads it automatically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# .env  (add this file to .gitignore)&lt;/span&gt;
&lt;span class="nv"&gt;DB_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;use-a-long-random-local-password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The :?Set DB_PASSWORD part makes Compose stop with a clear error if the variable is missing, rather than starting PostgreSQL with an empty password.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's going on in this file:
&lt;/h2&gt;

&lt;p&gt;• &lt;strong&gt;Service names are hostnames.&lt;/strong&gt; The backend reaches PostgreSQL at db:5432. Compose puts all three services on a shared network with built-in DNS.&lt;br&gt;
• &lt;strong&gt;Only one port is published.&lt;/strong&gt; 8080:80 makes the frontend available at localhost:8080. The backend and database are reachable by other containers on the network, but not from your machine or the internet.&lt;br&gt;
• &lt;strong&gt;The health check controls startup order. condition&lt;/strong&gt;: service_healthy makes the backend wait until PostgreSQL accepts connections, not just until its container starts. Your app should still retry if the database drops later, because the health check only covers startup.&lt;br&gt;
• &lt;strong&gt;The named volume keeps your data.&lt;/strong&gt; The database files live in postgres_data, outside the container, so you can remove and recreate the container without losing them.&lt;/p&gt;
&lt;h2&gt;
  
  
  Docker best practices beginners should follow
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Keep secrets out of images and Git&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Never put passwords or API keys in a Dockerfile. Anything written there ends up in the image layers, where anyone with the image can read it. A gitignored .env file is fine for local development. In production, use your platform's secret manager or Docker secrets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ignore what the image doesn't need&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A typical backend/.dockerignore:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
npm-debug.log
.git
.env
coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Excluding node_modules matters more than it looks. Copying your laptop's modules into a Linux Alpine image can break native packages such as bcrypt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pin versions, then update them on purpose&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;node:24-alpine and postgres:16 are pinned to a major version. latest is not. Combined with package-lock.json and npm ci, everyone builds the same thing. Pinning isn't a reason to stop updating, though. Rebuild regularly to pick up security patches, and run an image scanner such as docker scout before anything goes to production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choose small images, but not only for size&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Alpine-based images are small and fast to pull. They use musl instead of glibc, though, and some native Node packages behave differently there. If something odd fails on Alpine, try node:24-slim before spending an afternoon debugging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Don't run as root&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If an attacker gets into a process running as root, they have far more room to cause damage. USER node costs one line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Volumes aren't backups&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A named volume survives container restarts. It doesn't survive docker compose down -v, a deleted volume or a failed disk. For data you care about, schedule pg_dump backups and test restoring one at least once.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you run and test it?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker compose up &lt;span class="nt"&gt;--build&lt;/span&gt;        &lt;span class="c"&gt;# build images and start everything&lt;/span&gt;
docker compose ps                &lt;span class="c"&gt;# check status and health&lt;/span&gt;
docker compose logs &lt;span class="nt"&gt;-f&lt;/span&gt; backend   &lt;span class="c"&gt;# follow one service's logs&lt;/span&gt;
docker compose down              &lt;span class="c"&gt;# stop and remove containers and network&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;a href="http://localhost:8080" rel="noopener noreferrer"&gt;http://localhost:8080&lt;/a&gt; in your browser.&lt;br&gt;
docker compose down keeps the postgres_data volume. docker compose down -v deletes it along with your database. That one flag accounts for a lot of "my data disappeared" posts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common problems and how to fix them
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The backend can't connect to PostgreSQL&lt;/strong&gt;&lt;br&gt;
Check that DATABASE_URL uses db as the host, not localhost. Then run docker compose logs db. A wrong password or database name shows up there straight away. If you changed POSTGRES_PASSWORD after the first run, the old password is still in effect, because PostgreSQL only reads those variables when the volume is empty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A container exits immediately&lt;/strong&gt;&lt;br&gt;
docker compose ps shows the exit code and docker compose logs  shows why. The usual causes are a missing dependency, a typo in CMD, or a crash on startup because an environment variable isn't set.&lt;br&gt;
Other containers can't reach the backend&lt;br&gt;
Your server is probably listening on 127.0.0.1. Bind it to 0.0.0.0.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;de changes don't show up&lt;/strong&gt;&lt;br&gt;
Your code is baked into the image at build time, so run docker compose up --build after changes. For day-to-day development, look into docker compose watch or a bind mount so you don't rebuild on every save.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The frontend gets 404 or CORS errors calling the API&lt;/strong&gt;&lt;br&gt;
Work out where the request comes from. Calls from the browser need the /api proxy above. Calls between containers use service names. Mixing the two up causes most of these errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Database data disappeared&lt;/strong&gt;&lt;br&gt;
Check whether someone ran down -v, or whether the volume name changed. Renaming the project folder changes the default project name, and with it the volume name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do I need Kubernetes to run a multi-tier app in containers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;No. Docker Compose handles a frontend, backend and database on one machine, which covers local development, demos and plenty of small deployments. Kubernetes is for running and scaling containers across many machines. Learn Compose first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should the database run in Docker in production?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It can, with a persistent volume, backups and monitoring. Many teams use a managed database service in production instead and keep the PostgreSQL container for local development, which gives every developer the same version without installing anything.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's the difference between EXPOSE and ports?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;EXPOSE in a Dockerfile only documents which port the app uses. ports in Compose actually publishes a container port on your machine. Containers on the same Compose network can reach each other either way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to go from here
&lt;/h2&gt;

&lt;p&gt;Get this three-container setup running, break it on purpose (stop the database, use a wrong hostname, delete the volume), and read the logs each time. Docker makes far more sense once you've debugged it than when you've only read about it.&lt;/p&gt;

&lt;p&gt;Solitaire Infosystems is an IT training and internship company in Mohali, and Docker setups like this one come up regularly in the projects learners build during our 6-month industrial training and internship programmes.You can see the current programmes at &lt;a href="https://solitaireinfosystems.com/" rel="noopener noreferrer"&gt;Solitaire Infosystems&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Over to you:&lt;/strong&gt; what tripped you up most when you started with Docker: networking, Dockerfiles, volumes, or reading container logs?&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Traditional Machine Learning vs Generative AI: One Predicts, the Other Creates</title>
      <dc:creator>Tamana</dc:creator>
      <pubDate>Wed, 28 Oct 2026 11:57:52 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/traditional-machine-learning-vs-generative-ai-one-predicts-the-other-creates-k36</link>
      <guid>https://dev.to/solitaireinfosystems2011/traditional-machine-learning-vs-generative-ai-one-predicts-the-other-creates-k36</guid>
      <description>&lt;p&gt;Traditional machine learning learns from past data to predict an outcome: a category, a probability, a score or a number. Generative AI learns patterns from large amounts of data and produces new content: text, code, images or audio. One answers "what is likely to happen?" The other answers "what should this look like?"&lt;/p&gt;

&lt;p&gt;Picture two features in the same subscription app. One flags customers who are likely to cancel. The other writes a personalized message to win them back. Both get called "AI", but they are built, tested and maintained in very different ways.&lt;/p&gt;

&lt;p&gt;If you're learning Python or deciding what to study next, that difference matters more than which one is trending this month. Below you'll find a short Python example of each, a side-by-side comparison, a way to decide between them, and a practical learning order.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is traditional machine learning?
&lt;/h2&gt;

&lt;p&gt;Traditional machine learning (ML) trains a model on historical examples so it can make predictions about new data. Instead of hand-writing a rule for every situation, you show the model enough past cases and let it learn the relationships.&lt;br&gt;
Say an online store wants to know whether a visitor will buy. Its dataset might include:&lt;br&gt;
• Previous purchases&lt;br&gt;
• Time spent on the site&lt;br&gt;
• Number of products viewed&lt;br&gt;
• Cart activity&lt;br&gt;
• How often the customer orders&lt;/p&gt;

&lt;p&gt;A trained model uses these features to estimate the probability of a purchase. The same idea powers:&lt;br&gt;
• Spam filtering&lt;br&gt;
• Fraud detection&lt;br&gt;
• Customer churn prediction&lt;br&gt;
• Sales forecasting&lt;br&gt;
• Product recommendations&lt;br&gt;
• Predictive maintenance&lt;br&gt;
In each case the output is constrained: a label, a probability, a score or a numeric estimate.&lt;/p&gt;
&lt;h3&gt;
  
  
  A minimal scikit-learn example
&lt;/h3&gt;

&lt;p&gt;Here's a small classification model built with scikit-learn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.tree&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DecisionTreeClassifier&lt;/span&gt;

&lt;span class="c1"&gt;# Each row: [hours studied, practice tests completed]
&lt;/span&gt;&lt;span class="n"&gt;X&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# 0 = did not pass, 1 = passed
&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DecisionTreeClassifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;random_state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;42&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Predict the outcome for a new learner
&lt;/span&gt;&lt;span class="n"&gt;prediction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;([[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Predicted result:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prediction&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The decision tree learns a split from six examples and labels a new learner as 0 or 1. Six rows is far too little data for a real assessment, so treat this purely as a demonstration of the workflow: prepare features, train, predict.&lt;br&gt;
The key point: the model can only return one of the outcomes you defined in advance.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is generative AI?
&lt;/h2&gt;

&lt;p&gt;Generative AI models learn patterns from training data and use them to produce new content in response to a prompt or other input. Depending on the model, that content can be:&lt;br&gt;
• Text and explanations&lt;br&gt;
• Source code&lt;br&gt;
• Images and illustrations&lt;br&gt;
• Audio and speech&lt;br&gt;
• Summaries of long documents&lt;br&gt;
• Synthetic data for testing&lt;/p&gt;

&lt;p&gt;Go back to a learning app. A traditional ML model might predict whether a student is likely to pass an exam. A generative model could write practice questions on a chosen topic, or explain a tricky concept in simpler language. The first predicts an outcome; the second produces something that didn't exist before.&lt;br&gt;
Large language models (LLMs) are the best-known type of generative AI. They generate text one token at a time, predicting what should come next based on the prompt and patterns learned in training.&lt;br&gt;
That also explains their main weakness: fluent output isn't the same as correct output. LLMs can state wrong facts confidently or write code that runs but has bugs or security gaps. Anything they produce needs checking, and generated code needs testing like any other code.&lt;/p&gt;
&lt;h3&gt;
  
  
  A minimal generative AI example in Python
&lt;/h3&gt;

&lt;p&gt;Most developers start by calling a hosted model through an API. With the OpenAI Python SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;  &lt;span class="c1"&gt;# reads the OPENAI_API_KEY environment variable
&lt;/span&gt;
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;responses&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-5&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Explain Python functions to a beginner &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;using one short code example.&lt;/span&gt;&lt;span class="sh"&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;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;output_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run it you need `pip install openai, an API key set as an environment variable, and access to the model named. Model names change often, so check the provider's documentation for what your account can use.&lt;br&gt;
Run the script twice and you'll probably get two different explanations. There's no fixed label like 0 or 1 here. That flexibility is the whole point, and it's also why testing a generative feature is harder than testing a classifier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Traditional ML vs generative AI: a side-by-side comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Traditional ML&lt;/th&gt;
&lt;th&gt;Generative AI&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Main purpose&lt;/td&gt;
&lt;td&gt;Predict, classify or find patterns&lt;/td&gt;
&lt;td&gt;Create new content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Typical output&lt;/td&gt;
&lt;td&gt;Label, score, probability or forecast&lt;/td&gt;
&lt;td&gt;Text, code, images, audio&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Example task&lt;/td&gt;
&lt;td&gt;Predict customer churn&lt;/td&gt;
&lt;td&gt;Draft a customer-support reply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common techniques&lt;/td&gt;
&lt;td&gt;Regression, decision trees, clustering&lt;/td&gt;
&lt;td&gt;Transformers, diffusion models&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How it's evaluated&lt;/td&gt;
&lt;td&gt;Accuracy, precision, recall, error metrics&lt;/td&gt;
&lt;td&gt;Relevance, factual accuracy, safety, task-specific checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Common uses&lt;/td&gt;
&lt;td&gt;Fraud detection, forecasting, risk scoring&lt;/td&gt;
&lt;td&gt;AI assistants, coding tools, content drafting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer focus&lt;/td&gt;
&lt;td&gt;Data prep, features, training, evaluation&lt;/td&gt;
&lt;td&gt;Prompting, integration, context, output validation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The line between them isn't perfectly sharp. Generative models are trained with machine learning methods and make predictions internally, token by token. The useful distinction is the job the application does: decide, or create.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which one should you use?
&lt;/h2&gt;

&lt;p&gt;Start from the output you need, not from the technology:&lt;br&gt;
• The answer is a fixed category or a number, and you have labelled historical data: traditional ML. A churn score or fraud flag belongs here.&lt;br&gt;
• The answer is open-ended language, code or images: generative AI. Summaries, drafts and explanations belong here.&lt;br&gt;
• You need the same answer every time for the same input: traditional ML is far easier to make consistent and to audit.&lt;br&gt;
• Cost and speed matter at scale: a small trained classifier can run on a laptop in milliseconds; API calls to large models are billed per token and add latency.&lt;br&gt;
• You need a decision and a written explanation: combine them, as in the example below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can traditional ML and generative AI work together?
&lt;/h2&gt;

&lt;p&gt;Yes, and many production systems do exactly that. Take a customer-support tool that receives a message about a problem with an order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Classification: an ML model tags the ticket as billing, delivery, technical or other.&lt;/li&gt;
&lt;li&gt; Prioritization: a second model estimates urgency or the chance the issue needs escalation.&lt;/li&gt;
&lt;li&gt; Retrieval: the app pulls relevant passages from product docs or the support knowledge base.&lt;/li&gt;
&lt;li&gt; Response generation: a generative model drafts a reply using the customer's message and the retrieved information.&lt;/li&gt;
&lt;li&gt; Validation: the app checks the draft and sends sensitive or uncertain cases to a human agent.
Customer message → Classification → Prioritization → Retrieval → Response generation → Validation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Not every product needs all five pieces. Sometimes one model, or even a few plain if-statements, does the job. The real skill is knowing which piece a problem calls for.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should you learn first?
&lt;/h2&gt;

&lt;p&gt;My honest take: spend a few weeks on ML fundamentals before going deep on LLMs. You don't need to master every algorithm, but learning how models are trained and evaluated changes how you judge any AI output, including a chatbot's.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Python and data fundamentals
&lt;/h3&gt;

&lt;p&gt;• Python basics and data structures&lt;br&gt;
• Functions and modules&lt;br&gt;
• NumPy and pandas&lt;br&gt;
• Basic statistics and probability&lt;br&gt;
• Data cleaning and visualization&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Machine learning fundamentals
&lt;/h3&gt;

&lt;p&gt;• Supervised and unsupervised learning&lt;br&gt;
• Regression and classification&lt;br&gt;
• Decision trees and random forests&lt;br&gt;
• Train/test splits&lt;br&gt;
• Overfitting and underfitting&lt;br&gt;
• Model evaluation metrics&lt;br&gt;
Build one small project, such as a spam classifier or churn predictor, and pay attention to how the data and evaluation choices change the result.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Generative AI development
&lt;/h3&gt;

&lt;p&gt;• How LLMs work at a high level&lt;br&gt;
• Prompt design&lt;br&gt;
• API integration&lt;br&gt;
• Embeddings and semantic search&lt;br&gt;
• Retrieval-augmented generation (RAG)&lt;br&gt;
• Structured outputs&lt;br&gt;
• Evaluation and safety&lt;/p&gt;

&lt;p&gt;Then build something: a tool that answers questions about a set of documents, or one that turns study notes into practice questions. Don't stop at getting a response back. Handle errors, validate the output, keep API keys out of your code, and write tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Three portfolio projects worth building
&lt;/h3&gt;

&lt;p&gt;• ML prediction app: train a model on a public dataset, evaluate it properly and add a simple interface.&lt;br&gt;
• Generative AI assistant: answer questions over a limited set of documents using retrieval.&lt;br&gt;
• Combined app: classify incoming requests with ML and draft context-aware replies with a generative model.&lt;br&gt;
Write a short README for each explaining your choices, limitations and how you tested it. Interviewers often care more about that reasoning than about the demo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which career path fits you?
&lt;/h2&gt;

&lt;p&gt;It depends on the problems you enjoy. If you like datasets, statistics and forecasting, traditional ML and data science are a natural fit. If you'd rather build products, wire up APIs and work with language models, applied AI or generative AI engineering may suit you better.&lt;br&gt;
Roles you'll see in job listings include machine learning engineer, data scientist, AI engineer, applied AI developer and generative AI engineer. They overlap heavily, and requirements vary a lot between employers.&lt;br&gt;
You don't have to pick one forever. And remember that using an AI tool well isn't the same as building a reliable AI application. Software engineering, testing, data handling and security still decide whether a project works outside a demo.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is generative AI a type of machine learning?&lt;/strong&gt;&lt;br&gt;
Yes. Generative models are trained using machine learning techniques. "Traditional ML vs generative AI" describes what the system produces, a prediction or new content, rather than two unrelated fields.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need to learn traditional ML before generative AI?&lt;/strong&gt;&lt;br&gt;
Not strictly. You can call an LLM API on day one. But ML basics such as train/test splits and evaluation metrics help you judge whether an AI feature actually works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can an LLM replace a churn or fraud model?&lt;/strong&gt;&lt;br&gt;
Usually it isn't the right tool. For structured, tabular predictions, a trained classifier is typically cheaper, faster, more consistent and easier to evaluate.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Practice on real projects&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Reading about the difference is the easy part; it really clicks when you build both kinds of project. If you're in Mohali or the Chandigarh Tricity area and want guided, project-based practice in Python, machine learning or AI, &lt;a href="https://solitaireinfosystems.com/" rel="noopener noreferrer"&gt;Solitaire Infosystems&lt;/a&gt;runs &lt;a href="https://solitaireinfosystems.com/best-industrial-training-in-mohali/" rel="noopener noreferrer"&gt;industrial training and internship programs in Mohali&lt;/a&gt; built around hands-on work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Over to you&lt;/strong&gt;: if you were starting today, would you learn traditional ML first or go straight to generative AI? If you've already shipped something in either area, I'm curious what surprised you most.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>generativeai</category>
    </item>
    <item>
      <title>UI/UX in Software Development: Why It Matters and How Developers Can Build It In</title>
      <dc:creator>Tamana</dc:creator>
      <pubDate>Tue, 27 Oct 2026 11:45:20 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/uiux-in-software-development-why-it-matters-and-how-developers-can-build-it-in-3i9f</link>
      <guid>https://dev.to/solitaireinfosystems2011/uiux-in-software-development-why-it-matters-and-how-developers-can-build-it-in-3i9f</guid>
      <description>&lt;p&gt;UI/UX in software development decides whether people can actually use what you've built. The backend can be fast and the APIs clean, but if a user can't work out how to sign up or where to find their data, the product fails at the point that matters most to them.&lt;/p&gt;

&lt;p&gt;UI (user interface) is what people see and touch: buttons, forms, layouts, type. UX (user experience) is how easily they get from what they want to done. Developers shape both, because every design decision ends up as code someone has to write, test and maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between UI and UX?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UI is the visible, interactive layer:&lt;br&gt;
• Buttons, forms, menus and navigation&lt;br&gt;
• Colour, typography, spacing and layout&lt;br&gt;
• Icons and interactive states such as hover, focus and disabled&lt;/p&gt;

&lt;p&gt;UX is whether the product makes sense to the person using it. It covers understanding user needs, organising information, mapping user journeys and spotting usability problems.&lt;br&gt;
A quick example: a registration form can look polished and still frustrate people. If the password rules only appear after a failed submit, or the error just says "Invalid input", that's a UX problem no amount of styling will fix.&lt;br&gt;
Put simply, good UI makes an interface clear and consistent. Good UX makes it easy to use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does UI/UX matter for developers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Usability problems are cheaper to fix early&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think about an online learning platform. A student wants to find a course, open the materials and check their progress. If each of those takes three menus, they'll give up or flood support with questions.&lt;br&gt;
Spotting a confusing workflow at the wireframe stage costs a meeting. Spotting it after launch can mean rebuilding screens, routes and sometimes the data model behind them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Designers and developers need each other early&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;UI/UX isn't only the designer's job. Designers think about layouts, interactions and journeys. Developers think about component structure, technical feasibility, responsiveness and performance.&lt;br&gt;
Say a designer proposes a full-screen animation on page load. It looks great on a laptop and stutters on a mid-range Android phone. If a developer raises that during design review, the team can swap in a lighter CSS transition and keep the intent. Raised a week before release, it usually just gets cut.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Responsive design is about tasks, not just fitting the screen&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;People move between phones, tablets and desktops all day. An interface that works perfectly on a 27-inch monitor can be a struggle on a 6-inch screen. Responsive design means:&lt;br&gt;
• Flexible layouts and components&lt;br&gt;
• Text that stays readable at every size&lt;br&gt;
• Touch targets big enough for a thumb&lt;br&gt;
• Navigation that doesn't depend on hover&lt;br&gt;
CSS Grid, Flexbox and media queries handle the layout side. The real test is different: can someone finish the checkout or submit the form on a small screen without zooming in or mis-tapping?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Accessibility starts in the markup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An interface should work for people using keyboards, screen readers, magnification or voice control. Most of the groundwork is everyday front-end practice:&lt;br&gt;
• Use semantic HTML (header, nav, main, button).&lt;br&gt;
• Give every form field a visible label that's connected to the input.&lt;br&gt;
• Check colour contrast: WCAG asks for at least 4.5:1 for normal body text (W3C contrast guidance).&lt;br&gt;
• Make sure everything works with a keyboard and shows a visible focus state.&lt;br&gt;
The classic example is the clickable div:&lt;/p&gt;



Submit
 



&lt;p&gt;Submit&lt;br&gt;
A native  can be focused, responds to Enter and Space, and is announced as a button by screen readers, all without extra code (MDN's button reference covers the details). Recreating that on a div means adding tabindex, a role and key handlers, and it's easy to miss one.&lt;br&gt;
Accessibility added at the end is a retrofit. Built in from the first component, it costs very little.&lt;/p&gt;


&lt;p&gt;&lt;strong&gt;5. Consistent components are easier to maintain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As an app grows, three slightly different buttons quietly turn into twelve. A design system stops that by defining reusable pieces (buttons, inputs, navigation, cards, notifications) with agreed states and behavior.&lt;br&gt;
In a framework like React, each of those becomes one component. Change the focus style once and it updates everywhere. Users get predictable behavior, and developers get far less duplicate code to maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How can developers build UI/UX into their workflow?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A practical UI/UX process starts with the problem, not with colours or code. These five steps work for most projects:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Understand the users. Who is this for, what are they trying to do, and what's getting in their way? Write it down before you pick a stack.&lt;/li&gt;
&lt;li&gt; Map the user journey. List the steps for the main task. For a course website: Visit website → Explore courses → Select a course → Register → Receive confirmation. Every extra step is a chance for someone to drop off.&lt;/li&gt;
&lt;li&gt; Wireframe before you style. Low-fidelity layouts in a tool like Figma let the team agree on structure and content order while changes are still cheap.&lt;/li&gt;
&lt;li&gt; Build reusable components with all their states. Loading, empty, error, disabled and success states are where most real-world UX bugs hide. Design and build them on purpose, not as an afterthought.&lt;/li&gt;
&lt;li&gt; Test with real tasks, then refine. Ask someone who didn't build it to complete the main task on a phone. Watch where they hesitate, and fix that first.
Design, build, test, refine. Then do it again.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What UI/UX mistakes do developers make most often?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;• Styling over usability: effects that slow the page or distract from the task.&lt;br&gt;
• Desktop-only testing: resizing a browser window isn't the same as using a real phone.&lt;br&gt;
• Vague error messages: "Something went wrong" tells the user nothing. Say what happened and how to fix it.&lt;br&gt;
• Inconsistent components: two buttons that look the same but behave differently erode trust.&lt;br&gt;
• Treating accessibility as optional: if it doesn't work with a keyboard, it doesn't work for everyone.&lt;br&gt;
• Skipping usability testing: what's obvious to the people who built it often confuses a first-time user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is UI/UX worth learning if you're a developer?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Yes. You don't need to become a designer, but understanding user journeys, accessibility and component states makes you better at implementation, easier to work with in design reviews, and more useful on small teams where roles overlap. For front-end developers especially, it's now part of the job.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Working code is the starting point, not the finish line. Clear navigation, accessible interactions, responsive layouts and a logical journey are what turn a functioning app into one people actually want to use.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Great software isn't only about what happens behind the screen. It's about how easily people can use what's in front of them.&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Written by the team at &lt;a href="https://solitaireinfosystems.com/" rel="noopener noreferrer"&gt;Solitaire Infosystems&lt;/a&gt; , an IT training and internship company in Mohali, Punjab. If you're a student building your development skills, take a look at our&lt;a href="https://solitaireinfosystems.com/internship/" rel="noopener noreferrer"&gt; 6-month industrial training and internship programmes&lt;/a&gt; .&lt;/p&gt;


</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>ux</category>
      <category>a11y</category>
    </item>
    <item>
      <title>Student Projects: Turning IT Knowledge Into Practical Experience</title>
      <dc:creator>Tamana</dc:creator>
      <pubDate>Fri, 25 Sep 2026 05:28:08 +0000</pubDate>
      <link>https://dev.to/solitaireinfosystems2011/student-projects-turning-it-knowledge-into-practical-experience-1mmk</link>
      <guid>https://dev.to/solitaireinfosystems2011/student-projects-turning-it-knowledge-into-practical-experience-1mmk</guid>
      <description>&lt;p&gt;For IT students and freshers, theoretical knowledge is only the starting point. Student projects provide a practical way to apply that knowledge, strengthen technical skills, and understand how technology can be used to solve real-world problems.&lt;br&gt;
A strong project does not need to be complex. What matters most is having a clear purpose, making thoughtful technical decisions, testing your work, and being able to explain what you built, why you built it, and what you learned along the way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Makes a Student Project Valuable?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A useful student project should demonstrate:&lt;br&gt;
• A clear problem, goal, or purpose&lt;br&gt;
• Relevant technologies and tools&lt;br&gt;
• Practical implementation of the solution&lt;br&gt;
• Testing, debugging, and refinement&lt;br&gt;
• Clear and useful documentation&lt;br&gt;
• A specific explanation of the student's contribution&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choose Projects That Demonstrate Real Skills&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Students can build projects such as a task management system, expense tracker, portfolio website, student management system, or simple e-commerce application. The goal is not to build the biggest application, but to create something useful enough to demonstrate planning, development, and problem-solving.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn More Through Internship Projects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An internship project can show students how technical knowledge is applied in a practical environment. Beyond completing assigned tasks, students can learn how requirements are understood, features are developed, applications are tested, bugs are diagnosed, and solutions are improved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build a Portfolio That Tells the Full Story&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A strong student portfolio should show more than project titles. For each project, explain its purpose, technologies used, key features, personal contribution, challenges encountered, and lessons learned. Projects from internships and personal practice can both be valuable when the student's actual contribution is clearly described.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Feedback to Make Better Projects&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feedback from a mentor, teacher, teammate, or developer can uncover issues that are easy to miss when working alone. It can help improve code quality, documentation, usability, design, and functionality. More importantly, acting on feedback demonstrates a willingness to learn, adapt, and improve.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quality Matters More Than Quantity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Students do not need a long list of projects. A few well-developed projects that they understand thoroughly can demonstrate technical knowledge, problem-solving ability, and practical experience far more effectively than many unfinished or poorly understood projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thought&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A project is more than another item on a resume. It is an opportunity to demonstrate how you learn, solve problems, work with technology, handle challenges, and improve through feedback. Meaningful student projects can therefore be an important step toward becoming better prepared for internships and entry-level IT opportunities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Further Reading&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Want to learn more about building practical projects and developing skills for your IT career? Explore:&lt;a href="https://solitaireinfosystems.com/from-student-to-professional-real-world-project-training/" rel="noopener noreferrer"&gt; Learn More About Building Practical Student Projects&lt;/a&gt; &lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
