<?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: Hardik Jariwala</title>
    <description>The latest articles on DEV Community by Hardik Jariwala (@hardik_jariwala_748c4a032).</description>
    <link>https://dev.to/hardik_jariwala_748c4a032</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3056047%2F0677df4c-3a3a-48f9-ad63-e7c1a18ed059.jpg</url>
      <title>DEV Community: Hardik Jariwala</title>
      <link>https://dev.to/hardik_jariwala_748c4a032</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hardik_jariwala_748c4a032"/>
    <language>en</language>
    <item>
      <title>Python Lists vs Tuples vs Sets vs Dictionaries A Beginner-Friendly Guide</title>
      <dc:creator>Hardik Jariwala</dc:creator>
      <pubDate>Sat, 05 Sep 2026 07:07:47 +0000</pubDate>
      <link>https://dev.to/hardik_jariwala_748c4a032/python-lists-vs-tuples-vs-sets-vs-dictionaries-a-beginner-friendly-guide-13d4</link>
      <guid>https://dev.to/hardik_jariwala_748c4a032/python-lists-vs-tuples-vs-sets-vs-dictionaries-a-beginner-friendly-guide-13d4</guid>
      <description>&lt;h2&gt;
  
  
  Python Lists vs Tuples vs Sets vs Dictionaries 🐍
&lt;/h2&gt;

&lt;p&gt;If you're learning Python, you've probably run into these four data structures again and again:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;List&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Tuple&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Set&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Dictionary&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They all store collections of data, but each one has its own personality. Picking the right one makes your code cleaner, faster, and easier to understand.&lt;/p&gt;

&lt;p&gt;Let's break them down one by one, with simple examples and real-world analogies no jargon overload. 🚀&lt;/p&gt;




&lt;h2&gt;
  
  
  1. List 📝 The Flexible To-Do List
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;list&lt;/strong&gt; is an ordered collection that can hold multiple items, and you can &lt;strong&gt;change&lt;/strong&gt; it anytime (add, remove, update).&lt;/p&gt;

&lt;p&gt;Think of it like a &lt;strong&gt;shopping list&lt;/strong&gt; you can add items, cross them off, or rearrange them.&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;fruits&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;apple&lt;/span&gt;&lt;span class="sh"&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;banana&lt;/span&gt;&lt;span class="sh"&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;cherry&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Access by index
&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;fruits&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="c1"&gt;# apple
&lt;/span&gt;
&lt;span class="c1"&gt;# Add an item
&lt;/span&gt;&lt;span class="n"&gt;fruits&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mango&lt;/span&gt;&lt;span class="sh"&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;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;           &lt;span class="c1"&gt;# ['apple', 'banana', 'cherry', 'mango']
&lt;/span&gt;
&lt;span class="c1"&gt;# Update an item
&lt;/span&gt;&lt;span class="n"&gt;fruits&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="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;blueberry&lt;/span&gt;&lt;span class="sh"&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;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;           &lt;span class="c1"&gt;# ['apple', 'blueberry', 'cherry', 'mango']
&lt;/span&gt;
&lt;span class="c1"&gt;# Remove an item
&lt;/span&gt;&lt;span class="n"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cherry&lt;/span&gt;&lt;span class="sh"&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;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;           &lt;span class="c1"&gt;# ['apple', 'blueberry', 'mango']
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key traits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ordered (keeps insertion order)&lt;/li&gt;
&lt;li&gt;Mutable (changeable)&lt;/li&gt;
&lt;li&gt;Allows duplicate values&lt;/li&gt;
&lt;li&gt;Written with square brackets &lt;strong&gt;&lt;code&gt;[ ]&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use it when: you need an editable, ordered collection like a list of tasks, scores, or usernames.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Tuple 🔒 The Locked Box
&lt;/h2&gt;

&lt;p&gt;A tuple looks like a list, but once created, it cannot be changed. It's like a sealed box great for data that should stay constant.&lt;/p&gt;

