<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[hasabTech]]></title><description><![CDATA[hasabTech is a developer-focused educational platform committed to simplifying tech learning. We share practical coding tutorials, programming guides, and tech insights to help beginners and aspiring developers build real world skills. Our mission is to make technical education accessible, clear, and community driven. We are currently building our in house products, experimenting with real world tech solutions, and sharing what we learn along the way.]]></description><link>https://blog.hasab.tech</link><image><url>https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/logos/688d0e1def7e30d5c07b0040/c3a7db94-e6bd-4923-b04f-b8f1a0995f2b.png</url><title>hasabTech</title><link>https://blog.hasab.tech</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 18:17:27 GMT</lastBuildDate><atom:link href="https://blog.hasab.tech/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How JavaScript Works (Part 2) – Execution Context & Call Stack Explained in Simple Words]]></title><description><![CDATA[In Part 1, we explored how JavaScript runs under the hood and discussed the JavaScript engine and runtime environment.
In this part, we’re going deeper.
We will understand:

What is Execution Context?]]></description><link>https://blog.hasab.tech/how-javascript-works-part-2-execution-context-call-stack</link><guid isPermaLink="true">https://blog.hasab.tech/how-javascript-works-part-2-execution-context-call-stack</guid><category><![CDATA[javascript framework]]></category><category><![CDATA[javascript for beginners]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Mon, 02 Mar 2026 09:59:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/688d0e1def7e30d5c07b0040/53f8bd65-a05e-4b49-a10e-5c909ecfb330.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<iframe></iframe>

<p>In <strong>Part 1</strong>, we explored how JavaScript runs under the hood and discussed the JavaScript engine and runtime environment.</p>
<p>In this part, we’re going deeper.</p>
<p>We will understand:</p>
<ul>
<li><p>What is Execution Context?</p>
</li>
<li><p>What are the different phases and types of an Execution Context?</p>
</li>
<li><p>What is the Call Stack?</p>
</li>
<li><p>How functions are executed internally?</p>
</li>
</ul>
<p>And most importantly we’ll visualise everything with a simple code example.</p>
<p>Let’s begin.</p>
<h2>What is an Execution Context in JavaScript?</h2>
<p>Whenever JavaScript runs your code, it creates a special environment called an <strong>Execution Context</strong>.</p>
<p>Think of it as a <strong>container</strong> where JavaScript keeps everything needed to execute your code.</p>
<h2>Phases of Execution Context</h2>
<p>Each execution context goes through <strong>two phases</strong>:</p>
<h3><strong>1.Creation Phase (Memory Allocation Phase)</strong></h3>
<p>Before executing your code, JavaScript:</p>
<ul>
<li><p>Scans the code</p>
</li>
<li><p>Allocates memory for variables</p>
</li>
<li><p>Stores function definitions in memory</p>
</li>
</ul>
<p>Important behavior:</p>
<ul>
<li><p>Variables declared with <code>var</code> are initialized with <code>undefined</code></p>
</li>
<li><p>Functions are stored entirely in memory</p>
</li>
<li><p><code>let</code> and <code>const</code> are hoisted but kept in a temporal dead zone</p>
</li>
</ul>
<p>No code is executed here. Only memory setup happens.</p>
<h3>2.Execution Phase</h3>
<p>IN this phase, JavaScript:</p>
<ul>
<li><p>Executes code line by line</p>
</li>
<li><p>Assigns actual values to variables</p>
</li>
<li><p>Runs functions when invoked</p>
</li>
<li><p>Evaluates expressions</p>
</li>
</ul>
<p>This is where real execution happens.</p>
<h2>Types of Execution Context</h2>
<p>There are two main types of execution context:</p>
<h3>1.Global Execution Context (GEC)</h3>
<ul>
<li><p>Created when JavaScript starts running your file</p>
</li>
<li><p>Exists only once and stays in the Call Stack until the program closes</p>
</li>
<li><p>Represents the global scope</p>
</li>
</ul>
<h3>2.Function Execution Context (FEC)</h3>
<ul>
<li><p>Created whenever a function is called or invoked</p>
</li>
<li><p>Each function call creates a new execution context</p>
</li>
<li><p>Has its own memory and thread of execution</p>
</li>
</ul>
<h2>What’s Inside an Execution Context?</h2>
<h3>Thread of Execution</h3>
<p>This is the order in which JavaScript runs your code line by line.</p>
<p>JavaScript is (initially) single-threaded, meaning it executes one line at a time.</p>
<h3>Memory</h3>
<p>Each execution context has its own memory.</p>
<ul>
<li><p>Global context → Global memory</p>
</li>
<li><p>Function context → Local memory</p>
</li>
</ul>
<p>This is why variables inside functions are not accessible outside (unless returned).</p>
<h2>What is the Call Stack?</h2>
<p>JavaScript uses a special memory structure to keep track of all execution contexts called the <strong>Call Stack</strong>.</p>
<p>It follows LIFO structure, i.e., "Last In, First Out" (like a stack of plates).</p>
<ul>
<li>The last function added to the stack, will be executed first, and will be popped out of the stack first.</li>
</ul>
<h2>How all of this works: Step-by-Step!</h2>
<p>Let’s understand this using a simple example.</p>
<pre><code class="language-javascript">const firstName = "Munzah";
const lastName = "Shah";
const age = 27;
const designation = "Software Engineer";

function createFullName() {
  return firstName + " " + lastName;
}

function displayUserDetails() {
  console.log("Full Name:", createFullName());
  console.log("Age:", age);
  console.log("Designation:", designation);
}

