<?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>Tue, 08 Sep 2026 17:52:34 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[Class Method and Static Method Explained with Examples]]></title><description><![CDATA[https://www.youtube.com/watch?v=VsiJdLA5APQ&t=18s

Introduction
When learning Object-Oriented Programming (OOP) in Python, you will often work with three types of methods:

Instance Methods

Class Met]]></description><link>https://blog.hasab.tech/class-method-and-static-method-explained-with-examples</link><guid isPermaLink="true">https://blog.hasab.tech/class-method-and-static-method-explained-with-examples</guid><category><![CDATA[Python]]></category><category><![CDATA[##OOP in Python]]></category><category><![CDATA[Class Methods]]></category><category><![CDATA[static method]]></category><category><![CDATA[Object Oriented Programming]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Fri, 26 Jun 2026 19:34:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/688d0e1def7e30d5c07b0040/619dd038-b2e7-4f2a-ac8e-1eca1687b016.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a class="embed-card" href="https://www.youtube.com/watch?v=VsiJdLA5APQ&amp;t=18s">https://www.youtube.com/watch?v=VsiJdLA5APQ&amp;t=18s</a></p>

<h2>Introduction</h2>
<p>When learning Object-Oriented Programming (OOP) in Python, you will often work with three types of methods:</p>
<ul>
<li><p><strong>Instance Methods</strong></p>
</li>
<li><p><strong>Class Methods</strong></p>
</li>
<li><p><strong>Static Methods</strong></p>
</li>
</ul>
<p>Understanding when and why to use each one will help you write cleaner, more organized, and reusable code.</p>
<p>In this article, we will learn <strong>Class Methods</strong> and <strong>Static Methods</strong> with practical examples.</p>
<h2>Why Do We Need a Class Method?</h2>
<p>Suppose user data comes from a JSON string or a database. Without a class method, we must process the data outside the class every time before creating an object.</p>
<p><strong>For example:</strong></p>
<pre><code class="language-python">import json

class InefficientUser:
    def __init__(self, username, email):
        self.username = username
        self.email = email

    # This is an INSTANCE method — you have to create a user FIRST to call it,
    # even though you really want to validate the email BEFORE creating one.
    def is_valid_email(self, email):
        return "@" in email

user_json = '{"username": "ammad", "email": "ammad@hasabtech.com"}'
data = json.loads(user_json)
user = InefficientUser(data["username"], data["email"])
print(f"Created user externally: {user.username}")
</code></pre>
<p>In the code above, we manually convert the JSON string into a dictionary every time:</p>
<pre><code class="language-python">data = json.loads(user_json)
user = InefficientUser(data["username"], data["email"])
</code></pre>
<p>If we need to create multiple objects, we will have to repeat the same code again and again. This makes the code less efficient and harder to maintain.</p>
<h2>What is a Class Method?</h2>
<p>A <strong>Class Method</strong> is a method that belongs to the class rather than a specific object.</p>
<p>It is created using the <code>@classmethod</code> decorator and receives <code>cls</code> as its first parameter.</p>
<p>Class methods are commonly used as <strong>factory methods</strong> or <strong>alternative constructors</strong>, allowing objects to be created in different ways.</p>
<h3><strong>Class Method Example</strong></h3>
<pre><code class="language-python">import json

class User:
    system_name = "hasabTech OOP Portal"

    def __init__(self, username, email):
        self.username = username
        self.email = email

    # 1. Instance method — takes self, has access to instance AND class data
    def display_profile(self):
        print(f"User: {self.username}, Email: {self.email}, System: {User.system_name}")

    # 2. Class method — takes cls, has access to class-level data, used as a factory
    @classmethod
    def from_json(cls, json_string):
        """Alternative constructor: create a User object directly from a JSON string."""
        data = json.loads(json_string)
        # cls is the class itself (User). Calling cls(...) creates the instance.
        return cls(username=data["username"], email=data["email"])
