<?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: milanwinter</title>
    <description>The latest articles on DEV Community by milanwinter (@milanwinter).</description>
    <link>https://dev.to/milanwinter</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%2F493737%2Fd2b7b6a9-6f05-4ca3-8672-89ee10c589c2.png</url>
      <title>DEV Community: milanwinter</title>
      <link>https://dev.to/milanwinter</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/milanwinter"/>
    <language>en</language>
    <item>
      <title>Making Api Calls through a Rails backend to React frontend</title>
      <dc:creator>milanwinter</dc:creator>
      <pubDate>Fri, 12 Mar 2021 02:00:11 +0000</pubDate>
      <link>https://dev.to/milanwinter/making-api-calls-through-a-rails-backend-to-react-frontend-43bn</link>
      <guid>https://dev.to/milanwinter/making-api-calls-through-a-rails-backend-to-react-frontend-43bn</guid>
      <description>&lt;h1&gt;
  
  
  Why Use Rails?
&lt;/h1&gt;

&lt;p&gt;If you've unsuccessfully tried to make api calls from a React/Js frontend, you may have gotten a CORS error. Well what's happening is that many Apis actually block calls that are made directly from the browser. Well here is where Rails comes in in all of its glory. Using a Rails api backend allows you to make calls to the Api from Rails without running into CORS errors. &lt;/p&gt;

&lt;h1&gt;
  
  
  Setting up Rails-Api
&lt;/h1&gt;

&lt;p&gt;Rails is amazing, in that it can be built as an API only by using the following command. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_svA2LuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0uav7qa42e8we1g24r4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_svA2LuR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0uav7qa42e8we1g24r4.png" alt="Screen Shot 2021-03-11 at 2.15.11 PM"&gt;&lt;/a&gt;&lt;br&gt;
 This command limits what Rails generates in in terms of views and helpers and so on essentially giving you only the things that you need to be able to make your api calls.&lt;/p&gt;

&lt;h1&gt;
  
  
  Hiding the Api-Key
&lt;/h1&gt;

&lt;p&gt;I found that the easiest way to hide your API key is by using the Figaro gem because it basically does all the work for you. All you have to do is add the Figaro gem with the command "$ bundle exec figaro install". The gem will automatically create a file called Application.yml and add it to your gitignore file for you.Next declare your api key within that file like this. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pgrhyH1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22hamqhnfkighjb00wsx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pgrhyH1p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/22hamqhnfkighjb00wsx.png" alt="Screen Shot 2021-03-11 at 5.57.26 PM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now all you have to do is add Application.yml to your gitignore file and your api key is hidden!&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--feOVDWq5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w52z641z8ks2wdmmu7ny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--feOVDWq5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w52z641z8ks2wdmmu7ny.png" alt="Screen Shot 2021-03-11 at 5.37.53 PM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Retrieving the API Key
&lt;/h1&gt;

&lt;p&gt;In order to retrive your api key it's quite simple. You simply have to declare a variable in whatever function you're trying to make the api call. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---hEd7X01--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vn3i6uja02xztzdsx4dp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---hEd7X01--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vn3i6uja02xztzdsx4dp.png" alt="Screen Shot 2021-03-11 at 5.55.49 PM"&gt;&lt;/a&gt;&lt;br&gt;
Now you can interpolate that variable in your api call in whatever way you need! Here is an example!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JjhgooMq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vx04wzw6l8ccy3tlyvat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JjhgooMq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vx04wzw6l8ccy3tlyvat.png" alt="Screen Shot 2021-03-11 at 5.57.52 PM"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;
  
  
  Setting up Your Route
&lt;/h1&gt;