displayUserDetails();
</code></pre>
<h2>Step-by-Step Execution Breakdown</h2>
<h3>Step 1: Global Execution Context is Created</h3>
<p>When the file runs:</p>
<ul>
<li><p>Global Execution Context (GEC) is created</p>
</li>
<li><p>It is pushed into the Call Stack</p>
</li>
</ul>
<p>Call Stack:</p>
<pre><code class="language-javascript">| Global |
</code></pre>
<h2>Step 2: Creation Phase of Global Context</h2>
<p>Memory is allocated:</p>
<pre><code class="language-javascript">firstName → undefined
lastName → undefined
age → undefined
designation → undefined
createFullName → function definition
displayUserDetails → function definition
</code></pre>
<h2>Step 3: Execution Phase Begins</h2>
<p>Now values are assigned:</p>
<pre><code class="language-javascript">firstName → "Munzah"
lastName → "Shah"
age → 27
designation → "Software Engineer"
</code></pre>
<p>Functions are still not executed just stored.</p>
<h2>Step 4: Function Invocation Happens</h2>
<p>When this line runs:</p>
<pre><code class="language-javascript">displayUserDetails();
</code></pre>
<p>A new <strong>Function Execution Context</strong> is created.</p>
<p>Call Stack becomes:</p>
<pre><code class="language-javascript">| displayUserDetails |
| Global             |
</code></pre>
<p>Now JavaScript executes <code>displayUserDetails</code>.</p>
<h2>Step 5: Inside displayUserDetails()</h2>
<p>The thread of execution encounters another function call:</p>
<pre><code class="language-typescript">createFullName()
</code></pre>
<p>Another Function Execution ExecutionContext is created.</p>
<p>Call Stack now looks like this:</p>
<pre><code class="language-javascript">| createFullName     |
| displayUserDetails |
| Global             |
</code></pre>
<h2>Step 6: createFullName Executes</h2>
<p>It returns:</p>
<pre><code class="language-javascript">"Munzah Shah"
</code></pre>
<p>Once function is completed:</p>
<ul>
<li><p>Its result is returned to the parent execution context.</p>
</li>
<li><p>And It's execution context is popped out from the stack.</p>
</li>
</ul>
<p>So now, call Stack becomes:</p>
<pre><code class="language-javascript">| displayUserDetails |
| Global             |
</code></pre>
<h2>Step 7: Remaining Code In displayUserDetails() Function Executes</h2>
<p>Now:</p>
<pre><code class="language-javascript">Age: 27
Designation: Software Engineer
</code></pre>
<p>After finishing the execution of this function:</p>
<ul>
<li><p>displayUserDetails() context is removed</p>
</li>
<li><p>Stack pointer goes back to Global</p>
</li>
</ul>
<p>Call Stack:</p>
<pre><code class="language-typescript">| Global |
</code></pre>
<h2>Important Rule to Remember</h2>
<p>JavaScript always executes the function that is on the top of the Call Stack.</p>
<p>That’s why it follows LIFO.</p>
<h2>Final Output of This Code</h2>
<pre><code class="language-javascript">Full Name: Munzah Shah
Age: 27
Designation: Software Engineer
</code></pre>
<h2>Why Understanding This is Important</h2>
<p>If you understand:</p>
<ul>
<li><p>Execution Context</p>
</li>
<li><p>Call Stack</p>
</li>
<li><p>Creation Phase</p>
</li>
<li><p>Execution Phase</p>
</li>
</ul>
<p>You will easily understand:</p>
<ul>
<li><p>Hoisting</p>
</li>
<li><p>Scope</p>
</li>
<li><p>Closures</p>
</li>
<li><p>Asynchronous JavaScript</p>
</li>
<li><p>Event Loop</p>
</li>
</ul>
<p>And that’s when JavaScript truly starts making sense.</p>
<h2>Summary</h2>
<ul>
<li><p>JavaScript creates a <strong>Global Execution Context (GEC)</strong> when a program starts running.</p>
</li>
<li><p>Every execution context goes through <strong>two phases</strong>:</p>
<ul>
<li><p>Creation Phase (memory allocation)</p>
</li>
<li><p>Execution Phase (code runs line by line)</p>
</li>
</ul>
</li>
<li><p>Variables and function definitions are stored in memory during the creation phase.</p>
</li>
<li><p>Each function call creates a new <strong>Function Execution Context (FEC)</strong>.</p>
</li>
<li><p>Every execution context contains:</p>
<ul>
<li><p>Its own memory</p>
</li>
<li><p>A thread of execution</p>
</li>
</ul>
</li>
<li><p>JavaScript uses a <strong>Call Stack</strong> to manage execution contexts.</p>
</li>
<li><p>The Call Stack follows the <strong>Last In, First Out (LIFO)</strong> principle.</p>
</li>
<li><p>The function at the top of the stack is executed first.</p>
</li>
<li><p>Once a function finishes execution, it is removed (popped) from the stack.</p>
</li>
<li><p>The Global Execution Context remains until the program finishes running.</p>
</li>
<li><p>Understanding execution context and call stack makes advanced concepts like hoisting, closures, and async JavaScript easier to understand.</p>
</li>
</ul>
<p><em><strong>Stay connected with hasabTech for more information:</strong></em></p>
<p><a href="https://hasab.tech/"><strong>Website</strong></a> <a href="https://www.facebook.com/hasabTech"><strong>| Facebook</strong></a> <a href="https://www.linkedin.com/company/hasabtech"><strong>| LinkedIn</strong></a> <a href="https://youtube.com/@hasabTech"><strong>| YouTube</strong></a> <a href="https://x.com/hasabTech"><strong>| X (Twitter)</strong></a> <a href="https://tiktok.com/@hasabTech"><strong>| TikTok</strong></a></p>
]]></content:encoded></item><item><title><![CDATA[Instance Variables and Instance Methods in Python ]]></title><description><![CDATA[In Object-Oriented Programming (OOP), two of the most important concepts are:

Instance Variables

Instance Methods


If you don’t understand these properly, OOP will always feel confusing.
So let’s b]]></description><link>https://blog.hasab.tech/instance-variables-and-methods-in-python</link><guid isPermaLink="true">https://blog.hasab.tech/instance-variables-and-methods-in-python</guid><category><![CDATA[##OOP in Python]]></category><category><![CDATA[Python]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Thu, 19 Feb 2026 17:42:35 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/688d0e1def7e30d5c07b0040/87da1f3a-4450-43b8-8ca4-baadfd16dd88.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<iframe src="https://www.youtube.com/watch?v=F5IfSPe3Yow&amp;t=6s"></iframe>

<p>In Object-Oriented Programming (OOP), two of the most important concepts are:</p>
<ul>
<li><p><strong>Instance Variables</strong></p>
</li>
<li><p><strong>Instance Methods</strong></p>
</li>
</ul>
<p>If you don’t understand these properly, OOP will always feel confusing.</p>
<p>So let’s break everything down step by step in the simplest way possible.</p>
<h2>Let’s Start with a Simple Real-Life Example</h2>
<p>Imagine a classroom. Learn How Instance Variables and Methods Actually Work in Python</p>
<p>You (teacher) are the class blueprint.<br />Your students are objects.</p>
<p>Every student:</p>
<ul>
<li><p>Has a name</p>
</li>
<li><p>Has a roll number</p>
</li>
<li><p>Has marks</p>
</li>
<li><p>Can perform actions (submit homework, give test, etc.)</p>
</li>
</ul>
<p>Now here’s the important part:</p>
<p>Even though all students come from the same class,<br />each student has <strong>their own data</strong>.</p>
<p>That “own data” is exactly what we call:</p>
<blockquote>
<p><strong>Instance Variables</strong></p>
</blockquote>
<p>And the actions they perform?</p>
<blockquote>
<p><strong>Instance Methods</strong></p>
</blockquote>
<h2>What is an Instance Method in Python?</h2>
<p>An <strong>instance method</strong> is a method that belongs to an object and works on that specific object.</p>
<h3>Definition (Simple Words)</h3>
<p>An instance method:</p>
<ul>
<li><p>Is defined inside a class</p>
</li>
<li><p>Has <code>self</code> as its first parameter</p>
</li>
<li><p>Can access and modify instance variables</p>
<h3>Why Do We Need <code>self</code>?</h3>
</li>
</ul>
<p>When we create multiple objects from a class, each object has its own data.</p>
<p><code>self</code> tells Python:</p>
<p>Work with the current object that is calling this method</p>
<p>Example</p>
<blockquote>
<pre><code class="language-python">class User:
    def activate(self):
        self.is_active = True
</code></pre>
<p>If we create two objects:</p>
<pre><code class="language-python">user1 = User()
user2 = User()
</code></pre>
<p>When we call</p>
<pre><code class="language-python">user1.activate()
</code></pre>
<p>Python automatically does this internally:</p>
<pre><code class="language-python">User.activate(user1)
</code></pre>
<p>That means:</p>
<ul>
<li><code>self = user1</code></li>
</ul>
<p>So instance methods always operate on the object that calls them</p>
</blockquote>
<h2>What is an Instance Variable in Python?</h2>
<p>An <strong>instance variable</strong> is a variable that belongs to a specific object.</p>
<p>It is created using:</p>
<pre><code class="language-python">self.variable_name = value
</code></pre>
<h3>Important Concept</h3>
<p>Instance variables:</p>
<ul>
<li><p>Store data</p>
</li>
<li><p>Are unique for each object</p>
</li>
<li><p>Exist inside the object</p>
</li>
<li><p>Can be different for different objects</p>
</li>
</ul>
<h3>Example</h3>
<pre><code class="language-python">def set_email(self, email):
    self.email = email
</code></pre>
<p>When we call:</p>
<pre><code class="language-python">user1.set_email("shameel@hasabtech.com")
</code></pre>
<p>It becomes:</p>
<pre><code class="language-python">user1.email = "shameel@hasabtech.com"
</code></pre>
<p>Now <code>email</code> belongs only to <code>user1</code>.</p>
<p>If we check <code>user2</code>, it still does NOT have email until we set it.</p>
<p>That is why instance variables are object-specific.</p>
<h2>Complete Example with Deep Explanation</h2>
<p>Let’s build a proper example and understand what happens step by step.</p>
<pre><code class="language-python">class User:

    def activate(self):
        self.is_active = True

    def deactivate(self):
        self.is_active = False

    def set_email(self, email):
        self.email = email

    def show_status(self):
        print(f"{self.email} is {'active' if self.is_active else 'not active'}")
</code></pre>
<h3>Step 1: Creating Objects (Instances)</h3>
<pre><code class="language-python">user1 = User()
user2 = User()
</code></pre>
<p>When we execute this:</p>
<ul>
<li><p>Python creates two separate objects in memory</p>
</li>
<li><p>Each object has its own space to store data</p>
</li>
<li><p>Both objects have access to all instance methods</p>
</li>
</ul>
<p><strong>Important</strong>: Object and Instance mean the same thing.</p>
<h2>What Happens Inside Memory?</h2>
<p>Even though both objects come from the same class blueprint:</p>
<ul>
<li><p><code>user1</code> has its own data storage</p>
</li>
<li><p><code>user2</code> has its own data storage</p>
</li>
</ul>
<p>They do NOT share instance variables.</p>
<p>This is the beauty of OOP.</p>
<h2>Understanding Instance Methods in Action</h2>
<p>Now let’s call:</p>
<pre><code class="language-python">user1.set_email("shameel@hasabtech.com")
</code></pre>
<p>What happens?</p>
<ol>
<li><p>Python sees <code>user1</code></p>
</li>
<li><p>It passes <code>user1</code> automatically as <code>self</code></p>
</li>
<li><p>Inside method:</p>
<pre><code class="language-python">self.email = email
</code></pre>
<p>Becomes</p>
</li>
</ol>
<pre><code class="language-python">user1.email = "shameel@hasabtech.com"
</code></pre>
<p>Now:</p>
<ul>
<li><p><code>user1</code> has email</p>
</li>
<li><p><code>user2</code> still has nothing</p>
</li>
</ul>
<p>This proves instance variables belong to objects.</p>
<h2>Adding More Data to Objects</h2>
<p>Now:</p>
<pre><code class="language-python">user1.activate()
user2.deactivate()
</code></pre>
<p>This creates:</p>
<pre><code class="language-python">user1.is_active = True
user2.is_active = False
</code></pre>
<p>Again:</p>
<ul>
<li><p>Each object has its own <code>is_active</code></p>
</li>
<li><p>They are completely independent</p>
</li>
</ul>
<p>This independence is the core idea of instance variables.</p>
<h2>Why Methods are Called Instance Methods?</h2>
<p>Because they:</p>
<ul>
<li><p>Work with instance variables</p>
</li>
<li><p>Depend on the object</p>
</li>
<li><p>Use <code>self</code> to access object data</p>
</li>
</ul>
<p>For example:</p>
<pre><code class="language-python">def show_status(self):
    print(f"{self.email} is {'active' if self.is_active else 'not active'}")