</code></pre>
<h3>Understanding the Code</h3>
<ul>
<li><p><strong>system_name</strong> is a class variable.</p>
</li>
<li><p><strong>username</strong> and <strong>email</strong> are instance variables.</p>
</li>
<li><p><strong>display_profile()</strong> is an instance method.</p>
</li>
<li><p><strong>from_json()</strong> is a class method.</p>
</li>
<li><p><strong>cls</strong> refers to the class itself.</p>
</li>
<li><p><strong>cls(...)</strong> creates and returns a new object</p>
</li>
</ul>
<h3>Using the Class Method</h3>
<pre><code class="language-python"># Using Class Method (Factory pattern to create object)
user_data = '{"username": "shameel", "email": "shameel@hasab.tech"}'
user1 = User.from_json(user_data) # create user1 directly!
user1.display_profile()
</code></pre>
<p><strong>Output:</strong></p>
<pre><code class="language-plaintext">User: shameel, Email: shameel@hasab.tech, System: hasabTech OOP Portal
</code></pre>
<p>Here, the JSON data is processed inside the class, making object creation much cleaner.</p>
<h2>Why Do We Need a Static Method?</h2>
<p>In programming, we often use <strong>utility functions</strong> (also called helper functions).</p>
<p>Examples include:</p>
<ul>
<li><p>Checking whether an email is valid</p>
</li>
<li><p>Checking password length</p>
</li>
<li><p>Verifying password complexity</p>
</li>
<li><p>Formatting text</p>
</li>
<li><p>Validating input data</p>
</li>
</ul>
<p>These tasks usually do not need access to object data or class data.</p>
<p>If we only had instance methods, we would need to create an object before calling such functions.</p>
<p><strong>Example:</strong></p>
<pre><code class="language-python">dummy=InefficientUser("dummy", "dummy@email.com")
print(f"is email valid? {dummy.is_valid_email('test@hasab.tech')}")
</code></pre>
<p>Creating an object just to validate an email is unnecessary.</p>
<h3>What is a Static Method?</h3>
<p>A <strong>Static Method</strong> is a method that belongs to the class namespace but does not have access to:</p>
<ul>
<li><p>Instance variables (<code>self</code>)</p>
</li>
<li><p>Class variables (<code>cls</code>)</p>
</li>
</ul>
<p>It works like a normal function placed inside a class because it is logically related to that class.</p>
<p>Static methods are created using the <code>@staticmethod</code> decorator.</p>
<h3>Static Method Example</h3>
<pre><code class="language-python">@staticmethod
def is_valid_email(email):
    """Utility Method: Check email validity without needing class or instance"""
    return "@" in email and email.endswith(".tech")
</code></pre>
<h3>Understanding the Code</h3>
<p>Notice that:</p>
<ul>
<li><p>There is no <code>self</code>.</p>
</li>
<li><p>There is no <code>cls</code>.</p>
</li>
<li><p>The method only uses the data passed to it.</p>
</li>
<li><p>It acts like a utility/helper function</p>
</li>
</ul>
<h3>Calling a Static Method</h3>
<pre><code class="language-python">#Using Static Method (No instance method)
email_ok = User.is_valid_email("shameel@hasab.tech")
print(f"Static Method Email Check: {email_ok}") 
</code></pre>
<p><strong>Output:</strong></p>
<pre><code class="language-plaintext">Email Valid: True
</code></pre>
<p>The method is called directly from the class without creating an object.</p>
<h2>Summary</h2>
<p>In Python:</p>
<ul>
<li><p><strong>Instance methods</strong> work with object-specific data and use <code>self</code>.</p>
</li>
<li><p><strong>Class methods</strong> work with class-level data and use <code>cls</code>.</p>
</li>
<li><p><strong>Static methods</strong> do not depend on either the class or the object and behave like utility functions.</p>
</li>
<li><p><strong>Class methods are commonly used as factory methods or alternative constructors.</strong></p>
</li>
<li><p><strong>Static methods are useful for validation and helper functions that are logically related to the class.</strong></p>
</li>
</ul>
<p>Understanding these three method types will help you write cleaner, more professional, and maintainable Python code.</p>
<h3>Conclusion</h3>
<p>Class methods and static methods are important parts of Python OOP. A class method helps create objects in different ways, while a static method helps organise utility functions inside a class.</p>
<p>Use a <strong>Class Method</strong> when you need to create or manage objects at the class level.</p>
<p>Use a <strong>Static Method</strong> when you need a helper function that does not require access to instance or class data.</p>
<h2>Watch the Complete Video Tutorial</h2>
<p>Want to see these concepts in action?</p>
<p>Watch the complete YouTube tutorial where I explain <strong>Class Methods, and Static Methods</strong> with practical coding examples.</p>
<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[What are Class Variables in Python OOP?]]></title><description><![CDATA[https://youtu.be/F7za_-e8UAw

Introduction
In Python, class variables (also known as class attributes) are shared across all instances (objects) of a class. They belong to the class itself, not to any]]></description><link>https://blog.hasab.tech/what-are-class-variables-in-python-oop</link><guid isPermaLink="true">https://blog.hasab.tech/what-are-class-variables-in-python-oop</guid><category><![CDATA[Python]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[python programming]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Sat, 20 Jun 2026 02:06:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/688d0e1def7e30d5c07b0040/2900450f-356e-4c33-8eab-3b53d02cfe85.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a class="embed-card" href="https://youtu.be/F7za_-e8UAw">https://youtu.be/F7za_-e8UAw</a></p>

