<?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 Komolafe Tolulope on Medium]]></title>
        <description><![CDATA[Stories by Komolafe Tolulope on Medium]]></description>
        <link>https://medium.com/@betkom?source=rss-5166305adbcc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VJwMd_twxGjSirnS.jpeg</url>
            <title>Stories by Komolafe Tolulope on Medium</title>
            <link>https://medium.com/@betkom?source=rss-5166305adbcc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 12:23:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@betkom/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[Understanding Hoisting and Scoping in Javascript]]></title>
            <link>https://medium.com/backticks-tildes/understanding-hoisting-and-scoping-in-javascript-39ea7b41e31?source=rss-5166305adbcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/39ea7b41e31</guid>
            <category><![CDATA[hoisting]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[scoping]]></category>
            <category><![CDATA[fundamentals]]></category>
            <dc:creator><![CDATA[Komolafe Tolulope]]></dc:creator>
            <pubDate>Mon, 19 Feb 2018 11:18:56 GMT</pubDate>
            <atom:updated>2018-03-23T16:02:42.487Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PKiUn_Ky4FduLbiGLffIqg.png" /></figure><p>There are several times Javascript developers want to tear their hair out because of an unexpected behavior in their code. Most of these bugs could be traced to these two concepts, Scoping and Hoisting.</p><h4><strong>Scoping</strong></h4><p>Scoping is determining where variables, functions, and objects are accessible in your code during runtime. This means the scope of a variable(where it can be accessed) is controlled by the location of the variable declaration.</p><p>In Javascript, there are two scopes:</p><ol><li>Global Scope</li><li>Local Scope</li></ol><p><strong><em>Global Scope</em></strong></p><p>There is only one Global scope throughout a JavaScript document. A variable is in the Global scope if it’s defined outside of a function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0035117f2478c5d59dff2b678e7f373/href">https://medium.com/media/c0035117f2478c5d59dff2b678e7f373/href</a></iframe><p>You can also access and alter any variable declared in a global scope from any other scope.</p><p><strong><em>Local Scope</em></strong></p><p>Variables declared within a function are in the local scope. Local scope is also called function scope because local scope is created by functions in Javascript. Variables in the local scope are only accessible within the function in which they are defined, i.e they are bound to their respective functions each having different scopes. This allows us to create variables that have the same name and can be used in different functions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65d22658475d472df5c34a849de3c570/href">https://medium.com/media/65d22658475d472df5c34a849de3c570/href</a></iframe><p><strong><em>Variable Shadowing</em></strong></p><p>In JavaScript, variables with the same name can be specified at multiple layers of nested scope. In such case local variables gain priority over global variables. If you declare a local variable and a global variable with the same name, the local variable will take precedence when you use it inside a function. This type of behavior is called <em>shadowing</em>. Simply put, the inner variable shadows the outer. This is how the Javascript interpreter finds a particular variable; it searches for the variable at the innermost scope being executed at the time, and continues until the first match is found, even if there are other variables with the same name in the outer scope.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d8a31c0889e9a9abbd7a8e25dd13ec4/href">https://medium.com/media/0d8a31c0889e9a9abbd7a8e25dd13ec4/href</a></iframe><p>Another way of declaring variables with a local scope is via block functions. Prior to the introduction of let and const in ECMAScript 6, we couldn’t declare local scope in block statements like for loops</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59b6b5d1dea372c07eada7bf30de52fb/href">https://medium.com/media/59b6b5d1dea372c07eada7bf30de52fb/href</a></iframe><h4><strong>Hoisting</strong></h4><p>We already know that any variable declared within a scope belongs to that scope. But what we don’t know yet is that no matter where variables are declared within a particular scope, all variable declarations are moved to the top of their scope (global or local). This is because of a concept called <strong><em>Hoisting.</em></strong></p><p><strong>Hoisting</strong> in JavaScript is a feature in which the interpreter moves the function and variable declarations to the top of their containing<strong> </strong><a href="https://medium.com/@lenafaure/understand-javascript-variable-scope-with-ease-221a6d41dc43"><strong>scope</strong></a><strong>.</strong> It<strong> </strong>means that variable declarations, wherever they occur, are processed before any code is executed. Note that hoisting only moves the declaration and not the assignment. This will be clearer in the examples below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44a4d449143fe2f8cd839d2fdf0d0845/href">https://medium.com/media/44a4d449143fe2f8cd839d2fdf0d0845/href</a></iframe><p>You might have expected the first line to throw an error since the variable is not yet declared or you expected the console.log statement to print out undefined but this is what hoisting does, it essentially interprets the code as :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58c9c6930566fd9daf626f6e3d467cac/href">https://medium.com/media/58c9c6930566fd9daf626f6e3d467cac/href</a></iframe><p>You can see that the variable declaration is hoisted to the top of the global scope.</p><p>Let’s consider this other block of code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6b8cb3b6498f4611f50ce41d877d47a/href">https://medium.com/media/d6b8cb3b6498f4611f50ce41d877d47a/href</a></iframe><p>You might wonder why item is not defined when it’s printed. Isn’t item supposed to be hoisted? Well, remember I said only the declarations not the assignments are hoisted. To make this clearer, let’s see how javascript interprets the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e6dba41e95c2249636c40495c145a23/href">https://medium.com/media/0e6dba41e95c2249636c40495c145a23/href</a></iframe><p>You can see that the declaration of item is processed first.</p><p>Function declarations can also be hoisted:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19531fc20dc4010a47fe2429cb3375fe/href">https://medium.com/media/19531fc20dc4010a47fe2429cb3375fe/href</a></iframe><p>In the block of code above, while the function is being called before it’s declared, because of hoisting, the function declaration is hoisted to the top of the scope therefore making it possible for the function to be called.</p><p>You can see how easy it is to make some mistakes because rather than being available right after their declaration, variables and functions might actually be available beforehand in the code, which might lead to certain behaviors that you wouldn’t expect if you knew nothing about hoisting.</p><p><strong>Conclusion</strong></p><p>To avoid these mistakes, remember these:</p><ul><li>All declarations, both functions and variables, are hoisted to the top of the containing scope, before any part of your code is executed.</li><li>Functions are hoisted first, and then variables.</li><li>Function declarations have priority over variable declarations, but not over variable assignments.</li><li>Declare all of your variables at the top of their scope (at the top of the global scope or at the top of the function scope)</li><li>Make sure you put all your functions, if you can, also at the top of their scope.</li></ul><p>If this was helpful in anyway, feel free to comment and like this article so that others can find it easily.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39ea7b41e31" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backticks-tildes/understanding-hoisting-and-scoping-in-javascript-39ea7b41e31">Understanding Hoisting and Scoping in Javascript</a> was originally published in <a href="https://medium.com/backticks-tildes">Backticks &amp; Tildes</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get to D4]]></title>
            <link>https://medium.com/@betkom/how-to-get-to-d4-67bb24e0a114?source=rss-5166305adbcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/67bb24e0a114</guid>
            <category><![CDATA[career-advancement]]></category>
            <category><![CDATA[tech-leadership]]></category>
            <category><![CDATA[career-advice]]></category>
            <dc:creator><![CDATA[Komolafe Tolulope]]></dc:creator>
            <pubDate>Fri, 13 Oct 2017 12:03:47 GMT</pubDate>
            <atom:updated>2017-10-13T14:12:36.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*J5gRq8TtZn8oAdOwP0Zt1g.jpeg" /></figure><p>We’ve all gone through assessments for various D-Levels in the Fellowship in the past; but D4 feels different. D4 feels like a form of validation that the last two or three years were meaningful and that you’ve really grown and improved.The aim of this article is to simplify the process of D4 Advancement, and to equip Andelans with the knowledge they need to take the next step towards Technology Leadership. To do so, I will break my personal experience down into the three steps that helped me become a Product Manager.</p><p><strong>Step 1: Identify a Growth Track</strong></p><p>The first step towards achieving anything is to know <strong>what </strong>you want to achieve. Without the <strong>“what”</strong>, there wouldn’t be the <strong>“how”</strong> or <strong>“when”</strong></p><p>Currently, there are four D4 paths within the fellowship</p><ul><li>Project Management</li><li>Software Architecture</li><li>DevOps Management</li><li>Product Management</li></ul><p>When I was thinking about which of these paths to embark on, I was vacillating between 3 of these tracks and was very confused as to which option would be the best for me. One of the people that helped me reach a decision was Nad. He asked me some questions that I believe every Andela developer should start thinking about as soon as they start preparing for D3. The questions are:</p><ul><li>What do you think your current skills set are?</li><li>How confident are you in your current skills?</li><li>What other skills do you want to have in the next one year?</li><li>Which of these paths would help you achieve your mid to long-term career goals?</li></ul><p>Once you answer these questions, you will have enough information to choose what path you want to follow.</p><p><strong>Step2: Identify Learning Opportunities</strong></p><p>After you’ve identified a growth path, start looking out for opportunities for you to gain or practice the relevant skills for the path you want. Identify those skills that a person in your desired role, might need by referencing the relevant curriculum, speaking with individuals in that role, Mentors at Andela or your Partner.</p><p>For example, if you want to go through the Product Management Path, you have to consider the following:</p><ul><li>Communication</li><li>Leadership</li><li>Willingness to ask questions</li><li>Estimation</li><li>Problem Solving</li><li>Holistic thinking;</li></ul><p>These are some of the most crucial skills you would need to practice and sharpen. You can get opportunities via your partner work, volunteering on hackathons or external/side projects, signing up for apprenticeship opportunities for the path you want.</p><p>I created opportunities to build my Product Management skills both at Andela and on my Partner work by:</p><p>1.) Signing up to be an apprentice Product Manager on a new Andela Learning product (Thanks Adam Lupu for the opportunity).</p><p>2.) Asking to be part of Product conversations on my Partner project. These allowed me to develop skills I wouldn’t have been able to on my daily partner work.</p><p><strong>Step3: Coaching/Mentorship</strong></p><p>This is very important if you have a short time (e.g 6 months) to ramp up on a specific path. It is also useful in learning common best practices amongst experienced practitioners in a particular path. You can look for experienced practitioners to either coach or mentor you (this is based on your skill level and need) within or outside the fellowship by leveraging yours and Andela’s network.</p><p>Mentorship is typically a long term relationship focused on the person, their career and support for individual growth while coaching is a short-term task based relationship focused on developing specific skills for a given task, challenges and performance expectations.</p><p>After I failed my initial assessment, I jumped at an opportunity to be coached when my coach (Shoutout to Lisbi Abraham) volunteered by freeing up time on his schedule for coaching. The coaching ran for about 3 months and doing this simultaneously with apprenticing on a real product was immensely helpful. Each coaching session was one hour long and would begin with me enumerating the questions or challenges I encountered while working as a Product Manager on a product since the last coaching session and I’d leave at the end of the session with answers and insight from my Coach and a plan to implement the new things I learnt during the session.</p><p>I also had a mentor (Adam Lupu), who fortunately was part of the Product I was apprenticing on. Because of his first-hand knowledge of the Product’s requirement and vision, he was able to give me specific answers to the questions that would come up for me as I worked on the Product.</p><p>I cannot overemphasize the importance of coaching or mentorship in getting specific and practical knowledge on how to approach certain situations in any given path you choose.</p><p><strong>Conclusion</strong></p><p>D4 (or any level) is not scary but it will not drop in your laps. You have to prepare for it.</p><p><em>Remember:</em></p><ul><li><em>Have a clear goal or path to strive for.</em></li><li><em>Surround yourself with people who believe in you and support your goals.</em></li><li><em>Don’t be afraid to reach out to people to ask for help, especially coaches / mentors.</em></li><li><em>Don’t be afraid to jump in and get your hands dirty — it’s the best way to learn.</em></li></ul><blockquote><em>“There is only one thing that makes a dream impossible to achieve: the fear of failure.” — Paulo Coelho”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zKRVa0xmMpX2phHhZjxuAw.jpeg" /><figcaption>Celebrating with Christina Sass one of my mentors</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67bb24e0a114" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lessons from The Color Purple]]></title>
            <link>https://medium.com/@betkom/the-color-purple-es-magn%C3%ADfico-966cc8cb8837?source=rss-5166305adbcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/966cc8cb8837</guid>
            <category><![CDATA[broadway]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[entertainment]]></category>
            <dc:creator><![CDATA[Komolafe Tolulope]]></dc:creator>
            <pubDate>Sun, 08 Jan 2017 18:30:25 GMT</pubDate>
            <atom:updated>2017-01-12T16:27:25.382Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve never seen the Color purple on broadway, I recommend that you go see it as soon as you have a chance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*QG8fXkh-2GBJvnwRoxKbGg.jpeg" /></figure><p>Oct 5, 2016 was one of the most beautiful nights of my life. I saw the Color Purple on broadway.</p><p>This particular show was magnificent (a word not adequate to describe the show). The music, the voices, the stage, the arrangement, the transitions, the story line, the acts were all in perfect synchrony, bombarding all your five senses. The synchronisation <em>es perfecto</em>. I have seen the Color Purple movie — which in itself is a great movie — but I must tell you the broadway show brought the story to life in a way I had never imagined. The entire cast sang and performed with such conviction, depth and didn’t leave anything unturned or untouched.The broadway adaptation of the story is the best performance I’ve seen and never have I seen an audience more connected to the story that’s being told.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DS9nkMvlYGS2c6e_lAT7iQ.jpeg" /></figure><p>From the moment the show started till the end, I was held spellbound, led through a myriad of emotions, from laughter to anxiety, fear to hope, sadness to happiness, to love. I couldn’t keep my emotions in check and by the time we had the intermission, my body was covered in goosebumps. If it were a guy who invited me to see the show, I would have fallen in love with him at that moment.</p><p>Apart from the emotions, there were a million and one thoughts running through my mind and some life lessons were reinforced. Some of the lessons are:</p><ol><li>When you’re the best at what you do, people will applaud you whether you want it or not. I and every other person in that theatre couldn’t help but spontaneously applaud the show’s cast members at various points during the show. We felt that they gave and left their all on that stage, years of sweat, practice and pain turned into the sweetness of the applause of thousands of people.</li><li>Without teamwork, there can’t be a symphony. If any of the acts on that show had failed to do their part, the whole show wouldn’t have turned out the way it did. If a technician had dropped the ball on his/her responsibility, the whole performance would have been a disaster. Every one (the visible and non-visible) on that set played their part to make sure the show turned out perfect.</li><li>Nothing is too hopeless that it cannot be redeemed. Celie (the show’s main actress) suffered through physical, sexual and mental abuse, almost giving up at various times in her life thinking God has forgotten her, eventually through her tenacity, she triumphed.</li><li>Music transcends the physical. It’s a spiritual act that no one (even those who don’t believe in the spiritual) can deny. It gives you an out-of-body experience. Just listen to this theme song from the show.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1DiWTwC6Ek8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1DiWTwC6Ek8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1DiWTwC6Ek8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e540c1d57cb3d098ec785e00c8fc7e3e/href">https://medium.com/media/e540c1d57cb3d098ec785e00c8fc7e3e/href</a></iframe><p>As good as the video clip I put about was, it doesn’t do justice to how it comes across live in a packed theatre.</p><p>5. Anywhere awesomeness is being displayed, Nigerians are always there. I appreciated the show more because I could see the incredible planning that went into the show and I can say the show wouldn’t have been a success without the efforts of the composers, stage managers and technicians. I took the time to look through the names of everyone involved in the show and of course I saw the familiar, Nigerians…</p><p>Let me just end this here, in short, Go see the Color Purple and thank me later!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=966cc8cb8837" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discrete Mathematics and its application— Part 2B]]></title>
            <link>https://medium.com/@betkom/journey-to-becoming-a-better-software-developer-part-2b-1a3911b61b0f?source=rss-5166305adbcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a3911b61b0f</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Komolafe Tolulope]]></dc:creator>
            <pubDate>Sun, 01 May 2016 18:33:13 GMT</pubDate>
            <atom:updated>2018-02-10T11:30:06.212Z</atom:updated>
            <content:encoded><![CDATA[<p>In my last article in this series which can be found <a href="https://medium.com/@betkom/journey-to-becoming-a-better-software-developer-part-2a-c7d9ad302006#.y8cfvzke8">here</a>, I wrote about Asymptotic Notations and explained the three most important notations and their meaning. I believe understanding how to analyse an Algorithm’s efficiency is important in choosing the right algorithms to solve any particular problem and this is why I particularly enjoyed learning about Asymptotic notations. In this write-up, I will talk about how to determine the time complexity of some algorithms and compare functions using Asymptotic notations.</p><p><strong>Binary Search Runtime Analysis</strong></p><p>Given a problem to guess a number. Let’s say the computer chooses a random number between 1 and 100 and we have to guess the number, how would we guess what number the computer chose?</p><p>Normally we will take and compare each number with the guessed number until we get the right number. This method is called Linear search. Here’s a simple javascript snippet to implement Linear search.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb6a1d614cae0112c43a5f35c7e1e186/href">https://medium.com/media/eb6a1d614cae0112c43a5f35c7e1e186/href</a></iframe><p>The time complexity for linear search is O(<em>n</em>) where n is the number of times, in the worst case, it will have to loop through all the numbers in the list or array. This solution works but if we are dealing with a list of 100,000 numbers, how long will it take to iterate through the numbers and compare each, the time grows as the numbers increase. A more efficient way to solve this same problem is Binary Search.</p><p>Binary search is an efficient algorithm for quickly finding an item from an ordered list of items. It repeatedly divides in half the list until you’ve narrowed down the possible locations of the item to just one. A way to use Binary Search is to find an item in an Array.</p><p>Let’s look at how to use binary search to solve the guessing game. Using binary search we will start by:</p><ul><li>examining the middle number. If that number is the one chosen, we are done!</li><li>If it is not the number, we can use the ordered nature of the list to eliminate half of the remaining numbers.</li><li>If the number we are searching for is greater than the middle number, we know that the entire lower half of the list as well as the middle number, can be eliminated from further consideration. The number, if it is in the list, must be in the upper half.</li><li>We can then repeat the process with the upper half. Start at the middle item and compare it against what we are looking for. Again, we either find it or split the list in half, therefore eliminating another large part of our possible search space.</li></ul><p>This is a simple Javascript code to implement this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b8ab625e6741e256f92095ba86759e6/href">https://medium.com/media/5b8ab625e6741e256f92095ba86759e6/href</a></iframe><p>Now let’s look at the running time of this algorithm, we need to recall that each comparison eliminates about half of the remaining items from consideration.</p><p><strong>What is the maximum number of comparisons this algorithm will require to check the entire list?</strong></p><p>If we start with <em>n</em> items, about <em>n/2</em> items will be left after the first comparison. After the second comparison, there will be about <em>n/4</em>. Then <em>n/8</em>, <em>n/16</em>, and so on. The number of comparisons necessary to get to the point where it remains just one item in the list is <em>i</em> where <em>n/2i=1</em>. Solving for <em>i</em> gives us <em>i = log(n)</em> so we can say the worst running time of binary search is<em> log(n)</em> which we can rewrite using the asymptotic notation as <em>O(log n).</em></p><p>Note that in Linear search, the array/list does not need to be sorted but in Binary Search the array or list must be sorted</p><p><strong>Comparing functions using Asymptotic notations</strong></p><p>Different algorithm functions have different growing time. Below is a list that shows the different functions from slowest to fastest growing time.</p><pre>1. Constant functions(1, 4, 37 etc)</pre><pre>2. Logarithmic functions(log​8​​<em>n,</em>log​2​​<em>n)</em></pre><pre>3. Linear functions(4n, 7n)</pre><pre>4. Linearithmic functions(<em>n</em>log​2​​<em>n, n</em>log​8​​<em>n)</em></pre><pre>5. Polynomial functions(8n^4,6n^3)</pre><pre>6. Exponential functions(7^2n)​​</pre><p>Now let’s compare some functions.</p><p>Given 8 ^<em>n</em> , and 4^<em>n</em> , what is the asymptotic relationship between these functions? The best way to do this is to plug in actual values for <em>n</em> incrementally. Say we use 10 as <em>n</em>, and plug it into the above equations, 8¹⁰ will give us 1,073,741,824 and 4¹⁰ will give 1,048,576. This means 8^n will have a slower running time than 4^n and if we keep on increasing n, we will still notice the same pattern then we can say 8^<em>n</em> = Ω(4^<em>n</em>) i.e 8 ^<em>n</em> has an asymptotic lower bound Ω(4 ^<em>n</em> ).</p><p>Let’s take another example, for the functions, <em>n^k</em> and <em>c^n</em>, what is the asymptotic relationship between these functions? Assume that <em>k</em> &gt;= 1 and <em>c</em> &gt; 1 are constants.</p><p><em>n^k</em> is a polynomial function and <em>c^n</em> is an exponential function, and we know that polynomials always grow more slowly than exponentials from our list above so if we plug in some actual numbers we will notice for larger numbers <em>c^n</em> actually takes more time to run than <em>n^k</em> so we can say <em>n^k</em> = <em>O(c^n)</em>.</p><p>You can visit this link to learn more about how to compare functions <a href="https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/asymptotic-notation">https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/asymptotic-notation</a>.</p><p>If you have any question, you can send me a mail at betkomuniq@gmail.com or send me a DM on twitter <a href="https://twitter.com/betkom">@betkom</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a3911b61b0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discrete Mathematics and its application — Part 2A]]></title>
            <link>https://medium.com/@betkom/journey-to-becoming-a-better-software-developer-part-2a-c7d9ad302006?source=rss-5166305adbcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7d9ad302006</guid>
            <category><![CDATA[asymptotic-notation]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Komolafe Tolulope]]></dc:creator>
            <pubDate>Sun, 03 Apr 2016 20:22:23 GMT</pubDate>
            <atom:updated>2018-02-10T11:29:32.408Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*iEr9Jgu2_UV9MsXaD0l_NA.jpeg" /></figure><p>In part 1 of this series, where I documented my journey learning Data Structures and Algorithms, (which I began early March of 2016) and so far the journey has been more exciting than I had thought. I had expected it to be boring based on my past experiences trying to learn algorithms. Having tried several times, the different concepts had failed to sustain my attention till now. And now? Yay!!! I finally understand asymptotic notations(my favourite part so far). As promised, let me share some of what I learnt with you.</p><p><strong>What are Algorithms?</strong></p><p>Algorithms are a set of steps that a computer takes to accomplish a task. I can also say algorithms are like road maps for accomplishing a given, well-defined task.</p><p>Algorithms are central to any computation or computer program. And since computer programs are a set of logical rules put together in a structured way, we can say Data Structures + Algorithm = Computer Program</p><p>You might ask, “why do I need to learn how to write or use algorithms?”. Well, knowledge of algorithms will help you identify potential solutions to a problem based on existing solutions to a similar problem or help you design an efficient solution for your problem (time and performance-wise).</p><p>The best favor a developer can do for his/herself is to understand the existing algorithms we have in computer science today. Apart from increasing your developer toolkit, it means you are not stuck trying to reinvent the wheel whenever you encounter a problem. I am all for writing and developing new algorithms, but it makes sense to choose from the vast array of existing ones where applicable.</p><p>The problem of reinventing the wheel every time you want to solve a problem <strong><em>1</em></strong><em>.</em> will take you longer (time wasting) <strong><em>2.</em></strong> you will most certainly get it wrong several times (expending mental effort).</p><p>Some real life applications of Algorithms are</p><ul><li>compression algorithms which are used by video calling/streaming apps</li><li>Google Maps uses route finding algorithms to suggest routes from one point to another.</li><li>If you want to develop a game that allows a user play against the computer, then you can use minimax algorithms.</li><li>Google’s search engine use searching and sorting algorithms.</li><li>Frequency algorithm used by Gmail and Slack for getting the most frequent person you send messages and media to and suggests that immediately you start typing</li></ul><p><strong>What makes a good algorithm?</strong></p><ol><li>It solves a problem correctly.</li><li>It solves it efficiently.</li></ol><p>To choose the best algorithm to solve a particular problem, you have to be able to determine the efficiency of various algorithms. One of the most common ways of determining the efficiency of Algorithms is a technique called <strong><em>Asymptotic Analysis</em></strong>.</p><p><strong>What is Asymptotic Analysis</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*D2m0NnBlT-sw1uWspqk1cw.png" /></figure><p>Asymptotic Analysis is a study of algorithms based on their input size and the rate of growth of the running time (how fast the running time grows with the size of the input).</p><p>We perform this analysis because algorithms perform differently from each other with varying inputs, i.e., Given two algorithms, A and B, it might be possible that for a given set of input, the algorithm A performs better than the B. And for another given set of input B will perform better.</p><p>A lot of the theory is about how time and space requirements grow as the problem size increases, and it’s important because naive choices are often very fast on small datasets, but do not perform efficiently with large data sets.</p><p><strong><em>Asymptotic notations</em></strong> are mathematical tools to represent time complexity of algorithms for asymptotic analysis.</p><p>The following notations are commonly used to represent time complexity of algorithms</p><ol><li><strong>Big-Θ Notation(Theta):</strong> known as theta notation, this symbol is used to represent functions where we’ve nailed the running time to within a constant factor above and below, i.e. when the running time is within a range of constant values. Whenever we use big-Θ notation, we’re saying that we have an asymptotically tight bound on the running time. For example, When we say that a particular running time is Θ(n), we’re saying that once n gets large enough, the running time is, at least, k1⋅n and at most k2⋅n for some constants k1 and k2.</li><li><strong>Big-O notation:</strong> This term refers to the upper bound of an algorithm. For example, consider the case of Insertion Sort. It takes Θ(n) in the best case scenario and Θ(n^2) in the worst case scenario, so we safely say the time complexity of insertion sort cannot be worse than Θ(n^2) but can be better. In this case, we will write it as O(n^2). Consider a less complex example; suppose you work on average 7 hours every day and you walk up to a friend and say I work no more than 12 hours every day, your statement will be correct because 12 hours is an upper bound to 7 hours.</li><li><strong>Big-Ω Notation(Omega):</strong> This term is the opposite of Big-O notation. It is used to define the lower bound of an algorithm. If we want to say that an algorithm takes, at least, a certain amount of time(best case time complexity), then we use the Omega notation. The Omega notation is the least used notation among all three because mostly we don’t care about the best-case time complexity of our algorithm, we are mainly concerned with what the worst time case for any algorithm.</li></ol><p>To stop this write up from becoming long and tedious, I will end this here. In the next part of this series, I will talk about how we compare functions using asymptotic notations and how we determine the time complexity of some Algorithms.</p><p>You can also check out this link to understand more about Asymptotic notations</p><p><a href="https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/asymptotic-notation">https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/asymptotic-notation</a></p><p>I hope you learned something new from this article. If you have any question, you can send me a mail at betkomuniq@gmail.com or send me a DM on twitter <a href="https://twitter.com/betkom">@betkom</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7d9ad302006" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discrete Mathematics and its application — Part 1]]></title>
            <link>https://medium.com/@betkom/journey-to-becoming-a-better-software-developer-part-1-e69cf8dc2571?source=rss-5166305adbcc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e69cf8dc2571</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[discrete-maths]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Komolafe Tolulope]]></dc:creator>
            <pubDate>Mon, 14 Mar 2016 19:27:14 GMT</pubDate>
            <atom:updated>2018-02-10T11:30:51.213Z</atom:updated>
            <content:encoded><![CDATA[<p>About 3 weeks ago, in my bid to become a better software developer, I decided to undergo a study plan that involves learning the basics about different elements of being a world class software consultant. I will be doing this over the next couple of months.</p><p>I started with learning Discrete Maths over again, I really wished I had paid attention in my college classes. And I’ve decided to share what I learnt.</p><p><strong>Why Discrete Maths?</strong></p><p>This is a question lots of people have asked over and over again and there are lots of articles that have done justice to answering this question. I will just summarise the common answers I found on the internet.</p><p>Discrete Maths, unlike other branches of mathematics, helps to develop a logical approach to problem solving which you will agree is a very important skill that all programmers need to have. Of course, you will almost never open your Discrete Maths textbook and copy something into your code to solve a problem. However, understanding the concepts will help developers write better code, better algorithms, and use design patterns more effectively.</p><p>Not having a good knowledge of Discrete Maths limits you as a developer. Let me explain, if you are mainly focused on building web applications that implement basic CRUD operations or the most simple apps then you don’t probably need to understand Discrete Maths. However, if you wanted to challenge yourself as a developer by building more complex projects like building a search engine or an aggregation tool, a graphics software, an AI project etc then a good knowledge of Discrete Maths would be very useful.</p><p>The most useful and interesting part of Discrete Maths for me is probability and combinatorics because I could relate to their use in solving real life problems.</p><p><strong>Example of how discrete maths can be applied to real life problems</strong></p><p><em>Say, I want to build an app that advises users on the best bets to place. Specifically, let’s take this scenario, Brian has the option of placing a bet on a certain basketballer (Kevin Curry) making his third free throws in his fifth attempt or him making exactly 4 throws out of five throws</em>. He <em>needs to know the best option to go for. Kevin is an above average free throw taker who makes 63% of his throws.</em></p><p>Here’s how I would solve the problem using Discrete Maths</p><p><strong>Solution:</strong></p><p>For him to have his 3rd free throw in his fifth attempt, he has to make 2 throws out of his first four attempts</p><pre>so we have P(2 in 4 attempts) * P(success in the 5th attempt)</pre><p>To get the probability that he has 2 in 4 attempts, I will use <a href="http://mathworld.wolfram.com/Combination.html">combination</a> to get the possible outcomes and then multiply with the probability of making two shots and the probability of missing 2 shots</p><pre>4C2 = 4!/2!(4–2)! = 6 possible outcomes</pre><pre><em>If Kevin has 63% chance of making a throw then he has 37% (100-63) of missing a throw</em></pre><pre>P(of making a throw) = 63/100 = 0.63<br>P(of not making a throw) = 1 - 0.63 = 0.37</pre><pre><em>To make 2 throws out of four throws, it means Kevin has to make 2 throws and miss the other two throws. Considering this,</em><br>P(Kevin making exactly two out of four throws) = Possible outcomes * P(making throws twice) * P(missing throws twice). <br><em>Let&#39;s rewrite it as</em><br>P(2/4) = 6 * 0.63^2 * 0.37^2 = 0.326</pre><pre>P(making 3rd throw in fifth attempt) = P(making exactly 2 throws of 4 attempts) * P(making a throw in fifth attempt).<br><em>Let&#39;s rewrite it as</em> <br>P(3/5) = P(2/4)* P(making the 5th throw)</pre><pre>= 0.326 * 0.63<br>= 0.2054</pre><p>So the probability of him making his 3rd throw in his fifth attempt =<strong> 20.54%</strong></p><p>Now let’s find the probability of him making 4 of the 5 throws</p><pre><em>For Kevin to make exactly 4 of five throws, it means he has to miss one throw and make four throws so,</em></pre><pre>P(Kevin making exactly four out of five throws) = Possible outcomes of making 4 of 5 throws * P(making throws four times) * P(missing one throw).</pre><pre>P(4/5) = 5C4 = 5!/4!(5–4)! * 0.63 ^ 4 * 0.37 ^ 1</pre><pre>= 5 * 0.1575 * 0.37</pre><pre>= 0.2914</pre><p>The probability of Kevin making 4 of his 5 throws is <strong>29.14%</strong></p><p>So we can see that the probability of Kevin making his 3rd throw in his 5th attempt is lower than the probability of him making exactly 4 of 5 throws. Therefore, the best option for Brian is to place his bet on Kevin making 4 of the 5 throws.</p><p>The knowledge of discrete maths helps you write a good algorithm for your app’s recommendation logic.</p><p>There are also several other real-world problems that discrete maths help to solve e.g building a scheduling application, building games.</p><p>I’m moving on to learning Data structures and Algorithms, hopefully, I get to apply some of what I learnt in Discrete Maths. I look forward to sharing what I learn in the next part of this series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e69cf8dc2571" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>