<?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 Gabby on Medium]]></title>
        <description><![CDATA[Stories by Gabby on Medium]]></description>
        <link>https://medium.com/@gaaaabbbyy?source=rss-1d4e33807ca2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KpREhumwfTsx3ecnrp-jdQ@2x.jpeg</url>
            <title>Stories by Gabby on Medium</title>
            <link>https://medium.com/@gaaaabbbyy?source=rss-1d4e33807ca2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:45:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gaaaabbbyy/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[I hate writing documentation manually, so I built a GitHub action]]></title>
            <link>https://medium.com/@gaaaabbbyy/i-hate-writing-documentation-manually-so-i-built-a-github-action-d4b79e066f72?source=rss-1d4e33807ca2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4b79e066f72</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gemini]]></category>
            <dc:creator><![CDATA[Gabby]]></dc:creator>
            <pubDate>Sat, 20 Jun 2026 14:44:30 GMT</pubDate>
            <atom:updated>2026-06-20T14:44:30.228Z</atom:updated>
            <content:encoded><![CDATA[<p><em>When I was reading about Paul Duvall’s book Continuous Integration, I read him talk about NDoc and Javadoc to generate documentation from the source code, so I thought to myself, how can I create a GitHub action to create code documentation since I hate writing it manually?</em></p><p>It can even add simple flowcharts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*uh5g9pnYmSS-lS3wMFv4JQ.png" /></figure><h3>Here is how I did:</h3><p><strong>1) Get you API key from here aistudio.google.com</strong></p><p>I’m using Gemini.</p><p><strong>2) Insert your key under your_github_repo -&gt; settings -&gt; secrets and variables -&gt; actions</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Z6BxOdbcuHmmpM8qJElFw.png" /></figure><p><strong>3) Under .github/workflows add your configuration which will install google-genai. This will allow us to use Google’s generative models.</strong></p><p>It works only after a merge is completed:</p><pre>name: Code Explanation Generator<br><br>on:<br>  pull_request:<br>    paths:<br>      - &quot;**.py&quot;<br><br>jobs:<br>  explain:<br>    runs-on: ubuntu-latest<br>    permissions:<br>      pull-requests: write<br><br>    steps:<br>      - uses: actions/checkout@v4<br>        with:<br>          fetch-depth: 2<br><br>      - uses: actions/setup-python@v5<br>        with:<br>          python-version: &quot;3.10&quot;<br>      - name: Install dependencies<br>        run: pip install google-genai<br><br># This workflow only gets triggered when there is change in python file.<br># And, it writes changed files into changed_files.txt so that we can loop<br># through them one by one.<br><br>      - name: Get changed Python files<br>        run: |<br>          git diff --name-only HEAD~1 HEAD -- &#39;*.py&#39; &gt; changed_files.txt<br>          cat changed_files.txt<br><br>      - name: Generate explanations<br>        env:<br>          GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}<br>        run: python .github/scripts/explain.py<br><br>      - name: Post as PR comment<br>        uses: actions/github-script@v7<br>        with:<br>          script: |<br>            const fs = require(&#39;fs&#39;);<br>            const body = fs.readFileSync(&#39;explanation_output.md&#39;, &#39;utf8&#39;);<br>            github.rest.issues.createComment({<br>              issue_number: context.issue.number,<br>              owner: context.repo.owner,<br>              repo: context.repo.repo,<br>              body: body<br>            });</pre><p><strong>4) </strong><a href="http://explain.py/"><strong>explain.py</strong></a><strong> (.github/scripts) is for Gemini AI where we pass changed_files; it iterates through those files, and then we inject the prompt:</strong></p><pre>from google import genai<br>import os<br>import time<br>client = genai.Client(api_key=os.environ[&quot;GEMINI_API_KEY&quot;])<br><br><br>with open(&quot;changed_files.txt&quot;) as f:<br>    files = [l.strip() for l in f.readlines() if l.strip().endswith(&quot;.py&quot;)]<br><br>if not files:<br>    with open(&quot;explanation_output.md&quot;, &quot;w&quot;) as f:<br>        f.write(&quot;No Python files changed.&quot;)<br>    exit(0)<br><br>output = []<br><br>for filepath in files:<br>    if not os.path.exists(filepath):<br>        continue<br><br>    with open(filepath) as f:<br>        code = f.read()<br><br>    prompt = f&quot;&quot;&quot;Analyze this Python file and provide:<br><br>1. **Purpose** — what this module does in 2-3 sentences<br>2. **How it works** — step by step explanation of the logic<br>3. **Key functions/classes** — brief description of each<br>4. **Mermaid flowchart** — showing the main execution flow<br><br>File: `{filepath}`<br><br>```python<br>{code}<br>```<br><br>Format the Mermaid diagram inside a ```mermaid code block.<br>Follow these Mermaid rules strictly:<br>- Use `flowchart TD` not `graph TD`<br>- No semicolons at the end of lines<br>- No double quotes inside node labels<br>- Use single words or hyphenated-words inside node labels<br>Keep the explanation concise and developer-friendly.&quot;&quot;&quot;<br>    response = client.models.generate_content(<br>    model=&quot;gemini-2.5-flash&quot;,<br>    contents=prompt<br>    <br>)<br>    explanation = response.text<br>    output.append(f&quot;##  `{filepath}`\n\n{explanation}\n\n---\n&quot;)<br><br>with open(&quot;explanation_output.md&quot;, &quot;w&quot;) as f:<br>    f.write(&quot;#Code Explanation Report\n\n&quot;)<br>    f.write(&quot;\n&quot;.join(output))</pre><p>The prompt tells the AI how we want the structure (same as writing to ChatGPT). You can pass any model from their list. Their daily request limit is super low (eg. the max is Gemini 2.5 Flash with 20 requests per day).</p><p>If you want to switch models and check their limits navigate to aistudio.google.com -&gt; Dashboard -&gt; Rate Limit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJ_cCfUBJmOGjk6LbTi5sg.png" /></figure><p><strong>5) Documentation is then posted as PR comment:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aTK2xOpyJ492bpApTWZU7w.png" /></figure><p><strong>Here is the complete documentation:</strong> <a href="https://github.com/radioactivityy/checker/pull/8">https://github.com/radioactivityy/checker/pull/8</a></p><p><strong>Complete source code:</strong></p><p><a href="https://github.com/radioactivityy/checker">https://github.com/radioactivityy/checker</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4b79e066f72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHAT THE HECK, I GOT A Stack Overflow Error!]]></title>
            <link>https://medium.com/@gaaaabbbyy/what-the-heck-i-got-a-stack-overflow-error-dde9d7bf2355?source=rss-1d4e33807ca2------2</link>
            <guid isPermaLink="false">https://medium.com/p/dde9d7bf2355</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gabby]]></dc:creator>
            <pubDate>Sun, 05 Oct 2025 10:02:35 GMT</pubDate>
            <atom:updated>2025-10-05T10:02:35.083Z</atom:updated>
            <content:encoded><![CDATA[<p>It is because of the skill issue…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/0*k19aT5o_BAcZKC4k.png" /><figcaption>Source: <a href="https://stackoverflow.com/">stackoverflow.com</a></figcaption></figure><p>Just kidding, it is because you attempted to use MORE space than is available on the stack! And today, I will walk you through how to fix this issue.</p><p>Today, we’ll be talking about static and dynamic allocation.</p><h3>Let’s start with a simple question: When is memory allocation done?</h3><p>It is either done at <strong>compile</strong> time (aka Static Allocation) or at <strong>runtime</strong> (aka Dynamic Allocation).</p><p><em>Note: Examples will be in C since we explicitly allocate, deallocate, and free the memory in C. Whereas in some programming languages such as everyone’s favorite Python :) It’s done pretty much automatically.</em></p><h3><strong>Static Memory Allocation:</strong></h3><h4><strong>1.1 </strong>We allocate variables permanently</h4><p>Allocation is done BEFORE program execution. Since memory stays reserved throughout the entire program execution, unused memory will go to waste:</p><pre>#include &lt;stdio.h&gt;<br>// global array is allocated before main() starts<br>// memory is reserved even if we never use it<br>int global_array[1000];<br>int main() {<br> // runs but never touches the global array???!!!!!<br><br> // CONGRATSSSS YOU JUST WASTED 4000 BYTES THAT ARE ALREADY RESERVED <br> return 0;<br>}</pre><h4><strong>1.2</strong> It uses a stack for managing the allocated memory.</h4><p>If you’re wondering what a stack is:</p><p>Imagine it as a pile of plates, the last plate you put will be the first one you will take (<strong>LIFO</strong> order = Last in — First Out)</p><figure><img alt="Source: geeksforgeeks.org" src="https://cdn-images-1.medium.com/max/651/0*8fXwZocV1enY7qd-.png" /><figcaption>Source: geeksforgeeks.org</figcaption></figure><p>Stack <strong>automatically</strong> allocates memory when a function starts, and automatically frees the memory when the function ends. So you won’t need to think about malloc() or free().</p><p>BUT</p><p>Let’s say you keep the pile of dishes on your counter, and your counter has its limitations. Let’s say the maximum number of dishes it can handle is 20 plates. If you try to add 500 plates, then it will collapse. In programming, you will get “<strong>StackOverflow</strong>” error. So, you now know the core reason for <strong>StackOverflow </strong>error.</p><h4><strong>1.3 </strong>No memory reusability = less efficient</h4><p>When you have multiple function calls, each will get a separate stack space and, when you free the memory from previous function calls, you <strong>cannot reuse</strong> the freed memory.</p><p>Think of it like this: Remember our plate analogy? Imagine you have designated spots on your counter for each stack of plates. Once you remove plates from spot #1, you can’t move plates from spot #2 to use that (empty) space in spot #1. Each function gets its own “spot” and can’t share space with others, even when some spots become empty. (sounds pretty dumb, heh)</p><pre>void function_one() {<br>    int array_one[100];  // stack space in &quot;spot #1&quot;<br>    // function ends -&gt; space gets freed<br>}<br><br>void function_two() {<br>    int array_two[50];   // separate &quot;spot #2&quot;<br>    // CANNOT reuse the space that function_one just freed<br>    // Even though array_two is smaller than array_one&#39;s freed space<br>}<br><br>int main() {<br>    function_one();  // Uses and frees stack space<br>    function_two();  // Gets NEW stack space since it can&#39;t reuse the previous<br>    <br>    return 0;<br>}</pre><h4><strong>1.4 </strong>Once memory is allocated, the memory size cannot be changed.</h4><p>If we follow the same analogy, if you were to redesignate spots on your counter for each stack of plates (thinking you will need more or less space),… Once you’ve already designated that space, there is no going back… You’re stuck with that exact amount of space, whether you use all of it or need more.</p><pre>#include &lt;stdio.h&gt;<br>#include &lt;limits.h&gt;<br><br>void demonstrate_fixed_size() {<br>    int fixed_array[5];  // Size is exactly 5 integers<br>    <br>    //  works fine<br>    fixed_array[0] = 10;<br>    fixed_array[4] = 50;<br>    <br>    // But what if we suddenly need more space?<br>    fixed_array[5] = 60;  // ERROR! Out of bounds<br>    fixed_array[10] = 100; // ERROR! Still out of bounds<br><br>    // We&#39;re stuck with exactly 5 elements...<br>}<br>int main() {<br>    demonstrate_fixed_size();<br>    return 0;<br>}</pre><p>So, you need to think like a fortune teller and MUST guess the maximum size needed. <br>Suppose you are coding a registration system for a school complex and using static memory allocation. You might create an array for 1000 students, but only 10 actually enrolled. And as a result, 990 elements would go to waste in the memory that other programs could have used. <br>And since memory is allocated at compile time, the program cannot adapt to user input like “How many numbers will you enter?”</p><p>ALLL these pain in the ass problems are bringing us to DYNAMIC MEMORY (LEZZGOOOO)</p><h3>2. <strong>Dynamic Memory Allocation</strong></h3><p>It’s WAYYY smarter than static allocation since memory is allocated whenever <strong>malloc() </strong>is called, and it gets deallocated whenever <strong>free() </strong>is executed. Sooo it’s controlled during the <strong>runtime</strong>.</p><h4><strong>2.1 </strong>It uses a heap for managing the memory allocation</h4><p>If you’re wondering what a heap is:</p><p>You can think of it as a huge warehouse complex where you can rent storage units of any size:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_a0NI3HSk3lBKr2B.png" /><figcaption>Source: adgoarchitects.com</figcaption></figure><pre>int *data = malloc(1000 * sizeof(int)) <br>// Think you need a storage unit for 1000 boxes</pre><p>Here, <strong>malloc() = Rental Application</strong>. “I need storage space!!!”</p><p>And you can do dynamic size requests by:</p><pre>printf(&quot;How much storage do you need?&quot;);<br>scanf(&quot;%d&quot;, &amp;size);<br>int *storage = malloc(size * sizeof(int));</pre><p>Do you need more space? Easy. Just call:</p><pre>data = realloc(data, larger_size); </pre><p>BUT</p><p>If you forgot to call <strong>free(data), </strong>then it&#39;s like renting a storage unit and losing the keys. This means you’ll have Memory Leaks = Pay Rent Forever.</p><ul><li>&gt; You <strong>resize</strong> dynamically, and the memory can be freed when not required.</li><li>-&gt; You can change the allocated memory size. So, you can reuse the memory :)</li></ul><p>BUTT</p><p>Execution is slower than static memory allocation. WHY? (Answer is in the comment section.)</p><h3>RECAP: Here’s the BIG PICTURE of what we just learned:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPd04bSZ5-o8x7zZorMoiA.png" /><figcaption>Source: site24x7.com</figcaption></figure><p>Remember our <strong>plate stack analogy</strong>? That’s the <strong>Stack Memory</strong> on the left. Each function call gets its own ‘designated spot’ with fixed sizes that can’t be changed.</p><blockquote>Fixe size ‘plates’ that get auto cleaned when functions ends.</blockquote><p>And our <strong>warehouse rental system</strong>? That’s the <strong>Heap Memory</strong> on the right. See how the actual data objects (‘John Doe’ string, Employee object) live in this flexible space where you can rent any size you need.</p><blockquote>Flexible ‘warehouse rentals’ that YOU must remember to<strong> free()</strong></blockquote><p>This is why you get <strong>Stack Overflow</strong> when you pile too many ‘plates’ (deep recursion or large local arrays), but with dynamic allocation, you’re only limited by your total ‘warehouse budget’ (aka: available RAM)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dde9d7bf2355" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Which programming paradigms do you like the most?]]></title>
            <link>https://medium.com/@gaaaabbbyy/which-programming-paradigms-do-you-like-the-most-55d4bb85fc74?source=rss-1d4e33807ca2------2</link>
            <guid isPermaLink="false">https://medium.com/p/55d4bb85fc74</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[programming-paradigms]]></category>
            <dc:creator><![CDATA[Gabby]]></dc:creator>
            <pubDate>Mon, 11 Aug 2025 17:38:32 GMT</pubDate>
            <atom:updated>2025-08-11T17:38:32.998Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*kkbANPnY__dIyoKQGLxCHg.jpeg" /></figure><p><em>Imagine you’re learning to cook. Chefs have developed different ways to think about cooking ; step-by-step instructions, having reusable recipes, or simply describing the dish and letting the kitchen figure it out.</em></p><p>Programming has the same story. These different ways of thinking are called <strong>programming paradigms</strong>.</p><p><em>Today, I’m going to walk you through the main ones.</em></p><h3>1. The Early Days: Imperative Programming</h3><p>Let’s start at the very beginning.</p><p>In the 1950s and 60s, programming was <strong>imperative</strong>. That means you tell the computer exactly how to do something, one step after another.</p><p>Imagine I’m telling you how to make pasta: <em>Boil water… add pasta… wait 10 minutes… drain… add sauce.</em> That’s imperative programming — fixed instructions, in a fixed sequence.</p><pre>boil_water()<br>add_pasta()<br>wait_minutes(10)<br>drain()<br>add_sauce()<br>serve()</pre><ul><li>Simple to understand</li><li>Easy to start with</li></ul><p>But as the recipe grows, it can get messy. Imagine trying to cook a seven-course meal from one giant list of steps: exhausting to read, exhausting to manage.</p><h3>2. Structure Arrives: Structured Programming</h3><p><em>But computers got more powerful, and programs got bigger.</em></p><p>In the 1970s, we got <strong>structured programming</strong> . Still step by step, but organized into neat blocks, loops, and functions. Think of it as prioritizing <strong>modularity</strong>.</p><p>Instead of one massive recipe, you break it down:</p><p>a) A function for Cook pasta</p><p>b) A function for Make sauce</p><p>c) A function for Serve</p><pre>def cook_pasta():<br>    boil_water(); add_pasta(); wait_minutes(10); drain()<br><br>def make_sauce():<br>    heat_pan(); add_tomatoes(); season(); simmer()<br><br>def serve():<br>    plate(); add_sauce(); garnish()<br><br>def main():<br>    cook_pasta()<br>    make_sauce()<br>    serve()<br><br>main()</pre><p>This made code easier to follow and allowed us to reuse the same small recipe in multiple dishes.</p><p>But still with limited flexibility. Meaning big projects could still become complex if not managed well.</p><h3>3. OOP: Object-Oriented Programming</h3><p>Instead of just steps and functions, OOP says: <em>Let’s glue data and behavior into one package called an </em><strong><em>object</em></strong><em>.</em></p><p><strong>The Class: Blueprint</strong><br>Imagine we’re running a car factory.<br>We start with one master plan called a class.</p><p>Our <strong>Car </strong>class says:</p><p>a) Every car will have properties: color, speed, fuel level.</p><p>b) Every car will have behaviors: drive(), brake(), refuel().</p><p><strong>The Actual Car: Object</strong><br>When we follow the blueprint, we get a real object.</p><ol><li>My red Toyota is one instance.</li></ol><p>2. Your blue Tesla is another.</p><p>They both come from the same blueprint but have unique details.</p><p><strong>Specializing: Subclass &amp; Superclass</strong> <br>We can also make specialized versions without starting from scratch:</p><p><em>Superclass</em>: <strong>Car </strong>.</p><p><em>Subclass</em>: <strong>ElectricCar </strong>can inheris everything from <strong>Car </strong>but adds <strong>chargeBattery()</strong>.</p><pre># Class (blueprint)<br>class Car:  # superclass<br>    def __init__(self, color, fuel=100):<br>        self.color = color<br>        self.fuel = fuel<br>        self.speed = 0<br><br>    def drive(self):<br>        if self.fuel &gt; 0:<br>            self.speed += 10<br>            self.fuel -= 5<br><br>    def refuel(self, amount):<br>        self.fuel += amount<br><br># Subclass (specialized blueprint)<br>class ElectricCar(Car):  # inherits Car<br>    def charge_battery(self):<br>        self.fuel = 100<br><br># Objects (instances)<br>my_toyota = Car(&quot;red&quot;)<br>your_tesla = ElectricCar(&quot;blue&quot;)<br><br>my_toyota.drive()<br>your_tesla.charge_battery()</pre><p>This is inheritance: reusing and extending designs.</p><ul><li>=&gt; Code is reusable and easier to maintain</li><li>=&gt; Too many classes can overcomplicate small projects</li></ul><h3>4. Declarative Programming</h3><p>Here we focus on <strong>what</strong> you want (desired end result), not <strong>how</strong> to get it.</p><p>At a restaurant, you say: “I’d like spaghetti with marinara.” <strong>not </strong><em>Boil water, cook pasta, make sauce</em>.</p><pre>SELECT name<br>FROM users<br>WHERE status = &#39;active&#39;;</pre><p>This comes with cleaner, shorter code and, lets you focus on the goal, not the steps but it can feel like ‘magic’ if you don’t know what’s happening behind the scenes.</p><h3>5. Functional Programming</h3><h4>Pure Function Example</h4><p>square(4) will always give you 16.No matter what. It doesn’t secretly change anything else.</p><p>Functional programming also uses <strong>immutable values. </strong>Once a value is set, it can’t be changed and, often relies on <strong>recursion</strong> (functions that call themselves).</p><pre># Pure function: no side effects<br>def square(n):<br>    return n * n<br><br># Map/Filter: transform + select<br>nums = [1, 2, 3, 4, 5, 6]<br>squares = list(map(square, nums))<br>evens = list(filter(lambda x: x % 2 == 0, nums))<br><br># Recursion (factorial)<br>def fact(n):<br>    return 1 if n &lt;= 1 else n * fact(n - 1)</pre><ul><li>=&gt; Easy to test</li><li>=&gt; Immutability and recursion can sometimes negatively affect the performance</li></ul><h3>Recap:</h3><p><strong>Imperative</strong>: Step by step</p><p><strong>Structured</strong>: Steps into functions.</p><p><strong>OOP</strong>: Blueprints and reusability.</p><p><strong>Declarative</strong>: What you want, not how to do it.</p><p><strong>Functional</strong>: Pure, predictable functions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55d4bb85fc74" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>