<h3>Introduction</h3>
<p>In Python, class variables (also known as class attributes) <strong>are shared across all instances (objects) of a class</strong>. They belong to the class itself, not to any specific instance.</p>
<h3>The Problem: Why do we need Class Variables?</h3>
<p>Consider the following code snippet:</p>
<pre><code class="language-python">#We have a class "InefficientUser" defined with some basic data

class InefficientUser:
    def __init__(self, username):    
        self.username = username        
        self.max_login_attempts = 5 
        self.password_min_length = 8

# Creating two different user instances from this class:

u1 = InefficientUser("Shameel")
u2 = InefficientUser("Ammad")
</code></pre>
<p>In this class, the instance variables <code>max_login_attempts</code> and <code>password_min_length</code> are the values which are common and needs to be shared across all instances, whereas the username has to be a unique value for all instances.</p>
<p>Now, suppose for some reason, I want to change the value of <code>max_login_attempts</code> from 8 to 10 for the whole system. In such a case, I will have to manually change the value of <code>max_login_attempts</code> to 10 for every single instance, like this:</p>
<pre><code class="language-python">u1.max_login_attempts = 10
u2.max_login_attempts = 10
</code></pre>
<p>The aforementioned method of modifying values might for work less number of instances, but consider your code having 100 instances from a class, and manually changing the value of a common variable in all of them? That would be a headache! So this method is Tedious, time-consuming, and error-prone as well.</p>
<p>This is where the "<strong>Class Variables</strong>" kick in with their magic! ✨</p>
<h3>The Solution: Class Variables to the rescue!</h3>
<p>Class variables (also called class attributes) are variables that are defined inside a class but outside any instance methods or the <code>__init__</code> constructor. They hold data that is shared universally by all instances of that class, rather than data unique to each individual object. You may imagine them as global or shared data variables.</p>
<p>Consider the following code snippet:</p>
<pre><code class="language-python"># We have a class "User" defined with some basic data. But this time, some variables are defined outside the __init__ method. These variables are "Class Variables".

class User:
    # Class Variables 
    max_login_attempts = 5 
    password_min_length = 8
    system_name = "hasabTech Portal"
    
    def __init__(self, username):  
        # Instance Variable  
        self.username = username        
        

# Creating two different user instances from this class:

user1 = User("Shameel")
user2 = User("Ammad")
</code></pre>
<p>In this code, the <code>User</code> class has 3 Class variables:</p>
<ol>
<li><p><code>max_login_attempts</code></p>
</li>
<li><p><code>password_min_length</code></p>
</li>
<li><p><code>system_name</code></p>
</li>
</ol>
<p>These are shared variables and are attached to every instance that will be created from the <code>User</code> class. For example, the <code>user1</code> instance will have following properties and values:</p>
<img src="https://cdn.hashnode.com/uploads/covers/688d0e1def7e30d5c07b0040/1104c473-1d0d-495c-990b-7967019921aa.png" alt="" style="display:block;margin:0 auto" />

