<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bola Adebesin</title>
    <description>The latest articles on DEV Community by Bola Adebesin (@mobolanleadebesin).</description>
    <link>https://dev.to/mobolanleadebesin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F523431%2F2a1ac9b1-39ff-4e07-99ab-85cb416208c5.jpeg</url>
      <title>DEV Community: Bola Adebesin</title>
      <link>https://dev.to/mobolanleadebesin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mobolanleadebesin"/>
    <language>en</language>
    <item>
      <title>JavaScript: Linked Objects</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Fri, 14 Mar 2025 17:47:20 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/javascript-linked-objects-41di</link>
      <guid>https://dev.to/mobolanleadebesin/javascript-linked-objects-41di</guid>
      <description>&lt;p&gt;Recently, I've been working to understand JavaScript better with the goal of evolving how I write code, communicate ideas, and build stuff. &lt;/p&gt;

&lt;p&gt;I've often heard something to the effect of, "JavaScript has classes, but it is not a class-based language". Along with the implication that, the use of classes "bends" the language rather than accepting it for what it is. &lt;/p&gt;

&lt;p&gt;This felt like information that could be true, but that I didn't understand because...well JavaScript has classes. And it was my first language. I didn't come up learning Java or even complete a traditional computer science program at a four year institution. &lt;/p&gt;

&lt;p&gt;Eventually, I was exposed to more information about JavaScript's &lt;code&gt;Object.prototype&lt;/code&gt;. This great, ancestral object  sits at the top of the prototype chain passing on properties and characteristics to other objects. Things started to become a little clearer, but also still kind of confusing. Prototypal inheritance sounded cool, but it felt like a distinction without a difference. &lt;/p&gt;

&lt;p&gt;Then, I watched this &lt;a href="https://frontendmasters.com/courses/deep-javascript-v3/" rel="noopener noreferrer"&gt;workshop&lt;/a&gt; by Kyle Simpson the author of the You Don't Know JavaScript series. He demonstrated a way of linking objects together without using the &lt;code&gt;new&lt;/code&gt; keyword or the syntactic sugar that is &lt;code&gt;class&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;I was intrigued. I wanted to try it. I also wanted to apply more of what I've been learning. So I wrote some logic for generating different types of tasks using the factory pattern and linked objects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var TaskType = {
    TODO: "To Do", 
    IN_PROGRESS: "In Progress", 
    COMPLETED: "Completed"
}

var Task = {
    logTaskInfo(){
        console.log(`Title: ${this.title} | Details: ${this.details} | Status: ${this.status}`)
    }
}

function TaskFactory(){
    return createTask; 

    function createTask(type, title, details){
        var isInvalidType = !Object.values(TaskType).includes(type); 
        if(isInvalidType){
            throw new Error('Invalid Task Type')
        }
        return Object.assign(Object.create(Task), {
            title, 
            details, 
            status: type
        })
    }
}

var factory = TaskFactory(); 

var task1 = factory(TaskType.TODO, "Wash Dishes", "Load the dishwasher and scrub large pots and pans."); 
var task2 = factory(TaskType.IN_PROGRESS, "Write Code", "Apply newly acquired concepts like IFFE, Factory and OLOO"); 
var task3 = factory(TaskType.COMPLETED, "Walk Dog", "Take Soleil out for her morning walk."); 

task1.logTaskInfo(); 
task2.logTaskInfo(); 
task3.logTaskInfo(); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From &lt;a href="https://tc39.es/ecma262/#sec-object.assign" rel="noopener noreferrer"&gt;TC39&lt;/a&gt;,  &lt;code&gt;Object.assign ( target, ...sources )&lt;/code&gt; copies the values of all of the enumerable own properties from one or more source objects to a target object. And &lt;code&gt;Object.create ( O, Properties )&lt;/code&gt; creates a new object with a specified prototype. &lt;/p&gt;

&lt;p&gt;So, with these lines of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Object.assign(Object.create(Task), {
            title, 
            details, 
            status: type
        })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Object.Create(Task)&lt;/code&gt; creates a brand new object and links it to the existing &lt;code&gt;Task&lt;/code&gt; object. And that brand new object is assigned a title, details, and a status.&lt;/p&gt;

&lt;p&gt;Now, when &lt;code&gt;task1&lt;/code&gt; invokes &lt;code&gt;logTaskDetails&lt;/code&gt; it works because &lt;code&gt;logTaskDetails&lt;/code&gt; exists on the object that task1 is linked to.&lt;/p&gt;

&lt;p&gt;Okay, "pretty cool", I thought. You could make the argument that this approach is more explicit than using something like the &lt;code&gt;new&lt;/code&gt; keyword, but what's the big deal? But then things got really interesting. &lt;/p&gt;

&lt;p&gt;This style becomes the foundation for behavior delegation or "dynamic composition". Where objects with different concerns are linked together and can share methods. It's less top-down and more peer-to-peer.&lt;/p&gt;

&lt;p&gt;Here is an example Simpson presents with an AuthController and a LoginFormController:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var AuthController = {
    authenticate(){
        server.authenticate(
            [this.username, this.password], this.handleResponse.bind(this)
        )
    },
    handleResponse(resp){
        if(!resp.OK){
            this.displayError(resp.msg); 
        }
    }
}