&lt;p&gt;The last thing you want to do is set up a route for you api call. On the last project I worked on, I was making api calls to a weather app to get forecasts for ski resorts that I could send up to my front end. Here is what my custom route looked like to get information to a single. Now because the api needed a specific apiId for each ski resort, I designed my front end in a way that would allow me to get the apiId for each resort through my route. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f1ldFmGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/65pst4cf5o2zn00p137c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f1ldFmGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/65pst4cf5o2zn00p137c.png" alt="Screen Shot 2021-03-11 at 2.21.22 PM"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;And thats all there is to it! Although your api calls may be different, you always want to make sure that you're hiding your api key because if you make a commit and you haven't hidden it, you'll run into issues.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Basics of Big O Notation</title>
      <dc:creator>milanwinter</dc:creator>
      <pubDate>Thu, 11 Mar 2021 19:43:59 +0000</pubDate>
      <link>https://dev.to/milanwinter/basics-of-big-o-notation-4fe2</link>
      <guid>https://dev.to/milanwinter/basics-of-big-o-notation-4fe2</guid>
      <description>&lt;h1&gt;
  
  
  Why worry about Big O?
&lt;/h1&gt;

&lt;p&gt;As someone who has been coding for only a few months, I'll admit the concept of Big O notation was one that I avoided at first because it seemed complicated. When I first started I wasn't trying to figure out the best way to code something I was just trying to figure out code that works. While that's fine when you're first starting out, I soon realized how much faster I could make my code run by refactoring a couple lines or using a different method. And that is essentially why programmers use Big O notation to describe how fast particular code is especially when you start dealing with large data structures. Here I'll go over three main examples O(1), O(n), and O(n²) to give you a basic understanding of what Big O notation is.&lt;/p&gt;

&lt;h1&gt;
  
  
  So what is Big O?
&lt;/h1&gt;

&lt;p&gt;Essentially, Big O is a measurement of how quickly a certain block of code will run based on the input size(n). What do I mean by input size? Take this function for example...&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NkrIKPw9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/um9uui73pl0dcm0pu1yw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NkrIKPw9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/um9uui73pl0dcm0pu1yw.png" alt="Screen Shot 2021-03-10 at 2.21.54 PM"&gt;&lt;/a&gt;&lt;br&gt;
 This function takes in an array and the returns that array. The input size in this case would be the size of the array. So what is Big O? Big O is measuring how fast this function will run if you increase the size of the array that is passed in.&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4Ocf5ieT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jv660o1ko8c1487o2ju7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Ocf5ieT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jv660o1ko8c1487o2ju7.png" alt="Screen Shot 2021-03-10 at 2.26.02 PM"&gt;&lt;/a&gt;&lt;br&gt;
Let's say this is the array we're passing in to our function now. Will the function run slower now? As you may have guessed, the answer is no. In fact this function will have the same run time for pretty much any size of array that we pass in. So how do we get the O notation for this function or any function for that matter? Well the way to visualize this is through the use of graphs. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EJKArRuu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8wlgxaqkr8ti8sbuvl3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EJKArRuu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8wlgxaqkr8ti8sbuvl3.png" alt="images"&gt;&lt;/a&gt;&lt;br&gt;
 If you can think back to when you were learning about equations for graphs, you might remember that for a straight line parallel to the x-axis the equation is y = c. C being a constant. If a function never changes in how fast it operates given the input (n), we know that it will be a straight line at whatever the constant(c) is for that specific function. In Big O terms we call that O(1). Although you can replace the 1 with whatever your constant is, typically in coding 1 is used to show that the function doesn't change in time with a growing input.&lt;br&gt;
Now can take a look at an example that is slightly more complicated, O(n). &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MDBJptsJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tt5t6141cotzwiyqm0v5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MDBJptsJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tt5t6141cotzwiyqm0v5.png" alt="Screen Shot 2021-03-11 at 10.30.20 AM"&gt;&lt;/a&gt;&lt;br&gt;
 As you can see in this function we have a basic for loop that returns each element within the given array. The bigger the array is that we give to this function, the longer it will take for the function to run. Here is a graph that depicts how this function works.&lt;br&gt;
 &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sa7kkZKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfcgv7gehreh19hj89ax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sa7kkZKz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cfcgv7gehreh19hj89ax.png" alt="download"&gt;&lt;/a&gt;&lt;br&gt;
 So the bigger the size of our input(n) the longer it takes for the function to run. The equation for this graph would be y = ax + b or y = an + b. When we think about O notation, what we're searching for is the worst possible outcome or in other words the fastest growing term in our equation. If we take a look at the equation, we know that the fastest growing term is (an). As we increase the value of n (our input) , our value for y (time)  will also increase. Since the coefficient (a) in this equation is dependent on the specific function, we don't have to really worry about it. This leads us to the notation O(n). O(n) basically just means that the function is directly relying on the size of the input(n). &lt;br&gt;
