<?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 Poonam Patwardhan on Medium]]></title>
        <description><![CDATA[Stories by Poonam Patwardhan on Medium]]></description>
        <link>https://medium.com/@poonampatwardhan?source=rss-84f67e08eb17------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OCcREc8A_Outv1VzY2ottw@2x.jpeg</url>
            <title>Stories by Poonam Patwardhan on Medium</title>
            <link>https://medium.com/@poonampatwardhan?source=rss-84f67e08eb17------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 14:19:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@poonampatwardhan/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[Unveiling Our Remarkably Small World: Maximizing Its Potential]]></title>
            <link>https://medium.com/@poonampatwardhan/unveiling-our-remarkably-small-world-maximizing-its-potential-92685f77f3bd?source=rss-84f67e08eb17------2</link>
            <guid isPermaLink="false">https://medium.com/p/92685f77f3bd</guid>
            <category><![CDATA[interconnectedness]]></category>
            <category><![CDATA[network-science]]></category>
            <dc:creator><![CDATA[Poonam Patwardhan]]></dc:creator>
            <pubDate>Sat, 25 Nov 2023 14:10:26 GMT</pubDate>
            <atom:updated>2023-11-25T14:10:26.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LWJdSCMWZgs__kxQ" /><figcaption>Photo by <a href="https://unsplash.com/@nasa?utm_source=medium&amp;utm_medium=referral">NASA</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>“We live in a small world.” It’s a phrase we toss around casually, but what if we could quantify this notion? Imagine quantifying the links between you and any random person on this planet. Would it be just a single-digit figure? Most folks would likely shake their heads, unless they’re math wizards or network enthusiasts.</p><p>Hold onto your seat because, believe it or not, <strong>there are merely six degrees of separation</strong> between you and every other soul on Earth, no matter where they reside! Astonishing, isn’t it? This revelation stemmed from Stanley Milgram’s garoundbreaking experiment in the 1960s. For deeper insights into this experiment, delve into its intricacies <a href="https://en.wikipedia.org/wiki/Small-world_experiment">here</a>.</p><p>Yet, this phenomenon doesn’t confine itself to the bounds of social circles alone. It transcends, seeping into various networks — the mesmerizing realm of “Small World” networks. These networks offer a corridor where navigating between any two points demands only a handful of connections.</p><p>Astonishingly, the very neurons firing in your brain right now are part of this same network! That’s why your thoughts leap effortlessly, bridging gaps through just a few synapses.</p><p>From electrical power grids to airport connections and ecological food webs, these networks abound in our world. Even in the economic sphere, the enchantment of networks unfolds. Consider the “information cascade,” akin to a domino effect where individuals mimic actions due to others’ influence. This ripple effect explains the viral spread of certain internet content or the surge in product purchases triggered by others’ choices.</p><p><strong>Now, here’s a thought: </strong>if we’re intertwined within these “small world” networks, why confine our connectedness to sharing only viral TikTok clips or entertaining celebrity snippets? Let’s also propagate fact-checked, enlightening pieces that bridge literacy gaps, nurturing positivity and understanding. We’re already on this path, but why not traverse it more consciously? <strong>Let’s amplify the exchange of knowledge and wisdom.</strong></p><p><strong>So, the next time you forward an amusing clip or a captivating celeb moment, slip in a piece of today’s learning.</strong>It could be a tidbit of wisdom or a heartening quote — it might just reach someone in need after only six shares or less!</p><p>In this vast tapestry of connections, <strong>let’s be catalysts for a chain reaction of enlightenment. </strong>After all, within six degrees lies the potential to touch countless lives, one shared insight at a time :)</p><p>This is my thought shared for the day :) What about you ?</p><p>Happy Sharing!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92685f77f3bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My attempt at refactoring “Sing a song” coding kata!]]></title>
            <link>https://medium.com/@poonampatwardhan/my-attempt-at-refactoring-sing-a-song-coding-kata-db71dd8900fe?source=rss-84f67e08eb17------2</link>
            <guid isPermaLink="false">https://medium.com/p/db71dd8900fe</guid>
            <dc:creator><![CDATA[Poonam Patwardhan]]></dc:creator>
            <pubDate>Sun, 15 Oct 2023 12:01:48 GMT</pubDate>
            <atom:updated>2023-10-15T12:01:48.713Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I’m excited to share my experience with refactoring a coding kata from the Kata log website- a site which offers a diverse collection of coding katas, which serve as excellent exercises for honing your refactoring skills.</p><p>The specific kata I embarked upon is known as the “Sing a Song kata,” which can be accessed via this link: [Sing a Song Kata](<a href="https://kata-log.rocks/sing-a-song-kata">https://kata-log.rocks/sing-a-song-kata</a>).</p><p>The narrative that follows documents my personal expedition through the art of refactoring. It’s crucial to emphasize that the approach I present here isn’t necessarily the one-size-fits-all or the absolute best method for refactoring. While various solutions can coexist, my primary objective is to demonstrate how my chosen refactoring techniques distinctly improved the original code’s structure.</p><p>Without further ado, let’s dive into the journey!</p><p>To grasp why refactoring was necessary for this kata, it’s worthwhile to take a quick peek at its original version. The code is essentially a whimsical children’s rhyme stashed in a string variable aptly named “song,” and when it’s unveiled, it promises to bring a smile to your face :)</p><pre>#include &lt;iostream&gt;<br>#include &lt;string&gt;<br><br>int main() {<br> std::string song = &quot;There was an old lady who swallowed a fly.\n&quot; \<br>            &quot;I don&#39;t know why she swallowed a fly - perhaps she&#39;ll die!\n&quot; \<br>            &quot;\n&quot; \<br>            &quot;There was an old lady who swallowed a spider;\n&quot; \<br>            &quot;That wriggled and wiggled and tickled inside her.\n&quot; \<br>            &quot;She swallowed the spider to catch the fly;\n&quot; \<br>            &quot;I don&#39;t know why she swallowed a fly - perhaps she&#39;ll die!\n&quot; \<br>            &quot;\n&quot; \<br>            &quot;There was an old lady who swallowed a bird;\n&quot; \<br>            &quot;How absurd to swallow a bird.\n&quot; \<br>            &quot;She swallowed the bird to catch the spider,\n&quot; \<br>            &quot;She swallowed the spider to catch the fly;\n&quot; \<br>            &quot;I don&#39;t know why she swallowed a fly - perhaps she&#39;ll die!\n&quot; \<br>            &quot;\n&quot; \<br>            &quot;There was an old lady who swallowed a cat;\n&quot; \<br>            &quot;Fancy that to swallow a cat!\n&quot; \<br>            &quot;She swallowed the cat to catch the bird,\n&quot; \<br>            &quot;She swallowed the bird to catch the spider,\n&quot; \<br>            &quot;She swallowed the spider to catch the fly;\n&quot; \<br>            &quot;I don&#39;t know why she swallowed a fly - perhaps she&#39;ll die!\n&quot; \<br>            &quot;\n&quot; \<br>            &quot;There was an old lady who swallowed a dog;\n&quot; \<br>            &quot;What a hog, to swallow a dog!\n&quot; \<br>            &quot;She swallowed the dog to catch the cat,\n&quot; \<br>            &quot;She swallowed the cat to catch the bird,\n&quot; \<br>            &quot;She swallowed the bird to catch the spider,\n&quot; \<br>            &quot;She swallowed the spider to catch the fly;\n&quot; \<br>            &quot;I don&#39;t know why she swallowed a fly - perhaps she&#39;ll die!\n&quot; \<br>            &quot;\n&quot; \<br>            &quot;There was an old lady who swallowed a cow;\n&quot; \<br>            &quot;I don&#39;t know how she swallowed a cow!\n&quot; \<br>            &quot;She swallowed the cow to catch the dog,\n&quot; \<br>            &quot;She swallowed the dog to catch the cat,\n&quot; \<br>            &quot;She swallowed the cat to catch the bird,\n&quot; \<br>            &quot;She swallowed the bird to catch the spider,\n&quot; \<br>            &quot;She swallowed the spider to catch the fly;\n&quot; \<br>            &quot;I don&#39;t know why she swallowed a fly - perhaps she&#39;ll die!\n&quot; \<br>            &quot;\n&quot; \<br>            &quot;There was an old lady who swallowed a horse...\n&quot; \<br>            &quot;...She&#39;s dead, of course!&quot;;<br> std::cout &lt;&lt; song;<br> return 0;<br>}</pre><p>This code might seem like the perfect solution for a static use case where the song never changes — ideal for software that churns out classic children’s rhymes. But what if we ventured beyond this scenario?</p><p>What if the song’s composer wanted it to be flexible, open to whimsical inputs from its audience? Picture an audience of predominantly children, each with their unique animal preferences for the old lady’s adventures. While the core structure of the song remains unchanged, the characters within it can dynamically shift with each performance.</p><p>In such an evolving scenario, maintaining the original code becomes quite a challenge. For every new request from a customer (each imaginative child), the software would need to generate a fresh version, hardcoding the newly selected characters into the “song” variable.</p><p>This is precisely where refactoring the code comes into play!</p><p>When I viewed the kata through this dynamic lens, I proceeded to refactor it accordingly. After a series of iterations, backed by robust unit tests, I arrived at the following solution:</p><pre><br>int main()<br>{<br>    cout &lt;&lt; &quot;Please provide the file with your not-so-favourite animals <br>             so that the old lady can joyfully gulp them down.&quot;;<br>    string inputFile;<br>    cin &gt;&gt; inputFile;<br><br>    std::vector&lt;SongCharacter&gt; songCharacters;<br>    songCharacters = readCustomisedAnimalInputs(inputFile);<br>    <br>    SongBuilder songNarrator;<br>    <br>    auto song = songNarrator<br>     .addIntroductoryPiece()<br>     .buildStoryWithCharacters(songCharacters)<br>     .addConcludingPiece()<br>     .recite();<br>                                    <br>    for(auto&amp; lyrics : song)<br>    {<br>        std::cout &lt;&lt; lyrics &lt;&lt; std::endl;<br>    }<br>}</pre><p>In this version, the client of the code can decide which animals (song characters) it desires, and can even inject some custom, playful lyrics for each chosen animal!</p><p>The classes that build these lyrics are as follows :</p><pre>class SongCharacter<br>{<br>    public:<br>        string name;<br>        string reactionLyric;<br>        <br>    SongCharacter(string name, string reactionLyric)<br>    {<br>     this-&gt;name = name;<br>     this-&gt;reactionLyric =reactionLyric;<br>    }<br>};<br>struct Song<br>{<br>    string introLine;<br>    vector&lt;string&gt; lyrics;<br>    string concludingLine;<br>};<br>class SongBuilder<br>{<br>    Song song;<br>    vector&lt;SongCharacter&gt; characters;<br>    <br>    public:<br>    SongBuilder()<br>    {<br>        song.introLine = &quot;There was an old lady who swallowed a&quot;;<br>        song.concludingLine = &quot;She&#39;s dead, of course!&quot;;<br>    }<br>    <br>    SongBuilder addIntroductoryPiece(string introLine = &quot;&quot;)<br>    {<br>        if (!introLine.empty())<br>            song.introLine = introLine;<br>        <br>        return *this;<br>    }<br>    SongBuilder buildStoryWithCharacters(vector&lt;SongCharacter&gt; characters)<br>    {<br>        this-&gt;characters = characters;<br>        for (int currentCharacter = 0; currentCharacter &lt;= characters.size()-1; currentCharacter++)<br>        {<br>             addStoryFor(currentCharacter)<br>            -&gt;addRecap(currentCharacter);<br>        }<br>        return *this;<br>    }<br>    <br>    SongBuilder addConcludingPiece(string concludingLine = &quot;&quot;)<br>    {<br>        if (!concludingLine.empty())<br>            song.concludingLine = concludingLine;<br>            <br>        song.lyrics.push_back(song.concludingLine);<br>        return *this;<br>    }<br>    <br>    vector&lt;string&gt; recite()<br>    {<br>        return song.lyrics;<br>    }<br>    <br>    private:<br>    SongBuilder* addStoryFor(int currentOne)<br>    {<br>        song.lyrics.push_back(song.introLine + &quot; &quot; + characters[currentOne].name);<br>        song.lyrics.push_back(characters[currentOne].reactionLyric);<br>        return this;<br>    }<br>    <br>    void addRecap(int currentCharacter)<br>    {<br>        if (currentCharacter == 0 || currentCharacter == characters.size()-1)<br>            return;<br>        <br>        for(auto i = currentCharacter; i&gt;0; i--)<br>        {<br>            song.lyrics.push_back(&quot;She swallowed the &quot;+ characters[i].name + &quot; to catch the &quot; + characters[i-1].name);<br>        }<br>        song.lyrics.push_back(characters[0].reactionLyric);<br>    }<br>};<br><br>// the function that reads the custom animals can be part of the main.cpp file<br>vector&lt;SongCharacter&gt; readCustomisedAnimalInputs(string fileName)<br>{<br>    ifstream file;<br>    file.open(fileName);<br>    <br>    vector&lt;SongCharacter&gt; customAnimalInputs;<br>    string fileLine;<br>    while (getline(file, fileLine)) {<br>        int commaPosition = fileLine.find_first_of(&#39;,&#39;);<br>        string animalName = fileLine.substr(0, commaPosition);<br>        string reactionLyric = fileLine.substr(commaPosition + 1);<br>        <br>        SongCharacter animalCharacter(animalName, reactionLyric);<br>        customAnimalInputs.push_back(animalCharacter);<br>    }<br>    file.close();<br>    return customAnimalInputs;<br>}</pre><p>I made a deliberate effort to select names that resonate with the intricacies of our business domain. I made an effort to segregate responsibilities into distinct classes. Additionally, to maintain clarity and encapsulation, I ensured that only the functions directly pertinent to the client are exposed within the SongBuilder class.</p><p>If this solution brings you joy due to its readability and elegantly refactored style, I highly recommend indulging in Katrina Owen’s enlightening talk at RailsConf 2016, titled “Succession by Katrina Owen” <a href="https://youtu.be/59YClXmkCVM?si=HpLDEGmu-lCNjaev">Watch it here</a>.</p><p>Hope you enjoyed this journey of refactoring as much as I did :)</p><p>Thank you so much for reading! Have a nice day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db71dd8900fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>