var LoginFormController = Object.assign(
    Object.create(AuthController), 
    {
        onSubmit(){
            this.username = this.$username.val(); 
            this.password = $this.$password.val();
            this.authenticate() 
        }, 
        displayError(msg){
            alert(msg)
        }
    }
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I thought this was a really cool example, although I had to read through the code a few times to understand what was happening. &lt;/p&gt;

&lt;p&gt;Here, the same way that &lt;code&gt;task1&lt;/code&gt; was linked to the &lt;code&gt;Task&lt;/code&gt; object, &lt;code&gt;LoginFormController&lt;/code&gt; is linked to &lt;code&gt;AuthController&lt;/code&gt;. When an imaginary login form is submitted, &lt;code&gt;LoginFormController's&lt;/code&gt; &lt;code&gt;onSubmit&lt;/code&gt; method is called. Inside &lt;code&gt;onSubmit&lt;/code&gt; the &lt;code&gt;authenticate()&lt;/code&gt; method is called. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;LoginFormController&lt;/code&gt; doesn't have an authenticate method, but the object it is linked to (&lt;code&gt;AuthController&lt;/code&gt;) does. So, the method runs with &lt;code&gt;this&lt;/code&gt; still referring to &lt;code&gt;LoginFormController&lt;/code&gt;. Inside &lt;code&gt;authenticate&lt;/code&gt;, &lt;code&gt;this.username&lt;/code&gt; and &lt;code&gt;this.password&lt;/code&gt; are still referring to values on &lt;code&gt;LoginFormController&lt;/code&gt; and are passed to the server along with the callback &lt;code&gt;handleResponse&lt;/code&gt;. Now, &lt;code&gt;handleResponse&lt;/code&gt; is bound to &lt;code&gt;LoginFormController&lt;/code&gt; with &lt;code&gt;.bind&lt;/code&gt; as it is passed to the server. So whenever it is called, it will also be referring to &lt;code&gt;LoginFormController&lt;/code&gt; even though that isn't where it was defined. When &lt;code&gt;handleResponse&lt;/code&gt; is invoked, if the response was not okay, then it will call the &lt;code&gt;display&lt;/code&gt; method. &lt;code&gt;display&lt;/code&gt; has a &lt;code&gt;this&lt;/code&gt; that references &lt;code&gt;LoginController&lt;/code&gt; because that was the &lt;code&gt;this&lt;/code&gt; &lt;code&gt;handleResponse&lt;/code&gt; was bound to. &lt;/p&gt;

&lt;p&gt;So, in summary, &lt;code&gt;onSubmit&lt;/code&gt; which is defined in &lt;code&gt;LoginController&lt;/code&gt; calls &lt;code&gt;authenticate&lt;/code&gt; a method defined in &lt;code&gt;AuthController&lt;/code&gt;. &lt;code&gt;authenticate&lt;/code&gt; passes a callback, &lt;code&gt;handleResponse&lt;/code&gt;, which is defined in &lt;code&gt;Authcontroller&lt;/code&gt;, but bound to &lt;code&gt;LoginController&lt;/code&gt;. And &lt;code&gt;handleResponse&lt;/code&gt; calls &lt;code&gt;display&lt;/code&gt; which is defined in LoginController. &lt;/p&gt;

&lt;p&gt;This logic requires a strong understanding of &lt;code&gt;this&lt;/code&gt; (no pun intended). And even though I think it's pretty cool, given this task, I would not have thought to structure the code this way. It's a very different way of thinking than I'm used to.&lt;/p&gt;

&lt;p&gt;A classic case of, "the spirit is willing, but the flesh  is weak". I'm going to keep working at it though. &lt;/p&gt;

&lt;p&gt;In the meantime, please let me know what you think. Is this a style you have used or are interested in using? How do you think the code fares as far as readability? &lt;/p&gt;

&lt;p&gt;Image by &lt;a href="https://pixabay.com/users/alltechbuzz_net-13671689/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=4523100" rel="noopener noreferrer"&gt;Alltechbuzz_net&lt;/a&gt; from &lt;a href="https://pixabay.com//?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=4523100" rel="noopener noreferrer"&gt;Pixabay&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>oop</category>
    </item>
    <item>
      <title>Writing Human Readable Code: To Name or Not To Name</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Sun, 23 Feb 2025 23:07:20 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/writing-human-readable-code-to-name-or-not-to-name-2jci</link>
      <guid>https://dev.to/mobolanleadebesin/writing-human-readable-code-to-name-or-not-to-name-2jci</guid>
      <description>&lt;p&gt;I waffled back and forth about the title of this post, but in the end, I couldn't resist the Hamlet reference. &lt;/p&gt;

&lt;p&gt;Today's topic is about writing clear, human-readable code. I care about this for a few reasons. When code is easier to read/understand, it's easier to: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintain &lt;/li&gt;
&lt;li&gt;Refactor &lt;/li&gt;
&lt;li&gt;Discuss (with clients, colleagues, your rubber duck etc). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are so many instances where I've come across old code that I don't understand.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd2swum8iufh5l29bn27x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd2swum8iufh5l29bn27x.jpg" alt="Star Wars Meme about difficult to read code" width="480" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This frustrating experience has ignited my interest in learning how to craft "better" code. &lt;/p&gt;

&lt;p&gt;The good news is, there are a bunch of blog posts, forums, books, and articles about how to write better code. A few tips I've seen:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add comments to your code; Comments that explain "why" are better than comments that explain "what"&lt;/li&gt;
&lt;li&gt;Write tests &lt;/li&gt;
&lt;li&gt;Name your variables clearly &lt;/li&gt;
&lt;li&gt;The single responsibility principle: every function should do one job really well &lt;/li&gt;
&lt;li&gt;Avoid complicated conditionals &lt;/li&gt;
&lt;li&gt;Keep files to 250 lines of code or less &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I coud go on, but there is one piece of advice that really struck me and I want to discuss it. The advice was: "Use traditional function declarations and opt for named functions over anonymous ones." &lt;/p&gt;

&lt;p&gt;This advice caught my attention because my code is littered with anonymous functions. I can't count how many unnamed functions I've passed into &lt;code&gt;.map&lt;/code&gt;, &lt;code&gt;.forEach&lt;/code&gt;, and &lt;code&gt;.reduce&lt;/code&gt; methods.&lt;/p&gt;

&lt;p&gt;I don't think I'm alone in this. I've read time and time again that arrow functions and anonymous functions help to make code more concise and that this brevity makes for smaller files, which is part of writing better code, right? Well, it turns out that concise and anonymous does not necessarily mean better or more readable. &lt;/p&gt;

&lt;p&gt;The more I think about this, the more it makes sense. "Well-named variables" is one of the bullet items for achieving clearer code. Variables with clear names help us to understand the data contained within them. This should also be true for functions which not only contain data, but often manipulate that data in some way too.  &lt;/p&gt;

&lt;p&gt;Let's look at a small example pulled from the Frontendmasters course, "Deep JavaScript Foundations V3" by Kyle Simpson, author of the "You don't know JS" series. &lt;/p&gt;

&lt;p&gt;I am going to share two different implementations I wrote for a function called &lt;code&gt;printRecords&lt;/code&gt;. One uses named functions and the other does not. &lt;/p&gt;

&lt;p&gt;The function, &lt;code&gt;printRecords&lt;/code&gt; should: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accept an array of numbers (these numbers represent student Ids) &lt;/li&gt;
&lt;li&gt;Retrieve each student record using the student Id&lt;/li&gt;
&lt;li&gt;Sort these records alphabetically by the students' names &lt;/li&gt;
&lt;li&gt;Print each record to the console in the following format: &lt;code&gt;Name (student Id): Paid (or Not Paid)&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var currentEnrollment = [410, 105, 664, 375] 
var studentRecords = [
    { id: 313, name: "Frank", paid: true, },
    { id: 410, name: "Suzy", paid: true, },
    { id: 709, name: "Brian", paid: false, },
    { id: 105, name: "Henry", paid: false, },
    { id: 502, name: "Mary", paid: true, },
    { id: 664, name: "Bob", paid: false, },
    { id: 250, name: "Peter", paid: true, },
    { id: 375, name: "Sarah", paid: true, },
    { id: 867, name: "Greg", paid: false, },
];

// Named Functions Version: 
function printRecords(recordIds){
  function findStudentRecords(recordId){
     function hasStudentId(record){
       return recordId == record.id; 
     }
     return studentRecords.find(hasStudentId);
  }
  function alphabetizeRecordsByName(a,b){
    return a.name &amp;gt; b.name ? 1: -1; 
  }
  function logRecord(record){
    console.log(
      `${record.name} (${record.id}): ${record.paid ? 'Paid': 'Not Paid'}`
     );
  }
  recordIds.map(findStudentRecords)
  .sort(alphabetizeRecordsByName)
  .forEach(logRecord); 
}

//Anonymous Functions Version: 

function printRecords(recordIds){
    recordIds
        .map((recordId) =&amp;gt; 
            studentRecords.find((studentRecord) =&amp;gt; studentRecord.id == recordId)
        )
        .sort((a,b) =&amp;gt; a.name &amp;gt; b.name ? 1: -1)
        .forEach((student) =&amp;gt; {
            console.log(
                `${student.name} (${student.id}): ${student.paid ? 'Paid': 'Not Paid'}`
            )
        })
}


printRecords(currentEnrollment); 


// Console: 
/*
 Bob (664): Not Paid
 Henry (105): Not Paid
 Sarah (375): Paid
 Suzy (410): Paid
*/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looking at the two implementaions side-by-side in my editor, I can see that the named version of &lt;code&gt;printRecords&lt;/code&gt; spans lines 1-23, while the anonymous version spans lines 1-12. Some of this is a result of the automated code formatter I use, but right away it's clear that the anonymous version is more concise. &lt;/p&gt;

&lt;p&gt;Still, when I look at the named version, I understand what each function in the &lt;code&gt;.map&lt;/code&gt;, &lt;code&gt;.sort&lt;/code&gt;, and &lt;code&gt;.forEach&lt;/code&gt; method is doing. I don't have to read the code line by line. It's all right there in the names: find the student records, sort them alphabetically by name, print each record. By contrast, the anonymous version requires me to look at the code in the body of each function to understand what is happening. &lt;/p&gt;

&lt;p&gt;In this case, I would rather take the extra 11 lines of code for a better experience modifying this code down the road.&lt;/p&gt;

&lt;p&gt;In his lecture, Kyle Simpson posits that there are at least three reasons to choose named functions over anonymous ones: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reliable self-reference (e.g. If a function has a name, it can do things like call itself for a recursive solution) &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More debuggable Stack Trace (if the function has a name, the stack trace will provide it) &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;More self documenting code &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What do you think? Would you give up anonymous functions if it meant more human readable code? Do you use the number of lines of code as an indicator of whether a piece of code needs to be rewritten? How do ensure your code is readable 2 months down the road and beyond? &lt;/p&gt;

&lt;p&gt;Update March 13, 2025: &lt;/p&gt;

&lt;p&gt;I received some really great feedback on this post that I wanted to acknowledge because it encouraged me to think more (a.k.a I went down a bunch of rabbit holes) about naming conventions and not just clarity of code, but also the clarity that inherently exists (or doesn't) in human language itself. &lt;/p&gt;

&lt;p&gt;Thank you: &lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/moopet"&gt;@moopet&lt;/a&gt; &lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/devpacoluna"&gt;@devpacoluna&lt;/a&gt; &lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/pengeszikra"&gt;@pengeszikra&lt;/a&gt; &lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/lionelrowe"&gt;@lionelrowe&lt;/a&gt; &lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/decaf_dev"&gt;@decaf_dev&lt;/a&gt; &lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/ddfridley"&gt;@ddfridley&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The comments you left are great jump off points for me and others to continue learning and growing should they stumble across this post in the future!&lt;/p&gt;

&lt;p&gt;** Image by &lt;a href="https://pixabay.com/users/tumisu-148124/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=5863772" rel="noopener noreferrer"&gt;Tumisu&lt;/a&gt; from &lt;a href="https://pixabay.com//?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=5863772" rel="noopener noreferrer"&gt;Pixabay&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>JavaScript Types &amp; Coercion Corner Cases</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Sun, 16 Feb 2025 19:33:08 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/javascript-types-coercion-corner-cases-5eog</link>
      <guid>https://dev.to/mobolanleadebesin/javascript-types-coercion-corner-cases-5eog</guid>
      <description>&lt;p&gt;Recently, I've been learning about in-depth JavaScript concepts. This has exposed me to programmer and author Kyle Simpson of the "&lt;a href="https://github.com/getify/You-Dont-Know-JS" rel="noopener noreferrer"&gt;You Don't Know JS"&lt;/a&gt; series.&lt;/p&gt;

&lt;p&gt;I've heard it mentioned that JavaScript is a weird language and I've heard praise and criticism alike for it's loosely typed approach. As I've been reading parts of the &lt;a href="https://tc39.es/ecma262/" rel="noopener noreferrer"&gt;EcmaScript Specification Document&lt;/a&gt; and learning from Kyle Simpson's videos, I have a greater appreciation for what folks mean. &lt;/p&gt;

&lt;p&gt;Some fun examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-0 === 0 // true 

var workshopStudents = []; 
if(workshopStudents) // true 
if(workshopStudents == true) // false 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The triple equals ignoring the negative zero was an edge case I'd never been exposed to before. &lt;/p&gt;

&lt;p&gt;But the second example, was an even more surprising scenario. If you're familiar with the concept of falsy and truthy in JavaScript, then you know that there is a list of values that JavaScript interprets as "falsy": &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;undefined&lt;/li&gt;
&lt;li&gt;null &lt;/li&gt;
&lt;li&gt;"" &lt;/li&gt;
&lt;li&gt;0 &lt;/li&gt;
&lt;li&gt;-0 &lt;/li&gt;
&lt;li&gt;0n &lt;/li&gt;
&lt;li&gt;NaN&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Missing from that list is an empty array. So it makes sense that the conditional &lt;code&gt;if(workshopStudents)&lt;/code&gt; evaluates to true, but is surprising that &lt;code&gt;if(workshopStudents == true)&lt;/code&gt; evaluates to false. I learned that this happens because of how the double equals works in JavaScript under the hood. &lt;/p&gt;

&lt;p&gt;Essentially, in the first conditional, &lt;code&gt;workshopStudents&lt;/code&gt; is converted to a boolean type and because it is not on the falsy list it's boolean coercion evaluates to true. &lt;/p&gt;

&lt;p&gt;In the second conditional &lt;code&gt;workshopStudents&lt;/code&gt;,  is not coerced into a boolean type first. So the two conditionals use two different evaluation algorithms. In the double equals algorithmic evaluation,&lt;code&gt;workshopStudents&lt;/code&gt; is coerced into its primitive type before it is compared to the boolean value true. Well, it turns out the primitive value of an empty array is an empty string, "". And an empty string &lt;em&gt;is&lt;/em&gt; on the falsy list. &lt;/p&gt;

&lt;p&gt;Because one conditional uses the double equals and one does not they operate differently behind the scenes and trigger two different abstract operations. This leads to two outcomes that appear to contradict one another on the surface. I found this to be fascinating and kind of complex. And this is just one example of many. &lt;/p&gt;

&lt;p&gt;I have no doubt in my mind that it's important to become familiar with these kinds of scenarios in JavaScript. I've been coding in JavaScript long enough to know when I receive an array of data from the backend I need to write &lt;code&gt;if(arr.length){...}&lt;/code&gt; and NOT &lt;code&gt;if(arr){...}&lt;/code&gt; if I want to avoid trying to access nonexistent data. &lt;/p&gt;

&lt;p&gt;But I'm curious about how people typically deal with the different coercion corner cases in everyday code. After going through some exercises, I found that trying to cover all of the corner cases led to A LOT of code. I tried to make the code clear using notes referencing the corner cases, but I couldn't help but think, "This is very tedious". &lt;/p&gt;

&lt;p&gt;One suggestion from Kyle Simpson, is to reduce polymorphic functions. So, writing a function that only accepts number and string types rather than a function that accepts numbers, string, boolean, and object types. He also recommends knowing what types you are dealing with ahead of time (e.g. before you compare two variables you should know the type of each variable and consider what corner cases may arise from the comparison). &lt;/p&gt;

&lt;p&gt;I imagine this is also one of the reasons that TypeScript has become so popular in recent years. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>"Learn Less. Understand More."</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Sun, 09 Feb 2025 15:38:55 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/learn-less-understand-more-1635</link>
      <guid>https://dev.to/mobolanleadebesin/learn-less-understand-more-1635</guid>
      <description>&lt;p&gt;&lt;a href="https://medium.com/mr-plan-publication/why-junior-developers-are-burning-out-before-they-bloom-surviving-techs-obsession-with-new-771b5b2e0f646" rel="noopener noreferrer"&gt;This&lt;/a&gt; article landed in my inbox the other day. I was intrigued enough by the title that I seized the opportunity and re-purchased my Medium subscription. &lt;/p&gt;

&lt;p&gt;I'm glad I did. The author articulated a sentiment I've been grappling with for some time now. Plus, he had some quotable one liners:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A generation of developers who can assemble code like IKEA furniture but can't craft it.&lt;/li&gt;
&lt;li&gt;"Stay Relevant or Die" is a lie.&lt;/li&gt;
&lt;li&gt;Mastery beats novelty every time. &lt;/li&gt;
&lt;li&gt; Build libraries, not apps. &lt;/li&gt;
&lt;li&gt;Depth defies disruption. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maybe this is confirmation bias and this author happens to be saying what I want to hear, but his logic makes sense to me. It's the reason that, when faced with the choice between tackling Next.js, a React framework, or diving into deep JavaScript concepts, I went for the latter. &lt;/p&gt;

&lt;p&gt;It just didn't make sense for me to try to learn one more new thing rather than striving for a deeper understanding of what I &lt;em&gt;think&lt;/em&gt; I already know. &lt;/p&gt;

&lt;p&gt;Don't get me wrong, I would love to become more familiar with Next.js. The idea of building even faster sites using a tool that provides more structure for React and has optimization built into it's foundation seems really, really cool. But I'm trying to accept that, as exciting as it is to pursue the shiny new things, it's the fundamentals that will get me to where I'm trying to go. Which is to technical enlightenment. Or like, becoming one with my machine or something. Unclear.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Exploring JavaScript: Higher Order Functions, Callbacks, Closures, the Event Loop and Classes</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Thu, 06 Feb 2025 18:14:06 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/exploring-javascript-higher-order-functions-callbacks-closures-the-event-loop-and-classes-6f5</link>
      <guid>https://dev.to/mobolanleadebesin/exploring-javascript-higher-order-functions-callbacks-closures-the-event-loop-and-classes-6f5</guid>
      <description>&lt;p&gt;Recently, I went through the FrontendMasters course, "JavaScript the Hard Parts" by Will Sentance. If the title of this post sounds like a lot, that’s because it is. That said, the course was clear and engaging. I would highly recommend it. &lt;/p&gt;

&lt;p&gt;Some of what I learned is described below: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Parameters vs. Arguments:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The distinction between a parameter and an argument seems small, but I like the idea of being able to think and speak precisely. Part of that requires using words correctly even when I think they are interchangeable. &lt;/p&gt;

&lt;p&gt;A parameter refers to the variable name that's used as a placeholder when a function is defined. An argument is the actual value that is passed to a function when that function is called.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function logString(str){
  console.log(str);
}

logString("happy");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above example, &lt;code&gt;str&lt;/code&gt; is the parameter and &lt;code&gt;"happy"&lt;/code&gt; is the argument. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Higher Order Functions vs Callbacks:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In JavaScript a higher order function is a function that accepts or returns another function. A callback is a function that is passed into another function as a parameter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function logString(str){
  console.log(str);
}

setTimeout(logString, 1000)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, &lt;code&gt;logString&lt;/code&gt; is the callback and &lt;code&gt;setTimeout&lt;/code&gt; is the higher order function. &lt;/p&gt;

&lt;p&gt;I gained a better understanding of how JavaScript executes lines of code, including creating new execution contexts when a function is called. &lt;/p&gt;

&lt;p&gt;I reviewed concepts about the call stack and stack traces. &lt;/p&gt;

&lt;p&gt;I learned more about closures which I thought I understood. I didn’t have an appreciation for how powerful they can be. What stuck with me was  the idea that when a function is created and returned inside of another function it has access to relevant data that existed around it at the time of it's creation. Essentially, (if I anthropomorphize a closure), it has memory that it carries with it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function outer(){
  let count  = 0 
  function incrementCounter(){
   counter++; 
  }
  return incrementCounter
}
const myNewFunction = outer(); 
myNewFunction() // counter = 1 
myNewFunction() // counter = 2 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, &lt;code&gt;myNewFunction&lt;/code&gt; can continue to act on the variable &lt;code&gt;counter&lt;/code&gt; even though the function &lt;code&gt;outer&lt;/code&gt; is no longer on the call stack and JavaScript has left &lt;code&gt;outer's&lt;/code&gt; execution context by the time &lt;code&gt;myNewFunction&lt;/code&gt; is called. Prior to this, I just thought, "a closure if a function that returns another function". Which is true, but it is so much more than that too.. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Event Loop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I didn't know that I didn't know what the event loop was. In order to understand the event loop, I had to learn about the boundary between JavaScript and the Web Browser. I learned that when I call a function like &lt;code&gt;setTimeout&lt;/code&gt; it's actually the browser that is setting and keeping track of the timer and that as the rest of my code executes, the callback I passed to &lt;code&gt;setTimeout&lt;/code&gt; will (at some point depending on the time I set) be placed in a task queue. The event loop will figure out when the call stack is empty and all of the synchronous global JavaScript code has completed and then move the callback from the task queue to the call stack to be executed. &lt;/p&gt;