&lt;p&gt;Think of it like your date of birth it shouldn't change once it's set.&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;coordinates&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coordinates&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="c1"&gt;# 10
&lt;/span&gt;
&lt;span class="c1"&gt;# This will raise an error!
# coordinates[0] = 15   ❌ TypeError: 'tuple' object does not support item assignment
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key traits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ordered&lt;/li&gt;
&lt;li&gt;Immutable (cannot be changed after creation)&lt;/li&gt;
&lt;li&gt;Allows duplicate values&lt;/li&gt;
&lt;li&gt;Written with parentheses &lt;strong&gt;&lt;code&gt;( )&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Slightly faster than lists (good for performance-critical code)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use it when: you want to protect data from accidental changes like GPS coordinates, RGB colors, or fixed configuration values.&lt;/p&gt;




&lt;h2&gt;
  
  
  3.Set 🎯 The No-Duplicates Club
&lt;/h2&gt;

&lt;p&gt;A set is an unordered collection of unique items. Duplicates are automatically removed.&lt;/p&gt;

&lt;p&gt;Think of it like a guest list where no one can enter twice even if you try to add the same name again, it just won't duplicate.&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;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="mi"&gt;3&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;           &lt;span class="c1"&gt;# {1, 2, 3}  → duplicates removed automatically
&lt;/span&gt;
&lt;span class="c1"&gt;# Add an item
&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;add&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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;           &lt;span class="c1"&gt;# {1, 2, 3, 4}
&lt;/span&gt;
&lt;span class="c1"&gt;# Check membership (very fast!)
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# True
&lt;/span&gt;
&lt;span class="c1"&gt;# Set operations
&lt;/span&gt;&lt;span class="n"&gt;a&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="n"&gt;b&lt;/span&gt; &lt;span class="o"&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;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="nf"&gt;print&lt;/span&gt;&lt;span class="p"&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;# Union → {1, 2, 3, 4, 5}
&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;a&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&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;# Intersection → {3}
&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;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;# Difference → {1, 2}
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key traits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unordered (no guaranteed order, no indexing)&lt;/li&gt;
&lt;li&gt;Mutable, but items inside must be immutable (no lists inside sets)&lt;/li&gt;
&lt;li&gt;No duplicates allowed&lt;/li&gt;
&lt;li&gt;Written with curly braces &lt;strong&gt;&lt;code&gt;{ }&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Super fast for checking "does this exist?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use it when: you need to remove duplicates or quickly check membership like unique visitor IDs or tags.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Dictionary 📖 The Labeled Drawer System
&lt;/h2&gt;

&lt;p&gt;A dictionary stores data as key-value pairs. Instead of accessing items by position, you access them by a meaningful key.&lt;/p&gt;

&lt;p&gt;Think of it like a real dictionary you look up a word (key) to get its meaning (value).&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;student&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;name&lt;/span&gt;&lt;span class="sh"&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;Riya&lt;/span&gt;&lt;span class="sh"&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;age&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;21&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;course&lt;/span&gt;&lt;span class="sh"&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;Computer Science&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Access value by key
&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;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;     &lt;span class="c1"&gt;# Riya
&lt;/span&gt;
&lt;span class="c1"&gt;# Add a new key-value pair
&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;grade&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&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;student&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Update a value
&lt;/span&gt;&lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;age&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;