<p>Similarly, the <code>user2</code> instance will have following properties and values:</p>
<img src="https://cdn.hashnode.com/uploads/covers/688d0e1def7e30d5c07b0040/7cb25e83-4bc4-4ece-b0ad-8b6ba561f186.png" alt="" style="display:block;margin:0 auto" />

<p>So, we do not have to define these 3 properties and values again and again for each instance. And if we want to <em>modify</em> the value of any of these variables, we will just make changes in the value of the class variable defined inside the class, and all other instances will inherit the new value themselves.</p>
<h3>Main Use Cases of using Class Variables:</h3>
<p>Since Class variables store data on the class level, here are some common use cases for which these variables are being used:</p>
<ol>
<li><p><strong>Sharing Constant or Configuration Values</strong>: Storing data that should remain uniform across all instances, such as a company name, a default tax rate, or an API version.</p>
</li>
<li><p><strong>Tracking Class-Wide State</strong>: Keeping tabs on metrics that span across individual objects, such as a counter tracking the total number of objects created.</p>
</li>
<li><p><strong>Defining Default Values</strong>: Setting baseline attributes that every new object inherits automatically but can optionally override later.</p>
</li>
<li><p><strong>Memory Efficiency</strong>: Saving memory by maintaining a single copy of a variable instead of duplicating it inside every object.</p>
</li>
</ol>
<h3>Accessing the values of Class Variables</h3>
<p>There are two ways in which we can access the values of a Class variable.</p>
<ol>
<li><strong>Access value by class name</strong></li>
</ol>
<p><em>Accessing the value by class name</em> means that you access the value using the <code>Class.classVariableName</code> pattern.</p>
<p>For example, consider the same <code>User</code> class:</p>
<pre><code class="language-python">class User:
    # Class Variables 
    max_login_attempts = 5 
    password_min_length = 8
    system_name = "hasabTech Portal"
    
    def __init__(self, username):  
        # Instance Variable  
        self.username = username               

# Print the value of all class variables using class name:

print(f"Max Login Attempts: {User.max_login_attempts}")
print(f"Minimum Password Length: {User.password_min_length}")
print(f"System Name: {User.system_name}")
</code></pre>
<ol>
<li><strong>Access value by instance name</strong></li>
</ol>
<p><em>Accessing the value by instance name</em> means that you access the value using the <code>instance.classVariableName</code> pattern.</p>
<p>For example, consider the same <code>User</code> class and it's instances <code>user1</code> and <code>user2</code>:</p>
<pre><code class="language-python">class User:
    # Class Variables 
    max_login_attempts = 5 
    password_min_length = 8
    system_name = "hasabTech Portal"
    
    def __init__(self, username):  
        # Instance Variable  
        self.username = username     

# Creating two different user instances from this class:

user1 = User("Shameel")
user2 = User("Ammad")   
      

# Print the value of all class variables using user1 instance:
print(f"User 1 Max Login Attempts: {user1.max_login_attempts}")
print(f"User 1 Min Pass Length: {user1.password_min_length}")
print(f"User 1 System Name: {user1.system_name}")

# Print the value of all class variables using user2 instance:
print(f"User 2 Max Login Attempts: {user2.max_login_attempts}")
print(f"User 2  Min Pass Length: {user2.password_min_length}")
print(f"User 2 System Name: {user2.system_name}")
</code></pre>
<p>In the case of an instance variable, you are bound to access it using the instance name. However, in case of accessing class variables, it's a matter of choice how one wants to access a class variable. As a general rule of thumb, it is preferred to use pattern # 1 i.e., access class variable using Class name.</p>
<h3>Summary</h3>
<p><strong>✅ What are Class Variables?</strong></p>
<p>Class variables (also known as class attributes) <strong>are shared across all instances (objects) of a class</strong>. They belong to the class itself, not to any specific instance.</p>
<p><strong>✅ Two ways of accessing the values of a Class Variable:</strong></p>
<ol>
<li><p>Access by Class name: <code>Class.classVariableName</code></p>
</li>
<li><p>Access by Instance name: <code>Instance.classVariableName</code></p>
</li>
</ol>
<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 __init__ Method Explained: A Beginner's Guide to OOP]]></title><description><![CDATA[https://www.youtube.com/watch?v=f23RVb5j224&t=25s