</code></pre>
<p>This method:</p>
<ul>
<li><p>Reads <code>self.email</code></p>
</li>
<li><p>Reads <code>self.is_active</code></p>
</li>
<li><p>Prints data of that specific object</p>
</li>
</ul>
<p>So this method behaves differently for each object.</p>
<p>That’s why it is called an <strong>instance method.</strong></p>
<h2>Common Beginner Confusion</h2>
<p>Many students think:</p>
<blockquote>
<p>Is <code>self</code> a keyword?</p>
</blockquote>
<p>No.</p>
<p><code>self</code> is just a naming convention.</p>
<p>You can write:</p>
<pre><code class="language-python">def activate(myobject):
</code></pre>
<p>But by convention, we always write <code>self</code></p>
<h2>Why This Concept is Very Important?</h2>
<p>If you understand instance variables and instance methods, you can:</p>
<ul>
<li><p>Build login systems</p>
</li>
<li><p>Create user management systems</p>
</li>
<li><p>Understand Django models</p>
</li>
<li><p>Work with APIs</p>
</li>
<li><p>Design real-world applications</p>
</li>
</ul>
<p>Without understanding <code>self</code>, OOP will feel complicated.</p>
<h2>Final Understanding</h2>
<p>Whenever:</p>
<ul>
<li><p>You attach data using <code>self</code> → It becomes an instance variable.</p>
</li>
<li><p>You define a method with <code>self</code> → It becomes an instance method.</p>
</li>
</ul>
<p>Each object:</p>
<ul>
<li><p>Has its own data</p>
</li>
<li><p>Shares method structure</p>
</li>
<li><p>Behaves independently</p>
</li>
</ul>
<h2>Summary</h2>
<ul>
<li><p><strong>Object = Instance.</strong> They mean the same thing.</p>
</li>
<li><p><strong>Instance Variables</strong> are the "adjectives" (data) that describe the object.</p>
</li>
<li><p><strong>Instance Methods</strong> are the "verbs" (actions) the object can perform.</p>
</li>
<li><p><code>self</code> is the bridge that connects the method to the specific object’s data.</p>
</li>
<li><p>Each object has its own copy of instance variables</p>
</li>
</ul>
<p><em><strong>Stay connected with hasabTech for more information:</strong></em></p>
<p><a href="https://hasab.tech/"><strong>Website</strong></a> <a href="https://www.facebook.com/hasabTech"><strong>| Facebook</strong></a> <a href="https://www.linkedin.com/company/hasabtech"><strong>| LinkedIn</strong></a> <a href="https://youtube.com/@hasabTech"><strong>| YouTube</strong></a> <a href="https://x.com/hasabTech"><strong>| X (Twitter)</strong></a> <a href="https://tiktok.com/@hasabTech"><strong>| TikTok</strong></a></p>
]]></content:encoded></item><item><title><![CDATA[Understanding self in Python OOP: A Beginner Friendly Guide]]></title><description><![CDATA[https://www.youtube.com/watch?v=FPuoJmL6LTg
 
One of the biggest "roadblocks" for Python beginners is the self keyword. You see it in almost every class, it’s the first argument in every method, and yet, we don't seem to pass any value to it when we ...]]></description><link>https://blog.hasab.tech/understanding-self-in-python-oop-a-beginner-friendly-guide</link><guid isPermaLink="true">https://blog.hasab.tech/understanding-self-in-python-oop-a-beginner-friendly-guide</guid><category><![CDATA[Python]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[##OOP in Python]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Thu, 12 Feb 2026 10:53:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1770838531942/8663f1e7-42d8-4bc1-a40e-2a93dd73224a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=FPuoJmL6LTg">https://www.youtube.com/watch?v=FPuoJmL6LTg</a></div>
<p> </p>
<p>One of the biggest "roadblocks" for Python beginners is the <code>self</code> keyword. You see it in almost every class, it’s the first argument in every method, and yet, we don't seem to pass any value to it when we call the function.</p>
<p>If you’ve ever wondered:</p>
<ul>
<li><p>What does <code>self</code> actually do?</p>
</li>
<li><p>Why do I have to type it every single time?</p>
</li>
<li><p>How does Python know which object I’m talking about?</p>
</li>
</ul>
<p>Then this Blog is for you. Let’s break it down.</p>
<h2 id="heading-what-is-a-class-and-a-method">What is a Class and a Method?</h2>
<p>Before we talk about <code>self</code>, remember the relationship between a <strong>Class</strong> and an <strong>Object</strong>.</p>
<ul>
<li><p><strong>Class:</strong> A blueprint (like a drawing of a house).</p>
</li>
<li><p><strong>Object (Instance):</strong> The actual house built from that blueprint.</p>
</li>
</ul>
<p>If you build five houses from the same blueprint, they all have the same structure, but they have different owners and different furniture inside. <code>self</code> is the way the house "identifies" itself.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">User</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_email</span>(<span class="hljs-params">self, email</span>):</span>
        self.email = email
</code></pre>
<p>Here:</p>
<ul>
<li><p><code>User</code> → Class</p>
</li>
<li><p><code>set_email()</code> → Method</p>
</li>
</ul>
<h2 id="heading-what-is-self-the-simple-definition">What is <code>self</code>? (The Simple Definition)</h2>
<p><code>self</code> represents the specific instance (object) of the class.</p>
<p>When you define a method inside a class, Python needs a way to distinguish between different objects.</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Robot</span>:</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">introduce</span>(<span class="hljs-params">self</span>):</span>
        print(<span class="hljs-string">f"Hello, I am <span class="hljs-subst">{self.name}</span>"</span>)
</code></pre>
<p>In the code above, <a target="_blank" href="http://self.name"><code>self.name</code></a> tells Python: <em>Look for the name attribute inside THIS specific robot, not all robots in the world.</em></p>
<h2 id="heading-the-secret-behind-method-calls">The Secret Behind Method Calls</h2>
<p>This is where most beginners get confused. Look at these two ways to do the exact same thing:</p>
<h3 id="heading-method-1-the-manual-way-internal">Method 1: The Manual Way (Internal)</h3>
<pre><code class="lang-python">User.set_email(user1, <span class="hljs-string">"ammad@hasab.tech"</span>)
User.set_email(user2, <span class="hljs-string">"shameel@hasab.tech"</span>)
</code></pre>
<p>In this way:</p>
<ul>
<li><p>We manually pass the object</p>
</li>
<li><p><code>user1</code> becomes <code>self</code></p>
</li>
<li><p>This helps us understand what Python does internally</p>
</li>
</ul>
<h3 id="heading-method-2-the-pythonic-way-standard">Method 2: The Pythonic Way (Standard)</h3>
<pre><code class="lang-python">user1.set_email(<span class="hljs-string">"ammad@hasab.tech"</span>)
user2.set_email(<span class="hljs-string">"shameell@hasab.tech"</span>)
</code></pre>
<p>Behind the scenes, Python converts this into:</p>
<pre><code class="lang-python">User.set_email(user1, <span class="hljs-string">"amma@hasab.tech"</span>)
</code></pre>
<p>That’s why:</p>
<ul>
<li>This method is simpler and mostly used in real projects</li>
</ul>
<h2 id="heading-how-self-works-with-different-objects">How <code>self</code> Works with Different Objects</h2>
<p>When this line runs:</p>
<pre><code class="lang-python">user1.set_email(<span class="hljs-string">"ammad@hasab.tech"</span>)
</code></pre>
<ul>
<li><p><code>self</code> → <code>user1</code></p>
</li>
<li><p><a target="_blank" href="http://user1.email"><code>user1.email</code></a> → <code>"</code><a target="_blank" href="mailto:amma@hasab.tech"><code>ammad@hasab.tech</code></a><code>"</code></p>
</li>
</ul>
<p>When this line runs:</p>
<pre><code class="lang-python">user2.set_email(<span class="hljs-string">"shameel@hasab.tech"</span>)
</code></pre>
<ul>
<li><p><code>self</code> → <code>user2</code></p>
</li>
<li><p><a target="_blank" href="http://user2.email"><code>user2.email</code></a> → <code>"</code><a target="_blank" href="mailto:shamil@hasab.tech"><code>shameel@hasab.tech</code></a><code>"</code></p>
</li>
</ul>
<p>This shows that self ensures each user instance uses it’s own data or value, which is the core idea of Object Oriented Programming.</p>
<h2 id="heading-why-self-is-important">Why <code>self</code> Is Important</h2>
<p><code>self</code> allows Python to:</p>
<ul>
<li><p>Identify <strong>which object is calling the method</strong></p>
</li>
<li><p>Store data <strong>separately for each object</strong></p>
</li>
<li><p>Avoid data overwriting between objects</p>
</li>
</ul>
<p>Without <code>self</code>, Python would not know where to store object-specific values.</p>
<h2 id="heading-common-beginner-mistakes">Common Beginner Mistakes</h2>
<ul>
<li><p>Thinking <code>self</code> is a keyword (it’s not, but it’s a strong convention)</p>
</li>
<li><p>Forgetting to add <code>self</code> as the first parameter</p>
</li>
<li><p>Confusing instance variables with class variables</p>
</li>
</ul>
<p>Always remember:</p>
<pre><code class="lang-python">self.variable_name
</code></pre>
<p>means the variable belongs to <strong>that specific object</strong>.</p>
<h2 id="heading-summary">Summary</h2>
<ul>
<li><p><code>self</code> represents the <strong>current object</strong> in Python</p>
</li>
<li><p>It helps Python identify <strong>which object is calling a method</strong></p>
</li>
<li><p>A method can be called in <strong>two ways</strong>:</p>
<ul>
<li><p>Using class name (manual)</p>
</li>
<li><p>Using object name (automatic and common)</p>
</li>
</ul>
</li>
<li><p><code>self</code> changes depending on the object calling the method</p>
</li>
<li><p>It allows each object to maintain <strong>its own data independently</strong></p>
</li>
</ul>
<p>Understanding <code>self</code> is a <strong>foundation of Python OOP</strong>, and once you grasp it, many advanced concepts become much easier.</p>
<p><strong><em>Stay connected with hasabTech for more information:</em></strong></p>
<p><a target="_blank" href="https://hasab.tech/"><strong>Website</strong></a> <a target="_blank" href="https://www.facebook.com/hasabTech"><strong>| Facebook</strong></a> <a target="_blank" href="https://www.linkedin.com/company/hasabtech"><strong>| LinkedIn</strong></a> <a target="_blank" href="https://youtube.com/@hasabTech"><strong>| YouTube</strong></a> <a target="_blank" href="https://x.com/hasabTech"><strong>| X (Twitter)</strong></a> <a target="_blank" href="https://tiktok.com/@hasabTech"><strong>| TikTok</strong></a></p>
]]></content:encoded></item><item><title><![CDATA[Understanding Classes and Objects in Python]]></title><description><![CDATA[Now it’s time to clearly understand what a class is and what an object is in Object-Oriented Programming (OOP) using Python.
These two concepts are the foundation of OOP, and once you understand them,]]></description><link>https://blog.hasab.tech/understanding-classes-and-objects-in-python</link><guid isPermaLink="true">https://blog.hasab.tech/understanding-classes-and-objects-in-python</guid><category><![CDATA[Python]]></category><category><![CDATA[coding]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Mon, 02 Feb 2026 17:58:47 GMT</pubDate><enclosure url="https://cloudmate-test.s3.us-east-1.amazonaws.com/uploads/covers/688d0e1def7e30d5c07b0040/bfb6ed97-9f62-474d-8ac1-f1e03ee67e92.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<iframe></iframe>