&lt;p&gt;And  this callback will always run after the synchronous code before it, no matter how long it takes. Even with something like &lt;code&gt;setTimeout(callback, 0)&lt;/code&gt;. This is of course, assuming that there is nothing on the micro task queue as a result of calling some asynchronous code using Promises because the functions in the micro task queue receive higher priority than the functions in the task queue &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Classes and the &lt;code&gt;new&lt;/code&gt; keyword&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I've used JavaScript classes before, but I liked that this course worked up to them by demonstrating different scenarios in which you might want to have your data and the functions that act on that data grouped together. Then, the different ways that objects can be created in JavaScript, and finally the syntactic sugar that classes provided to do it in a way that is readable. Although Will makes the case that this approach is deceptive in that, many people &lt;em&gt;think&lt;/em&gt; they understand what is going on under the hood, but don't. &lt;/p&gt;

&lt;p&gt;I learned that the &lt;code&gt;new&lt;/code&gt; keyword used for creating an instance of an object: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Automatically creates an object assigned to &lt;code&gt;this&lt;/code&gt; in the execution context of the “creator” function.. &lt;/li&gt;
&lt;li&gt;Links, via  the hidden &lt;code&gt;__proto__&lt;/code&gt; property, the automatically created object to its fundamental object's &lt;code&gt;[[prototype]]&lt;/code&gt; key, and the value assigned to that &lt;code&gt;[[prototype]]&lt;/code&gt; key is itself an object, that holds data and methods. This gives the automatically created new object access to methods it does not have explicitly defined on itself, taking advantage of JavaScript's prototypal chain.
&lt;/li&gt;
&lt;li&gt;Returns this automatically created and linked object from the creator function. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And the class keyword gives us the chance to define this creator function (function-object) with all of the data and methods that we want it to have in one place, but doesn't really change anything under the hood. It does look nice though. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The End&lt;/strong&gt;&lt;br&gt;
All of this made me &lt;em&gt;feel&lt;/em&gt; like I have a better understanding of JavaScript than I did before. I believe my mental model of the language is a little clearer. I am left with some questions though: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How can I apply this new understanding to write better code? &lt;/li&gt;
&lt;li&gt;What ways can I use this information in the wild? &lt;/li&gt;
&lt;li&gt;I've seen people say that it is important to understand JavaScript classes, but not to use them. Why? What are the trade offs?&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Collections in Java</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Sun, 18 Jul 2021 12:21:37 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/collections-in-java-5d3g</link>
      <guid>https://dev.to/mobolanleadebesin/collections-in-java-5d3g</guid>
      <description>&lt;h2&gt;
  
  
  Collections
