<?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 Pravin More on Medium]]></title>
        <description><![CDATA[Stories by Pravin More on Medium]]></description>
        <link>https://medium.com/@morepravin1989?source=rss-41078f59c9f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*L7ysprT1TJ-lf90OUziuaw.png</url>
            <title>Stories by Pravin More on Medium</title>
            <link>https://medium.com/@morepravin1989?source=rss-41078f59c9f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 22:58:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@morepravin1989/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[Kubernetes Crash Course: Learn Everything You Need to Get Started in One Hour]]></title>
            <link>https://medium.com/@morepravin1989/kubernetes-crash-course-learn-everything-you-need-to-get-started-in-one-hour-37fb61fc9f20?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/37fb61fc9f20</guid>
            <category><![CDATA[kubernetes-cluster]]></category>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 11:35:34 GMT</pubDate>
            <atom:updated>2026-03-18T11:35:34.294Z</atom:updated>
            <content:encoded><![CDATA[<p>Kubernetes Crash Course — your fast‑track guide to understanding one of today’s most powerful and essential DevOps technologies.</p><p>By the end of this crash course, you’ll understand:</p><ol><li><strong>What Kubernetes is and why it became so popular</strong></li><li><strong>How Kubernetes architecture works behind the scenes</strong></li><li><strong>The main components every Kubernetes user must know</strong></li><li><strong>A full hands‑on demo deploying a real application</strong></li></ol><p>While Kubernetes is powerful, it can feel intimidating at first. This guide simplifies the fundamentals so you can quickly build confidence — and if you decide to go deeper, you’ll know exactly how to continue your Kubernetes learning journey.</p><h3>What Is Kubernetes? (And Why Do We Need It?)</h3><p>Kubernetes is an <strong>open‑source container orchestration framework</strong> originally developed by Google. In simple words, it helps you deploy, manage, scale, and maintain applications made of dozens, hundreds, or even thousands of containers — whether running on physical servers, virtual machines, cloud platforms, or hybrid environments.</p><h3>Why did Kubernetes become necessary?</h3><p>The rise of <strong>microservices</strong> led to applications being split into many small services. This caused:</p><ul><li>A massive increase in container usage</li><li>A need to coordinate thousands of containers</li><li>Complex multi‑environment deployments</li><li>Challenges with scaling, failover, and availability</li></ul><p>Kubernetes solves these challenges by offering:High Availability</p><p>Your application stays up and running with zero downtime. Scalability</p><p>It automatically scales up when load increases and scales down when traffic drops. Disaster Recovery</p><p>Kubernetes provides mechanisms for backups and restoration so your application can recover after failures.</p><p>These three capabilities are the core pillars of modern container orchestration.</p><h3>Kubernetes Architecture: How It Really Works</h3><p>A Kubernetes cluster consists of at least:</p><ul><li><strong>1 Master Node</strong></li><li><strong>1 or more Worker Nodes</strong></li></ul><p>Each worker node runs a process called <strong>kubelet</strong>, which communicates with the cluster and runs your application containers.</p><h3>What Runs on Worker Nodes?</h3><p>Worker nodes run:</p><ul><li>Application pods</li><li>Containers deployed across the cluster</li></ul><p>Worker nodes carry most of the workload.</p><h3>What Runs on the Master Node?</h3><p>Master nodes run Kubernetes control processes:</p><h4>1. API Server</h4><p>The central entry point to the cluster. All tools — CLI, UI dashboards, and APIs — communicate through it.</p><h4>2. Controller Manager</h4><p>Monitors the cluster and ensures the desired state is maintained (e.g., restarting pods that fail).</p><h4>3. Scheduler</h4><p>Decides where new pods should run based on resources, load, and policies.</p><h4>4. etcd</h4><p>A distributed key‑value store that holds the <em>entire cluster state</em>.<br> Backups and disaster recovery rely heavily on etcd snapshots.</p><h3>Virtual Network</h3><p>Kubernetes provides a cluster‑wide virtual network so pods across different nodes can communicate as if they were on the same machine.</p><h3>Kubernetes Components You Will Use Every Day</h3><p>To help you understand Kubernetes in action, let’s build a simple use case: a web application connected to a MongoDB database.</p><h3>1. Pods</h3><p>The smallest deployable unit in Kubernetes — an abstraction on top of containers.</p><ul><li>Usually hosts <strong>one application container</strong></li><li>Can run multiple containers when needed</li></ul><p>Each pod receives its <strong>own IP address</strong>, but pods are ephemeral — they can die and be replaced any time.</p><h3>2. Services</h3><p>A service provides a <strong>stable, permanent endpoint</strong> for pods.</p><ul><li>Internal services for internal communication</li><li>External services for user‑facing traffic</li><li>Acts as a load balancer between pod replicas</li></ul><p>When a pod restarts and gets a new IP, the service ensures your application still reaches the correct backend pod.</p><h3>3. Ingress</h3><p>Ingress provides:</p><ul><li>A friendly domain name</li><li>HTTPS support</li><li>Routing rules</li></ul><p>Instead of accessing your app via raw IP and port, ingress gives you a clean, production‑ready URL.</p><h3>4. ConfigMaps &amp; Secrets</h3><h3>ConfigMaps</h3><p>Store non-sensitive external configuration like service URLs.</p><h3>Secrets</h3><p>Store sensitive data like passwords and certificates.<br> They are base64‑encoded and ideally encrypted using third‑party tools.</p><p>Externalizing configuration prevents rebuilding container images for simple changes.</p><h3>5. Volumes</h3><p>Used for persistent storage — critical for databases.</p><p>Storage may come from:</p><ul><li>Local disks</li><li>Cloud storage</li><li>On‑prem systems</li></ul><p>Kubernetes itself does not manage your data; it only attaches storage to pods.</p><h3>6. Deployments</h3><p>A deployment is the blueprint for creating pods.</p><p>It provides:</p><ul><li>Replica management</li><li>Rolling updates</li><li>Self‑healing</li></ul><p>You almost always deploy applications using <strong>Deployments</strong>, not bare pods.</p><h3>7. StatefulSets</h3><p>Used for <strong>stateful applications</strong> like databases (MySQL, MongoDB, Elasticsearch).</p><p>Provides:</p><ul><li>Stable network identifiers</li><li>Persistent storage mappings</li><li>Ordered, controlled pod deployment</li></ul><p>StatefulSets handle complexities that Deployments cannot.</p><h3>Hands‑On Demo: Deploying a Real App with MongoDB</h3><p>In the demo section, you learn:</p><ul><li>How to use <strong>Minikube</strong> to run a local Kubernetes cluster</li><li>How to use <strong>kubectl</strong> to interact with it</li><li>How to create:</li><li>ConfigMaps</li><li>Secrets</li><li>Deployments</li><li>Services</li><li>How to expose your app using a <strong>NodePort</strong></li><li>How to view logs, debug, and test your application</li></ul><p>You build:</p><ul><li>A MongoDB Deployment + Service</li><li>A Web App Deployment + Service</li><li>Externalize configuration using ConfigMaps and Secrets</li></ul><p>Finally, you validate the setup through the browser using Minikube’s node IP and NodePort.</p><h3>Kubernetes Configuration as Code (YAML)</h3><p>You learn how Kubernetes YAML files are structured:</p><ol><li><strong>Metadata</strong> — name, labels</li><li><strong>Spec</strong> — desired state</li><li><strong>Status</strong> — automatically added by Kubernetes</li></ol><p>Kubernetes continuously compares <strong>desired state vs. actual state</strong>, and controller manager fixes mismatches — this is how Kubernetes achieves self‑healing.</p><h3>Using Kubectl: Your Main Kubernetes Tool</h3><p>You explore key commands:</p><ul><li>kubectl get</li><li>kubectl describe</li><li>kubectl logs</li><li>kubectl apply</li></ul><p>And learn how to:</p><ul><li>Inspect pods, services, deployments</li><li>View logs</li><li>Stream logs</li><li>Debug workloads</li></ul><h3>Exposing Your Application</h3><p>Using:</p><ul><li>NodePort for external access</li><li>Minikube IP for local testing</li><li>Service and Ingress for production‑ready routing</li></ul><p>You validate everything by opening the app in a browser and interacting with it live.</p><h3>Conclusion</h3><p>In this crash course, you explored the essential Kubernetes components that power modern, scalable applications:</p><ul><li>Pods</li><li>Services</li><li>Ingress</li><li>ConfigMaps</li><li>Secrets</li><li>Volumes</li><li>Deployments</li><li>StatefulSets</li></ul><p>You also learned how Kubernetes architecture works, how cluster communication happens, and how to deploy real applications step‑by‑step.</p><p>With these fundamentals, you’re now ready to move confidently into more advanced Kubernetes topics and start building robust production‑ready systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37fb61fc9f20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM FileNet Deployment Manager (FDM): Source-to-Destination Code Promotion]]></title>
            <link>https://medium.com/@morepravin1989/ibm-filenet-deployment-manager-fdm-source-to-destination-code-promotion-89b6e1d52b65?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/89b6e1d52b65</guid>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 09:22:19 GMT</pubDate>
            <atom:updated>2026-02-05T09:22:19.706Z</atom:updated>
            <content:encoded><![CDATA[<p>In enterprise IBM FileNet implementations, environments are intentionally isolated to protect stability and data integrity. Changes are always introduced in a <strong>Source environment (DEV)</strong> and then promoted to a <strong>Destination environment (SIT, UAT, or PROD)</strong>.</p><p>This article explains <strong>IBM FileNet Deployment Manager (FDM)</strong> strictly from a <strong>Source → Destination perspective</strong>, showing how FileNet assets are packaged, converted, analyzed, and imported in a controlled manner.</p><h3>Understanding Source and Destination in FileNet</h3><p>RoleEnvironmentPurpose<strong>Source</strong>DEVWhere changes are designed and tested<strong>Destination</strong>SITWhere changes are validated and integrated</p><p>FDM never works “environment to environment” directly.<br> Instead, it uses a <strong>Source–Destination Pair</strong>, which becomes the <strong>single deployment contract</strong> between environments.</p><h3>What Moves from Source to Destination?</h3><p>FDM promotes <strong>repository metadata and configuration</strong>, not application code.</p><p>Typical Source → Destination assets include:</p><ul><li>Object Stores</li><li>Classes and Subclasses</li><li>Property Templates</li><li>Choice Lists</li><li>Folder Structures</li><li>Workflows / Process Definitions</li><li>Event Actions</li><li>Security Policies (ACLs)</li></ul><blockquote><em>Best Practice: Promote </em><strong><em>metadata first</em></strong><em>, instance data later.</em></blockquote><h3>Prerequisites for Source → Destination Promotion</h3><p>Before configuring FDM:</p><ol><li><strong>Source and Destination CPE versions must match</strong></li><li><strong>FDM version must align with CPE</strong></li><li>Network access to both environments</li><li>Administrative privileges on both Object Stores</li><li>LDAP/AD users and groups must exist in Destination</li></ol><h3>Step 1: Create a Deployment Tree (Promotion Workspace)</h3><p>The <strong>Deployment Tree</strong> is the container for all Source–Destination activities.</p><ul><li>Holds environments</li><li>Holds deployment datasets</li><li>Holds mappings and logs</li></ul><p>Think of it as the <strong>release workspace</strong> for FileNet promotions.</p><h3>Step 2: Define the Source Environment (DEV)</h3><p>The <strong>Source Environment</strong> represents where the truth is defined.</p><p><strong>Actions:</strong></p><ul><li>Create a new Environment in FDM</li><li>Connect to DEV Content Engine</li><li>Retrieve Object Store metadata</li></ul><p>This allows FDM to read all classes, workflows, and dependencies from DEV.</p><h3>Step 3: Define the Destination Environment (SIT)</h3><p>The <strong>Destination Environment</strong> is where objects will be deployed.</p><p><strong>Actions:</strong></p><ul><li>Create another Environment</li><li>Connect to SIT Content Engine</li><li>Retrieve Object Store metadata</li></ul><p>This step allows FDM to compare Source and Destination states.</p><h3>Step 4: Create the Source–Destination Pair</h3><p>This is the <strong>core of FileNet promotion</strong>.</p><p>The Source–Destination Pair:</p><ul><li>Links DEV Object Store → SIT Object Store</li><li>Controls how objects move</li><li>Handles security and reference mapping</li></ul><p>Once created, <strong>all export, convert, analyze, and import actions run through this pair</strong>.</p><h3>Step 5: Export from Source (DEV)</h3><p>Export always happens from the <strong>Source</strong>.</p><p><strong>Purpose:</strong></p><ul><li>Capture selected objects</li><li>Preserve dependencies</li><li>Create a reusable deployment dataset</li></ul><p>Export candidates:</p><ul><li>Modified classes</li><li>New properties</li><li>Updated workflows</li><li>Supporting choice lists</li></ul><blockquote><em>Rule: Never export partial definitions — always include dependencies.</em></blockquote><h3>Step 6: Convert for Destination (SIT)</h3><p>Conversion adapts the Source export for the Destination.</p><p>What happens during conversion:</p><ul><li>Source-specific references are adjusted</li><li>Object identifiers are prepared</li><li>Security principals are mapped (if needed)</li></ul><p>This step makes the dataset <strong>Destination-aware</strong>.</p><h3>Step 7: Analyze the Source → Destination Impact</h3><p>Analysis compares:</p><ul><li>What exists in Source</li><li>What exists in Destination</li><li>What will be created, updated, or skipped</li></ul><p>Analyze helps detect:</p><ul><li>Missing dependencies</li><li>Security mismatches</li><li>Version conflicts</li></ul><blockquote><em>Running Analyze before Import is strongly recommended.</em></blockquote><h3>Step 8: Import into Destination (SIT)</h3><p>Import is the <strong>only step that modifies the Destination environment</strong>.</p><p>During import:</p><ul><li>Classes are created or updated</li><li>Workflows are deployed</li><li>Configuration changes are applied</li></ul><p>After import:</p><ul><li>Review logs</li><li>Validate object store</li><li>Perform functional testing in SIT</li></ul><h3>Common Source → Destination Issues</h3><h3>Dependency Failures</h3><p>Cause: Incomplete export from Source<br> Solution: Export full dependency hierarchy</p><h3>Security Principal Errors</h3><p>Cause: Users/groups missing in Destination<br> Solution: Sync LDAP/AD or configure mappings</p><h3>Environment Drift</h3><p>Cause: Manual changes in Destination<br> Solution: Enforce “Source-only changes” policy</p><h3>Best Practices for Source → Destination Promotion</h3><ul><li>Treat DEV as <strong>single source of truth</strong></li><li>Never modify SIT or PROD manually</li><li>Promote metadata before instance data</li><li>Keep Deployment Trees versioned</li><li>Maintain detailed deployment logs</li><li>Standardize DEV → SIT → UAT → PROD pipeline</li></ul><h3>Final Thoughts</h3><p>IBM FileNet Deployment Manager enforces a <strong>strict Source → Destination promotion model</strong>, which is essential for enterprise stability.</p><p>When used correctly:</p><ul><li>DEV defines the change</li><li>FDM controls the movement</li><li>SIT validates the outcome</li></ul><p>This approach ensures consistency, traceability, and production safety across all FileNet environmen</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89b6e1d52b65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decision Trees Explained Clearly: Intuition, Geometry, and Practical Insight]]></title>
            <link>https://medium.com/@morepravin1989/decision-trees-explained-clearly-intuition-geometry-and-practical-insight-c0e4d7c6a861?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0e4d7c6a861</guid>
            <category><![CDATA[decision-tree]]></category>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 10:45:35 GMT</pubDate>
            <atom:updated>2026-01-07T10:45:35.948Z</atom:updated>
            <content:encoded><![CDATA[<p>Decision Trees are one of the most intuitive and widely used algorithms in Machine Learning. Despite their simplicity, they form the foundation of powerful models such as Random Forests and Gradient Boosted Trees.</p><p>In this article, we’ll build a <strong>clear conceptual understanding</strong> of decision trees — how they work, why they work, and how to think about them both logically and geometrically.</p><h3>What Is a Decision Tree?</h3><p>A Decision Tree is a supervised learning algorithm used for <strong>classification and regression</strong>.<br> It works by asking a sequence of questions about the input data and splitting the data based on the answers.</p><p>At its core, a decision tree is nothing more than a structured set of <strong>nested if–else conditions</strong>.</p><h3>A Simple Real-World Example</h3><p>Assume we have a dataset collected from the Google Play Store with the following features:</p><ul><li>Gender</li><li>Occupation</li><li>App Downloaded</li></ul><p>Our objective is simple:</p><blockquote><em>If a new user arrives and we know their gender and occupation, can we predict which app they are likely to download?</em></blockquote><h3>Step 1: Choosing the Root Node</h3><p>When analyzing the dataset, we might notice a strong pattern:</p><ul><li>Users with the occupation <strong>Student</strong> consistently download the same app.</li></ul><p>This observation leads to our first question:</p><blockquote><em>Is the occupation equal to </em>Student<em>?</em></blockquote><p>This becomes the <strong>root node</strong> of the decision tree.</p><h3>Step 2: Further Splitting the Data</h3><p>For users who are not students, the output is still mixed.<br> Now we search for the next best feature and observe:</p><ul><li>Female users tend to download one app</li><li>Male users tend to download another</li></ul><p>So the next question becomes:</p><blockquote><em>Is the user female?</em></blockquote><p>This hierarchical questioning continues until each group becomes sufficiently pure.</p><h3>Decision Trees as Program Logic</h3><p>The entire model can be represented programmatically as:</p><pre>IF occupation == &quot;Student&quot;:<br>    Recommend App A<br>ELSE:<br>    IF gender == &quot;Female&quot;:<br>        Recommend App B<br>    ELSE:<br>        Recommend App C</pre><p>This clarity is what makes decision trees so powerful and easy to interpret.</p><h3>Geometric Intuition Behind Decision Trees</h3><p>From a geometric perspective:</p><ul><li>In <strong>2D</strong>, each split creates a straight line</li><li>In <strong>3D</strong>, it becomes a plane</li><li>In higher dimensions, it forms a <strong>hyperplane</strong></li></ul><p>Each split divides the feature space into smaller regions where predictions are more certain.</p><p>Decision trees do not try to fit curves — they partition space using axis-aligned boundaries.</p><h3>Classic Example: The “Play Tennis” Dataset</h3><p>A well-known dataset used to explain decision trees includes features such as:</p><ul><li>Outlook (Sunny, Overcast, Rain)</li><li>Temperature</li><li>Humidity</li><li>Wind</li></ul><p>The output is whether tennis was played or not.</p><p>By repeatedly choosing the best feature to split on, the tree arrives at accurate decisions with simple logic.</p><h3>Important Terminology</h3><ul><li><strong>Root Node</strong> — First splitting feature</li><li><strong>Decision Nodes</strong> — Intermediate conditions</li><li><strong>Leaf Nodes</strong> — Final predictions</li><li><strong>Branches</strong> — Outcomes of each decision</li></ul><h3>Advantages of Decision Trees</h3><ul><li>Easy to understand and interpret</li><li>Minimal data preprocessing required</li><li>Works with numerical and categorical data</li><li>Fast during inference</li></ul><h3>Limitations</h3><ul><li>Can easily overfit training data</li><li>Sensitive to small changes in data</li><li>Performance degrades with highly imbalanced datasets</li></ul><p>These issues are addressed by ensemble methods such as Random Forests.</p><h3>Final Thoughts</h3><p>Decision Trees are more than just machine learning models — they represent <strong>logical reasoning applied to data</strong>.</p><p>They help us understand:</p><ul><li>Why a prediction was made</li><li>Which features matter the most</li><li>How decisions evolve step by step</li></ul><p>For this reason, decision trees are often the <strong>first algorithm</strong> taught in machine learning — and rightly so.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0e4d7c6a861" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memory Ownership and Smart Pointers in C++ (Beginner-Friendly Guide)]]></title>
            <link>https://medium.com/@morepravin1989/memory-ownership-and-smart-pointers-in-c-beginner-friendly-guide-643b38a8ceb1?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/643b38a8ceb1</guid>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 11:41:16 GMT</pubDate>
            <atom:updated>2025-12-17T11:41:16.691Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Learn how modern C++ manages dynamic memory safely using std::unique_ptr, with simple explanations and clear examples.</blockquote><blockquote><a href="https://github.com/pravinmoreone-ux/Memory_Ownership_and_Smart_Pointers">https://github.com/pravinmoreone-ux/Memory_Ownership_and_Smart_Pointers</a></blockquote><h3>Why Memory Management Matters in C++</h3><p>C++ gives developers a lot of power — including direct control over memory. While this power enables high‑performance applications (games, engines, embedded systems), it also introduces risk.</p><p>Poor memory management can lead to:</p><ul><li>❌ Memory leaks</li><li>❌ Dangling pointers</li><li>❌ Crashes and undefined behavior</li></ul><p>To solve this, <strong>modern C++ encourages an ownership-based approach to memory</strong>, supported by <strong>smart pointers</strong>.</p><h3>Stack Memory vs Heap Memory</h3><h3>Stack Memory (Simple &amp; Automatic)</h3><pre>int x = 10;</pre><ul><li>Allocated automatically</li><li>Deallocated automatically</li><li>Very fast</li></ul><p>But stack memory has limitations:</p><ul><li>Limited size</li><li>Objects die when they go out of scope</li><li>Not suitable for dynamic lifetimes</li></ul><h3>Heap Memory (Flexible but Dangerous)</h3><pre>int* p = new int(10);<br>// ...<br>delete p;</pre><p>Heap memory:</p><ul><li>Allocated at runtime</li><li>Must be freed manually</li><li>Error‑prone if misused</li></ul><p>Common problems:</p><ul><li>Forgetting delete → memory leak</li><li>Using memory after delete → dangling pointer</li><li>Deleting twice → crash</li></ul><h3>The Idea of Memory Ownership</h3><blockquote><strong><em>Every dynamically allocated object should have exactly one clear owner.</em></strong></blockquote><p>Think of ownership like owning a house:</p><ul><li>The owner is responsible for cleaning up</li><li>There should be no confusion about who owns it</li></ul><p>In C++, <em>smart pointers</em> help enforce this rule.</p><h3>What Are Smart Pointers?</h3><p>Smart pointers:</p><ul><li>Behave like regular pointers</li><li>Automatically manage memory</li><li>Release resources when they go out of scope</li></ul><p>The most commonly used smart pointer is:</p><h3>std::unique_ptr</h3><blockquote><em>A smart pointer that represents </em><strong><em>exclusive ownership</em></strong><em> of a resource.</em></blockquote><p>Rules of std::unique_ptr:</p><ul><li>✔ Only one owner</li><li>❌ Cannot be copied</li><li>✔ Ownership can be transferred</li></ul><h3>Creating a unique_ptr (The Right Way)</h3><pre>#include &lt;memory&gt;</pre><pre>int main() {<br>    auto ptr = std::make_unique&lt;int&gt;(42);<br>}</pre><p>What happens here?</p><ul><li>An int is allocated on the heap</li><li>ptr owns it</li><li>Memory is freed automatically when ptr goes out of scope</li></ul><p>No delete. No leaks. No stress.</p><h3>Why std::make_unique() Is Preferred</h3><p>❌ Old style:</p><pre>int* p = new int(42);</pre><p>✔ Modern C++:</p><pre>auto p = std::make_unique&lt;int&gt;(42);</pre><p>Benefits:</p><ul><li>Exception‑safe</li><li>Cleaner syntax</li><li>Impossible to forget deletion</li></ul><h3>Using unique_ptr with Objects</h3><pre>#include &lt;iostream&gt;<br>#include &lt;memory&gt;</pre><pre>class Character {<br>public:<br>    std::string name;</pre><pre>    Character(std::string n) : name(n) {<br>        std::cout &lt;&lt; &quot;Creating &quot; &lt;&lt; name &lt;&lt; &#39;\n&#39;;<br>    }</pre><pre>    ~Character() {<br>        std::cout &lt;&lt; &quot;Deleting &quot; &lt;&lt; name &lt;&lt; &#39;\n&#39;;<br>    }<br>};</pre><pre>int main() {<br>    auto hero = std::make_unique&lt;Character&gt;(&quot;Frodo&quot;);<br>}</pre><h3>Output</h3><pre>Creating Frodo<br>Deleting Frodo</pre><p>The destructor is called automatically — this is <strong>RAII</strong> in action.</p><h3>Accessing the Object (* and -&gt;)</h3><pre>auto hero = std::make_unique&lt;Character&gt;(&quot;Frodo&quot;);</pre><pre>std::cout &lt;&lt; hero-&gt;name;   // Preferred<br>std::cout &lt;&lt; (*hero).name; // Also valid</pre><p>Smart pointers behave just like raw pointers when accessing members.</p><h3>Why You Cannot Copy a unique_ptr</h3><pre>auto p1 = std::make_unique&lt;int&gt;(10);<br>auto p2 = p1; // ❌ Compile-time error</pre><p>Copying would mean two owners — which violates the ownership rule.</p><p>C++ prevents this mistake <strong>at compile time</strong>.</p><h3>Passing unique_ptr to Functions</h3><h3>Borrowing Access (No Ownership Transfer)</h3><pre>void print(int* value) {<br>    std::cout &lt;&lt; *value;<br>}</pre><pre>int main() {<br>    auto num = std::make_unique&lt;int&gt;(42);<br>    print(num.get());<br>}</pre><p>get() provides access without giving up ownership.</p><h3>Transferring Ownership with std::move()</h3><pre>#include &lt;utility&gt;</pre><pre>void takeOwnership(std::unique_ptr&lt;int&gt; value) {<br>    std::cout &lt;&lt; *value;<br>}</pre><pre>int main() {<br>    auto num = std::make_unique&lt;int&gt;(42);<br>    takeOwnership(std::move(num));<br>}</pre><p>After std::move():</p><ul><li>Ownership is transferred</li><li>The original pointer becomes empty (nullptr)</li></ul><h3>Important Rule After std::move()</h3><p>❌ Wrong:</p><pre>std::cout &lt;&lt; *num; // num no longer owns anything</pre><p>✔ Correct:</p><pre>if (num) {<br>    std::cout &lt;&lt; *num;<br>}</pre><h3>Key Takeaways</h3><ul><li>Prefer <strong>stack memory</strong> when possible</li><li>Use <strong>heap memory</strong> only when needed</li><li>Always define <strong>clear ownership</strong></li><li>Use std::unique_ptr for exclusive ownership</li><li>Create objects with std::make_unique()</li><li>Transfer ownership using std::move()</li></ul><h3>Final Thought</h3><p>Modern C++ is not about avoiding dynamic memory — it’s about <strong>owning it safely</strong>.</p><p>If you master std::unique_ptr, you eliminate an entire class of bugs from your code.</p><p>Happy coding 🚀</p><p><em>If you found this useful, consider following for more beginner‑friendly C++ content on memory, STL, CMake, and game development.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=643b38a8ceb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the C++ Preprocessor and Linker — A Practical Guide]]></title>
            <link>https://medium.com/@morepravin1989/understanding-the-c-preprocessor-and-linker-a-practical-guide-006153508681?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/006153508681</guid>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 10:24:03 GMT</pubDate>
            <atom:updated>2025-12-15T11:19:02.653Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding the C++ Preprocessor and Linker — A Practical Guide</h3><p><em>C++ beginners often struggle with mysterious compilation and linker errors. Messages like </em><strong><em>“redefinition of symbol”</em></strong><em>, </em><strong><em>“undefined reference”</em></strong><em>, or </em><strong><em>“unresolved external”</em></strong><em> feel random — until you understand two core stages of the C++ build process: the </em><strong><em>Preprocessor</em></strong><em> and the </em><strong><em>Linker</em></strong><em>.</em></p><p>This article explains both <strong>clearly, practically, and with real-world rules</strong>, so you can debug confidently and write scalable C++ projects.</p><p><a href="https://github.com/pravinmoreone-ux">https://github.com/pravinmoreone-ux</a></p><h3>1. The C++ Build Pipeline (Big Picture)</h3><p>When you build a C++ program, it goes through <strong>four main stages</strong>:</p><ol><li><strong>Preprocessing</strong> — Text manipulation</li><li><strong>Compilation</strong> — Syntax &amp; type checking</li><li><strong>Linking</strong> — Connecting code across files</li><li><strong>Execution</strong> — Running the program</li></ol><p>Most confusion happens because developers mix up <strong>compilation errors</strong> with <strong>linker errors</strong>.</p><h3>2. The Preprocessor: What It Really Does</h3><p>The <strong>C++ preprocessor</strong> runs <em>before</em> the compiler. It does <strong>not understand C++ syntax</strong>.</p><p>Its job is simple:</p><blockquote><strong><em>Modify source code as plain text</em></strong></blockquote><h3>Common Preprocessor Directives</h3><pre>#include<br>#define<br>#undef<br>#ifdef / #ifndef<br>#endif<br>#pragma once</pre><h3>3. #include: Textual Substitution</h3><pre>#include &quot;Character.h&quot;</pre><p>This does <strong>not</strong> import compiled code.</p><p>It literally means:</p><blockquote>Copy-paste the contents of Character.h here.</blockquote><h3>&lt; &gt; vs &quot; &quot;</h3><pre>#include &lt;iostream&gt;   // system / standard library<br>#include &quot;Player.h&quot;  // your project files</pre><p>SyntaxSearch Location&lt; &gt;Compiler include paths&quot; &quot;Current directory → include paths</p><h3>4. The Danger of Multiple Inclusion</h3><pre>// Character.h<br>class Character {};</pre><p>Included twice:</p><pre>#include &quot;Character.h&quot;<br>#include &quot;Character.h&quot;</pre><p>Compiler error:</p><pre>redefinition of &#39;class Character&#39;</pre><p>Because the class was <strong>textually pasted twice</strong>.</p><h3>5. Header Guards: The First Line of Defense</h3><h3>Traditional Header Guard</h3><pre>#ifndef CHARACTER_H<br>#define CHARACTER_H</pre><pre>class Character {};</pre><pre>#endif</pre><h3>Modern Alternative</h3><pre>#pragma once</pre><pre>class Character {};</pre><p>✔ Prevents multiple inclusion<br>✔ Used in almost all modern codebases</p><h3>6. Why You Should NEVER Include .cpp Files</h3><pre>#include &quot;Character.cpp&quot;  // WRONG</pre><h3>Why This Breaks Projects</h3><ul><li>Causes multiple definitions</li><li>Slows compilation</li><li>Confuses the linker</li><li>Breaks scalability</li></ul><p><strong>Rule</strong></p><blockquote><em>Only include </em><strong><em>header files</em></strong><em>, never source files.</em></blockquote><h3>7. Declarations vs Definitions (Critical Concept)</h3><h3>Declaration</h3><pre>void Attack();</pre><p>Tells the compiler <em>something exists</em>.</p><h3>Definition</h3><pre>void Attack() {<br>  // implementation<br>}</pre><p>Provides the actual code.</p><p><strong>Rule</strong></p><ul><li>Declarations → many times allowed</li><li>Definitions → exactly once</li></ul><h3>8. Why Header + Source Files Exist</h3><h3>Header (.h / .hpp)</h3><pre>#pragma once</pre><pre>class Weapon {<br>public:<br>  int GetDamage();<br>};</pre><h3>Source (.cpp)</h3><pre>#include &quot;Weapon.h&quot;</pre><pre>int Weapon::GetDamage() {<br>  return 10;<br>}</pre><p>✔ Cleaner design<br>✔ Faster builds<br>✔ Clear separation of interface &amp; implementation</p><h3>9. Enter the Linker: Connecting Everything</h3><p>Each .cpp file is compiled <strong>independently</strong> into an object file:</p><pre>Weapon.cpp  → Weapon.o<br>Player.cpp  → Player.o<br>main.cpp    → main.o</pre><p>The <strong>linker</strong> then:</p><ul><li>Finds missing symbols</li><li>Matches declarations to definitions</li><li>Produces the final executable</li></ul><h3>10. A Classic Linker Error Explained</h3><pre>class Monster {<br>public:<br>  void Taunt();<br>};</pre><pre>int main() {<br>  Monster m;<br>  m.Taunt();<br>}</pre><p>Linker error:</p><pre>undefined reference to Monster::Taunt()</pre><h3>Why This Happens</h3><ul><li>Function was declared</li><li>Function was never defined</li></ul><p><strong>Fix</strong><br>Add the definition in a .cpp file.</p><h3>11. Forward Declarations &amp; Incomplete Types</h3><pre>class Sword;  // forward declaration</pre><pre>class Character {<br>  Sword* Weapon;  // OK<br>};</pre><p>Allowed:</p><ul><li>Pointers</li><li>References</li><li>Function parameters</li></ul><p>Not allowed:</p><pre>Weapon-&gt;Damage;  // needs full definition</pre><h3>12. Solving Circular Dependencies</h3><h3>Problem</h3><pre>Character.h → includes Sword.h<br>Sword.h → includes Character.h</pre><h3>Solution</h3><pre>// Character.h<br>class Sword;<br>class Character { Sword* Weapon; };</pre><pre>// Character.cpp<br>#include &quot;Character.h&quot;<br>#include &quot;Sword.h&quot;</pre><p>✔ No circular includes<br>✔ Faster compilation</p><h3>13. Preprocessor vs Linker — Clear Comparison</h3><p>StageResponsibilityPreprocessorText substitutionCompilerSyntax &amp; type checkingLinkerSymbol resolution</p><h3>14. Real-World Best Practices</h3><p>✔ Use #pragma once in every header<br>✔ Include headers, never .cpp<br>✔ Forward declare where possible<br>✔ Define functions exactly once<br>✔ Fix linker errors by <strong>adding definitions</strong>, not includes</p><h3>15. Final Mental Model</h3><blockquote><strong><em>The preprocessor pastes code, the compiler checks it, and the linker connects it.</em></strong></blockquote><p>Once this model clicks, C++ build errors stop being scary — they become logical and fixable.</p><h3>Final Thoughts</h3><p>If you are learning C++ seriously, mastering the <strong>preprocessor and linker</strong> is non-negotiable. These concepts appear in:</p><ul><li>Interviews</li><li>Large codebases</li><li>Game engines</li><li>Embedded systems</li><li>Enterprise software</li></ul><p>Understanding them early will save you <strong>years of confusion</strong>.</p><p><em>Happy Coding</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=006153508681" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[C++ Guide: Avoiding Dangling Pointers & References — A Practical Guide]]></title>
            <link>https://medium.com/@morepravin1989/c-guide-avoiding-dangling-pointers-references-a-practical-guide-51cba358d2a2?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/51cba358d2a2</guid>
            <category><![CDATA[pointers]]></category>
            <category><![CDATA[pointers-in-c]]></category>
            <category><![CDATA[c-language]]></category>
            <category><![CDATA[dangling-pointer]]></category>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Sat, 13 Dec 2025 13:51:24 GMT</pubDate>
            <atom:updated>2025-12-14T11:02:59.763Z</atom:updated>
            <content:encoded><![CDATA[<h3>C++ Guide: Avoiding Dangling Pointers &amp; References — A Practical Guide</h3><p><em>Learn one of the most common and dangerous memory pitfalls in C++, why it happens, and how to avoid it in real-world code.</em></p><p><a href="https://github.com/pravinmoreone-ux">https://github.com/pravinmoreone-ux</a></p><h3>Introduction</h3><p>As soon as you start using <strong>pointers</strong> and <strong>references</strong> in C++, you also take responsibility for <strong>object lifetimes</strong>. One of the most frequent mistakes — especially among beginners — is creating <strong>dangling pointers or references</strong>.</p><p>A dangling pointer/reference occurs when you keep referring to memory that <strong>no longer contains a valid object</strong>. The result is <em>undefined behavior</em>: crashes, corrupted data, or subtle security vulnerabilities.</p><p>This article explains:</p><ul><li>What dangling pointers and references are</li><li>Why they usually involve stack memory</li><li>How storage duration affects object lifetime</li><li>Safe alternatives and best practices</li></ul><h3>What Are Dangling Pointers and References?</h3><p>A <strong>dangling pointer</strong> or <strong>dangling reference</strong> is one that points to an object that has already been destroyed.</p><p>Once an object is destroyed, its memory may be:</p><ul><li>Reused by another variable</li><li>Overwritten by another function call</li><li>Left with garbage values</li></ul><p>Using a pointer or reference after this point leads to <strong>undefined behavior</strong>.</p><h3>The Classic Mistake: Returning a Pointer to Stack Memory</h3><pre>int* GetNumber() {<br>    int number{1};<br>    return &amp;number;   // Dangerous<br>}<br><br>int main() {<br>    int* result = GetNumber();<br>    std::cout &lt;&lt; *result;  // Undefined behavior<br>}</pre><p>At first glance, this looks reasonable. However, the output is unpredictable:</p><pre>Result: -858993460</pre><h3>Why This Happens</h3><ul><li>number is a <strong>local variable</strong></li><li>Local variables live in the function’s <strong>stack frame</strong></li><li>When GetNumber() returns, its stack frame is destroyed</li><li>The returned pointer now refers to <strong>invalid memory</strong></li></ul><p>The pointer itself still exists — but the object it points to does not.</p><h3>Stack Memory and Object Lifetime</h3><p>Each function call creates a <strong>stack frame</strong> that stores:</p><ul><li>Parameters</li><li>Local variables</li></ul><p>When the function ends, the entire stack frame is destroyed automatically.</p><p>This is known as <strong>automatic storage duration</strong>.</p><pre>struct SomeType {<br>    int value{1};<br>    ~SomeType() { std::cout &lt;&lt; &quot;Destroying\n&quot;; }<br>};</pre><pre>SomeType* GetObject() {<br>    SomeType obj;<br>    return &amp;obj;  // Dangling pointer<br>}</pre><p>Output:</p><pre>Destroying<br>Result: -858993460</pre><p>The destructor runs <strong>before</strong> the pointer is used, proving the object is already gone.</p><h3>Why This Only Applies to Pointers and References</h3><p>Returning values <strong>by value</strong> is safe:</p><pre>int GetNumber() {<br>    int number{1};<br>    return number;  // Safe<br>}</pre><p>Why?</p><ul><li>The returned value is <strong>copied or moved</strong></li><li>The caller gets its own independent object</li></ul><p>Pointers and references, however, <strong>do not own objects</strong>. They only refer to them.</p><p>If the referred object dies, the pointer/reference becomes dangerous.</p><h3>Understanding Storage Duration</h3><p>C++ objects have different <strong>storage durations</strong>, which determine how long they live:</p><h3>1. Automatic Storage Duration</h3><ul><li>Local variables</li><li>Destroyed when scope ends</li></ul><h3>2. Static Storage Duration</h3><ul><li>Global variables</li><li>static variables</li><li>Live for the entire program</li></ul><h3>3. Thread Storage Duration</h3><ul><li>One instance per thread</li></ul><h3>4. Dynamic Storage Duration</h3><ul><li>Created with new</li><li>Destroyed manually or via smart pointers</li></ul><p>Dangling pointers usually arise when <strong>automatic storage</strong> is misunderstood.</p><h3>Safe Ways to Return Data from Functions</h3><h3>Return by Value (Preferred)</h3><pre>SomeType GetObject() {<br>    return SomeType{};<br>}</pre><p>Modern C++ uses <strong>Return Value Optimization (RVO)</strong>, making this efficient and safe.</p><h3>Return a Reference to a Longer-Lived Object</h3><pre>SomeType globalObj;</pre><pre>SomeType&amp; GetObject() {<br>    return globalObj;  // Object outlives the function<br>}</pre><p>Use sparingly — global state has downsides.</p><h3>Use Smart Pointers</h3><pre>#include &lt;memory&gt;</pre><pre>std::unique_ptr&lt;SomeType&gt; GetObject() {<br>    return std::make_unique&lt;SomeType&gt;();<br>}</pre><p>Smart pointers:</p><ul><li>Clearly express ownership</li><li>Automatically manage lifetime</li><li>Prevent most dangling pointer bugs</li></ul><h3>Best Practices to Avoid Dangling Pointers</h3><ul><li><strong>Prefer returning values</strong> over pointers or references</li><li>Use <strong>std::unique_ptr</strong> or <strong>std::shared_ptr</strong> for dynamic lifetime</li><li>Avoid returning references to local variables</li><li>Minimize raw new and delete</li><li>Apply <strong>RAII</strong> (Resource Acquisition Is Initialization)</li><li>Enable compiler warnings (-Wall -Wextra)</li></ul><h3>Key Takeaways</h3><ul><li>Dangling pointers refer to destroyed objects</li><li>Stack memory is automatically freed when functions return</li><li>Pointers and references do <strong>not</strong> extend object lifetime</li><li>Returning by value is usually the safest option</li><li>Smart pointers dramatically reduce lifetime bugs</li></ul><p>Understanding object lifetime is a foundational skill in C++. Master it early, and your programs will be safer, faster, and easier to maintain.</p><h3>What’s Next?</h3><p>With memory fundamentals in place, the next logical step is <strong>polymorphism</strong> — learning how virtual functions and inheritance enable flexible and extensible designs without sacrificing safety.</p><p>Happy coding</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51cba358d2a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the this Pointer in C++ — Complete Beginner-Friendly Guide]]></title>
            <link>https://medium.com/@morepravin1989/mastering-the-this-pointer-in-c-complete-beginner-friendly-guide-91048b36cb9d?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/91048b36cb9d</guid>
            <category><![CDATA[this]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Fri, 12 Dec 2025 05:56:43 GMT</pubDate>
            <atom:updated>2025-12-12T05:57:50.345Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mastering the this Pointer in C++ — Complete Beginner-Friendly Guide</h3><p>In C++ object-oriented programming, the this pointer plays a powerful role. It lets objects refer to themselves, enables method chaining, helps with operator overloading, and allows objects to identify who interacted with them.</p><p>If you’re learning C++ or preparing for interviews, understanding this is essential.<br> This article breaks it down with clean explanations and real-world examples.</p><h3>What Is the this Pointer?</h3><p>Whenever you call a member function on an object, C++ secretly passes the address of that object into the function using this.</p><pre>struct SomeType {<br>  void SomeFunction(){<br>    cout &lt;&lt; this;  // prints object&#39;s address<br>  }<br>};</pre><pre>int main(){<br>  SomeType obj;<br>  cout &lt;&lt; &amp;obj &lt;&lt; &#39;\n&#39;;<br>  obj.SomeFunction();<br>}</pre><p>Both printed addresses will be the same — proving that this stores the memory address of the calling object.</p><h3>Dereferencing this</h3><p>Since this is a pointer, you can dereference it using *this.</p><pre>struct SomeType {<br>  SomeType* Pointer(){ return this; }      // returns pointer<br>  SomeType&amp; Reference(){ return *this; }   // returns reference<br>  SomeType  Copy(){ return *this; }        // returns copy<br>};</pre><p>This flexibility becomes extremely useful later in chaining and operator overloading.</p><h3>Use Case 1: Identify the Caller (Who Attacked Who?)</h3><p>Consider a simple game-like example:</p><pre>class Character {<br>public:<br>  Character(string Name) : mName{Name} {}</pre><pre>  void Attack(Character&amp; Target){<br>    Target.TakeDamage(*this);<br>  }</pre><pre>  void TakeDamage(Character&amp; Attacker){<br>    cout &lt;&lt; Attacker.mName &lt;&lt; &quot; has attacked me!&quot;;<br>  }</pre><pre>  string mName;<br>};</pre><p>Output:</p><pre>Player One has attacked me!</pre><p>Here, the attacker passes itself using *this.</p><h3>Use Case 2: Method Chaining</h3><p>Chaining makes code cleaner and more expressive:</p><pre>Enemy.SetName(&quot;Goblin&quot;).SetLevel(10).Log();</pre><p>To support this, methods return *this:</p><pre>class Character {<br>public:<br>  Character&amp; SetName(string Name){<br>    mName = Name;<br>    return *this;<br>  }</pre><pre>  Character&amp; SetLevel(int Level){<br>    mLevel = Level;<br>    return *this;<br>  }</pre><pre>  Character&amp; Log(){<br>    cout &lt;&lt; &quot;I am &quot; &lt;&lt; mName<br>         &lt;&lt; &quot; and level &quot; &lt;&lt; mLevel;<br>    return *this;<br>  }</pre><pre>private:<br>  string mName;<br>  int mLevel;<br>};</pre><p>This pattern is used widely in frameworks and fluent APIs.</p><h3>*Use Case 3: Operator Overloading (++, =, -=)</h3><p>Operators like ++, +=, *=, and -= should behave like they do with built-in types.</p><p>To allow chaining:</p><pre>(++x) *= 2;</pre><p>…your operator must return a <strong>reference to the object</strong>, using *this:</p><pre>struct Vector3 {<br>  float x, y, z;</pre><pre>  Vector3&amp; operator++(){<br>    ++x; ++y; ++z;<br>    return *this;<br>  }</pre><pre>  Vector3&amp; operator*=(int mul){<br>    x *= mul;<br>    y *= mul;<br>    z *= mul;<br>    return *this;<br>  }<br>};</pre><h3>Prefix vs Postfix Operators</h3><h3>Prefix (++x)</h3><ul><li>increments the value</li><li>returns the NEW value</li></ul><h3>Postfix (x++)</h3><ul><li>returns the OLD value</li><li>then increments</li></ul><p>Thus, postfix is slower — it needs to make a copy.</p><h3>Implementing the Postfix Version</h3><pre>struct Vector3 {<br>  float x, y, z;<br>// prefix<br>  Vector3&amp; operator++(){<br>    ++x; ++y; ++z;<br>    return *this;<br>  }<br>  // postfix<br>  Vector3 operator++(int){<br>    Vector3 temp{*this};<br>    ++(*this);<br>    return temp;<br>  }<br>};</pre><p>Note the dummy int parameter — this is required by C++ syntax.</p><h3>Performance Tip</h3><p>Prefer prefix (++x) when possible.</p><p>Postfix (x++) creates a copy — slower for heavy objects.</p><h3>Practice Exercise: Implement -=</h3><pre>Vector3&amp; operator-=(Vector3 Other){<br>  x -= Other.x;<br>  y -= Other.y;<br>  z -= Other.z;<br>  return *this;<br>}</pre><h3>Practice Exercise: Postfix —</h3><pre>Vector3 operator--(int){<br>  Vector3 temp{*this};<br>  --(*this);<br>  return temp;<br>}</pre><h3>Summary</h3><p>The this pointer is a foundation of C++ OOP.<br> You learned:</p><p>this stores the address of the calling object<br>You can dereference it using *this<br> It helps objects identify who called them<br> It enables fluent method chaining<br> It is essential for correct operator overloading<br> Prefix operators are faster than postfix<br> Returning *this allows chaining and consistency</p><p>Mastering this concept will make you a better C++ programmer — especially when working with classes, game engines, and performance-critical code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91048b36cb9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM BAW Offline Deployment: Step-by-Step Guide (DEV → SIT)]]></title>
            <link>https://medium.com/@morepravin1989/ibm-baw-offline-deployment-step-by-step-guide-dev-sit-d9151de4d208?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9151de4d208</guid>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Fri, 12 Dec 2025 05:53:46 GMT</pubDate>
            <atom:updated>2025-12-12T05:53:46.700Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Deploying BPM applications without Process Center connectivity</em></p><p>Offline deployment in IBM Business Automation Workflow (BAW) is extremely useful when environments do not have direct connectivity to Process Center, or when organizations prefer a controlled, file-based deployment approach.</p><p>In this article, we’ll walk through a <strong>clean, repeatable, and production-ready offline deployment method</strong> from <strong>DEV</strong> to <strong>SIT</strong> using wsadmin and offline snapshots.</p><h3>🔧 What Is Offline Deployment in IBM BAW?</h3><p>Offline deployment allows you to export a fully packaged snapshot from one environment and install it into another environment — without requiring online sync. This is done using:</p><ul><li><strong>Offline Servers</strong> (created in Process Center)</li><li><strong>Offline Deployment Packages</strong> (ZIP files)</li><li><strong>wsadmin Jython commands</strong></li></ul><p>This provides a safe, predictable, version-controlled deployment method.</p><h3>🟢 Step 1 — Create Offline Servers (DEV &amp; SIT)</h3><p>In <strong>Process Center → Servers → Offline Servers</strong>, create:</p><ul><li><strong>DEV Offline Server</strong></li><li><strong>SIT Offline Server</strong></li></ul><p>These virtual servers represent your real BAW environments for offline packaging.</p><blockquote><strong><em>Tip:</em></strong><em> Use clean names without spaces.</em></blockquote><h3>🟢 Step 2 — Generate Offline Deployment Package in DEV</h3><p>Log into the <strong>DEV system</strong> and start wsadmin:</p><pre>/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython</pre><p>Run the following command to extract the offline package:</p><pre>AdminTask.BPMExtractOfflinePackage(&#39;[-containerAcronym NBPF <br>-containerSnapshotAcronym NBP2_13 <br>-serverName SIT <br>-outputFile /home/bawadmin/NBP2_13.zip]&#39;)</pre><h3>What each parameter means:</h3><p>ParameterDescriptioncontainerAcronymProcess App acronymcontainerSnapshotAcronymSnapshot name, e.g., NBP2_13serverNameOffline server to target (SIT)outputFileLocation where the ZIP will be generated</p><p>After execution, you will see the package file:</p><pre>/home/bawadmin/NBP2_13.zip</pre><h3>🟢 Step 3 — Copy Deployment Package to SIT</h3><p>Move the generated ZIP to SIT:</p><pre>scp /home/bawadmin/NBP2_13.zip bawadmin@&lt;SIT_HOST&gt;:/home/bawadmin/</pre><p>Any secure transfer method is fine.</p><h3>🟢 Step 4 — Install the Package in SIT</h3><p>SSH into the <strong>SIT system</strong>, and open wsadmin:</p><pre>/opt/IBM/WebSphere/AppServer/bin/wsadmin.sh -lang jython</pre><p>Run the install command:</p><pre>AdminTask.BPMInstallOfflinePackage(&#39;[-inputFile /home/bawadmin/NBP2_13.zip]&#39;)</pre><p>BAW will unpack and install the snapshot into the SIT environment.</p><h3>🟢 Step 5 — Validate Deployment in Process Inspector</h3><p>Open:</p><pre>https://&lt;SIT_HOST&gt;:9443/ProcessInspector/</pre><p>Verify:</p><ul><li>Snapshot version is deployed</li><li>All services, coaches, variables are present</li><li>Application is active and ready</li></ul><p>This confirms the offline deployment is successful.</p><h3>📌 Summary of Commands</h3><p>ActionCommandExtract packageBPMExtractOfflinePackageInstall packageBPMInstallOfflinePackage</p><h3>🧩 Common Issues &amp; Fixes</h3><h3>✅ Snapshot not found</h3><p>Check the correct acronym and version in Process Center.</p><h3>✅ File permission denied</h3><p>Run commands as the appropriate BAW/UNIX user (bawadmin, wasadmin).</p><h3>✅ Deployment partially installed</h3><p>Use validation command:</p><pre>AdminTask.BPMValidateOfflinePackage(&#39;[-inputFile /path/zip]&#39;)</pre><h3>🎯 Final Thoughts</h3><p>Offline deployment is one of the cleanest, safest ways to move BAW applications between environments — especially in enterprise environments with strict security zones.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9151de4d208" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering C++ Debugging: A Deep Dive Into Breakpoints, Run-Time Behavior, and Smarter Development]]></title>
            <link>https://medium.com/@morepravin1989/mastering-c-debugging-a-deep-dive-into-breakpoints-run-time-behavior-and-smarter-development-5b285acd3faf?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b285acd3faf</guid>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 09:32:03 GMT</pubDate>
            <atom:updated>2025-12-08T09:32:03.538Z</atom:updated>
            <content:encoded><![CDATA[<p>Debugging is one of the most underrated skills in a programmer’s toolkit. Many beginners feel frustrated because their code “looks right” but still behaves incorrectly. They jump between files, print variables everywhere using std::cout, and hope the bug magically reveals itself.</p><p>But professional developers don’t debug like that.</p><p>They use the <strong>debugger</strong> — a powerful tool built into modern IDEs like Visual Studio, CLion, VS Code + CMake Tools, Xcode, or even command-line tools like gdb and lldb.</p><p>This guide will walk you through <strong>how debugging actually works</strong>, why it matters, and <em>how to use it to think like a real C++ engineer.</em></p><h3>Understanding Debugging: What It Really Means</h3><p>Debugging is not just “fixing errors.”<br> It is the process of <strong>observing your program while it runs</strong>.</p><p>Every C++ program has two phases:</p><h3>1. Build Time</h3><p>This is when:</p><ul><li>You compile your code.</li><li>The compiler checks syntax.</li><li>The compiler produces the executable.</li></ul><p>Errors that occur here include:</p><ul><li>Missing semicolons</li><li>Undeclared variables</li><li>Type mismatch</li><li>Linking errors</li></ul><p>These are usually easy to identify.</p><h3>2. Run Time</h3><p>This is where things get interesting.</p><p>Your code runs, but:</p><ul><li>Variables don’t have the values you expect</li><li>Loops behave incorrectly</li><li>Boolean conditions evaluate differently than you think</li><li>Your program crashes</li></ul><p>These bugs are <strong>not visible from reading the code alone</strong> — you must see the code <em>while</em> it is running.</p><p>And that is where the debugger shines.</p><h3>What Is a Debugger?</h3><p>A debugger is a tool that lets you:</p><h3>Pause execution</h3><p>At specific lines using <strong>breakpoints</strong>.</p><h3>Step through code</h3><p>Line by line, watching how values change.</p><h3>Inspect variables</h3><p>See the real-time values of:</p><ul><li>integers</li><li>floats</li><li>booleans</li><li>objects</li><li>pointers</li><li>memory addresses</li></ul><h3>Modify variables</h3><p>Yes — you can change values <strong>while</strong> the program is running.</p><h3>Track down tricky logic errors</h3><p>Especially ones that don’t produce compiler errors.</p><p>Think of the debugger as a <strong>microscope</strong> for your code.</p><p>It shows you the truth behind your assumptions.</p><h3>An Example: Debugging a Simple C++ Program</h3><p>Let’s start with a tiny C++ example:</p><pre>#include &lt;iostream&gt;<br>using namespace std;</pre><pre>int Health { 100 };<br>bool isDead { false };</pre><pre>int main() {<br>    Health -= 10;<br>    isDead = Health &lt;= 0;</pre><pre>    Health -= 200;<br>    isDead = Health &lt;= 0;<br>}</pre><p>On paper, this looks simple.</p><p>But in real debugging scenarios:</p><ul><li>Did Health change correctly?</li><li>Did isDead update the moment Health dropped below 0?</li><li>Did any overflow or unexpected behavior happen?</li></ul><p>Let’s see how debugging answers these questions.</p><h3>Step 1: Setting Breakpoints</h3><p>A <strong>breakpoint</strong> is a red marker you place next to a line of code.</p><p>When the program reaches that line:</p><ul><li>it <strong>pauses</strong></li><li>the debugger takes control</li><li>you can explore everything</li></ul><p>In Visual Studio or VS Code:</p><ul><li>Click left of the line number</li><li>A red dot appears</li><li>That line will pause during execution</li></ul><p>Best practice:<br> Place breakpoints at:</p><ul><li>suspicious lines</li><li>branches (if-else, loops)</li><li>places where variables updat</li></ul><h3>Step 2: Starting the Debugger</h3><p>When you click <strong>Run with Debugger</strong>, your IDE:</p><ul><li>compiles the app with debug symbols</li><li>launches it under the debugger</li><li>stops at the first breakpoint</li></ul><p>You’ll now see:</p><ul><li>highlighted current line</li><li>variable watch windows</li><li>call stack</li><li>thread information</li></ul><p>At this moment, your program is <em>frozen in time</em>.<br> You can now begin the investigation.</p><h3>Step 3: Inspecting Variables</h3><p>Hovering over a variable shows its value:</p><ul><li>Health initially = <strong>100</strong></li><li>Highlighted line will reduce it to 90</li><li>But that hasn’t happened yet</li></ul><p>Now press:</p><h3>Step Over ➝</h3><p>Executes the current line and moves to the next.</p><p>After pressing Step Over:</p><ul><li>Health = 90</li><li>isDead = false</li></ul><p>Then you proceed line by line, inspecting changes.</p><p>This ability to <em>observe your code’s evolution</em> is the core benefit of debugging.</p><h3>Step 4: Continue Until Next Breakpoint</h3><p>The <strong>Continue</strong> button:</p><ul><li>runs the program normally</li><li>pauses only when it reaches another breakpoint</li></ul><p>This is useful when:</p><ul><li>a bug happens deep inside a loop</li><li>you only want to stop at a specific condition</li><li>you want to skip unimportant sections</li></ul><p>Professional developers use Continue frequently.</p><h3>Advanced Debugging Skills You Should Learn</h3><p>As you get more comfortable, debuggers offer advanced features:</p><h3>1. Conditional Breakpoints</h3><p>Pause <em>only</em> when a condition is true.</p><p>Example:</p><pre>breakpoint condition: Health &lt; 0</pre><p>Now the program pauses only when Health becomes negative.</p><h3>🕵 2. Watch Variables</h3><p>Add variables to the <strong>Watch Window</strong> so you can track:</p><ul><li>current value</li><li>previous value</li><li>memory location</li></ul><p>Useful for:</p><ul><li>pointer debugging</li><li>memory corruption</li><li>tracking complex objects</li></ul><h3>3. Run to Cursor</h3><p>Right-click a line → <em>Run to Cursor</em><br> Useful when you don’t want to set a temporary breakpoint.</p><h3>4. Call Stack Exploration</h3><p>Shows the chain of function calls that led to the current point.</p><p>This is essential for:</p><ul><li>recursive debugging</li><li>crash debugging</li><li>multi-function workflows</li></ul><h3>Debugging in the Real World</h3><p>Printing variables (cout) is primitive debugging.</p><p>Professional C++ debugging is about:</p><ul><li>stepping through execution flow</li><li>validating assumptions</li><li>catching unexpected states</li><li>observing memory in real time</li><li>analyzing threads</li><li>reverse-engineering crashes</li></ul><p>In large C++ systems (games, finance, embedded systems), debugging is <em>non-negotiable</em>.</p><p>Even the best engineers rely on it daily.</p><h3>Tips to Become Better at Debugging</h3><h3>1. Debug every small program you write</h3><p>Even when you don’t need to.<br> It builds instinct.</p><h3>2. Don’t guess</h3><p>Use the debugger to <em>see</em> what is happening.</p><h3>3. When stuck, restart from the first breakpoint</h3><p>Many bugs happen earlier than you think.</p><h3>4. Use conditional breakpoints within loops</h3><p>Avoid manually stepping through 100 iterations.</p><h3>5. Learn hotkeys</h3><p>It makes debugging much faster:</p><ul><li>F9 → toggle breakpoint</li><li>F10 → step over</li><li>F11 → step into</li><li>Shift + F11 → step out</li></ul><h3>6. Inspect pointers carefully</h3><p>Watch out for:</p><ul><li>null pointers</li><li>dangling pointers</li><li>invalid memory access</li></ul><h3>7. Use logging + debugging together</h3><p>Large projects need both.</p><h3>Debugging Mindset: Think Like a Detective</h3><p>Debugging is not about fixing bugs instantly.<br> It is about understanding your system deeply.</p><p>Ask yourself:</p><ul><li><em>What should happen here?</em></li><li><em>What actually happened?</em></li><li><em>Where do these two diverge?</em></li></ul><p>Every bug teaches you something about:</p><ul><li>the language</li><li>your program</li><li>your assumptions</li></ul><p>Great engineers are ultimately great debuggers.</p><h3>Conclusion</h3><p>C++ debugging is a fundamental skill that transforms you from a code-writer into a real engineer.</p><p>By mastering:</p><ul><li>breakpoints</li><li>stepping</li><li>variable inspection</li><li>conditional debugging</li><li>call stacks</li></ul><p>— you gain complete control over what your program does at run time.</p><p>Don’t treat debugging as a last resort.<br> Treat it as <strong>part of your development workflow</strong>.</p><p>Your C++ journey will become faster, clearer, and far more enjoyable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b285acd3faf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Source to Executable: How Your Code Becomes a Running Program]]></title>
            <link>https://medium.com/@morepravin1989/from-source-to-executable-how-your-code-becomes-a-running-program-fdf20a190a7e?source=rss-41078f59c9f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdf20a190a7e</guid>
            <dc:creator><![CDATA[Pravin More]]></dc:creator>
            <pubDate>Tue, 25 Nov 2025 00:21:16 GMT</pubDate>
            <atom:updated>2025-11-25T00:21:16.853Z</atom:updated>
            <content:encoded><![CDATA[<p><em>An easy-to-read, Medium‑style deep dive into compilation, assembly, linking, and loading.</em></p><p><strong>Summary:</strong> A high-level overview of the steps a C program goes through on the way from human-readable source code to a runnable executable: <em>compilation → assembly → object file → linking → loading</em>. This article walks through each step with simple examples and explains why each step exists.</p><h3>Introduction</h3><p>When we write code in a high-level language like C it often feels like a single, magic step when we run gcc and get an executable. In reality the toolchain performs a sequence of distinct transformations. Understanding these steps helps with debugging, optimization, cross-compilation, and build system design.</p><p>We’ll step through the pipeline using a tiny example program that declares a couple of variables, calls printf, and returns to the operating system.</p><h3>Step 1: Source → Assembly (Compilation)</h3><p>The first step is compiling your C source into assembly language for the target architecture.</p><p>Command example (generate assembly):</p><pre>gcc -S test.c -o test.s</pre><p>-S tells GCC to stop after producing assembly (test.s). The produced file is human-readable assembly code (for example, x86 or x86_64 assembly).</p><p>In the assembly output you will typically see:</p><ul><li>A main: label marking the function entry.</li><li>Stack-frame setup and teardown instructions.</li><li>Code that stores and updates local variables.</li><li>A call instruction for calling printf.</li></ul><p>Important: the assembly won’t contain the actual implementation of printf. Instead, it contains a <em>reference</em> to printf and relocation information saying &quot;this symbol must be resolved later&quot;. That resolution is the linker&#39;s job.</p><h3>️ Step 2: Assembly → Object File (Assembling)</h3><p>Next, the assembler turns the assembly source into an object file (machine code inside a container format).</p><p>Command example (assemble into an object file):</p><pre>gcc -c test.c -o test.o</pre><p>The .o file contains:</p><ul><li><strong>Header metadata</strong> describing the file format (ELF on Linux, Mach-O on macOS, PE on Windows).</li><li><strong>Text segment</strong> (the compiled machine code).</li><li><strong>Data segment(s)</strong> (global/static data).</li><li><strong>Symbol table</strong> listing functions and global symbols exposed or required.</li><li><strong>Relocation entries</strong> indicating places that reference external symbols (like printf).</li></ul><p>Object files are binary and mostly unreadable to humans. The relocation and symbol table entries are how the linker knows what needs to be connected.</p><h3>🔗 Step 3: Linking — Combining Everything Into an Executable</h3><p>When you link, the linker combines one or more object files and libraries into a final executable.</p><p>Command example (link to an executable):</p><pre>gcc test.o -o test</pre><p>What the linker does:</p><ol><li>Scans relocation records for unresolved symbols (e.g., sub, printf).</li><li>Finds definitions for those symbols in other object files or libraries.</li><li>Assigns final memory addresses for code and data segments.</li><li>Patches (relocates) instructions and data to use those final addresses.</li><li>Optionally includes library code (static linking) or leaves references for the dynamic loader (dynamic linking).</li></ol><p>The linker also allows incremental builds: compile many translation units separately into .o files and only recompile the ones that change.</p><h3>Step 4: Loading — Turning an Executable into a Running Program</h3><p>The executable still needs to be loaded into memory before it runs. The loader (part of the OS) does this at runtime:</p><ul><li>Allocates memory for the process, based on the executable’s headers (text, data, bss sizes).</li><li>Copies the text and data segments into memory.</li><li>Prepares the stack and places command-line arguments and environment variables on it.</li><li>Clears or initializes registers and sets the stack pointer.</li><li>If using dynamic linking, the dynamic loader resolves external library symbols now (e.g., printf from libc).</li><li>Jumps to the program’s main entry point.</li></ul><p>After this setup your main runs just like the code you wrote.</p><h3>Why Split the Build Process into Multiple Steps?</h3><ul><li><strong>Portability:</strong> Compilers can target different ISAs by emitting different assembly. The rest of the toolchain is largely ISA-agnostic.</li><li><strong>Modularity and speed:</strong> Recompiling only changed source files (producing .o) saves time for large projects.</li><li><strong>Optimization and control:</strong> Each step (compiler, assembler, linker) can apply different optimizations or transformations. Linkers can do whole-program layout and optimization across object files.</li></ul><h3>Quick example (summary)</h3><ol><li>gcc -S test.c -o test.s → assembly with call printf and relocation info.</li><li>gcc -c test.c -o test.o → object file with text/data/relocations/symbols.</li><li>gcc test.o -o test → linker resolves printf, produces executable.</li><li>OS loader maps the executable into memory, resolves dynamic symbols, and starts main.</li></ol><h3>Final Notes</h3><ul><li>The exact details (file formats, calling conventions, relocation formats) depend on the platform and toolchain (ELF vs Mach-O vs PE, x86 vs ARM, static vs dynamic linking).</li><li>Tools like objdump, readelf, nm, and ldd (on Linux) are very useful to inspect object files, symbol tables, and shared-library dependencies.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdf20a190a7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>