<p>Now it’s time to clearly understand what a class is and what an object is in Object-Oriented Programming (OOP) using Python.</p>
<p>These two concepts are the <strong>foundation of OOP</strong>, and once you understand them, everything else becomes much easier.</p>
<h2>What Is a Class in Python?</h2>
<p>In simple words, a <strong>class is a blueprint or a template for creating objects that share common properties</strong>.</p>
<p>To understand this, let’s use a real-world example.</p>
<p>As discussed in our previous blog, first the <strong>concept of a human being</strong> was created, and then you and I were created from that concept. That <strong>concept</strong> is like a <strong>class</strong>, and our individual existence is like an <strong>object</strong>.</p>
<p>In Python terms:</p>
<ul>
<li><p>A <strong>class</strong> defines the structure (attributes) and behavior (methods).</p>
</li>
<li><p>It describes <em>what an object will look like</em></p>
</li>
<li><p>It doesn’t occupy memory by itself because it’s just a concept.</p>
</li>
</ul>
<p>So basically, a <strong>class is just a blueprint</strong>, not a real thing.</p>
<h2>What Is an Object in Python?</h2>
<p>An <strong>object</strong> is the actual house built from that blueprint. In programming, we call this an <strong>instance</strong>.</p>
<p>You can think of it this way:</p>
<ul>
<li><p><strong>Class = Blueprint</strong></p>
</li>
<li><p><strong>Object = Instance created from that blueprint</strong></p>
</li>
</ul>
<p>In Python, you’ll hear people use <strong>"object"</strong> and <strong>"instance"</strong> interchangeably. Don't let that confuse you they refer to the same thing: the real, usable version of a class.</p>
<h2>Built-in Classes in Python</h2>
<p>You might be surprised to learn that you’ve been using classes since Day 1. Every data type in Python—strings, integers, lists, and dictionaries is actually a class.</p>
<p>Try running this in your terminal:</p>
<pre><code class="language-typescript">            print(type("Hello"))
          //Output: &lt;class 'str'&gt;
</code></pre>
<p>See that? <code>str</code> is a class provided by Python. When you create a string like <code>name = "Shameel"</code>, you are actually creating an <strong>object</strong> of the <code>str</code> class.</p>
<pre><code class="language-typescript">            s0 = ""
            s1 = "Shameel"
</code></pre>
<p>Here:</p>
<ul>
<li><p><code>str</code> is the <strong>class</strong></p>
</li>
<li><p><code>str()</code> creates an <strong>object</strong></p>
</li>
<li><p>The parentheses <code>()</code> mean that an <strong>object of the class is being created</strong></p>
</li>
</ul>
<p>So:</p>
<ul>
<li><p><code>str</code> → blueprint</p>
</li>
<li><p><code>str()</code> → object (instance)</p>
</li>
</ul>
<p>This is why we say <strong>class and instance (object) are closely related</strong></p>
<h2>Literal Syntax in Python</h2>
<p>When you write:</p>
<pre><code class="language-typescript">s2 = "Shameel"
</code></pre>
<p>This is called <strong>shorthand literal syntax</strong>.</p>
<p>Behind the scenes, Python still creates an <strong>object of the</strong> <code>str</code> class. Python just hides this complexity to make the language easy and beginner-friendly.</p>
<h2>Modules and Built-in Classes</h2>
<p>Every class in Python belongs to a <strong>module</strong>.</p>
<ul>
<li><p>The file you run is also considered a <strong>module</strong></p>
</li>
<li><p>Built-in classes like <code>str</code> belong to the <strong>builtins module</strong></p>
</li>
</ul>
<p>That’s why when you inspect a string class, you’ll see it comes from <code>builtins</code>, even though you didn’t import anything manually.</p>
<h2>Objects and Memory in Python</h2>
<p>When you create an object, Python carves out a little piece of your computer's RAM to store it. Each object gets a unique "home address."</p>
<p>If you print a custom object, you’ll often see something like this: <code>&lt;__main__.User object at 0x106558c20&gt;</code></p>
<p>That long code at the end (<code>0x1065...</code>) is the physical memory address where that specific object lives.</p>
<pre><code class="language-typescript">&lt;__main__.User object at 0x106558c20&gt;
</code></pre>
<p>This address shows <strong>where the object exists in memory</strong>.</p>
<h2>Creating a Custom Class in Python</h2>
<p>Now let’s move from built-in classes to <strong>custom classes</strong>.</p>
<p>To create your own class in Python, you use the <code>class</code> keyword:</p>
<pre><code class="language-typescript">class User:
    pass