Finally, we'll take a look at O(n²). The best and most common example for this is a nested loop. Here's an example of a very simple nested for loop going through an array and returning all the possible pairs.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yz9L5wwn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7085pc360m15tdmmqvvy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yz9L5wwn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7085pc360m15tdmmqvvy.png" alt="Screen Shot 2021-03-11 at 11.32.24 AM"&gt;&lt;/a&gt;&lt;br&gt;
 Taking a look at the graph for this function, we can see the larger the input, the time exponentially increases.&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bDNdaLH2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82hh6zo9u9z2087qbqyz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bDNdaLH2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82hh6zo9u9z2087qbqyz.png" alt="download-1"&gt;&lt;/a&gt;&lt;br&gt;
 If we take a look at the equation, y =n² + an + c  we can see that it's a quadratic equation. Remember that for O notation we're looking for the worst case scenario and the fastest growing term from the equation which is n² in this case. So our O notation for this function is O(n²). This makes sense cause the function is looping through our array twice. &lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Although O notation gets more complicated with more scenarios, hopefully this gives you a basic understanding of what it is and how it's measured. The biggest thing to remember is that O notation is a measurement of the worst case scenario. We're not so much interested in how time changes when you increase input from 4 to 5, but rather 4 to 1000, or even 10000. Here are some additional resources if you're looking to dive a little deeper into this topic.&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=D6xkbGLQesk&amp;amp;list=PLK98i8lV22KFaHAsAj9aY-XzPX_i-Mz96&amp;amp;index=3"&gt;https://www.youtube.com/watch?v=D6xkbGLQesk&amp;amp;list=PLK98i8lV22KFaHAsAj9aY-XzPX_i-Mz96&amp;amp;index=3&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.digitalocean.com/community/tutorials/js-big-o-notation"&gt;https://www.digitalocean.com/community/tutorials/js-big-o-notation&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Clarifying Object Assign in Javascript</title>
      <dc:creator>milanwinter</dc:creator>
      <pubDate>Tue, 01 Dec 2020 19:16:00 +0000</pubDate>
      <link>https://dev.to/milanwinter/clarifying-object-assign-in-javascript-2anh</link>
      <guid>https://dev.to/milanwinter/clarifying-object-assign-in-javascript-2anh</guid>
      <description>&lt;p&gt;If you're learning javascript you may have come across something called Object Assign and asked yourself what the heck does this do? It seems like it takes in two arguments and blends them together but it can take in more than two arguments as well? &lt;/p&gt;

&lt;p&gt;When I came across Object Assign, the explanations that I found weren't as clear as I had hoped so I thought I'd put the explanation in my own words in the hopes that not only could I understand this topic better but also to help out anyone trying to get a better understanding of how to use Object Assign. &lt;/p&gt;

&lt;h2&gt;
  
  
  What do we use Object Assign for?
&lt;/h2&gt;

&lt;p&gt;As you may have guessed from the name, Object Assign is built-in javascript method that is  all about manipulating and dealing with objects. An object in javascript is basically a hash/{} with key-value pairs. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xb6Xenbr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lf0ki41km7fab81s7z0x.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xb6Xenbr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lf0ki41km7fab81s7z0x.jpg" alt="finalobject"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What Object Assign does is it basically combines two or more objects together and returns one merged object. Although this sounds simple, the way it works is a little bit more complicated than that so let's take a look at what is going on.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is going on?
&lt;/h2&gt;