Introduction
The __init__method helps us initialize objects automatically whenever they are created.
Instead of manually assigning data to every obje]]></description><link>https://blog.hasab.tech/python-init-method-explained-a-beginner-s-guide-to-oop</link><guid isPermaLink="true">https://blog.hasab.tech/python-init-method-explained-a-beginner-s-guide-to-oop</guid><category><![CDATA[Python]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Python Course]]></category><category><![CDATA[python projects]]></category><dc:creator><![CDATA[hasabTech]]></dc:creator><pubDate>Sat, 13 Jun 2026 14:49:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/688d0e1def7e30d5c07b0040/edbbfa3c-f503-4d08-b367-37d9953dadb7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a class="embed-card" href="https://www.youtube.com/watch?v=f23RVb5j224&amp;t=25s">https://www.youtube.com/watch?v=f23RVb5j224&amp;t=25s</a></p>

<h2>Introduction</h2>
<p>The <code>__init__</code>method helps us initialize objects automatically whenever they are created.</p>
<p>Instead of manually assigning data to every object, Python allows us to automate the process using the <code>__init__</code> method.</p>
<h2>The Pain Point before Python <strong>__init__</strong></h2>
<p>Imagine a simple class for a user. You create an object from that class, and then later assign attributes like name or email. <em>That works, but it is manual</em>.</p>
<p>Consider the following class</p>
<pre><code class="language-python">class SimpleUser:
    pass 
user = SimpleUser()
user.name = "Shameel" 
user.email = "shameel@example.com"
</code></pre>
<p>Here, we create an object and then manually assign attributes.</p>
<h3>Problem</h3>
<p>Every time we create an object, we must remember to add all required attributes manually.</p>
<p>For example:</p>
<pre><code class="language-python">user = SimpleUser()

#If we forget to assign:

user.name
user.email
</code></pre>
<p>Our object becomes incomplete.</p>
<p>This can cause errors later in the program.</p>
<h3>Another Common Approach</h3>
<p>Developers often create a separate method:</p>
<pre><code class="language-python">class SimpleUser:

    def set_data(self, name, email):
        self.name = name
        self.email = email

Usage:

user = SimpleUser()

user.set_data(
    "Shameel",
    "shameel@example.com"
)
</code></pre>
<p>Although this works, there is still a risk.</p>
<p>A developer might forget to call:</p>
<pre><code class="language-python">user.set_data()
</code></pre>
<p>and the object will remain uninitialized.</p>
<p>At first, this seems fine. But there is an obvious weakness. You can create the object and forget to call the setup method. Then you end up with an object that exists, but does not actually contain the data it is supposed to have.</p>
<p>That is exactly the kind of error-prone pattern Python <code>__init__</code> is designed to avoid.</p>
<h2>How Python __init__ Uses "self" to Assign Attributes</h2>
<p>Before understanding Python <code>__init__</code> properly, it helps to be clear on how self works.</p>
<p>Inside an instance method, <code>self</code> refers to the specific object currently being worked on. So when you write something like:</p>
<pre><code class="language-python">self.name = name 

self.email = email
</code></pre>
<p>you are attaching attributes directly to that object.</p>
<p>So if an object is stored in a variable called <code>user</code>, then inside the method, <code>self</code> is just another reference to that same object.</p>
<p><em>Assigning values through</em> <code>self</code> <em>means the object itself now carries those values.</em></p>
<p>Nothing magical is happening. The object is simply receiving attributes through <code>self</code>.</p>
<h2>What Python <strong>__init__</strong> actually Is</h2>
<p>Python <code>__init__</code> is a special method used for automatic object initialization.</p>
<p>Its name has a special format with two underscores before and after it.</p>
<blockquote>
<p>Methods written in this style are often called <strong>Dunder Methods</strong>.</p>
</blockquote>
<p>Dunder is short for double underscore methods. They are special methods in Python with predefined meanings.</p>
<p>The <code>__init__</code> method is written like any other method, but Python treats it specially. As soon as you create an object from a class Python <code>__init__</code> runs automatically.</p>
<p>That means instead of doing this in two separate steps:</p>
<ul>
<li><p>Create the object</p>
</li>
<li><p>Manually call another method to set attributes</p>
</li>
</ul>
<p>you can do it all at the time of object creation.</p>
<h2>How Python __<strong>init__</strong> Improves Object Creation</h2>
<p>Suppose you define a <code>User</code> class with an <code>__init__</code> method that accepts:</p>
<ul>
<li><p><strong>email</strong></p>
</li>
<li><p><strong>name</strong></p>
</li>
<li><p><strong>role</strong> (with a default value)</p>
</li>
</ul>
<p>That immediately gives you a much cleaner pattern</p>
<pre><code class="language-python">class User:
    def __init__(self, email, name, role="user"):
        self.email = email
        self.name = name
        self.role = role