</code></pre>
<p>Here:</p>
<ul>
<li><p><code>User</code> is the <strong>class</strong></p>
</li>
<li><p><code>pass</code> means the class is empty for now</p>
</li>
</ul>
<p>To create an object from this class:</p>
<pre><code class="language-typescript">u1 = User()
</code></pre>
<p>The <code>()</code> tells Python to <strong>create an object</strong> from the <code>User</code> class and store it in the variable <code>u1</code>.</p>
<p>You can create multiple objects from the same class:</p>
<pre><code class="language-typescript">u2 = User()
</code></pre>
<p>This means:</p>
<ul>
<li><p>One <strong>class</strong></p>
</li>
<li><p>Multiple <strong>objects</strong></p>
</li>
</ul>
<p>Just like one concept of humans, but many human beings.</p>
<h2><strong>Understanding</strong> <code>__main__</code> in Python Output</h2>
<p>When you see output like:</p>
<pre><code class="language-typescript">&lt;__main__.User object&gt;
</code></pre>
<p>It means:</p>
<ul>
<li><p><code>__main__</code> is the <strong>current file being executed</strong></p>
</li>
<li><p><code>User</code> is the class defined in that file</p>
</li>
</ul>
<p>If the class were defined in another file, you would see the module name instead of <code>__main__</code>.</p>
<h2>Checking an Object’s Class with <code>type()</code></h2>
<p>You can check the class of any object using:</p>
<pre><code class="language-python">type(u1)
</code></pre>
<p>Output:</p>
<pre><code class="language-python">&lt;class '__main__.User'&gt;
</code></pre>
<p>This confirms that <code>u1</code> is an object of the <code>User</code> class.</p>
<h2><strong>Checking Object Instances with</strong> <code>isinstance()</code></h2>
<p>This is a great way to "double-check" an object. In programming, any function starting with "is" usually returns a <strong>True</strong> or <strong>False</strong> (Boolean).</p>
<p>Examples:</p>
<pre><code class="language-python">isinstance(s1, str)   # True
isinstance(s1, int)   # False
isinstance(u1, User)  # True
</code></pre>
<p>In programming, when a sentence starts with <strong>“Is”</strong>, the result is usually a <strong>Boolean value</strong> (<code>True</code> or <code>False</code>).</p>
<p>This method is <strong>widely used in Python</strong> to validate object types.</p>
<h2>Summary</h2>
<ul>
<li><p><strong>Object-Oriented Programming (OOP) in Python</strong> is built around <strong>classes and objects</strong>.</p>
</li>
<li><p>A <strong>class</strong> is a blueprint that defines structure and behavior.</p>
</li>
<li><p>An <strong>object (instance)</strong> is a real entity created from a class.</p>
</li>
<li><p>Python’s built-in data types like <strong>str, int, list, and dict</strong> are actually classes.</p>
</li>
<li><p>Objects are created using <strong>parentheses</strong> <code>()</code> and stored in memory.</p>
</li>
<li><p>You can create your own <strong>custom classes</strong> using the <code>class</code> keyword.</p>
</li>
<li><p>Use <code>type()</code> to check an object’s class.</p>
</li>
<li><p>Use <code>isinstance()</code> to verify whether an object belongs to a specific class.</p>
</li>
<li><p>Understanding classes and objects is essential for mastering <strong>Python OOP</strong>.</p>
</li>
</ul>
<p><em><strong>Stay connected with hasabTech for more information:</strong></em></p>
<p><a href="https://hasab.tech/"><strong>Website</strong></a> <a href="https://www.facebook.com/hasabTech"><strong>| Facebook</strong></a> <a href="https://www.linkedin.com/company/hasabtech"><strong>| LinkedIn</strong></a> <a href="https://youtube.com/@hasabTech"><strong>| YouTube</strong></a> <a href="https://x.com/hasabTech"><strong>| X (Twitter)</strong></a> <a href="https://tiktok.com/@hasabTech"><strong>| TikTok</strong></a></p>
]]></content:encoded></item><item><title><![CDATA[Python OOP Prerequisites: The Essential Checklist for Beginners]]></title><description><![CDATA[https://youtu.be/jRpPE4-9VNA?si=i6dcm7QzmFm2fDUn
 
Before diving head-first into the world of Object-Oriented Programming (OOP), you need a solid grasp of a few "bread and butter" Python concepts. Think of it like building a house: you can't install ...]]></description><link>https://blog.hasab.tech/python-oop-prerequisites-the-essential-checklist-for-beginners</link><guid isPermaLink="true">https://blog.hasab.tech/python-oop-prerequisites-the-essential-checklist-for-beginners</guid><category><![CDATA[python beginner]]></category><category><![CDATA[Python]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Wed, 28 Jan 2026 12:53:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769595713452/7aff0210-8685-4c58-985d-1ebf98f7ac12.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/jRpPE4-9VNA?si=i6dcm7QzmFm2fDUn">https://youtu.be/jRpPE4-9VNA?si=i6dcm7QzmFm2fDUn</a></div>
<p> </p>
<p>Before diving head-first into the world of <strong>Object-Oriented Programming (OOP)</strong>, you need a solid grasp of a few "bread and butter" Python concepts. Think of it like building a house: you can't install the roof (OOP) until you’ve laid the foundation (Basics).</p>
<p>Don’t worry this series is designed for beginners. You don’t need to be a senior dev to get started, but having these few tools in your belt will make the transition to OOP feel like a breeze rather than a climb.</p>
<h2 id="heading-core-python-basics-you-should-know">Core Python Basics You Should Know</h2>
<p>To get the most out of this OOP series, ensure you're comfortable with the following three pillars:</p>
<h3 id="heading-1-variables-and-data-types">1. Variables and Data Types</h3>
<p>In OOP, we store data inside "Objects." To do that, you must understand how Python handles data. You should be familiar with:</p>
<ul>
<li><p><strong>Strings</strong>: For names and descriptions.</p>
</li>
<li><p><strong>Integers/Floats</strong>: For counts, ages, or prices.</p>
</li>
<li><p><strong>Booleans</strong>: For "True/False" logic (essential for state management).</p>
</li>
<li><p><strong>Lists</strong>: For storing collections of objects.</p>
<p>  <strong>Why it matters:</strong> In OOP, these <em>variables</em> will eventually become <em>Attributes</em> the characteristics that define your objects.</p>
</li>
</ul>
<h3 id="heading-2-functions-in-python">2. Functions in Python</h3>
<p>Functions are the "actions" of your code. Before moving to OOP, you should know:</p>
<ul>
<li><p>How to define a function (<code>def</code>).</p>
</li>
<li><p>How to pass arguments (positional and keyword).</p>
</li>
<li><p>How to return values to use elsewhere.</p>
</li>
</ul>
<p><strong>Why it matters:</strong> In the OOP world, <strong>functions living inside a class are called Methods</strong>. If you can write a function, you’re already 80% of the way to writing a class method.</p>
<h3 id="heading-3-working-with-dictionaries">3. Working with Dictionaries</h3>
<p>You should understand how Key-Value pairs work because:</p>
<ul>
<li><p>Dictionaries represent structured data.</p>
</li>
<li><p>Internally, Python actually uses dictionaries to store object attributes.</p>
</li>
</ul>
<p>If you can pull a value from a dictionary using a key, you'll find the logic of accessing object properties very familiar.</p>
<h2 id="heading-what-you-do-not-need-to-know">What You Do NOT Need to Know</h2>
<p>It’s easy to feel overwhelmed by the vast Python ecosystem. You do not need to master these before starting this series:</p>
<ul>
<li><p>Advanced Decorators or Generators: We’ll keep things simple.</p>
</li>
<li><p>Web Frameworks: No Django or FastAPI knowledge is required.</p>
</li>
<li><p>Database Management: We won’t be touching SQL or NoSQL in the beginning.</p>
</li>
</ul>
<p>Our focus is strictly on <strong>Core Python OOP</strong> step by step.</p>
<h2 id="heading-setup-amp-environment">Setup &amp; Environment</h2>
<p>Before we write our first class, make sure your environment is ready:</p>
<ol>
<li><p>Python Installed: Ensure you have Python 3.x on your machine.</p>
</li>
<li><p>Terminal Access: You should be comfortable running a script via <code>python</code> <a target="_blank" href="http://filename.py"><code>filename.py</code></a>.</p>
</li>
<li><p>Code Editor: Use whatever you like (VS Code, PyCharm, or even a simple text editor). No complex setup or heavy IDE configuration is required.</p>
</li>
</ol>
<pre><code class="lang-typescript"><span class="hljs-comment">// Run this to check your Python version</span>
<span class="hljs-keyword">import</span> sys
print(<span class="hljs-string">"Python version"</span>) <span class="hljs-comment">//Should be 3.7 or higher</span>
</code></pre>
<h2 id="heading-how-to-master-this-series">How to Master This Series</h2>
<p>To truly "level up" your skills, don't just be a spectator. Engage with the content:</p>
<ul>
<li><p>Follow the Sequence: Concepts build on each other. Don't skip ahead!</p>
</li>
<li><p>The "Type-Along" Rule: Never just read the code. Type it out. Muscle memory is a real thing in programming.</p>
</li>
<li><p>Break Things: Change a value, delete a colon, or rename a variable. Seeing how the code breaks is the fastest way to learn how to fix it.</p>
</li>
</ul>
<h3 id="heading-resources-amp-practice">Resources &amp; Practice</h3>
<p>We believe in Hands-on Learning. To support you:</p>
<ul>
<li><p>All code examples are available on our GitHub repository.</p>
</li>
<li><p>Links to the code are provided in our YouTube series descriptions.</p>
</li>
<li><p>Clone it, fork it, or copy it just make sure you practice it.</p>
</li>
</ul>
<h2 id="heading-final-note">Final Note</h2>
<p>Object Oriented Programming isn't just a syntax change; it’s a mindset shift. It will help you write cleaner, reusable, and more professional code. Stay consistent, keep practicing, and don't be afraid to ask questions.</p>
<p><strong><em>Stay connected with hasabTech for more information:</em></strong></p>
<p><a target="_blank" href="https://hasab.tech/">Website</a> <a target="_blank" href="https://www.facebook.com/hasabTech">| Facebook</a> <a target="_blank" href="https://www.linkedin.com/company/hasabtech">| LinkedIn</a> <a target="_blank" href="https://youtube.com/@hasabTech">| YouTube</a> <a target="_blank" href="https://x.com/hasabTech">| X (Twitter)</a> <a target="_blank" href="https://tiktok.com/@hasabTech">| TikTok</a></p>
]]></content:encoded></item><item><title><![CDATA[What Is Object Oriented Programming (OOP) in Python?]]></title><description><![CDATA[https://youtu.be/iP-SINTBKac?si=WHNFFFlr_1HjGq9m
 
Object Oriented Programming (OOP) in Python is a programming approach where software is built using objects that represent real world entities. Each object is created from a class which acts as a blu...]]></description><link>https://blog.hasab.tech/what-is-object-oriented-programming-oop-in-python</link><guid isPermaLink="true">https://blog.hasab.tech/what-is-object-oriented-programming-oop-in-python</guid><category><![CDATA[Python]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[coding]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[##OOP in Python]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Thu, 22 Jan 2026 11:23:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1769080540634/3056ed10-9343-44b2-9dae-34e333595afd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/iP-SINTBKac?si=WHNFFFlr_1HjGq9m">https://youtu.be/iP-SINTBKac?si=WHNFFFlr_1HjGq9m</a></div>
<p> </p>
<p><strong>Object Oriented Programming (OOP) in Python</strong> is a programming approach where software is built using <strong>objects</strong> that represent real world entities. Each object is created from a <strong>class</strong> which acts as a blueprint defining its data (attributes) and behavior (methods).</p>
<h2 id="heading-why-do-we-need-object-oriented-programming">Why Do We Need Object Oriented Programming?</h2>
<p>In the early days of programming, developers wrote code line by line variables and functions were all here and there. Data was scattered across the program.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769019000254/720f07e9-49e6-4984-8943-fe6310eb0911.gif" alt class="image--center mx-auto" /></p>
<p>This worked for small scripts, but as applications grew larger (such as social media platforms) this spaghetti code became difficult to manage, maintain, and scale.</p>
<p>Object Oriented Programming solves this problem by organizing code into <strong>structured, reusable components</strong>.</p>
<h2 id="heading-understanding-oop-with-a-real-world-example">Understanding OOP with a Real World Example</h2>
<p>Think about the creation of a human being. There is a basic biological blueprint that defines what makes a human:</p>
<ul>
<li><p>Heart</p>
</li>
<li><p>Brain</p>
</li>
<li><p>Lungs.</p>
</li>
</ul>
<p>While individuals may differ in appearance, the core structure remains the same.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769019556663/d342aac3-c6cd-473c-bb7f-b0d8e6991c76.gif" alt class="image--center mx-auto" /></p>
<p>In Python terms:</p>
<ul>
<li><p><strong>The Blueprint = Class:</strong> A Class defines common properties and behaviours.</p>
</li>
<li><p><strong>The Human = Object:</strong> A real instance created from a class is called an Object.</p>
</li>
</ul>
<p>Each object is unique, but all objects follow the same structure defined by the class.</p>
<h2 id="heading-what-is-a-class-in-python">What Is a Class in Python?</h2>
<p>A class in Python is a template used to create objects. It generally defines two things:</p>
<ol>
<li><p><strong>Attributes:</strong> Data or properties (e.g., eye color, height).</p>
</li>
<li><p><strong>Methods:</strong> Functions that describe behavior (e.g., walking, talking).</p>
</li>
</ol>
<p>Classes help developers write clean, organized, and reusable code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1769019814746/aeaf1db6-e808-42a5-acbc-f30a8feef005.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-what-is-an-object-in-python">What Is an Object in Python?</h2>
<p>An <strong>object</strong> in Python is a real instance created from a class. While a class is just a blueprint, an object is the actual thing that exists and can be used in a program.</p>
<p>Each object:</p>
<ul>
<li><p>Contains its own data (attributes)</p>
</li>
<li><p>Can perform actions using methods defined in the class</p>
</li>
<li><p>Is independent and unique, even if it is created from the same class</p>
</li>
</ul>
<p>For example, if a class represents a <em>Human</em>, then different people are objects of that class. They all share common features defined in the class, but their values (such as name, age, or height) can be different.</p>
<p>In simple words:</p>
<ul>
<li><p><strong>Class = Blueprint</strong></p>
</li>
<li><p><strong>Object = Real-world instance created from that blueprint</strong></p>
</li>
</ul>
<p>Objects allow programs to work with real-world concepts, making code more organized, reusable, and easier to understand.</p>
<h2 id="heading-why-is-it-called-object-oriented-programming">Why Is It Called Object Oriented Programming?</h2>
<p>It is called Object-Oriented Programming because programs are designed as a collection of organized, purposeful <strong>objects</strong> rather than just a loose list of instructions. This approach makes software easier to understand, maintain, and expand.</p>
<h2 id="heading-summary">Summary</h2>
<ul>
<li><p>OOP in Python uses objects to represent real-world entities.</p>
</li>
<li><p>A Class is a blueprint or template defining attributes (data) and methods (behaviour).</p>
</li>
<li><p>An Object is a real instance created from a class each object is unique but follows the same structure.</p>
</li>
<li><p>Early programming worked for small scripts but as applications grew this line by line code turned into unmanageable spaghetti code</p>
</li>
<li><p>OOP helps organize code, making it reusable, maintainable, and scalable.</p>
</li>
<li><p>Real-world analogy: Humans are like objects created from a blueprint (class), with core features like a heart, brain, and lungs.</p>
</li>
<li><p>Object Oriented Programming is called “object-oriented” because it treats programs as a collection of organized, purposeful objects.</p>
</li>
<li><p>Benefits of OOP: Clean code, better structure, easy maintenance, and improved scalability.</p>
</li>
</ul>
<h2 id="heading-whats-next">What’s Next?</h2>
<p>Now that you understand the theory, are you ready to code? In the next blog, we will write our first Python Class and Object.</p>
<p><strong>Stay connected with hasabTech:</strong></p>
<ul>
<li><p>Website: <a target="_blank" href="https://hasab.tech/"><strong>https://hasab.tech/</strong></a></p>
</li>
<li><p>Facebook: <a target="_blank" href="https://web.facebook.com/hasabTech"><strong>https://www.facebook.com/hasabTech</strong></a></p>
</li>
<li><p>LinkedIn: <a target="_blank" href="https://www.linkedin.com/company/hasabtech"><strong>https://www.linkedin.com/company/hasabtech</strong></a></p>
</li>
<li><p>X (Twitter): <a target="_blank" href="https://x.com/hasabTec"><strong>https://x.com/hasabTec</strong></a></p>
</li>
<li><p>YouTube: <a target="_blank" href="https://youtube.com/@hasabTech"><strong>https://youtube.com/@hasabTech</strong></a></p>
</li>
<li><p>TikTok: <a target="_blank" href="https://tiktok.com/@hasabtech"><strong>https://tiktok.com/</strong></a><strong>@hasabTech</strong></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[How Does JavaScript Code Run?]]></title><description><![CDATA[https://youtu.be/nqsevuRskdE
 
