<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mahmoud Hamdy on Medium]]></title>
        <description><![CDATA[Stories by Mahmoud Hamdy on Medium]]></description>
        <link>https://medium.com/@TutTrue?source=rss-3d73394f93ea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2lq2tZ0hjQ9YQ4Gw</url>
            <title>Stories by Mahmoud Hamdy on Medium</title>
            <link>https://medium.com/@TutTrue?source=rss-3d73394f93ea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:56:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@TutTrue/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The “Junior Syndrome” Problem]]></title>
            <link>https://medium.com/@TutTrue/the-junior-syndrome-problem-76d575c56aac?source=rss-3d73394f93ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/76d575c56aac</guid>
            <category><![CDATA[dunning-kruger-effect]]></category>
            <category><![CDATA[junior-developer]]></category>
            <category><![CDATA[newbie]]></category>
            <dc:creator><![CDATA[Mahmoud Hamdy]]></dc:creator>
            <pubDate>Mon, 06 Jan 2025 09:28:28 GMT</pubDate>
            <atom:updated>2025-01-06T09:28:28.741Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*di46_CVZq20CExGoSda6Hw.jpeg" /></figure><p>I’ve decided to call this phenomenon “Junior Syndrome.” I’m not sure if it has another name, but it perfectly captures a common attitude I’ve observed among newcomers in any field. It reminds me of the famous quote:</p><blockquote>“When all you’ve got is a hammer, every problem looks like a nail.”</blockquote><h3>This mindset is something I’ve noticed in many of my peers, and it’s one of the reasons I feel I’ve progressed further than most. Here’s how it manifests:</h3><p>When a junior learns a new skill or concept, they tend to see it as the ultimate solution to every problem. For example:</p><ul><li>After reading <em>Clean Code</em> by Uncle Bob, they suddenly see every piece of code as “bad” and in desperate need of refactoring.</li><li>After studying <em>Clean Architecture</em>, they insist that every software system must have four layers, even when the project’s scale or requirements don’t justify such complexity.</li><li>They often argue against alternative solutions or architectures, even when those might be a better fit for the specific use case.</li></ul><p>Don’t even dare tell them that UUID4 is slow in MySQL because its B+ tree is sorted and UUID4 is random. Or try explaining that PostgreSQL isn’t optimal for systems with heavy updates — they might stop using it for a service that handles just 20 requests per hour!</p><p>Another aspect of Junior Syndrome is the obsession with knowing <em>everything</em> before taking action. For instance:</p><ul><li>A junior joins a new company and feels they need to understand every line of code before they can start contributing.</li><li>They spend excessive time watching tutorials or reading documentation, trying to master every detail before even touching the technology.</li></ul><p>This approach often backfires. Real knowledge comes from hands-on experience — playing around with the code, understanding why certain decisions were made, and gradually applying their existing knowledge in context. By trying to learn everything upfront, they end up delaying their progress and, ironically, learning less.</p><p>The root of this behavior seems to be a fear of failure. Watching tutorials or reading documentation heavily becomes a comfort zone — a way to avoid the uncertainty of diving in and making mistakes. But the truth is, you don’t need to know everything to start. The best way to learn is to jump in, get your hands dirty, and figure out what you need along the way.</p><p>This is a lesson I’ve internalized, and it’s helped me grow faster than many of my peers. Embracing uncertainty and being willing to fail are essential steps toward mastery.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76d575c56aac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Function Pointers and Their Use with Structs]]></title>
            <link>https://towardsdev.com/function-pointers-and-their-use-with-structs-26639f37eb45?source=rss-3d73394f93ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/26639f37eb45</guid>
            <category><![CDATA[c]]></category>
            <category><![CDATA[function-pointer]]></category>
            <category><![CDATA[array-of-structures]]></category>
            <category><![CDATA[structure]]></category>
            <category><![CDATA[pointers]]></category>
            <dc:creator><![CDATA[Mahmoud Hamdy]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 10:01:33 GMT</pubDate>
            <atom:updated>2023-09-29T17:55:30.059Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Understanding Function Pointers</strong></blockquote><p>In programming, pointers are commonly used to point to variables in memory. But did you know that pointers can also be used to point to blocks of code? This is where function pointers come into play. A function pointer is a pointer that points to a block of code in memory, specifically a function. Let’s delve into the mechanics of function pointers and how to utilize them with structs.</p><p>Let’s start by looking at how regular pointers are declared:</p><pre>int x = 3;<br>int *x_ptr = &amp;x;</pre><p>Now, how can we declare a function pointer? Consider a function called sum that takes two arguments and returns their sum:</p><pre>int sum(int x, int y)<br>{<br>    return (x + y);<br>}</pre><p>Interestingly, the sum function itself is a function pointer. However, to explicitly declare a function pointer and store the sum function on it, you would do:</p><pre>int (*Operation)(int, int);</pre><p>Breaking this down:</p><ul><li>int: This is the return type of the function that the pointer will point to.</li><li>(*Operation): This is the function pointer declaration. The * indicates that Operation is a pointer to a function. The name Operation is the variable name for the function pointer.</li><li>(int, int): These are the parameter types that the functions pointed to by Operation are expected to accept.</li></ul><p>You can assign the sum function to the Operation variable:</p><pre>int (*Operation)(int, int) = sum;</pre><p>and use operation instead of sum for calling this block of code</p><pre>int x = 3, y = 5;<br>printf(&quot;%d&quot;, operation(x, y)); // output: 8<br>printf(&quot;%d&quot;, sum(x, y)); // output: 8</pre><h3>Using Function Pointers with Structs</h3><p>Imagine you want to select and execute a function based on user input (e.g., &quot;sum&quot; -&gt; sum(x, y)). Using lengthy if conditions or switch cases can become cumbersome, especially as the number of functions increases. However, an elegant solution involves using an array of structs.</p><p>Consider the following example:</p><pre>typedef struct ops<br>{<br>    char *input;<br>    int (*f)(int, int); // function pointer<br>} ops_f;<br><br>int main()<br>{<br>    int x = 10, y = 5;<br>    char *input = &quot;mul&quot;;<br>    <br>    ops_f ops[] = {<br>        {&quot;sum&quot;, sum}, {&quot;mul&quot;, mul}, {&quot;div&quot;, div}, {&quot;mod&quot;, mod}, {NULL, NULL}<br>    };<br>    <br>    int j = 0;<br>    while (ops[j].input)<br>    {<br>        if (strcmp(ops[j].input, input) == 0) // Check if input matches<br>            ops[j].f(x, y); // Execute the matched function<br>        j++;<br>    }<br>    <br>    return 0;<br>}</pre><p>Here’s the breakdown:</p><ul><li>We define a struct ops that contains a character pointer input (representing the function&#39;s name) and a function pointer f pointing to the respective function.</li><li>We create an array of ops_f structs, where each struct holds a function name and its corresponding function pointer.</li><li>We iterate through the array of structs and compare the input string with the user input. If a match is found, we execute the associated function using the function pointer.</li></ul><p>This approach makes it effortless to add more functions without adding extra lines of code. Just introduce a new struct to the array, and you’re good to go!</p><p>By combining function pointers and structs, you’ve created a flexible and maintainable system for dynamically selecting and executing functions based on user input. This technique is not only elegant but also paves the way for scalability and ease of maintenance in your codebase.</p><h3>Conclusion</h3><p>Function pointers provide a powerful mechanism in programming, enabling you to point to blocks of code and dynamically select and execute functions. While regular pointers are used to reference variables in memory, function pointers allow you to reference functions themselves. By harnessing function pointers, you can build more flexible and extensible code structures.</p><p>Utilizing function pointers with structs offers an elegant solution for dynamically selecting and executing functions based on user input or other runtime conditions. By encapsulating function pointers within a struct, you create a structured and organized way to manage various functions. This approach significantly reduces the need for lengthy if conditions or switch cases, making your code more concise, readable, and maintainable.</p><p>In essence, the combination of function pointers and structs empowers you to build adaptable and scalable systems, accommodating future additions of functions without complex code modifications. This technique enhances code efficiency, encourages code reusability, and contributes to the overall robustness of your software applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26639f37eb45" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/function-pointers-and-their-use-with-structs-26639f37eb45">Function Pointers and Their Use with Structs</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Difference Between type(obj) == class and isinstance(obj, class) in Python]]></title>
            <link>https://medium.com/@TutTrue/understanding-the-difference-between-type-obj-class-and-isinstance-obj-class-in-python-dff62e4242ba?source=rss-3d73394f93ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/dff62e4242ba</guid>
            <category><![CDATA[objects]]></category>
            <category><![CDATA[class]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[inheritance]]></category>
            <dc:creator><![CDATA[Mahmoud Hamdy]]></dc:creator>
            <pubDate>Mon, 10 Jul 2023 11:15:52 GMT</pubDate>
            <atom:updated>2023-07-10T11:15:52.827Z</atom:updated>
            <content:encoded><![CDATA[<p>Python is a versatile programming language that provides multiple ways to check the type of an object. Two common approaches are using the expression type(obj) == class and the isinstance(obj, class) function. While they may appear similar, there are fundamental differences between the two. In this article, we will explore the distinctions and help you understand when to use each method.</p><ol><li>type(obj) == class The type() function in Python returns the type of an object. When using type(obj) == class, you are essentially checking if the type of the object matches the given class. For example, consider the following code snippet:</li></ol><pre>class Person:<br>    pass<br><br>john = Person()<br><br>print(type(john) == Person)  # True</pre><p>In this case, type(john) == Person will evaluate to True because the type of the john object is Person. However, there are some situations where using type(obj) == class may not be the best choice.</p><p>One important thing to note is that type(obj) returns the exact type of the object, but it does not consider inheritance. For instance, if we have a subclass of Person called Employee, type(john) == Person will evaluate to False because john is not an instance of Person directly but rather an instance of Employee, which is a subclass of Person.</p><p>2. isinstance(obj, class) The isinstance() function is a built-in Python function that checks whether an object is an instance of a particular class or any of its subclasses. It takes two arguments: the object to check and the class (or a tuple of classes) to compare against. Here&#39;s an example:</p><pre>class Person:<br>    pass<br><br>class Employee(Person):<br>    pass<br><br>john = Employee()<br><br>print(isinstance(john, Person))  # True</pre><p>In this case, isinstance(john, Person) will evaluate to True because john is an instance of Employee, which is a subclass of Person. The isinstance() function considers both direct instances and instances of subclasses.</p><p>Unlike type(obj) == class, isinstance(obj, class) takes inheritance into account, making it a more flexible and widely used approach to check object types in Python. It allows you to write code that can handle objects of multiple related types.</p><p>Choosing the Right Approach When deciding between type(obj) == class and isinstance(obj, class), you should consider the specific requirements of your code. Here are some general guidelines:</p><ul><li>If you want to check if an object is an instance of a specific class without considering inheritance, using type(obj) == class is sufficient.</li><li>If you want to check if an object is an instance of a specific class or any of its subclasses, use isinstance(obj, class).</li><li>If your code needs to handle multiple related types and their subclasses, isinstance(obj, class) is the recommended approach, as it allows for more flexibility and adaptability.</li></ul><p>In conclusion, type(obj) == class and isinstance(obj, class) serve different purposes when it comes to checking object types in Python. The former is useful when you want to check for an exact match of the object&#39;s type, while the latter considers inheritance and allows for more flexibility in handling related classes and subclasses. Understanding the distinction between these two methods will help you write more robust and maintainable code in Python.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dff62e4242ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Enchanting Tale of the Linked List: A Journey to Hidden Treasures]]></title>
            <link>https://medium.com/@TutTrue/the-enchanting-tale-of-the-linked-list-a-journey-to-hidden-treasures-6c2e8f3aad05?source=rss-3d73394f93ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c2e8f3aad05</guid>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[linked-lists]]></category>
            <dc:creator><![CDATA[Mahmoud Hamdy]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 19:54:28 GMT</pubDate>
            <atom:updated>2023-07-09T19:54:28.492Z</atom:updated>
            <content:encoded><![CDATA[<p>Once upon a time, in a small village called Linkville, there lived a group of friends who were fond of exploring and solving puzzles. One day, they stumbled upon an ancient map that led to a hidden treasure deep within a mysterious forest. 😮</p><p>Excited by the prospect of uncovering the treasure, the friends embarked on their journey. As they delved into the dense woods, they encountered a peculiar creature named Nodeo, who seemed to possess magical powers. Nodeo told them that the path to the treasure was not straightforward and that they would need to follow a special structure called a linked list. 🗺️✨</p><p>Curiosity piqued, the friends gathered around Nodeo as it began to unfold the tale of the linked list. They learned that the linked list was like a chain of connected elements, much like a necklace made up of individual beads. Each bead in the necklace represented a node, holding a valuable piece of information. 🔗💡</p><p>Nodeo explained that the magic of the linked list lay in its ability to connect these nodes in a specific order. Each node had a pointer, a special magical link, to the next node in the list. This magical link allowed the friends to traverse through the list, one node at a time, to retrieve the hidden treasure. 🧙‍♂️🚶‍♀️🚶‍♂️🚶‍♀️🚶‍♂️🚶‍♀️🚶‍♂️🚶‍♀️🚶‍♂️🚶‍♀️</p><p>To demonstrate, Nodeo conjured up an enchanting visual representation of a linked list. It created a row of floating bubbles, each containing a clue that led closer to the treasure. The first bubble, known as the head, acted as the starting point. It pointed to the next bubble, and the next one pointed to another, forming a seamless connection. 💭💫</p><p>The friends marveled at the beauty and elegance of the linked list, realizing that it provided a flexible way to organize and access information. They understood that unlike other data structures, a linked list didn’t require a fixed amount of space. Nodes could be added or removed dynamically, like inserting a new bead into the necklace or detaching one when no longer needed. 🔁🧩🔄</p><p>Nodeo emphasized that traversing the linked list required following the magical pointers from one node to another until they reached the end. The last node, called the tail, would have a special pointer that indicated the end of the list, much like the final bead on a necklace. 🧭🔚</p><p>Equipped with this newfound knowledge, the friends thanked Nodeo for its guidance and set off on their adventure. They followed the linked list through the forest, uncovering the clues hidden within each node along the way. Step by step, they progressed through the list until they reached the treasure’s location. 🙌💪🚀💎</p><p>Amidst the joyous celebration, the friends realized that the linked list had not only helped them find the treasure but had also imparted a valuable lesson. They understood the power of organizing information in a connected manner, providing efficient access and flexibility in various situations. 🌟💡💪</p><p>With the treasure in hand and the knowledge of the linked list forever etched in their minds, the friends returned to Linkville, where they shared their tale with others. The villagers, inspired by their adventure, started exploring the concept of linked lists, using them to solve problems and unlock new possibilities in their own lives. 🏰📚🤔🌈🧩</p><p>And so, the story of the linked list spread far and wide, becoming a timeless legend in Linkville, reminding everyone of the magic and beauty that can be found in the simple yet powerful structures that connect us all. ✨📖🌌🔗❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c2e8f3aad05" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>