&lt;span class="c1"&gt;# Remove a key-value pair
&lt;/span&gt;&lt;span class="k"&gt;del&lt;/span&gt; &lt;span class="n"&gt;student&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;course&lt;/span&gt;&lt;span class="sh"&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;student&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# {'name': 'Riya', 'age': 22, 'grade': 'A'}
&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key traits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ordered (insertion order preserved since Python 3.7+)&lt;/li&gt;
&lt;li&gt;Mutable&lt;/li&gt;
&lt;li&gt;Keys must be unique and immutable (strings, numbers, tuples); values can be anything&lt;/li&gt;
&lt;li&gt;Written with curly braces { } and key: value pairs&lt;/li&gt;
&lt;li&gt;Extremely fast lookups by key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use it when: you need labeled, structured data like user profiles, JSON-like data, or configuration settings.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Quick Comparison Table
&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;List &lt;code&gt;[ ]&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;Tuple &lt;code&gt;( )&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;Set &lt;code&gt;{ }&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;Dictionary &lt;code&gt;{k: v}&lt;/code&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ordered&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes (Python 3.7+)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mutable&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Duplicates&lt;/td&gt;
&lt;td&gt;✅ Allowed&lt;/td&gt;
&lt;td&gt;✅ Allowed&lt;/td&gt;
&lt;td&gt;❌ Not allowed&lt;/td&gt;
&lt;td&gt;❌ Keys unique (values can repeat)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Indexing&lt;/td&gt;
&lt;td&gt;✅ By position&lt;/td&gt;
&lt;td&gt;✅ By position&lt;/td&gt;
&lt;td&gt;❌ Not supported&lt;/td&gt;
&lt;td&gt;✅ By key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Syntax&lt;/td&gt;
&lt;td&gt;&lt;code&gt;[1, 2, 3]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(1, 2, 3)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{1, 2, 3}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{"a": 1, "b": 2}&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Editable, ordered data&lt;/td&gt;
&lt;td&gt;Fixed/constant data&lt;/td&gt;
&lt;td&gt;Unique items, fast lookup&lt;/td&gt;
&lt;td&gt;Labeled key-value data&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🧠 How to Choose the Right One
&lt;/h2&gt;

&lt;p&gt;Ask yourself these questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;1. Do I need to change the data later?

&lt;ul&gt;
&lt;li&gt;Yes → List, Set, or Dictionary&lt;/li&gt;
&lt;li&gt;  No → Tuple&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Does the order of items matter?

&lt;ul&gt;
&lt;li&gt;Yes → List, Tuple, or Dictionary&lt;/li&gt;
&lt;li&gt;  No → Set&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Do I need to look things up by a name/label instead of position?

&lt;ul&gt;
&lt;li&gt;  Yes → Dictionary&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Do I need to eliminate duplicates or do fast membership checks?

&lt;ul&gt;
&lt;li&gt;  Yes → Set&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🎬 Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Here's the one-line summary you can keep in your back pocket:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;List → An editable, ordered collection → ["a", "b", "c"]&lt;/li&gt;
&lt;li&gt;Tuple → A locked, ordered collection → ("a", "b", "c")&lt;/li&gt;
&lt;li&gt;Set → A collection of unique items, no order → {"a", "b", "c"}&lt;/li&gt;
&lt;li&gt;Dictionary → A collection of key-value pairs → {"key": "value"}&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>🚀 Redis Caching in .NET (Memurai on Windows + Docker Recommended)</title>
      <dc:creator>Hardik Jariwala</dc:creator>
      <pubDate>Tue, 24 Mar 2026 16:55:43 +0000</pubDate>
      <link>https://dev.to/hardik_jariwala_748c4a032/redis-caching-in-net-memurai-on-windows-docker-recommended-39g5</link>
      <guid>https://dev.to/hardik_jariwala_748c4a032/redis-caching-in-net-memurai-on-windows-docker-recommended-39g5</guid>
      <description>&lt;p&gt;Caching is essential for improving performance and scalability in modern applications. This guide shows how to use Redis caching in .NET, including how to run it on Windows using Memurai (without Docker).&lt;/p&gt;

&lt;h2&gt;
  
  
  🔴 What is Redis?
&lt;/h2&gt;

&lt;p&gt;Redis is an in-memory data store used to cache frequently accessed data, making applications faster by reducing database calls. It serves data instantly on a cache hit and stores new data on a cache miss, improving performance and scalability.&lt;/p&gt;

