<?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: Brad Bieselin</title>
    <description>The latest articles on DEV Community by Brad Bieselin (@bradbieselin).</description>
    <link>https://dev.to/bradbieselin</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%2F853839%2F1253d4c1-0c1b-4012-a4fe-e0139770e2d8.png</url>
      <title>DEV Community: Brad Bieselin</title>
      <link>https://dev.to/bradbieselin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bradbieselin"/>
    <language>en</language>
    <item>
      <title>dropDesk - How I made Jira FRIENDLY!</title>
      <dc:creator>Brad Bieselin</dc:creator>
      <pubDate>Mon, 25 Jul 2022 18:32:00 +0000</pubDate>
      <link>https://dev.to/bradbieselin/how-i-made-a-better-jira-20nc</link>
      <guid>https://dev.to/bradbieselin/how-i-made-a-better-jira-20nc</guid>
      <description>&lt;p&gt;Have you ever used Jira? I did for one job, and that is definitely one complicated application to use. In comes &lt;strong&gt;dropDesk&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;dropDesk was the final project I built while enrolled in Flatiron School's Immersive Software Engineering bootcamp. My ultimate goal for my final project was to create some type of ticket system with Jira in mind. What sparked the final idea of dropDesk was when I thought about how much is going on in Jira, and how it can become overwhelming. My solution: make it simple and friendly. The tech stack for this project was a React frontend and a Ruby on Rails backend.&lt;/p&gt;

&lt;p&gt;Let's take a look:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8YzlpLL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/woeh2wtyg17r2xos1c3w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8YzlpLL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/woeh2wtyg17r2xos1c3w.png" alt="Image description" width="880" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  DROP
&lt;/h2&gt;

&lt;p&gt;dropDesk is named after the drag and drop functionality I added to it using the React-Beautiful-DnD library. This library allows you to drag and drop items on the webpage to different parts of the page, which is all configured manually. So, you can only drag and drop into a specific place on the page!&lt;/p&gt;

&lt;p&gt;Create your ticket in the category of your choosing:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wv9H23kR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/314phgdo8433edfrgtzu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wv9H23kR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/314phgdo8433edfrgtzu.png" alt="Image description" width="343" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, drag the ticket between the categories to change it's current category! Simple enough!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OAVgALPA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2v91ovnx8qlgb97kg53w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OAVgALPA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2v91ovnx8qlgb97kg53w.png" alt="Image description" width="880" height="754"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scaling the app
&lt;/h2&gt;

&lt;p&gt;The app is currently still being developed to be a full scale app. The next phase of development for this app is to allow users to create separate teams. What's great about this feature is that you could choose to create a team of your own and use it as a task tracker, or a company can create different teams for within the company which can be moderated by admin users. &lt;/p&gt;

&lt;p&gt;Please feel free to explore the application here: &lt;a href="https://dropdeskapp.herokuapp.com/"&gt;https://dropdeskapp.herokuapp.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The source code can be found here: &lt;a href="https://github.com/bradbieselin/dropDesk"&gt;https://github.com/bradbieselin/dropDesk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If anyone has any questions or suggestions, please comment below! The project is open source as well!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>rails</category>
      <category>dropdesk</category>
    </item>
    <item>
      <title>Flood Fill (Recursion)</title>
      <dc:creator>Brad Bieselin</dc:creator>
      <pubDate>Thu, 14 Jul 2022 15:06:27 +0000</pubDate>
      <link>https://dev.to/bradbieselin/flood-fill-recursion-21ob</link>
      <guid>https://dev.to/bradbieselin/flood-fill-recursion-21ob</guid>
      <description>&lt;h2&gt;
  
  
  Today I came across my first Leetcode graph problem, Flood Fill.
&lt;/h2&gt;

&lt;p&gt;Here is the question:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dd1SpYRT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydmf192w69k8hw7atynp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dd1SpYRT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ydmf192w69k8hw7atynp.png" alt="Image description" width="880" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The goal of the problem is to take a given image, in this case: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TzuhafDi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ujib2bljcnf47ubkwaqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TzuhafDi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ujib2bljcnf47ubkwaqp.png" alt="Image description" width="261" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And &lt;strong&gt;flood fill&lt;/strong&gt; the image starting from a specific pixel (the red 1 in the center).&lt;/p&gt;

&lt;p&gt;Basically we need to replace any of the 1s on the graph with a 2. However if there are any other numbers on that graph (such as 0), we should leave them as they are. &lt;/p&gt;

