<?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 Ben Tagtow on Medium]]></title>
        <description><![CDATA[Stories by Ben Tagtow on Medium]]></description>
        <link>https://medium.com/@bentagtow?source=rss-f536d7dc966a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*kq0q9vBFPCCrN-hylasrIA.jpeg</url>
            <title>Stories by Ben Tagtow on Medium</title>
            <link>https://medium.com/@bentagtow?source=rss-f536d7dc966a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:55:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bentagtow/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[A Quick Look at Optimistic vs. Pessimistic Rendering]]></title>
            <link>https://blog.devgenius.io/a-quick-look-at-optimistic-vs-pessimistic-rendering-4df00a5af0ff?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4df00a5af0ff</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[page-load-time]]></category>
            <category><![CDATA[rendering]]></category>
            <category><![CDATA[optimistic-rendering]]></category>
            <category><![CDATA[web-page-performance]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Sun, 15 Nov 2020 17:03:11 GMT</pubDate>
            <atom:updated>2020-11-15T17:16:45.099Z</atom:updated>
            <content:encoded><![CDATA[<p>Quick confession… I’m a bit of a news addict. I’m not biased about it, I’ll read nearly any type, from news about my favorite sports teams to the latest updates on the upcoming election. I’ll even occasionally stray to topics on the very fringes of the “news” category, such as this BuzzFeed article about <a href="https://www.buzzfeed.com/sydrobinson1/weekly-dog-posts-january-6-2020?origin=web-hf">18 Adorable Dog Posts To Spread The Good Vibe Gospel This Week</a>.</p><p>Unfortunately and for no good reason, I all-too-frequently also find myself scouring the comments of these articles. This undoubtably means running across a pointless argument between two people who would never be this confrontational in person and clearly aren’t doing a good job of convincing anyone to come over to their side. Yet, again for no good reason, if I agree with one person and disagree with the other I’m always willing to tap that <em>like</em> or thumbs-up key as a tiny validation to the argument I support.</p><p>The point of this article is to examine what happens when I hit that like key. Frankly, the process is pretty uninteresting: I tap the <em>like </em>button and the webpage updates to display the new running total of “likes” and to offer the client an <em>unlike</em> option. That’s it. Generally, the client-experience in this situation boils down to speed. Therefore, if that <em>like</em> happens almost instantaneously, the client is satisfied. But this is 2020 so if it takes a few seconds, that can be enough to irritate the client and possibly push them away from your website. So how can a developer maximize speed and thus improve the client-experience? That’s where optimistic rendering comes in.</p><p>The easiest way to describe optimistic rendering is to first touch on its alternative: <em>pessimistic rendering</em>. When web-pages render pessimistically, they work like this:</p><p>1 — A client performs an action, such as a click, which sends an HTTP request to the server.</p><p>2 — The server processes the request and returns a response.</p><p>3 — The client’s application is changed based on this response.</p><p>To demonstrate how this looks, I’ll use the comment-liking action I mentioned earlier (as a note, “likes” would typically not render pessimistically because, again, that would cause an unwanted delay for the client). Here’s how it would look, however:</p><p>1 — I click “like” on a comment.</p><p>2 — My “like” is sent to the website’s server.</p><p>3 — Once the server processes the request and returns a response, the page is updated to reflect my additional like on the comment (assuming it was successful).</p><p>So that’s pessimistic rendering. What’s the difference, you ask? Well, essentially <em>optimistic rendering</em> removes the hold-up in the flow. Rather than calling to the server and forgoing future action until a response is received, the client’s application will render immediately and simultaneously with the call to the server. As the client makes a request, the client’s application will optimistically assume that that request was successful before it has received received a response from the server, eliminating the wait time that is caused by the call to the server. As compared to the pessimistic process, the optimistic process works like this (changes are in bold):</p><p>1 — A client (or user) makes a request to a page via an action, such as a click.</p><p><strong>2 — The webpage is rendered to display the results of the client’s action. (I.e. adding and displaying an additional “like” and changing the button to an unlike option.)</strong></p><p><strong>3 </strong>— Based on the client’s action, a corresponding call is sent to the server.</p><p>4 — The server processes the request and returns a response.</p><p><strong>5 — If the request failed, the client’s page may again update or they may receive an error message.</strong></p><p>There are appropriate times to use either optimistic or pessimistic rendering. While optimistic is often more client-friendly, there are certainly times when it is not a preferred option. For example, if a client is purchasing a ticket to a baseball game, it may not (or definitely wouldn’t) be a great idea to display “Your purchase was successful!” before the purchase has actually gone through. This preference for pessimism extends to almost any transaction on the web.</p><p>The moral of the story: in terms of a general approach to life, optimism is the way to go. When developing features for full-stack apps, however, I’d recommend allowing yourself a little more leeway to weigh the merits and drawbacks of optimistic vs. pessimistic rendering for your specific situation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4df00a5af0ff" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/a-quick-look-at-optimistic-vs-pessimistic-rendering-4df00a5af0ff">A Quick Look at Optimistic vs. Pessimistic Rendering</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</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 use switch statements in Javascript (with examples)]]></title>
            <link>https://bentagtow.medium.com/how-to-use-switch-statements-in-javascript-with-examples-a0e553edfcdf?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0e553edfcdf</guid>
            <category><![CDATA[conditional-statements]]></category>
            <category><![CDATA[switch-case]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[if-else]]></category>
            <category><![CDATA[switch-statement]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Sun, 01 Nov 2020 02:39:23 GMT</pubDate>
            <atom:updated>2020-11-01T02:39:23.807Z</atom:updated>
            <content:encoded><![CDATA[<p>Switch statements are used, primarily, when you have logic that would otherwise be written as a long-winded conditional statement. As if-else statements become larger and more complex, they can become expensive, and often hard to read.</p><p>Here is the syntax for a switch statement (borrowed from <a href="https://www.w3schools.com/js/js_switch.asp">w3schools</a>). We’ll break it down line by line:</p><pre><strong>switch(<em>expression</em>) {</strong><br>  case <em>x</em>:<br><em>    // code block<br></em>    break;<br>  case <em>y</em>:<br><em>    // code block<br></em>    break;<br>  default:<br>    // <em>code block</em><br>}</pre><h4>switch(expression)</h4><p>The expression here is what will tell your program what case to evaluate. For a simple example, you may have a function that prints out animal sounds depending on which animal you pass in. If you pass in cow, you want the function to print out “moo.” If you pass in dog, “bark.” You get the idea!</p><p>Here’s how the expression could look in code:</p><pre>switch (animal){</pre><p>We’ll get to the different cases in just a moment. The important thing here is to just know that each time you call this switch statement (or the function that contains this switch statement), you’ll need to pass in an animal.</p><pre>switch(<em>expression</em>) {<br><strong>  case <em>x</em>:</strong><br><em>    // code block<br></em>    break;<br><strong>  case <em>y</em>:</strong><br><em>    // code block<br></em>    break;<br>  default:<br>    // <em>code block</em><br>}</pre><h4>case x &amp; case y</h4><p>The cases, from the animal sounds example above, would be the different types of animals that you may be passing in. One case would be the cow, and the other would be the dog. Important note, the expression you pass in must be an <strong>exact match</strong> to the case in your switch statement, including being of the same type. If your switch statement was evaluating numbers, you couldn’t have the case be looking for a string of “1” and then pass in the integer of 1.</p><p>Inside of your case, you’ll simply put the code block that you wish to execute. In code:</p><pre>case &quot;dog&quot;: <br>   console.log(&quot;bark!&quot;)</pre><pre>switch(<em>expression</em>) {<br>  case <em>x</em>:<br><em>    // code block<br></em><strong>    break;</strong><br>  case <em>y</em>:<br><em>    // code block<br></em><strong>    break;</strong><br>  default:<br>    // <em>code block</em><br>}</pre><h4>break</h4><p>The break statement is optional, but is often very helpful when using switch statements. It means that the program will break out of the switch statement when the matched statement is executed. In other words, when your program hits “dog”, it will print out the “bark” and then break out of that switch statement. If you don’t include the break statement, the next case will be executed regardless of whether the evaluation matches the case.</p><pre>switch(<em>expression</em>) {<br>  case <em>x</em>:<br><em>    // code block<br></em>    break;<br>  case <em>y</em>:<br><em>    // code block<br></em>    break;<br><strong>  default:</strong><br>    // <em>code block</em><br>}</pre><h4>default</h4><p>The optional default keyword is what will happen if no cases match. An example of this is if your two cases are “dog” and “cow”, and your expression evaluates to “cat”. If you don’t include a default statement, the program will continue to the statement after the switch.</p><h4>When to use switch statements</h4><p>Switch statements are most useful when you have conditionals with three or more cases. For the purpose of simplicity in this post, I used only two cases for the examples (“dog” and “cow”), however, if you only have two cases in your code, it’s probably best to stick with an if-else statement. However, if you want to have matching code blocks for three or more cases, switch statements are more efficient and more readable than an if-else statement.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0e553edfcdf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When to use Double Equals and when to use Triple Equals in JavaScript:  == vs. ===]]></title>
            <link>https://bentagtow.medium.com/when-to-use-double-equals-and-when-to-use-triple-equals-in-javascript-vs-bb8b49d560b5?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb8b49d560b5</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[double-equal]]></category>
            <category><![CDATA[triple-equal]]></category>
            <category><![CDATA[equality-operators]]></category>
            <category><![CDATA[operand]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Sat, 24 Oct 2020 17:14:12 GMT</pubDate>
            <atom:updated>2020-10-24T17:14:12.127Z</atom:updated>
            <content:encoded><![CDATA[<h3>When to use Double Equals and when to use Triple Equals in JavaScript: == vs. ===</h3><p>Often times, developers that don’t have a ton of experience use == and ===, two equality operators, interchangeably in JavaScript. This is bad practice and can lead to (often hard to debug) issues with your code. Both of these operators return booleans (true or false), but knowing the differences between both the purpose and functionality of the two operators is a foundational piece of being a JavaScript developer.</p><h4>Double Equals (==)</h4><p>The double equals is actually just called the “equality operator” (the triple equals, ===, is the “strict equality operator.” Notice the difference in naming, this operator is not called “strict.” The reason for this is that, simply, this operator is more lenient in what can return true.</p><p>The double equals uses something called the Abstract Equality Comparison Algorithm to determine its return value. This basics of the algorithm goes as follows, but you can get a full picture of the algorithm’s rules <a href="http://www.ecma-international.org/ecma-262/5.1/#sec-11.9.3">here</a>:</p><p>1.When operands of two different types are compared, attempt to convert these two operands to the same type before comparing (more on this below)</p><ul><li>When one object is a boolean with a value true, the equality operator will convert this value to 1 before comparing. For a quick example, go into your console and create two variables, x = 1 and y = true. Then use the equality operator to compare x == y , it will return true.</li><li>If you’re comparing a string and a number, the operator attempts to convert the string to a number before comparing (i.e. &quot;5&quot; == 5 returns true)</li></ul><p>2. When comparing two objects, only return true if they reference the same object.</p><p>3. If one value is null and the other is undefined, return true</p><p>4. When comparing two strings, return true only when both operands have the same characters in exactly the same order</p><p>5. When comparing two numbers, compare the value of those numbers. If either is not a number, return false (+0 == -0 returns true)</p><p>6. When comparing booleans, return true if both are true or if both are false</p><h4>Triple Equals / Strict Equality (===)</h4><p>The triple equals is called the strict equality operator. The strict equality operator, briefly , only returns true when both operands are the exact same value. Here’s a few rules that summarize the essential functionality/strictness:</p><p>1. The strict equality operator does <strong>not</strong> use type comparison, so when you are comparing, say, a string and a number (&quot;5&quot; === 5), regardless of either value, the return value will be false</p><p>2. If the value of both are null, return true. Ditto for both being undefined.</p><p>3. Comparing +0 === -0 still returns true, since the value of each operand is the same.</p><p>4. Comparing two values where either is NaN, the return value will be false.</p><h4>Summary</h4><p>Both of these operators will often give you the same return value. However, in my opinion, using the strict equality operator is almost always a better move. It minimizes potential bugs from the type comparison (and if you really need type comparison, you can create a function for that before using the operator).</p><p>Two resources I found particularly useful for creating this post were the MDN docs on the two operators: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality">Double equals</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Strict_equality">triple equals</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb8b49d560b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event Bubbling (and how to stop it using event.stopPropagation)]]></title>
            <link>https://bentagtow.medium.com/event-bubbling-and-how-to-stop-it-using-event-stoppropagation-405d4c7c8ac8?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/405d4c7c8ac8</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[event-propagation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-events]]></category>
            <category><![CDATA[event-bubbling]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Fri, 16 Oct 2020 22:20:50 GMT</pubDate>
            <atom:updated>2020-10-16T22:20:50.445Z</atom:updated>
            <content:encoded><![CDATA[<p>The principle of event bubbling, from <a href="https://javascript.info/bubbling-and-capturing">javascript.info</a>, states that: <strong>When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors. </strong>In other words, if you have a div that changes color with a onmouseover event, if you scroll your cursor over any children inside of that div, the onmouseover event will still run.</p><p>To illustrate the example in code, if you clicked the innermost &lt;button&gt; in the code snippet below, all three functions (aThirdFunction, anotherFunction, and someFunction) would run:</p><pre>&lt;div onclick={someFunction}&gt;My div</pre><pre>  &lt;p onclick={anotherFunction}&gt; My p tag</pre><pre>    &lt;button onclick={aThirdFunction}&gt; My button</pre><pre>    &lt;/button/&gt;</pre><pre>  &lt;/p&gt; </pre><pre>&lt;/div&gt;</pre><p>So that is event bubbling. It’s a pretty straightforward concept, and it’s certainly a very important tool to be familiar with in Javascript.</p><p>However, there are times when you don’t want event bubbling to occur, at least in its default operation. There are plenty of ways to manage this.</p><h4>event.stopPropagation()</h4><p>The stopPropagation function stops bubbling at the element where this function is called. For example, if in the above code snippet I had put event.stopPropagation() on the child button, the event would be considered fully processed, and would not bubble up to the &lt;p&gt; and &lt;div&gt; elements.</p><p>One important piece of context that I want to emphasize again is that event bubbling starts at the child element and “bubbles” up. Therefore, when the stopPropagation function is called, any events that would have run *after* the element with the stopPropagation function would not run. The child’s event will still run, but it does not bubble up to the parent.</p><p>Another note: Event bubbling is not a bad thing. In fact, you almost always will want to let it run its default behavior. You should only event.stopPropagation() when you really need to. In most cases, you can leave event bubbling as is or just manage it by using things like custom events and event.target.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=405d4c7c8ac8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Pseudo-Classes (including :nth-child)]]></title>
            <link>https://bentagtow.medium.com/css-pseudo-classes-including-nth-child-752cfc6fa4c3?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/752cfc6fa4c3</guid>
            <category><![CDATA[html-css]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[css-selectors]]></category>
            <category><![CDATA[nth-child]]></category>
            <category><![CDATA[pseudo-class]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Thu, 27 Aug 2020 00:46:12 GMT</pubDate>
            <atom:updated>2020-08-27T00:46:12.782Z</atom:updated>
            <content:encoded><![CDATA[<h3>CSS Pseudo-Classes (including :nth-child)</h3><figure><img alt="Peter Griffin (from Family Guy) attempting and failing to close blinds" src="https://cdn-images-1.medium.com/max/512/0*okZsvJPi_KFpXtnA.gif" /><figcaption>When you’re styling your page, don’t be like Peter Griffin…</figcaption></figure><p>A highly effective, and fairly straight-forward, way to make your pages look better is by using CSS pseudo-classes (or pseudo-selectors).</p><p>Pseudo-classes specify a special state of a selected element. It’s kind of like CSS’s version of an event listener. You can define a pseudo-class for when a user hovers over something, visits a link from your page, “focuses” on an element, and much more. We’re going to cover the basic pseudo-classes, but you can find a complete index of pseudo-classes here: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes">https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes</a>.</p><p>Pseudo-classes are easy to implement into your code. The syntax is as follows:</p><pre>selector:pseudo-class {<br>  property: value;<br>}<br></pre><p>For example, let’s say you want to have a button (.dropdownButton) highlight gray when a user hovers over it:</p><pre><em>.dropdown-button:hover</em>{<br>  background-color: lightgray;<br>}</pre><h3>Using pseudo-classes to select specific children</h3><p>You can use pseudo-classes to select certain children as well. First-child, last-child, first-of-type, and nth-child are a few, but not all, of the pseudo-classes for selecting certain children. This uses the same pseudo-class syntax as above, so to select the first child or a certain class, you’d just do something like:</p><pre>.class:first-child {<br>  color: orange;<br>}</pre><h4>nth-child()</h4><p>A more specific way to select certain children is using nth-child. <em>N</em> is represented by a single argument, and it can be either a <strong>number</strong>, a <strong>keyword</strong>, or a <strong>formula</strong>.</p><p>For example, if you wanted to select the third element of parent, you’d just put 3 in as your nth-child argument, like so:</p><pre>.class:nth-child(3) {<br>  color: orange;<br>}</pre><p>You can also select multiple children. If you want to select every third child, you’d just put 3n in your argument:</p><pre>.class:nth-child(3n) {<br>  color: orange;<br>}</pre><p>Or, you can use a keyword like even or odd in your argument to select all even (or odd) children:</p><pre>.class:nth-child(even) {<br>  color: orange;<br>}</pre><p>Finally, there is a formula that allows you to be even more specific with your selectors. The formula is An + B, where:</p><ul><li>A is the cycle size</li><li>N is the counter which starts at 0</li><li>B is the amount of offset (or where the formula will start).</li></ul><p>So if you want to select every element, starting at the sixth child, you’d write:</p><pre>.class:nth-child(n + 6) {<br>  color: orange;<br>}</pre><p>Or if you wanted every <em>third</em> element starting at the <em>fourth</em> child:</p><pre>.class:nth-child(3n + 4) {<br>  color: orange;<br>}</pre><p>CSS pseudo-classes are useful and fairly straightforward. The simple logic and syntax allow for easy implementation, and there is a mini laundry list of available pseudo-classes to use.</p><h4>Additional Resources:</h4><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes">https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes</a></li><li><a href="https://www.w3schools.com/cssref/sel_nth-child.asp">https://www.w3schools.com/cssref/sel_nth-child.asp</a></li><li><a href="https://css-tricks.com/useful-nth-child-recipies/">https://css-tricks.com/useful-nth-child-recipies/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=752cfc6fa4c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming your brain to use keyboard shortcuts]]></title>
            <link>https://bentagtow.medium.com/programming-your-brain-to-use-keyboard-shortcuts-5be31e5f37c2?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/5be31e5f37c2</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[visual-studio-code]]></category>
            <category><![CDATA[typing]]></category>
            <category><![CDATA[keyboard-shortcuts]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Wed, 26 Aug 2020 23:44:47 GMT</pubDate>
            <atom:updated>2020-08-26T23:44:47.798Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="mac keyboard" src="https://cdn-images-1.medium.com/max/1024/0*H30kGEnMwCkUg7RF" /></figure><p>Keyboard shortcuts can be very underrated. For experienced programmers, many shortcuts are second nature. But for newer programmers, it takes time and concerted effort to train your brain to use these shortcuts.</p><p>Here’s the system I use for learning shortcuts:</p><p>First, depending on your relationship with keyboard shortcuts, you will likely want to google a list. In my case, I use Visual Studio Code on a Mac, so I googled “VS Code shortcuts macOs and immediately found <a href="https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf">this helpful cheat sheet</a>.</p><p>Take a quick scan through the list and note or highlight a few new shortcuts that you could see yourself using regularly.</p><p>For me, and I assume most folks out there, the key to “training” myself to do anything is repetition. Surprise, the best way to program your brain into using keyboard shortcuts is repetition!</p><p>One key (pun intended) for learning keyboard shortcuts is to take it one at a time. Choose a specific shortcut you want to learn (either from the list you googled or just one that you come across) and write it down on a sticky note. Put it on your computer and force yourself to use that shortcut by making a tally on the sticky note every time you use it. If you don’t end up with at least five tallies by the end of the day, or whatever amount seems reasonable for what you’re working on, cross out your tallies and start fresh the next day. Do this until you have used the shortcut five times in one day and chances are you’ll start using that shortcut in the future.</p><p>Also, make sure you are somehow keeping track of keyboard shortcuts when you run across them. I keep a page in my notes specifically for keyboard shortcuts. It prevents me from losing track of them. As long as I think to go back and reference the list, I can use the sticky note strategy to slowly but easily integrate every shortcut I come across into my daily coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5be31e5f37c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pólya’s Four Step Method — And How It Can Improve Your White Boarding]]></title>
            <link>https://blog.devgenius.io/p%C3%B3lyas-four-step-method-and-how-it-can-improve-your-white-boarding-452eb90d7b0b?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/452eb90d7b0b</guid>
            <category><![CDATA[whiteboarding]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[problem-solving]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[pseudocode]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Wed, 19 Aug 2020 22:07:26 GMT</pubDate>
            <atom:updated>2020-08-20T07:06:43.060Z</atom:updated>
            <content:encoded><![CDATA[<h3>Pólya’s Four Step Method — And How It Can Improve Your White Boarding</h3><p><em>Turns out the microwave oven wasn’t the only useful tool invented in 1945</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/0*zniBE2S4GhBay-gm.jpg" /><figcaption>George Pólya in all his glory (Goodreads)</figcaption></figure><p>Pólya’s Four Step Method is an age-old method to solving problems, and its usefulness hasn’t deteriorated since it was first written about in 1945. While George Pólya initially laid out this technique as a way to solve math problems, it is incredibly effective on a broader scope for solving basically any type of complex problem one may run across, and this technique is particularly helpful when it comes to approaching white boarding problems. The method goes like this:</p><ul><li>Step 1. Understand (or clarify) the problem</li><li>Step 2. Devise a plan</li><li>Step 3. Carry out the plan</li><li>Step 4. Look for ways to improve your work</li></ul><p>Let’s break it down step-by-step to see how it can help you when it comes to white boarding.</p><h4>Step 1. Understand (or clarify) the problem</h4><p>When you first encounter the problem, whether it be in an interview or a coding website, you might be tempted to jump right in. Ease up though, kiddo! Take a few seconds to confirm that you know exactly what the problem is asking and whether there are constraints to how you can solve it. For example, if you’re asked to sort an array, some possible questions could be: “Is it an array of only integers?”; “How should it be sorted (ascending, descending)?”; “Should I avoid build-in methods?”</p><p>When white boarding, this step is where you should create an input-output table. Not only is it just good practice for white boarding in general, but it will also help you figure out what clarifying questions you may have.</p><h4>Step 2. Devise a plan</h4><p>How are you going to approach the problem? Depending on your time constraints, it’s very helpful to come up with at least two or three possible ways to solve the problem. If you’re having trouble coming up with ways to solve the problem, break it down into smaller problems that you can solve!</p><p>If you’re asked to reverse a string, a couple plans you may come up with could be:</p><ul><li>.reverse() — as long as you clarified in step 1 that you can use built in methods!</li><li>.split it, then use a for loop to pop/push into a new array</li></ul><h4>Step 3. Carry out the plan</h4><p>If you correctly navigated through the first two steps, you will have set yourself up for success here. But that certainly doesn’t make this step is a breeze.</p><p>One important thing to remember here, especially for interviews, is to make sure you are properly communicating as you work through the problem. Don’t make the interviewer read your mind, tell them what you are thinking! Feel free to pseudocode your plan at first, and that might help you be able to talk through your code a little better.</p><h4>Step 4. Look for ways to improve your work</h4><p>This is a crucial step, but it is also the most overlooked. Is the solution you wrote dynamic, or will it only work in certain cases? For example, if you were asked to reverse a string, will the solution you wrote still work if the string is a mix of letters, numbers, spaces, and symbols?</p><p>Looking for ways to improve your code demonstrates maturity as a developer, and it will help you in writing better code in the future. If you’re in an interview and it feels right, you can and should ask the interviewer what they may have done differently.</p><p>Sources:</p><ul><li><em>How to Solve It</em> (1945) by George Pólya</li><li>Four Step Method: <a href="https://www.wtamu.edu/academic/anns/mps/math/mathlab/int_algebra/int_alg_tut8_probsol.htm">https://www.wtamu.edu/academic/anns/mps/math/mathlab/int_algebra/int_alg_tut8_probsol.htm</a></li><li>Image: <a href="https://www.goodreads.com/author/show/663311.George_P_lya">https://www.goodreads.com/author/show/663311.George_P_lya</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=452eb90d7b0b" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/p%C3%B3lyas-four-step-method-and-how-it-can-improve-your-white-boarding-452eb90d7b0b">Pólya’s Four Step Method — And How It Can Improve Your White Boarding</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Specificity]]></title>
            <link>https://blog.devgenius.io/css-specificity-17649dadff14?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/17649dadff14</guid>
            <category><![CDATA[styling]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[web-page-design]]></category>
            <category><![CDATA[css-specificity]]></category>
            <category><![CDATA[css-in-js]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Tue, 18 Aug 2020 20:52:00 GMT</pubDate>
            <atom:updated>2020-08-24T18:54:09.832Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="CSS is awesome mug (with questionable CSS)" src="https://cdn-images-1.medium.com/proxy/0*EEg0UybWCFFgg-ey" /></figure><p>One of the more confusing (but important) pieces of CSS is specificity. I have to admit, this concept took me quite a while to grasp. And while it is definitely a bit confusing, once you get the hang of it it’s actually fairly straightforward. With that being said, here is a quick “what and how” on understanding CSS specificity.</p><h4>The “What”</h4><p>By rule, the browser will read your CSS file from top to bottom. That means if you have two h1 selectors, the one that occurs lower on the file will be read.</p><pre>h1 {<br>   color: red<br>}<br>h1 {<br>   color: orange<br>}<br>//Browser will display h1’s in orange since it is lower down</pre><p>Often times when you are writing CSS, you will have multiple “rules” written into your CSS file that may contradict each other. The way the browser determines how to prioritize those rules is through <em>specificity</em>.</p><p>Example: Let’s say you have a to-do list. Each to-do has a class of “to-do”, but some of them have a unique ID (using ID’s isn’t recommended, but they are helpful here in understanding specificity):</p><pre>//HTML<br> <br>&lt;div class=&quot;to-do&quot;&gt; <br>    To-Do #1 <br>&lt;/div&gt;<br>&lt;div class=&quot;to-do&quot; id=&quot;second-to-do&quot;&gt; <br>    To-Do #2 <br>&lt;/div&gt;<br>&lt;div class=&quot;to-do&quot;&gt; <br>    To-Do #3 <br>&lt;/div&gt;</pre><p>In your stylesheet, you style each element with class “to-do” with a background color of red. However, you also style the element with the id of “second-to-do” with a background color of green:</p><pre>//stylesheet</pre><pre>.to-do{<br>   background-color: red<br>}</pre><pre>#second-to-do{<br>   background-color: green<br>}</pre><p>“Well…” your browser thinks as it comes across the second to-do, “Which one is it, green or red?!”</p><p>Except your browser doesn’t actually think that, because (besides browsers not having brains) your browser knows to determine the style based on specificity! Keep reading…</p><h4>The “How”</h4><p>So how does the browser calculate specificity? Well, luckily for all of us, it has a built in way to do this!</p><p>The browser calculates specificity by summarizing each selector with a four digit number, starting at 0000, that is compiled based on four categories. Whenever there are two or more contradicting styles for a certain element (like in the to-do example above), the selector with the greater four digit number is the one that is read by the browser.</p><p>Let’s break that 0000 down:</p><ul><li>First digit (*<strong>0*</strong>000): Determined by whether an selector has inline styling or the important keyword (more on this later)</li><li>Second digit (0*<strong>0*</strong>00): Determined by whether the selector has an ID. If it has one ID and nothing else (such as below), the specificity calculator would look like: 0100. If it has two IDs, calculator would be: 0200.</li></ul><pre>//one id, calculator is 0100<br>#second-to-do{<br>   background-color: green<br>}</pre><pre>//two ids, calculator is 0200<br>#second-to-do#fourth-to-do{<br>    background-color: green<br>}</pre><ul><li>Third digit (00*<strong>0*</strong>0): Determined by whether the selector has a class or pseudo-class (like :hover). With one class and nothing else, number is 0010, or just 10. With one class and one ID, the number would be 0110, or just 110. In the case below, since 110 is higher than 10, the second to-do will have a background color of green.</li></ul><pre>//one class, calculator is 0010<br>.to-do{<br>   background-color: red<br>}</pre><pre>//one id one class, calculator is 0110. <br>.to-do #second-to-do{<br>    background-color: green<br>}<br>//Since 0110 is higher than 0010, second to-do will have a background color of green.</pre><ul><li>Fourth Digit (000*<strong>0*</strong>): Determined by whether selector has an element (such as div, h1, p… etc.). Element selectors are the least specific, since any class or id selector will inevitably have a higher number.</li></ul><pre>//one element, calculator is 0001<br>div{<br>   background-color: green<br>}</pre><ul><li>Back to first digit (<strong>0</strong>): Generally, it’s actually best practice to not mess with this first digit. But if you must, the first digit is changed when the element has inline styling or the !<strong>important</strong> keyword. Again, neither of these are recommended so I am not going to go too far into detail. Just know that if you use in-line styling or the !important keyword, this is the most specific you can be (which in turn makes it super hard to refactor or adjust your styling, hence why it is not recommended).</li></ul><h4>Summary</h4><p>Not having a clear understanding of CSS specificity can lead to all sorts of headaches. Knowing the way the browser calculates specificity is an important tool to making your pages look better and your code more readable. Specificity is calculated in the browser with a four digit number that is adjusted based on the !important keyword/inline styling, id’s, classes/pseudo-classes/attributes, and element selectors. !important and inline styling are the most specific. Id’s are second-most specific. Classes are third-most specific. Elements are the least specific.</p><h4>Additional Resources:</h4><p>Docs: <a href="https://www.w3schools.com/css/css_specificity.asp">https://www.w3schools.com/css/css_specificity.asp</a></p><p>Specificity Calculator: <a href="https://specificity.keegan.st/">https://specificity.keegan.st/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17649dadff14" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/css-specificity-17649dadff14">CSS Specificity</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brainstorming Your Next Coding Brainchild]]></title>
            <link>https://blog.devgenius.io/brainstorming-your-next-coding-brainchild-f17b23540c0f?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f17b23540c0f</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[brainstorming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 17:40:31 GMT</pubDate>
            <atom:updated>2020-08-03T17:18:33.700Z</atom:updated>
            <content:encoded><![CDATA[<h4>Or at least a few creative ideas to get you started</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDOtThkpq7pLqLj6snqN3A.jpeg" /><figcaption>Let’s fill the idea tank (image taken from <a href="https://hatrabbits.com/en/brainstorming-mistakes-part-two/">https://hatrabbits.com/en/brainstorming-mistakes-part-two/</a>)</figcaption></figure><p>One of the main challenges I’ve experienced in the time since I started coding late last year has very little to do with the actual writing of code. Even though I’ve always thought of myself as creative and innovative, that self-assessment has been put through the ringer almost every time I try to brainstorm my next portfolio project. While building a classic to-do app is great practice, it’s not exactly a fun or fresh idea. That’s why I decided to come up with a short list of coding projects that you can use for your next web app. These are intentionally broad ideas intended to be adjusted based on the interests and focus of the developer building them. I am a strong believer that the best apps have a bit of your personality in them too!</p><h4>1. Choose Your Adventure</h4><p>Interactive movies/stories seem to be gaining popularity in the past few years. Netflix’s Black Mirror: Bandersnatch and Unbreakable Kimmy Schmidt: Kimmy vs. the Reverend are a few recent movies in this field that come to mind. Your audience will immerse themselves in creating complex, non-linear stories.</p><h4>2. Teaching app for kids</h4><p>I’m not a parent, but I’m pretty sure there are few things that make a mom or dad happier than when their kid is having fun while learning. Make an app that helps accomplish just that. There are so many ways you can take this, from geography to languages to math.</p><h4>3. Money app</h4><p>Budgeting, banking, bulk-buying, bargaining, and the list goes on — There’s a whole plethora of things you can do with a money app. One great thing about this type of app in particular, almost everyone can benefit from it (plus, you’ll have no problem tracking down eager friends to “test” out your creation).</p><h4>4. User-generated… something!</h4><p>Whether it’s a superhero, a virtual pet, a town, or really anything else. People love customizing, and whoever uses your app will be excited to put their own spin on the “something”.</p><h4>5. Boredom Breaker — short activities to fill the time</h4><p>Create an app that randomizes 5–10 minute puzzles, games, stories, etc. for your audience to enjoy. Let your user get sucked into short, engaging activities to occupy their mind. This can double as an stress/anxiety reducer!</p><h4>6. Activism</h4><p>There’s so many problems in the world. As web developers, we have an opportunity to design tools that can make a difference. Make an app that assists local charities, promotes grass-roots fundraising for causes, or helps users organize events.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f17b23540c0f" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/brainstorming-your-next-coding-brainchild-f17b23540c0f">Brainstorming Your Next Coding Brainchild</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Half-full or half-empty? A quick look at Optimistic vs. Pessimistic Rendering]]></title>
            <link>https://bentagtow.medium.com/half-full-or-half-empty-a-quick-look-at-optimistic-vs-pessimistic-rendering-dd73f24cc1bd?source=rss-f536d7dc966a------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd73f24cc1bd</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[full-stack-development]]></category>
            <dc:creator><![CDATA[Ben Tagtow]]></dc:creator>
            <pubDate>Mon, 06 Jan 2020 18:24:18 GMT</pubDate>
            <atom:updated>2020-02-21T19:26:42.718Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*HKEU-emlRxfr45dx.jpg" /><figcaption>Being an optimist is rarely viewed as a negative trait. In UI rendering, however, there are times when pessimism is the way to go.</figcaption></figure><p>Quick confession… I’m a bit of a news addict. I’m not biased about it, I’ll read nearly any type, from news about my favorite sports teams to the latest updates on the upcoming election. I’ll even occasionally stray to topics on the very fringes of the “news” category, such as this BuzzFeed article about <a href="https://www.buzzfeed.com/sydrobinson1/weekly-dog-posts-january-6-2020?origin=web-hf">18 Adorable Dog Posts To Spread The Good Vibe Gospel This Week</a>.</p><p>Unfortunately and for no good reason, I all-too-frequently also find myself scouring the comments of these articles. This undoubtably means running across a pointless argument between two people who would never be this confrontational in person and clearly aren’t doing a good job of convincing anyone to come over to their side. Yet, again for no good reason, if I agree with one person and disagree with the other I’m always willing to tap that <em>like</em> or thumbs-up key as a tiny validation to the argument I support.</p><p>The point of this article is to examine what happens when I hit that like key. Frankly, the process is pretty uninteresting: I tap the <em>like </em>button and the webpage updates to display the new running total of “likes” and to offer the client an <em>unlike</em> option. That’s it. Generally, the client-experience in this situation boils down to speed. Therefore, if that <em>like</em> happens almost instantaneously, the client is satisfied. But this is 2020 so if it takes a few seconds, that can be enough to irritate the client and possibly push them away from your website. So how can a developer maximize speed and thus improve the client-experience? That’s where optimistic rendering comes in.</p><p>The easiest way to describe optimistic rendering is to first touch on its alternative: <em>pessimistic rendering</em>. When web-pages render pessimistically, they work like this:</p><p>1 — A client performs an action, such as a click, which sends an HTTP request to the server.</p><p>2 — The server processes the request and returns a response.</p><p>3 — The client’s application is changed based on this response.</p><p>To demonstrate how this looks, I’ll use the comment-liking action I mentioned earlier (as a note, “likes” would typically not render pessimistically because, again, that would cause an unwanted delay for the client). Here’s how it would look, however:</p><p>1 — I click “like” on a comment.</p><p>2 — My “like” is sent to the website’s server.</p><p>3 — Once the server processes the request and returns a response, the page is updated to reflect my additional like on the comment (assuming it was successful).</p><p>So that’s pessimistic rendering. What’s the difference, you ask? Well, essentially <em>optimistic rendering</em> removes the hold-up in the flow. Rather than calling to the server and forgoing future action until a response is received, the client’s application will render immediately and simultaneously with the call to the server. As the client makes a request, the client’s application will optimistically assume that that request was successful before it has received received a response from the server, eliminating the wait time that is caused by the call to the server. As compared to the pessimistic process, the optimistic process works like this (changes are in bold):</p><p>1 — A client (or user) makes a request to a page via an action, such as a click.</p><p><strong>2 — The webpage is rendered to display the results of the client’s action. (I.e. adding and displaying an additional “like” and changing the button to an unlike option.)</strong></p><p>3<strong> </strong>— Based on the client’s action, a corresponding call is sent to the server.</p><p>4— The server processes the request and returns a response.</p><p><strong>5 — If the request failed, the client’s page may again update or they may receive an error message.</strong></p><p>There are appropriate times to use either optimistic or pessimistic rendering. While optimistic is often more client-friendly, there are certainly times when it is not a preferred option. For example, if a client is purchasing a ticket to a baseball game, it may not (or definitely wouldn’t) be a great idea to display “Your purchase was successful!” before the purchase has actually gone through. This preference for pessimism extends to almost any transaction on the web.</p><p>The moral of the story: in terms of a general approach to life, optimism is the way to go. When developing features for full-stack apps, however, I’d recommend allowing yourself a little more leeway to weigh the merits and drawbacks of optimistic vs. pessimistic rendering for your specific situation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd73f24cc1bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>