&lt;p&gt;Why use it?&lt;br&gt;
⚡ Fast (RAM-based)&lt;br&gt;
📉 Reduces DB load&lt;br&gt;
🌍 Works across multiple servers&lt;br&gt;
⏱ Supports expiration (TTL)&lt;/p&gt;
&lt;h2&gt;
  
  
  🧠 How It Works (Cache Aside Pattern)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request → Check Cache → Return (if found) 
                     ↓ 
                  DB → Save in Cache → Return
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  📦 Required Packages (.NET)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package Microsoft.Extensions.Caching.StackExchangeRedis 
dotnet add package Newtonsoft.Json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  ⚙️ Redis Configuration
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddStackExchangeRedisCache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt; 
     &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Configuration&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"localhost:6379"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
     &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InstanceName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt;  &lt;span class="s"&gt;"MyApp:"&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;🔥 Caching Implementation (Service Layer)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProductService&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt; 
     &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="n"&gt;IDistributedCache&lt;/span&gt; &lt;span class="n"&gt;_cache&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
     &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;ProductService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IDistributedCache&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
     &lt;span class="p"&gt;{&lt;/span&gt; 
          &lt;span class="n"&gt;_cache&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
     &lt;span class="p"&gt;}&lt;/span&gt; 
     &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;GetProducts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; 
     &lt;span class="p"&gt;{&lt;/span&gt; 
         &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;cacheKey&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"product_list"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
         &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;cacheData&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetStringAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cacheKey&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;cacheData&lt;/span&gt; &lt;span class="p"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
         &lt;span class="p"&gt;{&lt;/span&gt; 
             &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Data from Redis"&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;JsonConvert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DeserializeObject&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&lt;/span&gt;   
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cacheData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt; 
         &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Data from DB"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
         &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;FakeDb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetProducts&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Replace with real DB &lt;/span&gt;
         &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;DistributedCacheEntryOptions&lt;/span&gt; 
         &lt;span class="p"&gt;{&lt;/span&gt; 
             &lt;span class="n"&gt;AbsoluteExpirationRelativeToNow&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromMinutes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
         &lt;span class="p"&gt;};&lt;/span&gt; 
         &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SetStringAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;cacheKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;JsonConvert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SerializeObject&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="n"&gt;options&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;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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Run Redis WITHOUT Docker (Windows)
&lt;/h2&gt;

&lt;p&gt;Use Memurai:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Memurai&lt;/li&gt;
&lt;li&gt;Start service:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;Win + R → services.msc → Start "Memurai"&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Verify:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;memurai-cli ping
Output: `PONG`
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Runs on:localhost:6379&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🐳 Recommended: Use Docker
&lt;/h2&gt;

&lt;p&gt;Docker (best for production)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;docker run -d -p 6379:6379 redis

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔄 Cache Invalidation (Important)
&lt;/h2&gt;

&lt;p&gt;Remove cache manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RemoveAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"product_list"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use expiration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;AbsoluteExpirationRelativeToNow&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;FromMinutes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&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;Clear all cache (dev):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;memurai-cli flushall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 Best Practices With...
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Always set expiry&lt;/li&gt;
&lt;li&gt;Use meaningful keys (product_101)&lt;/li&gt;
&lt;li&gt;Invalidate cache on update/delete&lt;/li&gt;
&lt;li&gt;Avoid caching sensitive data&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redis</category>
      <category>docker</category>
      <category>webdev</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>📡 Real-Time Communication with SignalR in ASP.NET Core Complete Setup Guide</title>
      <dc:creator>Hardik Jariwala</dc:creator>
      <pubDate>Tue, 27 May 2025 18:06:14 +0000</pubDate>
      <link>https://dev.to/hardik_jariwala_748c4a032/real-time-communication-with-signalr-in-aspnet-core-complete-setup-guide-22bb</link>
      <guid>https://dev.to/hardik_jariwala_748c4a032/real-time-communication-with-signalr-in-aspnet-core-complete-setup-guide-22bb</guid>
      <description>&lt;p&gt;Want to build a real-time chat app or push live notifications? In this blog, I’ll walk you through setting up SignalR from scratch using ASP.NET Core and a .NET console client. Perfect for beginners or those revisiting SignalR.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  🔧 Step 1: Create the SignalR Server Project
&lt;/h2&gt;

&lt;p&gt;Create an ASP.NET Core Web API project and add package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package Microsoft.AspNetCore.SignalR
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 Step 2: Create a SignalR Hub
&lt;/h2&gt;

&lt;p&gt;Create a new class &lt;code&gt;ChatHub.cs&lt;/code&gt; inside the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Microsoft.AspNetCore.SignalR;

public class ChatHub : Hub
{
    public async Task SendMessage(string user, string message)
    {
        await Clients.All.SendAsync("ReceiveMessage", user, message);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  🌐 Step 3: Configure the SignalR Hub in &lt;code&gt;Program.cs&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Update &lt;code&gt;Program.cs&lt;/code&gt; to register the SignalR service and endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSignalR();
builder.Services.AddControllers();
var app = builder.Build();

app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();

// Add this line to map the hub
app.MapHub&amp;lt;ChatHub&amp;gt;("/chatHub");

app.Run();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  🧪 Step 4: Run the Server
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  📥 Step 5: Create a .NET Console Client
&lt;/h2&gt;

&lt;p&gt;Create a new console app and add SignalR client package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet add package Microsoft.AspNetCore.SignalR.Client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  🧑‍💻 Step 6: Build the Client Logic
&lt;/h2&gt;

&lt;p&gt;Replace &lt;code&gt;Program.cs&lt;/code&gt; content with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;using Microsoft.AspNetCore.SignalR.Client;

var connection = new HubConnectionBuilder()
    .WithUrl("https://&amp;lt;your localhost&amp;gt;/chatHub") your server
    .WithAutomaticReconnect()
    .Build();

// Receive messages
connection.On&amp;lt;string, string&amp;gt;("ReceiveMessage", (user, message) =&amp;gt;
{
    Console.WriteLine($"{user}: {message}");
});

try
{
    await connection.StartAsync();
    Console.WriteLine("Connected to SignalR Hub.");
}
catch (Exception ex)
{
    Console.WriteLine($"Connection failed: {ex.Message}");
    return;
}

// Sending messages
while (true)
{
    Console.Write("Enter your name: ");
    var user = Console.ReadLine();

    Console.Write("Enter your message: ");
    var message = Console.ReadLine();

    try
    {
        await connection.InvokeAsync("SendMessage", user, message);
    }
    catch (Exception ex)
    {
        Console.WriteLine($"Error sending message: {ex.Message}");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  ✅ Step 7: Test the Communication
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Run the server project:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ../SignalRServer
dotnet run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the client project in a new terminal:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ../SignalRClient
dotnet run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type your name and message in the console. If everything is set up correctly, you’ll see the message echoed back from the hub.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧪 Test Multiple Clients
&lt;/h2&gt;

&lt;p&gt;Open two terminals and run the client in each. You’ll see real-time communication between both.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>webdev</category>
      <category>signalr</category>
      <category>beginners</category>
    </item>
    <item>
      <title>🐳 Dockerize Your Angular App: A Beginner’s Guide</title>
      <dc:creator>Hardik Jariwala</dc:creator>
      <pubDate>Sun, 20 Apr 2025 07:24:35 +0000</pubDate>
      <link>https://dev.to/hardik_jariwala_748c4a032/dockerize-your-angular-17-app-a-beginners-guide-4pjn</link>
      <guid>https://dev.to/hardik_jariwala_748c4a032/dockerize-your-angular-17-app-a-beginners-guide-4pjn</guid>
      <description>&lt;h2&gt;
  
  
  What is Docker?🧠
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Imagine shipping your entire application including its OS, environment, dependencies, and code as one neatly packaged box. That’s Docker in a nutshell.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Docker is a platform that allows you to create, deploy, and run applications in isolated environments called containers. These containers ensure your app works the same across development, testing, staging, and production regardless of the host OS.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Docker for Angular?📦
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;No more “but it works on my machine!” bugs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clean, reproducible dev environments&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easy deployment to cloud platforms&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lightweight and fast compared to VMs(Virtual Machines)&lt;br&gt;
&lt;br&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting Started with Docker🚀
&lt;/h2&gt;

&lt;p&gt;✅ Install Docker&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make sure Docker is installed and running on your machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.docker.com/products/docker-desktop/" rel="noopener noreferrer"&gt;Install Docker Desktop&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Verify via terminal:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h3&gt;
  
  
  Essential Docker Commands🛠️
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t your-app-name .
docker run -p 3000:3000 your-app-name
docker ps        # list running containers
docker stop &amp;lt;container-id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h2&gt;
  
  
  Dockerizing an Angular 17+ Project 🧑‍💻
&lt;/h2&gt;



&lt;h3&gt;
  
  
  Step 1: Build Your Angular App 🏗️
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng build --configuration production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Output will go to: &lt;code&gt;dist/your-app-name/browser&lt;/code&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Create a Dockerfile 📁
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Build stage
FROM node:18 AS build

WORKDIR /app

# Copy package.json and package-lock.json to leverage Docker cache
COPY package*.json ./

# Install dependencies
RUN npm install --legacy-peer-deps 

# Install additional dependencies
RUN npm install ngx-bootstrap google-libphonenumber --legacy-peer-deps

# Copy project files
COPY . .

# Build the Angular application with production configuration
RUN npm run build -- --configuration production

# Serve stage
FROM node:18-slim

# Install a lightweight static server
RUN npm install -g serve

WORKDIR /app/dist/your-app-name/browser

# Copy the built Angular app from the previous stage
COPY --from=build /app/dist/your-app-name/browser .

# Expose the default serve port
EXPOSE 3000

# Run the app with serve
CMD ["serve", "-s", ".", "-l", "3000"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔁 Replace your-app-name with the actual folder name inside dist.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Build and Run the Container 🚀
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Build the Docker image
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t angular-demo .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the container
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -p 3000:3000 angular-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open in browser&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go to 👉 &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus: Docker for Development (Optional) 🎁
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Want live-reloading while developing?&lt;/li&gt;
&lt;li&gt;Mount your project folder as a volume&lt;/li&gt;
&lt;li&gt;Use Angular CLI inside the container&lt;/li&gt;
&lt;li&gt;Use ng serve --host 0.0.0.0

&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Docker and Angular make a powerful combo for modern web development. Whether you're deploying to the cloud or just keeping your local dev environment tidy, containers are the way to go. With Angular 17’s new standalone module system and enhanced performance, it's the perfect time to containerize your app and scale your skills.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>docker</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🚀 Mastering Angular 17+ Fundamentals : A Dev’s Guide to Modern Angular</title>
      <dc:creator>Hardik Jariwala</dc:creator>
      <pubDate>Wed, 16 Apr 2025 17:18:39 +0000</pubDate>
      <link>https://dev.to/hardik_jariwala_748c4a032/mastering-angular-17-fundamentals-a-devs-guide-to-modern-angular-54k7</link>
      <guid>https://dev.to/hardik_jariwala_748c4a032/mastering-angular-17-fundamentals-a-devs-guide-to-modern-angular-54k7</guid>
      <description>&lt;p&gt;Angular has evolved into a powerful and modern framework for building scalable web applications. With the advent of standalone components, reactive primitives, and deferrable views, Angular is more streamlined than ever.&lt;/p&gt;

&lt;p&gt;In this post, we’ll walk through core Angular concepts every modern developer should know, complete with theory and code examples. Whether you’re a beginner or brushing up, this guide is your Angular fundamentals crash course.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents📚
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Routing&lt;/li&gt;
&lt;li&gt;Standalone Components&lt;/li&gt;
&lt;li&gt;Forms&lt;/li&gt;
&lt;li&gt;Property Binding&lt;/li&gt;
&lt;li&gt;Event Handling&lt;/li&gt;
&lt;li&gt;Conditional Rendering&lt;/li&gt;
&lt;li&gt;For Loops in Angular&lt;/li&gt;
&lt;li&gt;Passing Data Between Components&lt;/li&gt;
&lt;li&gt;Deferrable Views&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Routing🧭
&lt;/h2&gt;

&lt;p&gt;Routing lets you navigate between views and components in Angular apps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app.routes.ts
import { Routes } from '@angular/router';
import { HomeComponent } from './home.component';
import { AboutComponent } from './about.component';

export const routes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'about', component: AboutComponent },
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// main.ts
bootstrapApplication(AppComponent, {
  providers: [provideRouter(routes)],
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Standalone Components🧩
&lt;/h2&gt;

&lt;p&gt;Standalone components don’t need an NgModule. They promote simpler architecture.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Component({
  standalone: true,
  selector: 'app-hello',
  template: `&amp;lt;h1&amp;gt;Hello, Angular!&amp;lt;/h1&amp;gt;`,
})
export class HelloComponent {}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Forms📝
&lt;/h2&gt;

&lt;p&gt;Angular supports template-driven and reactive forms.&lt;br&gt;
Template-driven Form:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form #form="ngForm" (ngSubmit)="submit(form.value)"&amp;gt;
  &amp;lt;input name="username" ngModel /&amp;gt;
  &amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Property Binding🔗
&lt;/h2&gt;

&lt;p&gt;Bind values from component to template using [property].&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img [src]="imageUrl" alt="Dynamic Image" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Event Handling🖱️
&lt;/h2&gt;

&lt;p&gt;Use (event) to listen for DOM events&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button (click)="handleClick()"&amp;gt;Click Me&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;handleClick() {
  console.log('Button clicked!');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conditional Rendering🔄
&lt;/h2&gt;

&lt;p&gt;Show/hide elements with *ngIf.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;p *ngIf="isLoggedIn"&amp;gt;Welcome back!&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;isLoggedIn = true;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  For Loops in Angular🔁
&lt;/h2&gt;

&lt;p&gt;Use *ngFor to loop through lists.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;ul&amp;gt;
  &amp;lt;li *ngFor="let user of users"&amp;gt;{{ user.name }}&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;users = [{ name: 'Alice' }, { name: 'Bob' }];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Passing Data Between Components🔄
&lt;/h2&gt;

&lt;p&gt;Use @Input and @Output to communicate.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parent to Child:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;app-user [name]="userName"&amp;gt;&amp;lt;/app-user&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Input() name!: string;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Child to Parent:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;app-user (notify)="onNotify()"&amp;gt;&amp;lt;/app-user&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Output() notify = new EventEmitter&amp;lt;void&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deferrable Views💤
&lt;/h2&gt;

&lt;p&gt;Optimize performance by deferring part of the UI until needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;ng-container *ngIf="isLoaded(); else loading"&amp;gt;
  &amp;lt;app-heavy-component /&amp;gt;
&amp;lt;/ng-container&amp;gt;
&amp;lt;ng-template #loading&amp;gt;
  &amp;lt;p&amp;gt;Loading...&amp;lt;/p&amp;gt;
&amp;lt;/ng-template&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Thoughts🧠
&lt;/h2&gt;

&lt;p&gt;Angular’s modernization journey with features like standalone components and signals makes it more intuitive, reactive, and leaner than ever. Mastering these fundamentals sets you up for building robust, scalable applications.&lt;/p&gt;

&lt;p&gt;Feel free to share your thoughts or ask questions in the comments. Happy coding! 🔥&lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