&lt;p&gt;Once we have replaced all the 1s with 2s, we return the modified image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OI4bn9tz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3uresq3a7incmqzmwbsw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OI4bn9tz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3uresq3a7incmqzmwbsw.png" alt="Image description" width="259" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How do we approach this problem?
&lt;/h2&gt;

&lt;p&gt;Let's take it one step at a time. We first need to recognize that to traverse through this graph, we can use recursion. We will need some recursive function within our algorithm to repeat until our conditions are met.&lt;/p&gt;

&lt;p&gt;Now that we have done that, lets get rid of any possible edge cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var floodFill = function(image, sr, sc, color) {
    if(image === null || image.length &amp;lt; 1) {
        return image;
    }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We know that if the image is null, then we can't do any transformation. Let's return the image if that is the case. If the image is of length 0, we also return the image, as the image is empty.&lt;/p&gt;

&lt;p&gt;Next, we need to store our starting point in a variable. We are given our starting point through the parameters &lt;strong&gt;image, sr, and sc&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var floodFill = function(image, sr, sc, color) {
    if(image === null || image.length &amp;lt; 1) {
        return image;
    }
    let start = image[sr][sc]
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;sr represents the row, and sc represents the column.&lt;/p&gt;

&lt;h2&gt;
  
  
  The recursive function
&lt;/h2&gt;

&lt;p&gt;To begin our recursion, lets create a function that takes in the provided parameters, plus our starting point variable, &lt;strong&gt;start&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var floodFill = function(image, sr, sc, color) {
    if(image === null || image.length &amp;lt; 1) {
        return image;
    }
    let start = image[sr][sc]
    const fill = (image, r, c, color, initCol) =&amp;gt; {}
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With any recursive function, we need a way to break out of the function, which is referred to as the base case. Here is what we will use as the base case:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(r &amp;lt; 0 || r &amp;gt;= image.length || c &amp;lt; 0 || c &amp;gt;= image[0].length || image[r][c] !== initCol) {
     return;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember, &lt;strong&gt;r&lt;/strong&gt; represents rows and &lt;strong&gt;c&lt;/strong&gt; represents columns. If we have no rows, or the row number is greater than the length of the image, we have no possible pixels to transform. This is the same for the columns. &lt;/p&gt;

&lt;h2&gt;
  
  
  Now that we have a base case set up, we can create our recursive logic.
&lt;/h2&gt;

&lt;p&gt;Let's quickly check what all of our code looks like together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var floodFill = function(image, sr, sc, color) {
    if(image === null || image.length &amp;lt; 1) {
        return image;
    }
    let start = image[sr][sc]
    const fill = (image, r, c, color, initCol) =&amp;gt; {
    if(r &amp;lt; 0 || r &amp;gt;= image.length || c &amp;lt; 0 || c &amp;gt;= image[0].length 
        || image[r][c] !== initCol) {
    return;
    }
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's a little trick with this type of problem, which isn't clear at first but makes total sense once you understand how it works.&lt;/p&gt;

&lt;p&gt;The first thing we want to do is set &lt;code&gt;image[r][c] = -1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;br&gt;
Remember in our base case, we &lt;em&gt;return&lt;/em&gt; if &lt;code&gt;image[r][c] !== initCol&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;What we can do with this is replace all the 1s with -1. Then, we run our recursive function. You'll see how it all comes together in just a moment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var floodFill = function(image, sr, sc, color) {
    if(image === null || image.length &amp;lt; 1) {
        return image;
    }
    let start = image[sr][sc]
    const fill = (image, r, c, color, initCol) =&amp;gt; {
    if(r &amp;lt; 0 || r &amp;gt;= image.length || c &amp;lt; 0 || c &amp;gt;= image[0].length 
        || image[r][c] !== initCol) {
    return;
    }
    image[r][c] = -1;
    fill(image, r-1, c, color, initCol);
    fill(image, r+1, c, color, initCol);
    fill(image, r, c-1, color, initCol);
    fill(image, r, c+1,color, initCol);
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We call our recursive function 4 times here, because the problem requires us to change any pixels connected &lt;strong&gt;4-directionally&lt;/strong&gt;. Take a look at each call of &lt;strong&gt;fill()&lt;/strong&gt;. In the first run, we are calling this on r-1, or the row to the left of the start point. We hit our if statement (base case), return, set the 1 to -1, and run the next &lt;strong&gt;fill()&lt;/strong&gt; call. This repeats for r+1, c-1, c+1 so we are moving in all 4 directions and changing our starting point each time, until it is not possible to change anymore pixels. Now all of our 1s are -1s and our 0s still remain.&lt;/p&gt;

&lt;p&gt;Once we have called our recursive function 4 times, we add this final line to the function: &lt;code&gt;image[r][c] = color;&lt;/code&gt;&lt;br&gt;
All this does is replace all the -1s with 2.&lt;/p&gt;

&lt;p&gt;Finally, we call our recursive function and then return our modified image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var floodFill = function(image, sr, sc, color) {
    if(image === null || image.length &amp;lt; 1) {
        return image;
    }
    const initCol = image[sr][sc];
    const fill = (image, r, c, color, initCol) =&amp;gt; {
        if(r &amp;lt; 0 || r &amp;gt;= image.length || c &amp;lt; 0 || c &amp;gt;= image[0].length || image[r][c] !== initCol) {
            return;
        }
        image[r][c] = -1;
        fill(image, r-1, c, color, initCol);
        fill(image, r+1, c, color, initCol);
        fill(image, r, c-1, color, initCol);
        fill(image, r, c+1,color, initCol);
        image[r][c] = color;
    }
    fill(image, sr, sc, color, initCol)
    return image;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can be quite a tricky question, but what's great about this problem is that how we handled moving 4-directionally will apply to any other similar problems!&lt;br&gt;
Give it a try, draw it out on a whiteboard, and good luck!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>algorithms</category>
      <category>recursion</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The sliding window pattern</title>
      <dc:creator>Brad Bieselin</dc:creator>
      <pubDate>Mon, 27 Jun 2022 16:58:22 +0000</pubDate>
      <link>https://dev.to/bradbieselin/the-sliding-window-pattern-3nei</link>
      <guid>https://dev.to/bradbieselin/the-sliding-window-pattern-3nei</guid>
      <description>&lt;p&gt;Depending on the problem at hand, there are patterns that we can follow to help us solve algorithm problems. The sliding window pattern creates a &lt;strong&gt;window&lt;/strong&gt; which can be an array or number from one position to another. The sliding window pattern is very useful for keeping track of a subset of data in an array, string, etc. when the data is continuous in some way. Depending on a certain condition, the window increases or closes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recognizing the sliding window pattern
&lt;/h2&gt;

&lt;p&gt;Again the sliding window pattern is very useful for keeping track of a subset of data. This will often be in an array and the data is continuous. The following is an example problem which can be solved using the sliding window pattern.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Write a function called maxSubarraySum which accepts an array of integers and a number called &lt;strong&gt;n&lt;/strong&gt;. The function should calculate the maximum sum of n consecutive elements in the array.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some example inputs look like this:&lt;br&gt;
&lt;code&gt;maxSubarraySum([1,2,5,2,8,1,5], 2) =&amp;gt; 10&lt;br&gt;
maxSubarraySum([1,2,5,2,8,1,5], 4) =&amp;gt; 17&lt;br&gt;
maxSubarraySum([4,2,1,6], 1) =&amp;gt; 6&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Solving the maxSubarraySum problem
&lt;/h2&gt;

&lt;p&gt;The following solution is of the Time Complexity O(N). Many people may start out by teaching the naïve or "easy" solution. Instead, lets look at this solution which uses the sliding window pattern. If we can understand how this pattern works now, you will start to recognize other similar problems and you will be able to apply the sliding window pattern to those problems as well. You will also get a much better time complexity following this solution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function maxSubarraySum(arr, num) {
  let maxSum = 0;
  let tempSum = 0;
  if(arr.length &amp;lt; num) return null;
  for(let i = 0; i &amp;lt; num; i++) {
    maxSum += arr[i];
  }
  tempSum = maxSum;
  for (let i = num; i &amp;lt; arr.length; i++) {
    tempSum = tempSum - arr[i-num] + arr[i];
    maxSum = Math.max(maxSum, tempSum);
  }
  return maxSum;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;So, what is this solution doing?&lt;/strong&gt;&lt;br&gt;
First we are declaring two variables, maxSum and tempSum. These will be used a bit further down in our code. We have an if statement to check for any edge cases where the array is invalid. &lt;em&gt;Num&lt;/em&gt; is the number with which we need to find the sum in our array. If the number is larger than the length of our array, we can't get a valid sum, and thus we return null.&lt;/p&gt;

&lt;p&gt;Then, we create our first sum. &lt;br&gt;
Let's take this example and pass in 3:&lt;br&gt;
&lt;code&gt;maxSubarraySum([2,6,9,2,1,8,5,6,3], 3)&lt;/code&gt;&lt;br&gt;
We go to the beginning of our array and sum together the first 3 numbers(2, 6, and 9). We store the sum of these numbers in a variable, which we called maxSum. We then set our tempSum equal to maxSum(note we are returning maxSum at the end of the function). We now start another loop. Instead of starting at the beginning, or index 0, we start our loop after the first 3 numbers we already summed together. In this case, we would start at index 3(2).&lt;/p&gt;

&lt;p&gt;Our tempSum is currently storing the value &lt;strong&gt;17&lt;/strong&gt; (2+6+9), and we are going to add 2 (from index 4) and subtract 2(from index 0). If we check our sum again, we still have a value of &lt;strong&gt;17&lt;/strong&gt;. When we iterate through the loop again, we take our tempSum(17), add 1(index 5), and subtract 6(index 1). Our new tempSum is (9+2+1). The last line of our for loop takes the maximum value between maxSum and tempSum. If tempSum is larger than the value of maxSum, we overwrite maxSum's value. Otherwise, we continue looping.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does this solution work with O(N) time complexity?
&lt;/h2&gt;

&lt;p&gt;We could have a million digits, or even millions of digits. The beauty of the sliding window pattern is that we only ever have to loop over our array one time. &lt;/p&gt;

&lt;p&gt;Practice this question and solution. Then, start looking for more sliding window pattern problems. Give this one a shot:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Write a function called minSubArrayLen which accepts two parameters - an array of positive integers and a positive integer. This function should return the minimal length of a contiguous subarray of which the sum is greater than or equal to the integer passed to the function. If there isn't one, return 0 instead.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Examples:&lt;br&gt;
&lt;code&gt;minSubArrayLen([2,3,1,2,4,3], 7) =&amp;gt; 2 ([4,3] is the smallest subarray)&lt;br&gt;
minSubArrayLen([4,3,3,8,1,2,3], 11) =&amp;gt; 2&lt;/code&gt;&lt;/p&gt;

</description>
      <category>algorithms</category>
      <category>leetcode</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Ruby - Inheritance</title>
      <dc:creator>Brad Bieselin</dc:creator>
      <pubDate>Fri, 03 Jun 2022 20:32:31 +0000</pubDate>
      <link>https://dev.to/bradbieselin/ruby-inheritance-j80</link>
      <guid>https://dev.to/bradbieselin/ruby-inheritance-j80</guid>
      <description>&lt;h2&gt;
  
  
  What is Inheritance?
&lt;/h2&gt;

&lt;p&gt;Ruby is an object-oriented programming language, and thus allows for inheritance. This allows the programmer to inherit the characteristics of one Ruby class into another Ruby class, which is called the &lt;em&gt;superclass&lt;/em&gt;. Why would we want this? Well, let's be honest here. &lt;em&gt;Programmers are lazy&lt;/em&gt;. Inheritance allows us to reuse code. Less typing, more happy.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to understand inheritance
&lt;/h2&gt;

&lt;p&gt;In our everyday lives, different things are related to each other in various ways. For example, there are many different brands of "cars" such as Honda, Toyota, Subaru, etc. Though they are different brands of cars, they are still all "cars" that have the same characteristics at their core.&lt;/p&gt;

&lt;p&gt;A less hierarchal example would be a class of "students" and a class of "programmers" and how they interact. Not all students are programmers, but all programmers are students(if we are talking about students in a school).&lt;/p&gt;

&lt;p&gt;This translates very well with Ruby. The use of inheritance in Ruby allows us to create classes that have shared behaviors, while also still having their differences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Super Class and Subclass
&lt;/h2&gt;

&lt;p&gt;The class which is inheriting is a &lt;em&gt;subclass&lt;/em&gt;. A subclass has access to all of the methods of its parent, or &lt;em&gt;super class&lt;/em&gt;. Back to our previous example, "Honda" is a subclass of "car" and so "Honda" is our subclass and "car" is our super class.&lt;br&gt;
From "car" we might inherit that a car has four wheels, or a car is 6 windows. However some cars may be electric, while some may be gas. The use of inheritance in programming allows us to inherit methods that can be useful to many different subclasses, while allowing them to also contain their own unique characteristics.&lt;/p&gt;
&lt;h2&gt;
  
  
  How do we inherit from another class?
&lt;/h2&gt;

&lt;p&gt;There is a very simple syntax to say you want to inherit from another class in Ruby. It looks like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;class Honda &amp;lt; Cars&lt;br&gt;
//Code goes here&lt;br&gt;
end&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We now have access, through inheritance, to whatever is in the "Cars" class!&lt;/p&gt;

&lt;p&gt;We can also find the super class of a class but using the .superclass method:&lt;br&gt;
&lt;code&gt;Honda.superclass&lt;/code&gt; in our example, would return "Car" &lt;code&gt;=&amp;gt; Car&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Using our inherited methods
&lt;/h2&gt;

&lt;p&gt;Now that we have set up our inheritance, we can use the .super method call to refer to methods from our super class for use in our subclass!&lt;/p&gt;

&lt;p&gt;Our example may look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Super Class
class Car
  def name
    puts "Civic"
  end
end

//Subclass
class Honda &amp;lt; Car
  def name
    super
  end
end

car = Honda.new
car.name

=&amp;gt; Civic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ruby</category>
      <category>objects</category>
      <category>inheritance</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Client-Side Routing vs. Server-Side Routing with React Router</title>
      <dc:creator>Brad Bieselin</dc:creator>
      <pubDate>Fri, 13 May 2022 18:55:46 +0000</pubDate>
      <link>https://dev.to/bradbieselin/client-side-routing-vs-server-side-routing-with-react-router-l79</link>
      <guid>https://dev.to/bradbieselin/client-side-routing-vs-server-side-routing-with-react-router-l79</guid>
      <description>&lt;p&gt;&lt;a href="https://media.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%2Foktqpdbb79t30sdjwrrz.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Foktqpdbb79t30sdjwrrz.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
If you are going to be building websites, it's clear you will need to learn routing. It is fundamental in web development and nearly every site you visit will change it's URL as you navigate through the site. When first learning React and creating single page applications, you will see that creating routes is not required to make a functional application. However, once you discover routing, you will never not use it again.&lt;/p&gt;

&lt;p&gt;While all websites are connected to a server and a lot of the time routing is handled server-side, frameworks like React have great ways to also handle routing client-side.&lt;/p&gt;

&lt;h2&gt;
  
  
  So, what is routing?
&lt;/h2&gt;

&lt;p&gt;Routing is the mechanism by which requests are routed to the code that handles them. These requests are specified by a URL and protocol method(HTTP). Essentially, you the router will determine what will happen when a user visits a specific URL. &lt;/p&gt;

&lt;p&gt;Sound familiar? We see this every day when browsing the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server-Side Routing
&lt;/h2&gt;

&lt;p&gt;Server-side routing is still the most common way of handling requests. &lt;br&gt;
Server-side routing looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user clicks a link that requests a new page and new data from the server.&lt;/li&gt;
&lt;li&gt;The server responds with the requested content.&lt;/li&gt;
&lt;li&gt;The content refreshes on the browser.&lt;/li&gt;
&lt;li&gt;The URL is updated to reflect the request and content on the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Client-Side Routing
&lt;/h2&gt;

&lt;p&gt;Client-side routing is when the route is handled by the Javascript that is loaded to the page. It's process differs from server-side routing. Let's take a look:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user clicks a link and the URL changes.&lt;/li&gt;
&lt;li&gt;The URL change represents the state change in the application.&lt;/li&gt;
&lt;li&gt;NOTE: The whole page does not refresh. Only the component/data with a state change re-renders.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  React Router
&lt;/h2&gt;

&lt;p&gt;When using React, we have access to an amazing library called React Router. React Router allows us to do both server-side and client-side routing. &lt;/p&gt;

&lt;p&gt;So which routing method should we use? Well, each has it's pros and cons. There's no best method to how you route, and you will need to decide which method best fits your needs.&lt;/p&gt;

&lt;p&gt;Typically client-side routing is preferred for fast routing between components, since less data is loaded on each change. Server-side routing is fast on page load, and you will get the exact data you requested. Most browsers are optimized for server-side routing because it has been the more common method for a longer period of time. &lt;/p&gt;

&lt;p&gt;Do you want client-side routing?&lt;br&gt;
All you need to do is install the library and wrap your content in the &lt;code&gt;&amp;lt;BrowserRouter&amp;gt;&lt;/code&gt; tag, and then create some Routes.&lt;br&gt;
Then, &lt;code&gt;&amp;lt;Link&amp;gt;&lt;/code&gt; is used to set the URL and keep track of browsing history.&lt;/p&gt;

&lt;p&gt;Do you want server-side routing?&lt;br&gt;
Instead of wrapping your content in the &lt;code&gt;&amp;lt;BrowserRouter&amp;gt;&lt;/code&gt; tag, you  need to use the &lt;code&gt;&amp;lt;StaticRouter&amp;gt;&lt;/code&gt; tag and use ReactDOMServer.renderToString instead of ReactDOM.render.&lt;/p&gt;

&lt;p&gt;For more information, check out the docs: &lt;a href="https://reactrouter.com/docs/en/v6" rel="noopener noreferrer"&gt;https://reactrouter.com/docs/en/v6&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>routing</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