&lt;p&gt;So how does this method work exactly? Well to start out Object Assign takes in at least two arguments which must all be objects. (Note that it can take in more than two arguments but we'll get to that a little later. )&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dJc9H6Q9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8fvx3cyfpz2slctu6ho8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dJc9H6Q9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8fvx3cyfpz2slctu6ho8.jpg" alt="correcthowitworks"&gt;&lt;/a&gt;&lt;br&gt;
If we console logged the variable meal from above we would get &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hTr4gejD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f6kde2881hkmf0f0mn9k.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hTr4gejD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/f6kde2881hkmf0f0mn9k.jpg" alt="meal"&gt;&lt;/a&gt;&lt;br&gt;
As you can see, meal is just a combination of the two hashes merged together. So how does this happen? Well, the first argument(object) that you pass to this method is considered the "target" object. In other words, everything is being copied onto the first target object and then that modified object becomes the return value. So does that mean the first object changes when we pass it in? Yes!&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xRq-F87M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z9ubqe5dq899oarhm43m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xRq-F87M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z9ubqe5dq899oarhm43m.jpg" alt="desserts"&gt;&lt;/a&gt;&lt;br&gt;
Since desserts was the first object/argument passed in, the key-value pairs from the dinner object were copied and inserted into it. Then it was returned as the value which is what the variable meal was assigned to it. Neat right? Well you might be thinking, what if I don't want to change the first object that I'm passing in? With this method, we can actually pass an empty object as our first argument, therefore leaving our other objects intact.This is where we can start passing in more than two arguments. Here's what it looks like. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--N7ixkr2g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/juobuzuwe2r3haoiuiv9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--N7ixkr2g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/juobuzuwe2r3haoiuiv9.jpg" alt="emptyhash"&gt;&lt;/a&gt;&lt;br&gt;
Now, our first argument (the empty {}) becomes our "target" and the key-value pairs from the other objects you pass in are copied into this empty hash instead of modifying your objects.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mj8ImwId--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t3buxuw3ezteza7i0gye.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mj8ImwId--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t3buxuw3ezteza7i0gye.jpg" alt="allthree"&gt;&lt;/a&gt;&lt;br&gt;
As you can see, our original objects are left untouched and if we wanted to we could keep adding objects as arguments and all the key-value pairs would be copied onto the first target object. Another question you might be asking is what if the two or more objects have the same key? Let's take a look at what happens when that is the case. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G5blB5Yv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kgj6ykkgimje3nru91xd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G5blB5Yv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kgj6ykkgimje3nru91xd.jpg" alt="samekeys"&gt;&lt;/a&gt;&lt;br&gt;
Here you can see that both objects passed in have a key of pie, however the value in the new object is the value from the dinner object.&lt;br&gt;
When two or more objects have the same keys, Object assign will overwrite the key each time it encounters a new object with that key (going from left to right) In other words, if you have multiple objects with the same key, the key-value from the last object passed in will be the one that is used for in the returned object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;There are many different ways you can use ObjectAssign and the ability to create a new hash by modifying existing ones is quite powerful. Here's a way you can use ObjectAssign in combination with map to show you some of the potential of this method. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cHCsPW0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n4aa77h7w7jdf7bnpv3g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cHCsPW0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/n4aa77h7w7jdf7bnpv3g.jpg" alt="complicated"&gt;&lt;/a&gt;&lt;br&gt;
In this example we're mapping over an array of objects, using object assign to modify those objects, and creating a new array with those modified objects. This is just one example, but there are many different ways to use this method and I hope that this has given you the confidence to start using it throughout your code! Thanks for reading, have a great rest of your day!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A new beginning</title>
      <dc:creator>milanwinter</dc:creator>
      <pubDate>Tue, 10 Nov 2020 20:19:27 +0000</pubDate>
      <link>https://dev.to/milanwinter/a-new-beginning-2734</link>
      <guid>https://dev.to/milanwinter/a-new-beginning-2734</guid>
      <description>&lt;p&gt;At the start of this year I was grinding every day at a physical therapy clinic, hoping to start applying to schools right around this time of year. But like many peoples' lives, everything changed when covid hit. Although it's been horrible having to deal with a pandemic for the first time, I do appreciate the opportunities that have arisen from it.&lt;/p&gt;

&lt;p&gt;For all of my life I've been told by my family to pursue some career in the medical field. Unsurprising, since most of my family has some kind of job in the field. My mom and aunt are both nurses, my grandma, and uncle both doctors, and my sister is on her way to becoming a physical therapist. For a very long time in my life I thought I was destined to become a doctor and was eager to follow in the familial footsteps. I was on the right path, studying biology at UCSB but after a couple classes of rough organic chemistry classes and dealing with some mental health issues I decided to take some time off from school. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pZSOSEJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wh6b14sg9w5rj2oegthb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pZSOSEJm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/wh6b14sg9w5rj2oegthb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upon returning, I had realized by then that perhaps being a doctor isn't quite right for me so I switched my focus onto something more realistic. I thought why not follow my sister's footsteps and try to become a physical therapist(PT). Since I had played baseball up until high school and had to do some physical therapy for my shoulder for a couple months, I felt that I had a handle of what a PT does. So I switched my major to psychology and started making up for lost time, hoping to graduate as quick as possible.Within a year I had knocked out most of my pre-requisites for PT school except for a class or two and was ready to graduate. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BNOCtH5d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0jwps4rtccc5qt3vaqnp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BNOCtH5d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0jwps4rtccc5qt3vaqnp.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In order to even think about applying to PT schools however, first I had to start working at a clinic in order to get my required hours. I believe it's recommended to have somewhere between 100-300 hours for most schools that I was interested in applying to so I had a ways to go. Luckily, not long after I graduated and moved back home I was hired at a nice clinic close by and began working within a month of graduation. As aides our duties were actually quite vast. Between, cleaning tables, working with patients, communicating with the front desk and all the therapists, and scheduling the rooms and tables, there wasn't too much downtime during the rush hours. And as a new aide, I was also tasked with learning a whole list of exercises so that I could later be able to teach them to patients. So for the first two months or so I was barely working with the patients besides taking them back at the beginning of their appointments to a specific table. However, once I started working more with patients and started to teach more exercises my enthusiasm for the job slowly started to drop. &lt;/p&gt;

&lt;p&gt;The world of physical therapy seems like it might be full of rainbows and positivity because you're supposedly healing people, but the road to recovery is often surrounded by a storm. The mental aspect of physical therapy isn't often talked about but I now realize just how important it can be. Many people that seek physical therapy are simply defeated from having to deal with chronic pains and motivating them to do exercises when they know it'll be painful can be quite difficult. Often times, a patient's mental struggle with therapy was projected onto the aides or the therapists and although we understood where they were coming from it still feel great when a patient was rude or acting entitled.Anyways, the more I did it the more I just realized that it wasn't for me. And then covid hit like a meteor.&lt;/p&gt;

&lt;p&gt;The clinic I work at was shut down pretty quick with no definitive date of opening up again and I was stuck at home with nothing to do but play games. It was during those first few months that I was introduced to the wonderful world of programming. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EfU1X5gP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pve9n2bqmgnczlbeeizg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EfU1X5gP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pve9n2bqmgnczlbeeizg.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
I began watching some intro-to-coding videos and started to get hooked pretty quick. I had always loved dealing with computers and electronics from a young age, but due to the my family's pressure to become a health professional, I had never even considered a career in programming. The more I considered it, the more I began to feel like it was the great path for me and  within a month or two I was exploring bootcamps and coding programs that I could enroll in. I was able to find Flatiron School, and am currently in phase 2 of the program already 6 weeks in!&lt;/p&gt;

&lt;p&gt;To me coding isn't just about the money or the availability of jobs out there (although it certainly helps :)). Coding is challenging. If it weren't everyone would be doing it.It's more than just writing lines of code for hours on end. It's solving problems with creative solutions. Although when you code you're peaking behind the green curtain and seeing how something works with a lines of a certain language, there is still something magical about working on your code and then seeing it transform into something that works. The possibilities of programming are endless and I think that's what excites me the most about this field. I have the freedom and the ability to learn so much more about anything I want. And that is really something quite special.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why ActiveRecord is Amazing</title>
      <dc:creator>milanwinter</dc:creator>
      <pubDate>Tue, 20 Oct 2020 02:55:22 +0000</pubDate>
      <link>https://dev.to/milanwinter/why-activerecord-is-amazing-5d9a</link>
      <guid>https://dev.to/milanwinter/why-activerecord-is-amazing-5d9a</guid>
      <description>&lt;h1&gt;
  
  
  Intro
&lt;/h1&gt;

&lt;p&gt;Hi there! Are you like me and have recently started your journey into the magical land of coding? Are you feeling a bit overwhelmed by how much this magical land has to offer? Are you learning to use Object Relational mapping and just get tired of writing all the same methods for each individual class? Well then you've come to the right place! I would like to introduce you to my new best friend ActiveRecord. Not only will ActiveRecord take care of those pesky repetitive methods that you've been rewriting over and over again, but it will do it with ease! You will be able to keep your code extremely DRY.(Don't repeat yourself)&lt;/p&gt;

&lt;h2&gt;
  
  
  What is ActiveRecord?
&lt;/h2&gt;

&lt;p&gt;If you've begun learning about object-relational mapping(often referred to as ORM), then a great next step for you is to learn about and start using Active Record. If you haven't heard of it or know very little about it you can learn all about it in great depth here &lt;a href="https://guides.rubyonrails.org/active_record_basics.html"&gt;https://guides.rubyonrails.org/active_record_basics.html&lt;/a&gt;. Essentially, ActiveRecord is gem, which you can add to your code files, that is able to not only create objects and store data within a database, but also contains many built-in methods that allow you to call upon that database and perform different operations on the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is Active Record So Useful?
&lt;/h2&gt;

&lt;p&gt;If you take a look at the website that I linked above and start going through the documentation, you'll notice that there are dozens of methods that you can call upon so instead of having to writing out a bunch of methods in your class that you have to rewrite for each new class that you make, you can use Active Record and omit writing many of those simpler methods and simplify other more complicated methods. For example if your code looked like this before:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1JDOr7Ed--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hgv31a1o8mmz8eyt4hxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1JDOr7Ed--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hgv31a1o8mmz8eyt4hxd.png" alt="ORM screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using ActiveRecord, you could make it look like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kSVPsV5W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0yhnbsc7d66nvcqywun8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kSVPsV5W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0yhnbsc7d66nvcqywun8.png" alt="AR PIC"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By simply making your class inherit from ActiveRecord, it adopts all those methods that are in the documentation and they now become free for you to use within your code. Look at all the empty space! &lt;br&gt;
In addition, ActiveRecord doesn't just interact with your models/classes, it also interacts with your database. You can now fill up a table within a database simply by using ActiveRecord whereas before you would have to write out complicated code involving SQL to do the same thing. Similarly, once you have information within your database ActiveRecord makes it extremely easy to interact with that data and filter it down for whatever results you need.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Methods that Make Active Record So Useful
&lt;/h2&gt;

&lt;p&gt;Learning about object relational mapping may have made you frustrated because for each class you were forced to write the same methods. For example, having a reader/writer method for your arguments is pretty standard in a class as well as having a self.all method that outputs all the objects that belong to a specific class. I'm sure you'd be happy to know that ActiveRecord has build in methods for all of these! Other common methods that ActiveRecord has build in include: where, find, group, having, includes, joins, order, select and many more. These few methods are just a glimpse into what ActiveRecord can do and these methods only deal with working with the data from your database. There are CRUD(create, read, update, delete) methods all built in as well. Although the documentation for ActiveRecord is long and learning the syntax for some of these methods might take a little time to get used to, the potential time you might save by learning how to use this gem is mind boggling. &lt;/p&gt;

&lt;h2&gt;
  
  
  ActiveRecord must cost a fortune and take ages to install!!
&lt;/h2&gt;

&lt;p&gt;You may be thinking that this is all seems too good to be true and that with such an amazing tool it will surely cost lots of money to install and use. But alas, ActiveRecord is a 100% free gem that requires some installations that aren't too lengthy. If you would like a good resource for help on installing this gem I would recommend this website: &lt;a href="https://www.techcareerbooster.com/blog/use-activerecord-in-your-ruby-project"&gt;https://www.techcareerbooster.com/blog/use-activerecord-in-your-ruby-project&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;All in all I think ActiveRecord is simply amazing and has already made my life easier in just the couple days that I've started to use it and my hope is that after you read this you will too. I'd also like to quickly acknowledge just how amazing the programming community is and how thankful I am that there are people out there who write these gems for everyone to use for free because without them we would be all working twice as hard.&lt;br&gt;
Sources:&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