</code></pre>
<p>Now every time you create a <code>user</code>, Python automatically runs this setup logic.</p>
<p>So if you create an object with email and name, those values are assigned straight away. If you do not provide a role, it defaults to <code>user</code>. This means your object starts out complete and predictable.</p>
<h2>Required and Optional Parameters in Python__<strong>init__</strong></h2>
<p>One useful thing about Python <code>__init__</code> is that it lets you define which data is mandatory and which data is optional.</p>
<p>In the example above:</p>
<ul>
<li><p><strong>email</strong> is required</p>
</li>
<li><p><strong>name</strong> is required</p>
</li>
<li><p><strong>role</strong> is optional because it already has a default value</p>
</li>
</ul>
<p>That means object creation itself becomes a kind of contract. Anyone creating a <code>user</code> must provide the important values. Optional values can still be customised when needed.</p>
<p>This is one of the biggest reasons Python <code>__init__</code> is so useful. It forces the right information to be provided at the right time.</p>
<h2>Using Python __init__ for Validation</h2>
<p>Another major benefit of Python <code>__init__</code> is validation.</p>
<p>For example, if you expect an email address, you can check whether it contains the @ symbol before accepting it. If the format is wrong, you can stop object creation immediately.</p>
<pre><code class="language-python">class User:
    def __init__(self, email, name, role="user"):
        if "@" not in email:
            raise ValueError("Invalid email")

        self.email = email
        self.name = name
        self.role = role
</code></pre>
<p>This is powerful because it prevents invalid objects from being created in the first place.</p>
<p>You can also imagine stricter rules, such as:</p>
<ul>
<li><p>Allowing only business email addresses</p>
</li>
<li><p>Rejecting common public domains</p>
</li>
<li><p>Applying company-specific signup requirements</p>
</li>
</ul>
<p>The point is simple Python <code>__init__</code> is not only for storing data. It is also the perfect place to protect the integrity of your objects.</p>
<h2>Derived Attributes in Python __init__</h2>
<p>Sometimes an object is created with one piece of data, and from that data you want to generate something extra. That is where derived attributes come in.</p>
<p>For example, if a user signs up with an email address, you might also want to store the email domain. Instead of asking for both separately, you can derive the domain from the email inside Python <code>__init__</code></p>
<pre><code class="language-python">self.domain = email.split("@")[1]
</code></pre>
<p>If the email is something like <code>shameel@hasab.tech</code>, then the derived domain becomes company.com.</p>
<p>This is useful because:</p>
<ul>
<li><p>It avoids repeated work elsewhere in the code</p>
</li>
<li><p>It keeps related logic together</p>
</li>
<li><p>It ensures the derived value is always available on the object</p>
</li>
</ul>
<p>So Python <code>__init__</code> can take input data and transform it into extra attributes that make the object more useful.</p>
<h2>Setting Default Internal Attributes with Python __init__</h2>
<p>Another common pattern is assigning internal defaults that every object should have, regardless of what the caller provides.</p>
<p>For a user object, that might mean attributes such as:</p>
<ul>
<li><p><strong>is_active = True</strong></p>
</li>
<li><p><strong>login_attempts = 0</strong></p>
</li>
</ul>
<p>These are not values the caller necessarily needs to pass in. They are part of the system's default behavior.</p>
<p>This makes Python <code>__init__</code> a convenient place to define the starting state of each object.</p>
<p>Whenever a new user is created, those defaults are already in place. No extra setup is required later.</p>
<h2>Auto-Generated Attributes in Python __init__</h2>
<p>Some attributes are not provided by the user at all. They are generated automatically by the system.</p>
<p>Examples include:</p>
<p>A unique user ID A creation timestamp Some internal tracking value</p>
<p>This is another natural use case for Python <code>__init__</code> When the object is created, these values can be generated and attached immediately.</p>
<p>A popular Python approach for unique identifiers is using a UUID. In real applications, this kind of auto-generated data is very common, especially for records that later connect to databases or APIs.</p>
<p>What happens when an object is instantiated?</p>
<p>This is the key thing to remember about Python <code>__init__</code> it runs automatically during instantiation.</p>
<p>When you write something like:</p>
<pre><code class="language-python">user1 = User("name@company.com", "Shameel")
</code></pre>
<p>Python does not just create an empty object and stop there. It creates the object and then immediately calls <strong>__init__</strong> for that object.</p>
<p>At that moment:</p>
<ul>
<li><p><code>self</code> refers to the newly created object</p>
</li>
<li><p>The provided arguments are mapped to the parameters</p>
</li>
<li><p>Assignments, validation, and extra logic run automatically</p>
</li>
</ul>
<p>So the object is initialized right away, not later.</p>
<p>If you provide only the required values, optional ones use their defaults. If you provide a custom role, that custom value is stored instead.</p>
<h2>A Practical Example of Python <strong>__init</strong>__</h2>
<p>Here is the complete pattern all together:</p>
<pre><code class="language-python">    
class User:
    def __init__(self, email, name, role="user"):
        if "@" not in email:
            raise ValueError("Invalid email")

        self.email = email
        self.name = name
        self.role = role
        self.domain = email.split("@")[1]
        self.is_active = True
        self.login_attempts = 0