Introduction
Have you ever wondered how JavaScript code actually runs?
Does it execute on its own or is there a system working behind the scenes?
In this blog we will clearly understand:

how JavaScript code really runs...]]></description><link>https://blog.hasab.tech/how-does-javascript-code-run</link><guid isPermaLink="true">https://blog.hasab.tech/how-does-javascript-code-run</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Devops articles]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Wed, 14 Jan 2026 13:23:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768392999411/d660f47e-e85b-497f-aa86-2ac1370a5378.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/nqsevuRskdE">https://youtu.be/nqsevuRskdE</a></div>
<p> </p>
<h2 id="heading-introduction">Introduction</h2>
<p>Have you ever wondered how JavaScript code actually runs?</p>
<p>Does it execute on its own or is there a system working behind the scenes?</p>
<p>In this blog we will clearly understand:</p>
<ul>
<li><p>how <strong>JavaScript code really runs?</strong></p>
</li>
<li><p>what a JavaScript <strong>Runtime Environment</strong> is?</p>
</li>
<li><p>The <strong>role of JavaScript Engine and it's types</strong> (V8, SpiderMonkey, JavaScriptCore)</p>
</li>
<li><p>how the <strong>JavaScript V8 Engine looks like from inside</strong>? (Call Stack, Heap, Parser, JIT Compiler, Interpreter, and Garbage Collector)</p>
</li>
</ul>
<p>This blog builds the foundation for understanding:</p>
<ul>
<li><p>Call Stack in detail</p>
</li>
<li><p>The working of JavaScript Engine, Execution Thread and Context</p>
</li>
<li><p>The event loop</p>
</li>
<li><p>Callback queue</p>
</li>
<li><p>MicroTask queue</p>
</li>
<li><p>Async JavaScript</p>
</li>
</ul>
<p>which we will cover in our future blogs. In this blog, we focus on building a strong mental model of the JS engine itself.</p>
<h2 id="heading-does-javascript-run-on-its-own">Does JavaScript Run on Its Own?</h2>
<p>The simple answer is <strong>No</strong>.</p>
<p>JavaScript code cannot do anything on its own unless it is executed inside a Runtime Environment.</p>
<p>A runtime environment provides all the necessary tools, libraries, and features required for JavaScript to interact with the real world such as handling clicks, accessing files, or making network requests.</p>
<h2 id="heading-what-is-a-javascript-runtime-environment">What Is a JavaScript Runtime Environment?</h2>
<p>JavaScript Runtime Environment is a system where JavaScript code lives and runs.</p>
<p>You may have heard some popular runtime environments, such as:</p>
<ul>
<li><p>Web Browsers (Chrome, Firefox, Safari)</p>
</li>
<li><p>Node.js</p>
</li>
<li><p>Bun</p>
</li>
<li><p>Deno</p>
</li>
</ul>
<p>All of these provide an environment that allows JavaScript to execute.</p>
<h2 id="heading-what-does-a-runtime-environment-provide">What Does a Runtime Environment Provide?</h2>
<p>Runtime environment offers:</p>
<ul>
<li><p>JavaScript Engine (the heart ♥️ of the runtime)</p>
</li>
<li><p>Environment-specific APIs</p>
</li>
<li><p>Event Loop, Callback Queue, and MicroTask Queue.</p>
</li>
</ul>
<p>Together these components allow JavaScript to perform real-world tasks.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768330074956/d06eda44-f935-46b3-9e53-d2c0fdcb0f06.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-javascript-engine-the-heart-of-runtime-environment">JavaScript Engine: The Heart of Runtime Environment</h2>
<p>JavaScript Engine is the core component responsible for executing JavaScript code.</p>
<p>It is not something mysterious a JavaScript engine is simply a program that reads, compiles, and runs your code.</p>
<h3 id="heading-popular-javascript-engines">Popular JavaScript Engines</h3>
<p>Different environments use different engines:</p>
<ul>
<li><p><strong>Chrome &amp; Node.js</strong> → V8 Engine</p>
</li>
<li><p><strong>Firefox</strong> → SpiderMonkey</p>
</li>
<li><p><strong>Safari</strong> → JavaScriptCore</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768330443877/336e9fcd-25d1-4ba3-8cc2-8406d7da6eac.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-environment-specific-apis">Environment Specific APIs</h2>
<p>Runtime environments also provide APIs which allow JavaScript to communicate with other software and systems. APIs depends on which environment they are in (like, Browser, Server, etc).</p>
<h3 id="heading-browser-apis-examples">Browser APIs Examples</h3>
<p>When JavaScript runs in a browser it gets access to:</p>
<ul>
<li><p>DOM (Document Object Model)</p>
</li>
<li><p>Fetch API</p>
</li>
<li><p>setTimeout and setInterval</p>
</li>
<li><p>localStorage</p>
</li>
<li><p>Event handling APIs</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768331593719/baf20026-af30-432c-82c3-a565345ee7c0.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-server-side-apis-nodejs">Server-Side APIs (Node.js)</h2>
<p>In server environments like Node.js, JavaScript has access to APIs such as:</p>
<ul>
<li><p>File System (<code>fs</code> module)</p>
</li>
<li><p>Networking</p>
</li>
<li><p>Global objects</p>
</li>
<li><p>Process management</p>
</li>
</ul>
<p>These APIs are not available in the browser which shows that APIs depend on the runtime environment.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768331963751/1882d34e-ee7e-47cd-8036-adb8f098ea3d.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-event-loop-brief-overview">Event Loop (Brief Overview)</h2>
<p>The runtime environment also contains:</p>
<ul>
<li><p>Event Loop</p>
</li>
<li><p>Callback Queue</p>
</li>
<li><p>Microtask Queue</p>
</li>
</ul>
<p>These components handle asynchronous operations in JavaScript. We will discuss them in detail in upcoming blogs.</p>
<h2 id="heading-inside-the-javascript-v8-engine">Inside the JavaScript V8 Engine</h2>
<p>Now let’s take a deeper look at how a JavaScript V8 Engine (which is the most popular one) works internally.</p>
<h3 id="heading-core-components-of-a-javascript-v8-engine">Core Components of a JavaScript V8 Engine</h3>
<h3 id="heading-1-heap-memory">1. Heap Memory</h3>
<p>Heap Memory is an unstructured memory space used to store:</p>
<ul>
<li><p>Objects</p>
</li>
<li><p>Variables</p>
</li>
<li><p>Functions</p>
</li>
</ul>
<p>It is mainly used for dynamic memory allocation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768332215403/c4b5781a-b05b-4eb8-acb3-be58cdfddcf1.gif" alt class="image--center mx-auto" /></p>
<h3 id="heading-2-call-stack">2. Call Stack</h3>
<p>The Call Stack keeps track of:</p>
<ul>
<li><p>Function calls</p>
</li>
<li><p>Execution context</p>
</li>
</ul>
<p>It follows the Last In First Out (LIFO) principle. We’ll discuss this in detail in the next blog.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768386838758/9b21f4ae-055e-44eb-a076-170a3776e11e.gif" alt class="image--center mx-auto" /></p>
<h2 id="heading-additional-v8-engine-components">Additional V8 Engine Components</h2>
<p>Modern JavaScript engines like V8 also include several optimisation and processing components:</p>
<h3 id="heading-1-parser">1. Parser</h3>
<ul>
<li><p>Reads JavaScript code</p>
</li>
<li><p>Converts it into AST (Abstract Syntax Tree)</p>
</li>
<li><p>AST represents code in a tree structured format</p>
</li>
</ul>
<h3 id="heading-2-interpreter">2. Interpreter</h3>
<ul>
<li><p>Reads and executes code line by line</p>
</li>
<li><p>Produces intermediate bytecode</p>
</li>
</ul>
<h3 id="heading-3-jit-compiler-just-in-time-compiler">3. JIT Compiler (Just-In-Time Compiler)</h3>
<ul>
<li><p>Converts byte code into machine readable code</p>
</li>
<li><p>Improves performance by optimising frequently executed code</p>
</li>
</ul>
<h3 id="heading-4-garbage-collector">4. Garbage Collector</h3>
<ul>
<li><p>Automatically cleans unused memory</p>
</li>
<li><p>Removes objects and variables that are no longer in use</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768332568968/e9fee7c7-d2a3-445f-add0-fd90b6709d1d.gif" alt class="image--center mx-auto" /></p>
<p>In our next blog, we will understand the working and execution of JavaScript V8 Engine with the help of a simple code snippet example.</p>
<p>Let’s quickly revise what we learnt in this blog.</p>
<h2 id="heading-summary">Summary:</h2>
<ul>
<li><p>The JavaScript language itself is limited until and unless it is inside of a Runtime environment.</p>
</li>
<li><p>The runtime environment acts as a container that provides additional context, tools, and capabilities, enabling JavaScript to interact with browsers, servers, and outside world.</p>
</li>
<li><p>The runtime environment comprises of JS Engine, environment specific APIs, Event Loop, Callback Queue, and MicroTask queue.</p>
</li>
<li><p>Engine is the main working component of a runtime, which handles the execution.</p>
</li>
<li><p>JavaScript V8 Engine comprises of a Heap Memory, Call Stack, Parser, JIT Compiler, Interpreter, and a Garbage Collector.</p>
</li>
</ul>
<h2 id="heading-whats-next">What’s Next?</h2>
<p>In our next blog, we will understand the execution and working of the JavaScript engine with the help of a simple code example, where we will explore the:</p>
<ul>
<li><p>Call Stack and Heap Memory in action</p>
</li>
<li><p>Execution Thread and Execution Context</p>
</li>
</ul>
<p><strong>Stay connected with hasabTech:</strong></p>
<ul>
<li><p>Website: <a target="_blank" href="https://hasab.tech/"><strong>https://hasab.tech/</strong></a></p>
</li>
<li><p>Facebook: <a target="_blank" href="https://web.facebook.com/hasabTech"><strong>https://www.facebook.com/hasabTech</strong></a></p>
</li>
<li><p>LinkedIn: <a target="_blank" href="https://www.linkedin.com/company/hasabtech"><strong>https://www.linkedin.com/company/hasabtech</strong></a></p>
</li>
<li><p>X (Twitter): <a target="_blank" href="https://x.com/hasabTec"><strong>https://x.com/hasabTec</strong></a></p>
</li>
<li><p>YouTube: <a target="_blank" href="https://youtube.com/@hasabTech"><strong>https://youtube.com/@hasabTech</strong></a></p>
</li>
<li><p>TikTok: <a target="_blank" href="https://tiktok.com/@hasabtech"><strong>https://tiktok.com/</strong></a><strong>@hasabTech</strong></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Mastering Intermediate JavaScript]]></title><description><![CDATA[Understanding How JavaScript Really Works
This Intermediate JavaScript Tutorial series is designed for developers who already understand JavaScript basics and want to go beyond syntax to understand how JavaScript actually works behind the scenes.
If ...]]></description><link>https://blog.hasab.tech/mastering-intermediate-javascript</link><guid isPermaLink="true">https://blog.hasab.tech/mastering-intermediate-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Wed, 07 Jan 2026 12:05:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1767722763239/a378ffa8-8d7d-4657-a4c0-8ac614f8b11d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-understanding-how-javascript-really-works">Understanding How JavaScript Really Works</h2>
<p>This Intermediate JavaScript Tutorial series is designed for developers who already understand JavaScript basics and want to go beyond syntax to understand how JavaScript actually works behind the scenes.</p>
<p>If you’re comfortable with variables, loops, and functions, but struggle with asynchronous code, unexpected bugs, or confusing behavior, this series will help you build real JavaScript understanding instead of relying on guesswork.</p>
<p>In this Intermediate JavaScript course, we explore the core concepts that power modern web applications, including:</p>
<ul>
<li><p>How JavaScript really runs (JavaScript engine and execution context)</p>
</li>
<li><p>Call stack &amp; memory heap</p>
</li>
<li><p>Scopes in JavaScript</p>
</li>
<li><p>Closures</p>
</li>
<li><p>Hoisting (var vs let vs const)</p>
</li>
<li><p>The this keyword in different contexts</p>
</li>
<li><p>Prototype &amp; prototype chain</p>
</li>
<li><p>Event loop (microtasks vs macrotasks)</p>
</li>
<li><p>Asynchronous JavaScript fundamentals</p>
</li>
<li><p>Callbacks and Callback Hell</p>
</li>
<li><p>Promises</p>
</li>
<li><p>Async / await with real-world examples</p>
</li>
</ul>
<p>Many people say they “know JavaScript.”<br />But knowing JavaScript syntax and understanding how JavaScript actually works behind the scenes are two very different things.</p>
<p>If you can write variables, functions, loops, and basic logic, congratulations!<br />You are no longer a beginner.</p>
<p>However, becoming an Intermediate JavaScript developer means going much deeper than writing basic code.</p>
<p>This blog introduces what <em>Intermediate JavaScript</em> really means and why it is a critical step in your web development journey.</p>
<h2 id="heading-beginner-vs-intermediate-javascript-whats-the-difference">Beginner vs Intermediate JavaScript: What’s the Difference?</h2>
<p>At the beginner level, you focus on:</p>
<ul>
<li><p>Writing correct syntax</p>
</li>
<li><p>Making code “work”</p>
</li>
<li><p>Using variables, loops, functions, and conditions</p>
</li>
</ul>
<p>At the intermediate level, your focus shifts to:</p>
<ul>
<li><p>Understanding why your code behaves a certain way</p>
</li>
<li><p>Knowing what happens internally in JavaScript</p>
</li>
<li><p>Debugging issues without guessing</p>
</li>
<li><p>Writing code that is predictable, scalable, and maintainable</p>
</li>
</ul>
<p>This is where real JavaScript learning begins.</p>
<h2 id="heading-what-does-an-intermediate-javascript-developer-know">What Does an Intermediate JavaScript Developer Know?</h2>
<p>An intermediate JavaScript developer is someone who:</p>
<ul>
<li><p>Understands JavaScript behavior, not just syntax</p>
</li>
<li><p>Can read and understand other developers’ code</p>
</li>
<li><p>Writes clean, debuggable, and scalable code</p>
</li>
<li><p>Knows how asynchronous JavaScript works</p>
</li>
<li><p>Can confidently debug bugs and explain <em>why</em> they happened</p>
</li>
<li><p>Is prepared to move into frameworks like React or backend tools like Node.js</p>
</li>
</ul>
<p>This level is about clarity and confidence, not just writing more code.</p>
<h2 id="heading-why-do-many-developers-get-stuck">Why Do Many Developers Get Stuck?</h2>
<p>Many developers move forward too fast.</p>
<p>They jump into:</p>
<ul>
<li><p>React</p>
</li>
<li><p>Node.js</p>
</li>
<li><p>Frameworks and libraries</p>
</li>
</ul>
<p>Without fully understanding JavaScript core behavior</p>
<p>This creates a dangerous gap.</p>
<p>Later, this gap shows up as:</p>
<ul>
<li><p>Bugs they can’t explain</p>
</li>
<li><p>Code they don’t fully trust</p>
</li>
<li><p>Unexpected behavior in real projects</p>
</li>
<li><p>Fear of debugging complex issues</p>
</li>
</ul>
<p>The problem is not frameworks. The problem is weak JavaScript foundations.</p>
<h2 id="heading-why-understanding-javascript-behavior-matters">Why Understanding JavaScript Behavior Matters</h2>
<p>JavaScript behaves differently from many other programming languages, which is why simply knowing the syntax is not enough. At the intermediate level, developers begin to understand <em>why bugs happen</em>, <em>why code behaves unexpectedly</em>, and <em>how JavaScript handles execution and asynchronous tasks internally</em>. This deeper understanding allows developers to debug issues logically instead of relying on guesswork. Ultimately, this knowledge is what separates average developers from confident and professional JavaScript engineers.</p>
<h2 id="heading-about-the-hasabtech-intermediate-javascript-series">About the hasabTech Intermediate JavaScript Series</h2>
<p>This is exactly why we designed the <strong>Intermediate JavaScript Series by hasabTech</strong>. The series focuses on understanding how JavaScript behaves, not just how it is written. It covers core concepts that developers usually skip, helps build strong fundamentals for real-world projects, and prepares learners for modern frameworks like React, backend tools such as Node.js, and advanced JavaScript development. Because knowing JavaScript is different from truly understanding JavaScript.</p>
<p>Watch the full video here</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/xkSpjloM7iw">https://youtu.be/xkSpjloM7iw</a></div>
<p> </p>
<p><em>Stay connected with hasabTech:</em></p>
<p>Website: <a target="_blank" href="https://hasab.tech/">https://hasab.tech/</a></p>
<p>Facebook: <a target="_blank" href="https://web.facebook.com/hasabTech">https://www.facebook.com/hasabTech</a></p>
<p>LinkedIn: <a target="_blank" href="https://www.linkedin.com/company/hasabtech">https://www.linkedin.com/company/hasabtech</a></p>
<p>X (Twitter): <a target="_blank" href="https://x.com/hasabTec">https://x.com/hasabTec</a></p>
<p>YouTube: <a target="_blank" href="https://youtube.com/@hasabTech">https://youtube.com/@hasabTech</a></p>
<p>TikTok: <a target="_blank" href="https://tiktok.com/@hasabtech">https://tiktok.com/@hasabtech</a></p>
]]></content:encoded></item></channel></rss>