&lt;/h2&gt;

&lt;p&gt;In Java, a collection is a class whose main purpose is to store a collection(or group) of other elements. This could be a group of integers, strings, boolean values, objects, etc. &lt;/p&gt;

&lt;p&gt;Collections are divided into 3 major groups: Set, List, and Map. &lt;/p&gt;

&lt;h3&gt;
  
  
  Set
&lt;/h3&gt;

&lt;p&gt;An unordered group of elements, each. element in a collection is unique:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.HashSet;

public class Solution {
    public static void main(String[] args) throws Exception {
        HashSet&amp;lt;String&amp;gt; set = new HashSet&amp;lt;String&amp;gt;(); 
        set.add("watermelon"); 
        set.add("banana"); 
        set.add("cherry"); 
        set.add("pear"); 
        set.add("cantaloupe"); 
        set.add("blackberry"); 
        set.add("ginseng"); 
        set.add("strawberry"); 
        set.add("iris"); 
        set.add("potato"); 

        for(String word: set){
            System.out.println(word); 
        }

    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Despite the order of the strings added being: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;watermelon &lt;/li&gt;
&lt;li&gt;banana&lt;/li&gt;
&lt;li&gt;cherry &lt;/li&gt;
&lt;li&gt;pear&lt;/li&gt;
&lt;li&gt;cantaloupe &lt;/li&gt;
&lt;li&gt;blackberry &lt;/li&gt;
&lt;li&gt;ginseng &lt;/li&gt;
&lt;li&gt;strawberry &lt;/li&gt;
&lt;li&gt;iris &lt;/li&gt;
&lt;li&gt;potato &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When the &lt;code&gt;System.out.println&lt;/code&gt; method is called on each element in the set (using a for each shorthand), this is the order that the words are printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;banana
cherry
pear
iris
blackberry
ginseng
potato
strawberry
watermelon
cantaloupe
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order is different. &lt;/p&gt;

&lt;h3&gt;
  
  
  Lists
&lt;/h3&gt;

&lt;p&gt;In a list, each element is organized by an index. (A familiar example of a list is an array). Because each element is associated with a number, it is an ordered collection and one can access a specific element if one knows the correct index. It's kind of like looking for your friend when you have their address, it is much easier to locate them when you have this information that identifies their location.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.List;
import java.util.ArrayList; 

public class Solution {
    public static void main(String[] args) throws Exception {
    ArrayList&amp;lt;String&amp;gt; list = new ArrayList&amp;lt;String&amp;gt;(); 
        list.add("Hello World"); 
        list.add("Goodbye Mars"); 
        list.add("Salutations Venus"); 


        for(String word: list){
            System.out.println(list.indexOf(word) + ":" + word); 
        }

    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result of the above code is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0:Hello World
1:Goodbye Mars
2:Salutations Venus
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Maps
&lt;/h3&gt;

&lt;p&gt;Maps are a group of key-value pairs. Unlike lists, in which each element is identified by an integer beginning from zero, maps can be identified by name. In maps, each key must be unique, but the values do not have to be unique.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import java.util.HashMap;
import java.util.Map;

public class Solution {
    public static void main(String[] args) throws Exception {
        HashMap&amp;lt;String, String&amp;gt; map = new HashMap&amp;lt;String, String&amp;gt;(); 
        map.put("K-Drama", "This is my first life"); 
        map.put("Drama", "Start Up"); 
        map.put("Anime", "One Piece"); 
        map.put("Comedy", "Grownish"); 
        map.put("Animation", "Bob's Burgers");
        map.put("Romance", "Pride and Prejudice"); 


        for(Map.Entry&amp;lt;String, String&amp;gt; pair: map.entrySet()){
            String key = pair.getKey(); 
            String value = pair.getValue(); 

            System.out.println(key + " : " + value); 
        }

    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output of the above code is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Anime : One Piece
Drama : Start Up
K-Drama : This is my first life
Animation : Bob's Burgers
Romance : Pride and Prejudice
Comedy : Grownish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Bonus:
&lt;/h3&gt;

&lt;p&gt;In the three examples above, the following syntax is used:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for(String text: set){
  System.out.println(text); 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is Java shorthand for iterating through collections. It allows us to iterate through these groups of elements by using an implicit iterator. The longer version of this looks like"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Iterator&amp;lt;String&amp;gt; iterator = set.iterator(); 
while(iterator.hasNext()) // Check if there is another element 
{
   //Get the current element and move to the next line 
    String text = iterator.next(); 
    System.out.println(text); 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>codenewbie</category>
      <category>collections</category>
    </item>
    <item>
      <title>Static Variables and Methods (Java)</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Fri, 02 Jul 2021 21:00:40 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/static-variables-and-methods-java-1bcl</link>
      <guid>https://dev.to/mobolanleadebesin/static-variables-and-methods-java-1bcl</guid>
      <description>&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;Static variables are tied to the Class itself. Each object of a class shares the static variable. &lt;/p&gt;

&lt;p&gt;Non-static variable (instance variables) are tied to the object. In the example below, every object of the Cat class has its own name variable. However, every object &lt;em&gt;shares&lt;/em&gt; the catCount variable. &lt;/p&gt;

&lt;p&gt;When you see the static keyword in front of a variable name think of a &lt;em&gt;shared&lt;/em&gt; variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Class Cat 
{
String name; // Non-static variable (each object has it's own copy) 
static int catCount; //Static variable (each object of the class Cat shares this variable

Cat(String name){
this.name = name; // Non-static variables can be referenced with "this" keyword 
Cat.catCount++; // Static variables are referenced using the class name 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Methods
&lt;/h2&gt;

&lt;p&gt;Java methods are divided into two categories. &lt;em&gt;Instance methods&lt;/em&gt; and &lt;em&gt;Static methods&lt;/em&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Instance Methods
&lt;/h3&gt;

&lt;p&gt;These methods are called on an object and they have access to an objects data (non-static variables). This makes sense. Since an object is an &lt;em&gt;instance&lt;/em&gt; of a class, an instance method works on objects. &lt;/p&gt;

&lt;p&gt;The reason that instance methods are able to access an objects data is because they have a reference to the object. That reference is stored in the keyword "this". "this" holds a reference that tells us where the object we are referencing is. Without "this" we can't refer to the object. &lt;/p&gt;

&lt;p&gt;When you call an instance method, the object that you called the method on is actually passed along to that method as the first argument, we just don't see it. &lt;br&gt;
What we see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cat sally = new Cat(); 
String name = sally.getName(); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is actually happening:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cat sally = new Cat(); 
String name = Cat.getName(sally); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The object sally is being passed into the getName method. Then inside the method, the object sally will be referred to as "this". &lt;/p&gt;

&lt;h3&gt;
  
  
  Static Methods
&lt;/h3&gt;

&lt;p&gt;These methods do not have access to an objects data. Since they don't have an object reference. Static methods don't have "this". Instead a null value is passed to static methods. But, static methods can reference the static variables of the class and other static methods. &lt;/p&gt;

&lt;p&gt;Static methods allow us to call a method before we create any objects because they are tied to the class not the object. This is how the main() method works for example. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Views in SQL</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Wed, 30 Jun 2021 00:12:57 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/views-in-sql-3n8i</link>
      <guid>https://dev.to/mobolanleadebesin/views-in-sql-3n8i</guid>
      <description>&lt;h3&gt;
  
  
  What is a View
&lt;/h3&gt;

&lt;p&gt;TLDR: A view is like a query you can save for later. &lt;/p&gt;

&lt;p&gt;A view is defined as a mechanism for querying data. I think of it as a way to create a query and save it for later. By creating a view you have access to a specific set of data without creating a new table or taking up space. &lt;/p&gt;

&lt;h3&gt;
  
  
  How Can I create a View
&lt;/h3&gt;

&lt;p&gt;A view can be created by assigning a name to a select statement and then storing the query for others to use. (Similar to how we can store a value in a variable to use later). Then, other people can use your view to access data as if they were querying an actual table. Sometimes you don't even know you're using a view.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE VIEW customer_vw 
AS 
SELECT 
customer_id, 
first_name name,
last_name surname, 
concat(substr(email, 1, 2), '*****', substr(email, -4)) email 
FROM customer; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first part of the statement gives the view a name &lt;code&gt;customer_vw&lt;/code&gt;. The second part of the statement is a select statement which must contain one expression for each column in the view. &lt;br&gt;
Once this view is created it can be queried just like a table! &lt;/p&gt;

&lt;p&gt;We can also use &lt;code&gt;desc customer_vw&lt;/code&gt; to examine the fields and types that make up the data in the view. &lt;/p&gt;

&lt;p&gt;You can join views to other tables too. &lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Views
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Data Security - you can use views to mask data you don't want others to see &lt;/li&gt;
&lt;li&gt; Data aggregation - you can use views to preaggregate data so that when others query the view they are querying data that may be more meaningful than just raw data from the database. &lt;/li&gt;
&lt;li&gt;Hiding Complexity &lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Constructors in Java</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Tue, 29 Jun 2021 02:31:12 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/constructors-in-java-48hm</link>
      <guid>https://dev.to/mobolanleadebesin/constructors-in-java-48hm</guid>
      <description>&lt;p&gt;Recently, I've been learning Java. The goal  of this article and subsequent writings is to write a short blurb about the topics, I cover each day to help reinforce my learning and hold myself accountable. &lt;/p&gt;

&lt;p&gt;Constructors are special methods (functions associated with classes) that create a kind of skeleton that each new object (instance of a class) must match. &lt;/p&gt;

&lt;p&gt;I like to think of constructors like a checkpoint when you make a new object. Your object cannot move passed the checkpoint (i.e. your program will throw an error) if the criteria specified by the constructor are not met. And by setting these criteria, we ensure that our objects always have a valid state. When we use constructors all of our variables are initialized. &lt;/p&gt;

&lt;p&gt;Example without Constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Main {
  public static class Car{
    String model; 
    int maxSpeed;

  }


  public static void main(String[] args) {

    Car newCar = new Car(); 
    newCar.model = "Toyota"; 
    newCar.maxSpeed = 100; 

    System.out.println(newCar.model); 
    System.out.println(newCar.maxSpeed);
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Output:
&lt;/h6&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9jjpnkko4wnn3ivlkvh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9jjpnkko4wnn3ivlkvh.png" alt="image" width="800" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Without a constructor, I can create a car object &lt;code&gt;newCar&lt;/code&gt; without initializing any variables. Instead, I initialize the &lt;code&gt;model&lt;/code&gt; and &lt;code&gt;maxSpeed&lt;/code&gt; variables on the following lines. Not only does this take up more space. But if I forget to do this step, my program will have errors later on in life. &lt;/p&gt;

&lt;p&gt;In the example below, we create a constructor by using the keyword &lt;em&gt;public&lt;/em&gt; create the method Car (the same name as our class, this is important), and then pass the variables we want to initialize when our object is created (in this case the model and the maximum speed of the car). By using the &lt;code&gt;this&lt;/code&gt; keyword we are referencing the specific object we are creating. so &lt;code&gt;this&lt;/code&gt; references &lt;em&gt;this&lt;/em&gt; Car not some other car. &lt;/p&gt;

&lt;p&gt;Example with Constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Main {
  public static class Car{
    String model; 
    int maxSpeed;

    public Car(String model, int maxSpeed){
      this.model = model; 
      this.maxSpeed = maxSpeed; 
    }

  }
  public static void main(String[] args) {

    Car newCar = new Car(); 
    newCar.model = "Toyota"; 
    newCar.maxSpeed = 100; 

    System.out.println(newCar.model); 
    System.out.println(newCar.maxSpeed);


    }
  }

The image below shows that when I include the constructor on lines (6-9) I can no longer create the `newCar` object without initializing the variable. The editor underlines the object to indicate an error. 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49qhxd9802h2t33wk07k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F49qhxd9802h2t33wk07k.png" alt="image" width="800" height="1022"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the code is run the following error is produced: &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uxwjxi4ne3gj22e2c0l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2uxwjxi4ne3gj22e2c0l.png" alt="image" width="800" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But when we correctly pass the expected arguments to our constructor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Main {
  public static class Car{
    String model; 
    int maxSpeed;

    public Car(String model, int maxSpeed){
      this.model = model; 
      this.maxSpeed = maxSpeed; 
    }

  }


  public static void main(String[] args) {

    Car newCar = new Car("Toyota", 100); 
    // newCar.model = "Toyota"; 
    // newCar.maxSpeed = 100; 

    System.out.println(newCar.model); 
    System.out.println(newCar.maxSpeed);


    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We get the following output: &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypbvofr0ygtqorv4a8wv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fypbvofr0ygtqorv4a8wv.png" alt="image" width="800" height="122"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So again, constructors help us ensure that our objects are valid and have everything they need. A great way to dummy proof our code. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Recursion</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Mon, 15 Feb 2021 17:16:49 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/recursion-1j73</link>
      <guid>https://dev.to/mobolanleadebesin/recursion-1j73</guid>
      <description>&lt;h1&gt;
  
  
  Recursion
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Recursion can be an intimidating topic. (There's a reason I chose a seemingly endless and slightly sinister-looking spiral staircase for the cover photo of this article). Until a couple of days ago, when asked about recursion, the only real answer I could muster was, "It's a function that calls itself". Which is a true answer, if not a complete one. &lt;/p&gt;

&lt;p&gt;As with most challenging or tricky topics, when we break it down into smaller chunks, give ourselves time to digest, and practice, we can get it. So let's try to do some of that now. &lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;p&gt;Some concepts that are important to understand in order to cover this topic are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Familiarity with JavaScript as this is the language used for the code examples&lt;/li&gt;
&lt;li&gt; Loops: for loops, while loops, etc. &lt;/li&gt;
&lt;li&gt; A basic understanding of how functions and function calls work (e.g. functions run in a particular order, functions can contain other functions, functions can call other functions. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Note: I have a tendency, for better or worse, to anthropomorphize concepts. I like to think this provides a friendly and low-pressure atmosphere.&lt;/em&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Functions Calling Functions
&lt;/h2&gt;

&lt;p&gt;One great thing about functions is that, in most cases, they are orderly and polite. What I mean by that is, they tend to run in a predictable order. We can usually predict the order in which functions will execute. So when we call one function inside another, the outer function will wait for the inner function to complete before completing itself. Let's look at an example of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function makeFlashcards(){
    let languages = ["Python", "Java", "JavaScript"];
    languages.forEach((language) =&amp;gt; {
        console.log(`Make a ${language} flashcard`);
    })
    return 
}

function watchUdemyVideo(){
    console.log("Watching Udemy Video"); 
    makeFlashcards();
    return 
}

function study(){
    watchUdemyVideo(); 
    console.log("All done studying!")
    return 
}

study()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Bonus: Before moving on to the section below, try and see if you can figure out the order the phrases above will print based on the order of the function calls.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's walk through what's happening here. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After we define our three functions (&lt;code&gt;makeFlashcards&lt;/code&gt;, &lt;code&gt;watchUdemyVideo&lt;/code&gt;, &lt;code&gt;study&lt;/code&gt;) we call the study function. &lt;/li&gt;
&lt;li&gt;Immediately &lt;code&gt;study&lt;/code&gt; calls &lt;code&gt;watchUdemyVideo&lt;/code&gt;. Now, &lt;code&gt;study&lt;/code&gt; is waiting. It does not move on to the next line yet. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;watchUdemyVideo&lt;/code&gt; prints "Watch Udemy Video". Then calls &lt;code&gt;makeFlashcards&lt;/code&gt;. Now &lt;code&gt;watchUdemyVideo&lt;/code&gt; is waiting AND   &lt;code&gt;study&lt;/code&gt; is still waiting too.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;makeFlashcards&lt;/code&gt; cycles through the array, &lt;code&gt;languages&lt;/code&gt;, and prints a phrase for each flashcard. Then it returns. &lt;/li&gt;
&lt;li&gt;Now that &lt;code&gt;makeFlashcards&lt;/code&gt; has returned, &lt;code&gt;watchUdemyVideo&lt;/code&gt; can stop waiting and return. &lt;/li&gt;
&lt;li&gt;After &lt;code&gt;watchUdemyVideo&lt;/code&gt; returns, &lt;code&gt;study&lt;/code&gt; can stop waiting. It prints "All done studying" and finally returns too. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So in the console, we should see:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Watching Udemy Video
Make a Python flashcard
Make a Java flashcard
Make a JavaScript flashcard
All done studying!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, now we've demonstrated how functions can call other functions and that each function will wait until the function inside of it is completed. &lt;/p&gt;

&lt;p&gt;Recursion is really a continuation of this same idea except, instead of &lt;code&gt;function a&lt;/code&gt; calling &lt;code&gt;function b&lt;/code&gt; and waiting for &lt;code&gt;function b&lt;/code&gt; to return, &lt;code&gt;function a&lt;/code&gt; calls itself and waits. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Call Stack
&lt;/h2&gt;

&lt;p&gt;What we've described, the waiting functions, actually has terminology that we can use to be more precise, the call stack. &lt;/p&gt;

&lt;p&gt;The call stack is responsible for managing the order in which functions are executed. When a function is called it is placed on the call stack. When a function returns (finishes executing) it is removed from the call stack. So in the example above, the functions would be added to the call stack as follows: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;study&lt;/code&gt; is added &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;watchUdemyVideo&lt;/code&gt; is added on top of &lt;code&gt;study&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;makeFlashcards&lt;/code&gt; is added on top of &lt;code&gt;watchUdemyVideo&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The functions would be removed from the stack in the following order: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;makeFlashcards&lt;/code&gt; returns and is removed. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;watchUdemyVideo&lt;/code&gt; returns and is removed. &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;study&lt;/code&gt; returns and is removed. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Another way to describe this behavior is "last in first out". If this seems confusing or unintuitive, just think, there are real examples of this every day. &lt;/p&gt;

&lt;p&gt;Imagine you are making pancakes. You make the first pancake and you add it to the plate. Then you make the second pancake and add it to the plate. You add the second pancake on top of the first and so on. Eventually, you have this stack (ha!) of pancakes. When you're ready to consume your pancakes what do you do? You eat the pancake on top. So the last pancake you made is placed on top of the stack and is the first one you eat. Last in, first out. &lt;/p&gt;

&lt;p&gt;Ok, so now that we have a better understanding of functions calling other functions and the call stack let's get to recursion. &lt;/p&gt;

&lt;h2&gt;
  
  
  Recursion
&lt;/h2&gt;

&lt;p&gt;Earlier, I mentioned that recursion is a function calling itself. Until a few days ago, that was the only way I thought of it. Really, recursion is a tool in our developer toolbox that provides a different way of solving problems. &lt;/p&gt;

&lt;p&gt;Let's look at an example below. We can solve the same problem recursively(using recursion) or iteratively (without recursion). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem: Write a function that takes a positive integer and returns the product of all the integers from 1 to that integer a.k.a. find the factorial. For example: if the input is 3, the output should be 6 (the product of 3  * 2 * 1)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fti6vvz1qmj6wtkk1jopd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fti6vvz1qmj6wtkk1jopd.png" alt="Alt Text" width="800" height="211"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Given the same inputs, these two functions return the same outputs. (Feel free to try it out &lt;a href="https://codepen.io/bolaadebesin/pen/vYyxZKL" rel="noopener noreferrer"&gt;here&lt;/a&gt; on CodePen.)&lt;/p&gt;

&lt;p&gt;Although this is a simple example, with our recursive solution, we didn't have to initiate separate variables &lt;code&gt;product&lt;/code&gt; and &lt;code&gt;i&lt;/code&gt; or loop through a for loop. Instead, we used the given parameter, a conditional, and a function call. &lt;/p&gt;

&lt;p&gt;These are the fundamental components in a recursive solution. Let's take a closer look at them. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvjizj2d4vprdwq4bjbjt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvjizj2d4vprdwq4bjbjt.png" alt="Alt Text" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3 Parts of the Recursive Function
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;The Base Case / Conditional &lt;/li&gt;
&lt;li&gt;The Recursive Call &lt;/li&gt;
&lt;li&gt;The Modified Input &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We can gain an understanding of how these components work by examining what happens if we remove them or leave them out: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Without the base case, the recursive function would theoretically run forever (actually the call stack has a limited amount of space so eventually we would see the stack overflow error). Additionally, if we include a base case that doesn't match the changes we make to the input, we end up with the same issue. In the example above, if we kept our base case, but added 1 to &lt;code&gt;num&lt;/code&gt; instead of subtracting 1 from &lt;code&gt;num&lt;/code&gt;, we would never reach a point where &lt;code&gt;num === 1&lt;/code&gt;. It's also important that we have a return statement. If we replaced the return statement with a &lt;code&gt;console.log(1)&lt;/code&gt; instead, our recursive function would continue to run. Remember, it the function hitting a return that causes it to finish executing and to be removed from the call stack. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Without the recursive call, none of this works. This may seem obvious, but the function must call itself if the base case has not been met.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Without modifying the input, specifically in a way that moves it towards the base case, the recursive call will never stop. Again, in our example above, if we continued passing &lt;code&gt;num&lt;/code&gt;, unmodified, into our &lt;code&gt;factorial&lt;/code&gt; function, we would never reach our base case. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's step through what's happening. We want to know if the base case has been met and if it has return 1. If not, we want to make another recursive call with a modified input. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp5a94vlyqy3ufohou1wd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp5a94vlyqy3ufohou1wd.png" alt="Alt Text" width="800" height="907"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When 3 is passed in, we have not met our base case so we return &lt;code&gt;3 * factorial(3-1)&lt;/code&gt;. Now &lt;code&gt;factorial(3)&lt;/code&gt; is on the call stack, waiting on the return value of &lt;code&gt;factorial(2)&lt;/code&gt;. (Number 1 on the diagram)&lt;/p&gt;

&lt;p&gt;Now 2 is our input. It does not meet our base case. So we return &lt;code&gt;2 * factorial(2-1)&lt;/code&gt;. Now &lt;code&gt;factorial(3)&lt;/code&gt; and &lt;code&gt;factorial(2)&lt;/code&gt; are both on the call stack waiting. (Number 2 on the diagram)&lt;/p&gt;

&lt;p&gt;Now our input is 1. It &lt;strong&gt;does&lt;/strong&gt; meet our base case. So &lt;code&gt;factorial(1)&lt;/code&gt; returns &lt;code&gt;1&lt;/code&gt;! (Numbers 3 and 4 on the diagram). If we didn't have a base case and return a value, the diagram would go on forever.  &lt;/p&gt;

&lt;p&gt;Now we can work backwards. &lt;code&gt;factorial(2)&lt;/code&gt; can return with 2 multiplied by the value returned from &lt;code&gt;factorial(1)&lt;/code&gt; (in this case 1). So &lt;code&gt;2 * 1 = 2&lt;/code&gt;. Now &lt;code&gt;factorial(3)&lt;/code&gt; can return. It returns 3 multiplied by the value returned from &lt;code&gt;factorial(2)&lt;/code&gt; (which is 2). This leads to &lt;code&gt;3 * 2 = 6&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;All our functions have returned, our stack is empty, and we've got our answer: &lt;code&gt;6&lt;/code&gt;.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does Recursion Matter?
&lt;/h2&gt;

&lt;p&gt;Although the example above was simple, there are times when recursion offers a cleaner solution than an iterative one.&lt;/p&gt;

&lt;p&gt;Recursive functions are a great way to learn to step through functions and understand the order that they are called and executed. &lt;/p&gt;

&lt;p&gt;It's great for problems that can be broken down into small repetitive tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  I Still Don't Get It
&lt;/h2&gt;

&lt;p&gt;If you still don't get it that's ok. Sometimes you have to sit with a concept or idea before it really clicks. Practicing helps. Start simple and work up to more challenging examples. Google Chrome is a great tool because it allows you to step through recursive functions(all functions really) and see what is on the call stack and what is being returned from each function on the stack at each step. Most importantly, don't give up. &lt;/p&gt;

&lt;p&gt;Resources: &lt;/p&gt;

&lt;p&gt;Tools to practice: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CodePen &lt;/li&gt;
&lt;li&gt;Chrome Browser &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Other Learning Resources: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you learn better from videos Colt Steele has a great video on &lt;a href="https://www.youtube.com/watch?v=lMBVwYrmFZQ" rel="noopener noreferrer"&gt;recursion&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.geeksforgeeks.org/recursion/" rel="noopener noreferrer"&gt;GeeksForGeeks&lt;/a&gt; has an article on recursion. &lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Introduction to HTTP</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Mon, 01 Feb 2021 22:37:54 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/introduction-to-http-4lc0</link>
      <guid>https://dev.to/mobolanleadebesin/introduction-to-http-4lc0</guid>
      <description>&lt;h2&gt;
  
  
  What does HTTP stand for?
&lt;/h2&gt;

&lt;p&gt;HTTP stands for HyperText Transfer Protocol. If the acronym is intimidating, don't worry we'll break these four words down further. &lt;/p&gt;

&lt;p&gt;Even if you're brand new to web development, you've likely heard of HTML, which stands for HyperText Markup Language. Any of that acronym seem familiar? (Hint: it's the "hypertext" part). &lt;/p&gt;

&lt;p&gt;HTML is a text-based approach to describing the structure of a web page's content. It is &lt;em&gt;the&lt;/em&gt; major markup language used across the worldwide web. (&lt;a href="https://www.w3schools.com/whatis/whatis_http.asp" rel="noopener noreferrer"&gt;W3 Schools&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Okay, so HTML gives us the structure, or essentially, tells us how content on a web page should be &lt;em&gt;organized&lt;/em&gt;. HTTP provides the rules (protocol) for how that content should be sent and received or &lt;em&gt;transferred&lt;/em&gt; across the web. It is the foundation of any data exchange on the web. Hence, HyperText Transfer Protocol. &lt;/p&gt;

&lt;p&gt;To give you an analogy, let's say you want to order a bookcase from a furniture company. You have to provide that company with information about what type of bookcase you want, maybe the size, color, and model. The company has to process this information and get the bookcase to your door somehow. The rules, or protocol, the company uses to get the bookcase to you is HTTP. Once your bookcase arrives, the instructions for how to build the bookcase, how the pieces should be organized, is HTML. (Note: this simple analogy is imperfect but hopefully useful). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.flickr.com/photos/25708116@N08/2984153738/in/photolist-5xGyWw-4uJBGW-63Q6X6-8wSHm-7PusJv-r1y8Uq-fHq1i-8QY16K-8XpEhc-4aLFH9-9WN3F6-63Q744-7ChABG-7Uebs7-pKRxCK-4ciuoZ-2KuqbX-2VX1xJ-4BzX3V-7JUweq-6sM4Tv-7JUwf9-4wE74m-uoWHG-8cYqV6-8TSF7E-63UjEA-2WbqRJ-5BnLF-9WQSRN-4CjRbw-2vjrfU-63Q6Rv-5VkXEP-57Jr11-6dQWMG-FZww-79JTaR-57NiqC-4vaspL-2mY331-wE8Xam-63Q6U8-5zjjei-8v1euR-9hxkcx-cKpSCf-2LvcsY-6hkvs3-7M2Rns" title="bookcase" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flive.staticflickr.com%2F3230%2F2984153738_deea09c372_w.jpg" alt="bookcase" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How does HTTP work?
&lt;/h2&gt;

&lt;p&gt;Now that we have a better understanding of what HTTP is, let's talk about how it works. &lt;/p&gt;

&lt;p&gt;Commonly, HTTP is defined as a stateless, "client-server" protocol or "request-response" protocol. The client-server protocol describes the communication between two computers. The client (maybe a browser or another application) requests data and the server provides a response. This is how we are able to go to a website (make a request) and see information (get the response). With this protocol, the client request always happens first and is followed by the server's response.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;"Stateless" describes the fact that once the server provides a response, it isn't required to keep information stored about each user. Each request is executed without any knowledge of the requests that were executed before it or after it.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;&lt;a title="Gnome-fs-client.svg: David Vignoni&amp;lt;br&amp;gt;
Gnome-fs-server.svg: David Vignoni&amp;lt;br&amp;gt;
derivative work: Calimo, LGPL &amp;lt;http://www.gnu.org/licenses/lgpl.html&amp;gt;, via Wikimedia Commons" href="https://commons.wikimedia.org/wiki/File:Client-server-model.svg" rel="noopener noreferrer"&gt;&lt;img alt="Client-server-model" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fc%2Fc9%2FClient-server-model.svg%2F256px-Client-server-model.svg.png" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Request
&lt;/h3&gt;

&lt;p&gt;The request is where it all begins. Let's look at the components of a request&lt;sup&gt;1&lt;/sup&gt;: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Request line &lt;/li&gt;
&lt;li&gt;Request Headers (it is possible to have zero headers)&lt;/li&gt;
&lt;li&gt;An empty line &lt;/li&gt;
&lt;li&gt;The message body (optional)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /Protocols/rfc2626/rfc2616.htmll HTTP/1.1
Host: www.w3.org
User-Agent: Mozzila/5.0
(empty line)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first word in the first line (GET) is the request method. This is the action that we want to be done. In this case, we literally want to get some information. GET was the first method and is the most fundamental it is supported with all browsers because it is how we get content. &lt;/p&gt;

&lt;p&gt;For your reference, a list of methods taken from &lt;a href="https://www.tutorialspoint.com/http/http_methods.htm" rel="noopener noreferrer"&gt;TutorialsPoint&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HEAD&lt;/td&gt;
&lt;td&gt;Same as GET, but transfers the status line and header section only.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;Replaces all current representations of the target resource with the uploaded content.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;Removes all current representations of the target resource given by a URI.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CONNECT&lt;/td&gt;
&lt;td&gt;Establishes a tunnel to the server identified by a given URI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OPTIONS&lt;/td&gt;
&lt;td&gt;Describes the communication options for the target resource.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TRACE&lt;/td&gt;
&lt;td&gt;Performs a message loop-back test along the path to the target resource.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The request method is followed by the URI (Uniform Resource Identifier - we'll discuss this later) and the version of HTTP being used (yes, there is more than one version). While the request method holds the desired action, the headers contain other information for the server. Most of them are optional, but the host header field (which provides the name of the server along with the port number) is required.&lt;sup&gt;1&lt;/sup&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Response
&lt;/h3&gt;

&lt;p&gt;We discussed how it all begins with a request. Well, every time there is a request an HTTP response is sent. Fortunately for us, the components that make up the HTTP response are very similar to the components that make up the HTTP request&lt;sup&gt;1&lt;/sup&gt;: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Status line &lt;/li&gt;
&lt;li&gt;Response headers (can be zero)&lt;/li&gt;
&lt;li&gt;An empty line &lt;/li&gt;
&lt;li&gt;The message body (optional)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache/2.2.14 (Win32)
Last-Modified: Wed, 22 Jul 2009 19:15:56 GMT
Content-Length: 88
Content-Type: text/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line is the status line. It has a status code that provides information on whether or not the success was successfully processed. Followed by response headers. This provides more information to the client the same way request headers provide more information to the server. Another lovely table also take from &lt;a href="https://www.tutorialspoint.com/http/http_responses.htm" rel="noopener noreferrer"&gt;TutorialsPoint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Status Codes: &lt;br&gt;
Status Code Class|Description&lt;br&gt;
-----------------|--------------&lt;br&gt;
1xx|Informational. It means the request was received and the process is continuing.&lt;br&gt;
2xx|Success.| It means the action was successfully received, understood, and accepted.&lt;br&gt;
3xx|Redirection. It means further action must be taken in order to complete the request.&lt;br&gt;
4xx| Client Error. It means the request contains incorrect syntax or cannot be fulfilled.&lt;br&gt;
5xx|It means the server failed to fulfill an apparently valid request.&lt;/p&gt;

&lt;h2&gt;
  
  
  URI
&lt;/h2&gt;

&lt;p&gt;Previously, I mentioned the URI (Uniform Resource Identifier). You may be more familiar with the term URL (uniform resource locator). The relationship between URIs and URLs is kind of like the relationship between rectangles and squares. All squares are rectangles, but not all rectangles are squares (Wow, what a throwback to my grade school lessons on shapes). All URLs are URIs but not all URIs are URLs. URIs allow us to identify distinct resources. We can do that with a URL (which tells us exactly where to find a resource ), but we can do that with other things too. Like a URN (uniform resource name), which tells us what a resource is called, but not how to find it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.flickr.com/photos/kosmulski_origami/50385835217/in/photolist-2jLqzoR-Gzmb1N-we7e8o-2dvzcCS-Bk2oRi-26Wraj4-oXMhyX-xe9RoG-2d6nWq3-naUC15-28NgWRD-CLCHHf-Q55mMD-mhWG2-RiMmh4-JKV2Mj-2i9VT6g-2jdAE1Z-2kuw5Fw-2j626ua-2jWGMdr-K4LApR-2iRvXn4-2jfTSE9-2g5U4tE-2jg28S1-8hnYmv-Jav4yy-2k7LzfR-2jvRYAo-8LCax5-2iKXjD1-2iLancP-RQWDaw-2ieVkZx-2jMDmj3-b8Zf5K-ALMnjz-2jtzLtq-27fmPuo-2hmKvAJ-21AFrMN-UpZQtC-KZr6Uk-K7LKxr-pTn6pj-2c94xBc-2fWQ8mD-2iTLpbX-PKSMTm" title="Rectangle and Square Flagstone" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Flive.staticflickr.com%2F65535%2F50385835217_df48fe8fba_w.jpg" alt="Rectangle and Square Flagstone" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If this is interesting (or confusing to you. &lt;a href="https://en.wikipedia.org/wiki/Uniform_Resource_Identifier" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt; has a great article breaking down the history and usage of all three), but I pretty much use URL and URI interchangeably. &lt;/p&gt;

&lt;p&gt;The goal of this article is to walk through HTTP since it's an integral part of web applications that is important to understand. When I was first learning about web development it felt like a topic that was important, but my understanding was kind of fuzzy. Hopefully, this article can provide some clarity.  &lt;/p&gt;

&lt;p&gt;[1]: Sau Sheong Chang. Go Web Programming  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Preparing for the AWS Certified Cloud Practitioner Exam</title>
      <dc:creator>Bola Adebesin</dc:creator>
      <pubDate>Tue, 01 Dec 2020 02:33:40 +0000</pubDate>
      <link>https://dev.to/mobolanleadebesin/preparing-for-the-aws-certified-cloud-practitioner-exam-25pf</link>
      <guid>https://dev.to/mobolanleadebesin/preparing-for-the-aws-certified-cloud-practitioner-exam-25pf</guid>
      <description>&lt;h3&gt;
  
  
  Background
&lt;/h3&gt;

&lt;p&gt;The goal of writing this article is twofold. One, because I have just completed the Cloud Practitioner Certification, I want to share how I prepared for the exam while everything is still fresh in my mind. Two, if this post can be a helpful resource or serve as encouragement for anyone else considering getting the certification, that would be great! So without further ado, let's get to it! &lt;/p&gt;

&lt;h3&gt;
  
  
  What is the Certified Cloud Practitioner Exam?
&lt;/h3&gt;

&lt;p&gt;The Amazon Web Services (AWS) Certified Cloud Practioner exam is the first level of AWS certifications i.e. a foundational certification. It is a great starting point for individuals to gain "an overall understanding of the AWS cloud". &lt;/p&gt;

&lt;h3&gt;
  
  
  Why should you pursue this certification?
&lt;/h3&gt;

&lt;p&gt;As stated above, this certification is a great introduction to "The Cloud". More and more companies are moving to take advantage of the cost benefits, reduced hardware maintenance, and global infrastructure of cloud-based services. &lt;/p&gt;

&lt;h3&gt;
  
  
  Fast Facts about the Exam
&lt;/h3&gt;

&lt;p&gt;While the &lt;a href="https://d1.awsstatic.com/training-and-certification/Docs%20-%20Cloud%20Practitioner/AWS%20Certified%20Cloud%20Practitioner_Exam_Guide_v1.4_FINAL.PDF" rel="noopener noreferrer"&gt;Official AWS Exam Guide&lt;/a&gt; details: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What you need to know (broken down under different domains) &lt;/li&gt;
&lt;li&gt;Links to official training courses and materials &lt;/li&gt;
&lt;li&gt;Response Types &lt;/li&gt;
&lt;li&gt;How the exam is scored &lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  I was interested in the following:
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;65 Questions &lt;/li&gt;
&lt;li&gt;100 minutes &lt;/li&gt;
&lt;li&gt;Price of the exam is $100 USD &lt;/li&gt;
&lt;li&gt;Two styles of questions: multiple choice (one correct answer) AND multiple responses (two correct answers out of five) &lt;/li&gt;
&lt;li&gt;Exam is scored from 100 to 1000 and you need at least a 700 to pass&lt;/li&gt;
&lt;li&gt;Unanswered questions are scored as incorrect and there is no penalty for guessing &lt;/li&gt;
&lt;li&gt;You can take the exam at home or at a testing center &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How I Prepared
&lt;/h3&gt;

&lt;p&gt;My background: I have about one year of experience working as a full-time developer. My company does use AWS, but my personal experience with AWS Services was pretty limited. I had worked with EC2 instances, S3 buckets, and some of the IaaS (infrastructure as a service) tools, but would still label myself a beginner. &lt;/p&gt;

&lt;p&gt;Time to Study: I spent approximately a week and a half preparing for the exam. I saw individuals recommend anywhere from 10 to 20 hours of study time depending on one's familiarity with AWS. &lt;/p&gt;

&lt;p&gt;Resources (aka The Good Stuff): &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Blogs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This &lt;a href="https://towardsdatascience.com/ace-your-first-aws-certification-in-10-days-f6b2b7cbea34" rel="noopener noreferrer"&gt;post&lt;/a&gt; by Kedar Dabhadkar&lt;/li&gt;
&lt;li&gt;This &lt;a href="https://www.selikoff.net/2019/01/20/how-i-recommend-studying-for-the-aws-certified-cloud-practitioner-exam/" rel="noopener noreferrer"&gt;post&lt;/a&gt; by Jeanne Boyarsky &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These blog posts were well-organized and extremely helpful in my preparation. &lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Videos: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=DkE4lKNC7uw" rel="noopener noreferrer"&gt;Firsthand exam experience&lt;/a&gt; from Steep Technologies. I just found it nice to hear someone else's experience. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=KFhXKlX6p-o" rel="noopener noreferrer"&gt;Topics to Study&lt;/a&gt; By Peter Fessel. I will say this, every topic he mentions was on my exam, but there were a few topics on my exam that he did not mention. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.youtube.com/watch?v=3hLmDS179YE" rel="noopener noreferrer"&gt;(Almost) Everything You Need to Know&lt;/a&gt; from Andrew Brown. Honestly, shout out to Mr. Brown. This video got me 70% of the way there. After watching it, I didn't feel like I needed to watch anything else. I just made flashcards and did practice exams. I also didn't need to read all the white papers although I did skim some of them for more information on concepts I was struggling with such as the &lt;a href="https://d1.awsstatic.com/whitepapers/architecture/AWS_Well-Architected_Framework.pdf" rel="noopener noreferrer"&gt;5 Pillars of the AWS Well-Architected Framework&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Practice, Practice, Practice: &lt;br&gt;
Once, I felt like I had a good foundation my approach was to drill and then test. For me, that meant making flashcards and then doing practice exams. &lt;/p&gt;

&lt;h5&gt;
  
  
  Flashcards
&lt;/h5&gt;

&lt;p&gt;For my flashcards, I used a program called &lt;a href="https://apps.ankiweb.net/" rel="noopener noreferrer"&gt;Anki&lt;/a&gt;, which automates spaced-repetition, allows you to sort cards based on how well you feel you know the material, and a has bunch of other pretty cool features. I also really like &lt;a href="https://quizlet.com/" rel="noopener noreferrer"&gt;Quizlet&lt;/a&gt;. If you go the flashcard route, I would suggest making the cards yourself as I believe that making the cards helps with retaining the info.&lt;/p&gt;

&lt;h5&gt;
  
  
  Practice Exams
&lt;/h5&gt;

&lt;p&gt;For practice exams, I completed the first four exams from &lt;a href="https://www.udemy.com/course/aws-certified-cloud-practitioner-practice-test/" rel="noopener noreferrer"&gt;Udemy&lt;/a&gt; (I found many people who stated that the last two practice exams were out of scope for this test), 20 free questions from &lt;a href="https://www.whizlabs.com/aws-certified-cloud-practitioner/" rel="noopener noreferrer"&gt;Whizlabs&lt;/a&gt; and the four practice exams also from Whizlabs, and &lt;a href="https://d1.awsstatic.com/training-and-certification/Docs%20-%20Cloud%20Practitioner/AWS%20Certified%20Cloud%20Practioner_Sample%20Questions_v1.1_FINAL.PDF" rel="noopener noreferrer"&gt;10 free questions&lt;/a&gt; from AWS. &lt;/p&gt;

&lt;p&gt;The Udemy practice exams were structurally more similar to the test than the WhizLab questions because Whizlab had questions where three out of five answers might be correct, but the exam only ever asked for two correct answers at most. I still really liked Whizlabs because each explanation linked directly to resources on the AWS site with more information. I also think the level of difficulty of the Whizlabs questions was great too. On the exam, there were questions that were close enough to the practice exams that I might not have gotten correct otherwise. &lt;/p&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  How Much Did It Cost?
&lt;/h3&gt;

&lt;p&gt;In total, I spent $117.94: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;$100 for the exam &lt;/li&gt;
&lt;li&gt;$7.95 for the WhizLab Practice Exams (on sale at the time) &lt;/li&gt;
&lt;li&gt;$9.99 for the Udemy Practice Exams (on sale at the time) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some people recommended the &lt;a href="https://acloud.guru/learn/aws-certified-cloud-practitioner" rel="noopener noreferrer"&gt;ACloudGuru&lt;/a&gt; course, but at the time I looked the subscription was for $299/year or $49/month. I've heard really good things about this platform for the associate level courses and beyond, but I felt confident that I could spend less and still do well on the exam so I opted not to enroll.&lt;/p&gt;

&lt;h3&gt;
  
  
  The End
&lt;/h3&gt;

&lt;p&gt;Whew! Okay, we made it to the end. Thanks for sticking with me. I hope that you found this article helpful and best of luck on your certification exam and more importantly, your AWS Cloud journey! &lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudskills</category>
    </item>
  </channel>
</rss>