</code></pre>
<p>With this design, each new object gets:</p>
<ul>
<li><p>Required data stored automatically</p>
</li>
<li><p>Optional data handled cleanly</p>
</li>
<li><p>Validation before acceptance</p>
</li>
<li><p>Derived attributes created instantly</p>
</li>
<li><p>Default internal values assigned consistently</p>
</li>
</ul>
<p>That is the real strength of Python<code>__init__</code> It centralizes the setup of an object in one reliable place.</p>
<h2>Why Python __<strong>init__</strong> Beats Manual Setup Methods</h2>
<p>Manual setup methods can work, but they depend on discipline. A person creating the object has to remember the extra step every single time.</p>
<p>That leads to several risks:</p>
<ul>
<li><p>An object may be created without necessary attributes</p>
</li>
<li><p>Validation may be skipped accidentally</p>
</li>
<li><p>Default values may not be assigned consistently</p>
</li>
<li><p>Different parts of the code may initialize objects differently</p>
</li>
</ul>
<p>Python <code>__init__</code> removes all of that uncertainty. The object cannot be properly created without passing through its initialization logic.</p>
<p>In other words Python <code>__init__</code> makes object creation safer, cleaner, and less repetitive.</p>
<h2>Key Python <strong>__init__</strong> Patterns Every Beginner Should Know</h2>
<p>When using Python <code>__init__</code> these are the most important patterns to keep in mind:</p>
<ul>
<li><p><strong>Basic attribute assignment</strong> Store incoming values directly on the object.</p>
</li>
<li><p><strong>Validation</strong> Check that incoming data is acceptable before storing it.</p>
</li>
<li><p><strong>Derived attributes</strong> Generate additional values from the provided input.</p>
</li>
<li><p><strong>Internal defaults</strong> Assign standard starting values that every object should have</p>
</li>
<li><p><strong>Auto-generated Values</strong> Create IDs, timestamps, or other system-generated properties.</p>
</li>
</ul>
<h2>Final takeaway on Python __<strong>init</strong>__</h2>
<p>If you remember just one thing: <code>__init__</code> is the automatic setup method for your objects. It is called as soon as an object is instantiated, and it exists to make sure the object starts with the right data, the right defaults, and the right checks.</p>
<p>So instead of creating an object first and then manually attaching everything later, Python lets you define a proper initialization process once and reuse it every time.</p>
<p>That is why it is such a core part of Object Oriented Programming in Python.</p>
<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[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>