<?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: Matthew Shin</title>
    <description>The latest articles on DEV Community by Matthew Shin (@mshin1995).</description>
    <link>https://dev.to/mshin1995</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%2F145049%2F4e36358f-2d9c-49fe-ba62-b610ee602b15.jpg</url>
      <title>DEV Community: Matthew Shin</title>
      <link>https://dev.to/mshin1995</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mshin1995"/>
    <language>en</language>
    <item>
      <title>Basic Javascript: Removing Elements from an Array</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Tue, 10 Sep 2019 23:44:53 +0000</pubDate>
      <link>https://dev.to/mshin1995/basic-javascript-removing-elements-from-an-array-22pk</link>
      <guid>https://dev.to/mshin1995/basic-javascript-removing-elements-from-an-array-22pk</guid>
      <description>&lt;p&gt;I am back again this week to cover another fundamental topic on Javascript. I will be going over various ways to remove elements from an array. Although the topic is simple enough, I often find myself mixing up certain methods and what each of them actually do. By writing this guide, hopefully I will be able to further solidify my knowledge on these methods and help anyone else out who might be in the same situation.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. shift()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;breads&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;wheat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ciabatta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;sourdough&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;brioche&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;breads&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shift&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// returns wheat&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;breads&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [ciabatta, sourdough, brioche]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Using the shift method removes the first element in an array. It returns the first element and completely modifies the original array.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. pop()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;apple&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;banana&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;kiwi&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;orange&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;// returns orange&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [apple, banana, kiwi]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Using the pop method removes the last element in an array. It returns the last element and completely modifies the original array.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. splice()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;cars&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Toyota&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Ford&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Jeep&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;BMW&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;cars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns [Ford]&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cars&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [Toyota, Jeep, BMW]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The splice method can be used to remove or add elements in an array. The first argument is the index location at which elements are to be removed or added. The second argument is the number of elements to be removed from the array. In the example above, the arguments call for one element at index one to be removed. This method returns a new array with the removed element and modifies the original array.&lt;/p&gt;

&lt;p&gt;Using this method, you can remove a range of elements from an array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;heroes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Superman&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Batman&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Spiderman&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Ironman&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Thor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Hulk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Flash&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;heroes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns [Spiderman, Ironman, Thor, Hulk]&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;heroes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [Superman, Batman, Flash]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;4. slice()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;shoes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Nike&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Adidas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Reebok&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Jordan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Vans&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="nx"&gt;shoes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// returns [Adidas, Reebok, Jordan]&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;shoes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// [Nike, Adidas, Reebok, Jordan, Vans]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The slice method can be used to remove elements from an array without modifying the original array. The first argument specifies the starting index location and the second argument specifies the ending index location(the end is not included).  A new array object will be created using the elements within the range of those indexes. &lt;/p&gt;

&lt;p&gt;I hope this was helpful to anyone just starting to learn Javascript or to those who needed a refresher on a simple, but important topic. Let me know if there are any other methods that I missed out on. Thanks for reading!&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Basic Javascript: Removing Duplicates from an Array</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Wed, 04 Sep 2019 02:45:02 +0000</pubDate>
      <link>https://dev.to/mshin1995/back-to-basics-removing-duplicates-from-an-array-55he</link>
      <guid>https://dev.to/mshin1995/back-to-basics-removing-duplicates-from-an-array-55he</guid>
      <description>&lt;p&gt;As someone who is currently looking for a software developer job, I know just how important it is to have a solid foundation when it comes to coding. Although practicing for coding challenges that test these fundamentals might not be the most exciting, they are definitely practical by making your brain think in different ways. I thought that it would be helpful for me personally and for anyone reviewing for those technical interviews to go back to the basics and touch on some core topics. For this week, I wanted to come up with multiple ways to remove duplicates within an array.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. filter()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;removeDuplicates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;2. forEach()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;removeDuplicates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
  &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checks to see if each element in the array is unique.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Set&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;removeDuplicates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Creating a new Set stores unique elements from the array. The easiest way in my opinion&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. map()&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;removeDuplicates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; 
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Maps through the array and adds unique elements to a new array.&lt;/p&gt;

&lt;p&gt;I hope some people found this helpful! What are some other solutions that you guys can think of?&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A Basic Introduction to APIs</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Wed, 15 May 2019 00:10:27 +0000</pubDate>
      <link>https://dev.to/mshin1995/a-basic-introduction-to-apis-27a0</link>
      <guid>https://dev.to/mshin1995/a-basic-introduction-to-apis-27a0</guid>
      <description>&lt;p&gt;Ever since I started coding a few months ago, I have heard the three letters API being thrown around. For those who have experience with programming, it is a very familiar term, but what exactly is it? My first experience with an API actually came from my very &lt;a href="https://github.com/njenga-kariuki/module-one-final-project-guidelines-seattle-web-career-021819" rel="noopener noreferrer"&gt;first coding project&lt;/a&gt;. For this project, my partner and I were given the task of building a CLI application. The application utilized a NBA stats API and would return the stats of any player that a user would input in the terminal. At this point in time, I thought APIs were simply databases that you could pull information from. This is a common misconception for new users considering APIs are regularly used to fetch data. However, the API is not where the actual data is coming from.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is an API?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;API is an acronym that stands for Application Programming Interface. More specifically, the definition is "a set of functions and procedures allowing the creation of applications that access the features or data of an operating system, application, or other service". It isn't actually a database, but rather a part of the server that allows different applications to communicate with one another. APIs act as a middle man with the responsibility of receiving requests and returning responses. An easy way to think about this is to imagine the flow in a restaurant. You the customer(your application) orders a meal through the waiter(API), who then relays your order to the kitchen(the system). The kitchen makes the food(response) and the waiter brings it back to you. It is important to point out that these responses are not strictly limited to just data and that different APIs can be used for various purposes.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F7pdjzuspuyyg0spmc03b.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F7pdjzuspuyyg0spmc03b.png"&gt;&lt;/a&gt;&lt;/p&gt;

Flow of using an API




&lt;h2&gt;
  
  
  &lt;strong&gt;Common Types of APIs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One of the most commonly used types of APIs are web APIs. Web APIs allow different applications to communicate and connect with each other through the Internet. Many of these are based around the HTTP protocol, which means they can be accessed by almost all programming languages. Web APIs can further be categorized into public and private. Public APIs are generally available to anybody who wants to use them. Private APIs, however, restrict their access to the general public. These APIs are usually used by companies and require a key for access. Access can be bought depending on the API. Another type is library-based APIs. Like the name states, this type references a library of code or functions that can be used to create connections between different applications.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8nk2plbis51kkuz9hi78.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F8nk2plbis51kkuz9hi78.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why use an API?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One reason that APIs should be used is, because they makes applications more efficient. When considering just data, rather than having your application collect data on its own, using an API that has already collected the data you are looking for and retrieving it saves a lot of time and effort. APIs are also useful when you want to use preexisting functionalities within your application rather than creating them from scratch. Other than streamlining your applications, APIs provide another layer of security by acting as a gate when information is being passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Takeaways&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Taking into account all the benefits of using APIs, I highly recommend using them whenever you get the chance to. However, not all APIs work in the same way. From personal experience, I can confidently say that some are better than others. Before using a specific API, I would definitely look over it to see if it will actually be beneficial to whatever you are planning to use it for. Thanks for reading!&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fz7vk5ldiapajjsq1k68a.gif" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fz7vk5ldiapajjsq1k68a.gif"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>programming</category>
      <category>database</category>
    </item>
    <item>
      <title>Making a Video Game Using Phaser</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Wed, 01 May 2019 22:08:58 +0000</pubDate>
      <link>https://dev.to/mshin1995/making-a-video-game-using-phaser-44m5</link>
      <guid>https://dev.to/mshin1995/making-a-video-game-using-phaser-44m5</guid>
      <description>&lt;p&gt;Last week I was given the task of creating a single page application for a class project using a Javascript frontend with a Rails backend. After some brainstorming on what exactly I could build, I decided to attempt to create a video game. Ever since I could remember I was playing video games, whether they were simple flash games on websites or bigger ones on specific consoles. I have always wanted to learn about how these games were made, but had no knowledge on the subject for the longest time. Now that I had a couple months of coding experience under my belt, I thought that it was a good time to explore the surface of video game development. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Phaser?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;While researching how to actually create a video game using Javascript, I found that there were various ways to do so. One of the more popular methods was to use the canvas that was provided in Javascript to act as the window for the game itself. I also learned that the whole process behind writing code to deal with the physics aspect of the game was tedious and quite difficult to do, especially in a week. This is when one of my fellow classmates suggested using something called Phaser to lighten the burden on my end during this whole process. Phaser is a free, open-source framework that uses Javascript and specifically caters to video game development. It is data-oriented and provides users with a full body physics system, so that they don't have to code that part themselves. It also comes with essential elements needed to create a functional game such as input control and a mechanism to animate images whether they are static or dynamic.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conceptualization&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To begin the project, I first had to come up with an idea of what the game should actually be about and how it should function. As some of you may know, there is a hidden game on Google Chrome when there is no connection to the Internet. It is an infinite scroller where users control a dinosaur and try to avoid obstacles while earning points the longer they stay alive. I decided to take this concept and make my own version of it called Dino Dash. As a single page application, I wanted users to be able to enter their name when they first visited the site, transition to the actual game after, and finally have their scores saved to a table once they were finished.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;Frontend&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Included in the frontend is an index.html file which is used to render the initial page that users see to input their names. It also has all the Javascript files for the entire game. I decided to organize the game into three key files title.js, game.js, and main.js. &lt;/p&gt;

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

&lt;h4&gt;
  
  
  &lt;strong&gt;title.js&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Starting with title.js, like the name states, this file is responsible for the opening scene of the game. It renders a play button that once pressed moves on to the next scene in game.js.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;game.js&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Within game.js is where the essential code that makes the game actually function is located. The code within this file is split up into three components that Phaser gives us. These components are preload, create, and update, which run in that exact order when initialized. The preload part of this file is responsible for loading in all the assets that the game will utilize. These include anything from images, spritesheets, and sounds. &lt;/p&gt;

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

Spritesheet for character




&lt;p&gt;The create component is where the assets that got loaded are actually rendered and displayed to be seen. It is also where the logic behind the game is programmed, such as what position the player should start at, what objects should be able to collide with one another, or what event is triggered upon certain objects colliding. Moving on, the update component includes the functionality of the game. An action caused by the player will trigger an event associated with that action and update. The most common example of this functionality would be if a player pressed down on the right arrow key, the action will trigger an event that updates the position of the character to the right. Including animations for this event will make the position updating even more seamless.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;Preload&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;load&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;spritesheet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;doux&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assets/sprites/doux.png&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;frameWidth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;23.8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;frameHeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;17&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;Create&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;player&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;physics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sprite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;450&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;doux&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="err"&gt;#&lt;/span&gt;&lt;span class="nx"&gt;Update&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;cursors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;keyboard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createCursorKeys&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;anims&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;play&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;run&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cursors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isDown&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setVelocityX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;player&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;flipX&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

Preload, create, and update for character






&lt;h4&gt;
  
  
  &lt;strong&gt;main.js&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The final file main.js is what brings everything together. It is where the entire game is initialized in an html canvas using the two files above. Both title.js and game.js are imported as two separate scenes then combined. This is also where I decided to write my fetch requests. One of them gets existing usernames and their scores from the database in the backend and sorts for the top ten scores to display on the table. The other fetch posts a new user with a score of 0 to the database when they initially enter their name on the home page. Within game.js is another fetch request that posts a user's new score to the database once they restart the game upon death. &lt;/p&gt;

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

[Left] Title Scene, [Right] Game Scene




&lt;h2&gt;
  
  
  &lt;strong&gt;Backend&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Working on the backend was a lot simpler and more straightforward than working on the frontend. It was made using Rails with the sole purpose of creating users and saving them and their scores to the database. The backend was deployed using Heroku and the frontend fetches data using the provided url. &lt;/p&gt;

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

&lt;p&gt;Overall, I had a great time finishing this project and learning more about game development. Although I used Phaser for a lot of the heavy lifting, I still felt that my knowledge of Javascript improved. I started to learn React earlier this week and I was pleasantly surprised to find that my experience using Phaser was somewhat applicable, especially in the importing and exporting of files. The preload, create, and update functions that Phaser give are also similar to how lifecycle methods work in React. Moving forward, I definitely want to try making different types of video games using Javascript.&lt;/p&gt;

&lt;p&gt;Check out my code: &lt;br&gt;
&lt;a href="https://github.com/mshin1995/DinoDash" rel="noopener noreferrer"&gt;https://github.com/mshin1995/DinoDash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Play the game: &lt;br&gt;
&lt;a href="https://mshin1995.github.io/DinoDash/" rel="noopener noreferrer"&gt;https://mshin1995.github.io/DinoDash/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to play:&lt;br&gt;
-Use arrow keys to move/jump&lt;br&gt;
-Eat meat for extra points&lt;br&gt;
-Avoid bombs&lt;br&gt;
-Stay alive&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>javascript</category>
      <category>rails</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>Piracy on the Web</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Mon, 08 Apr 2019 20:04:04 +0000</pubDate>
      <link>https://dev.to/mshin1995/what-is-piracy-and-how-does-it-work-7kp</link>
      <guid>https://dev.to/mshin1995/what-is-piracy-and-how-does-it-work-7kp</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;My Experience&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ever since I started using computers and the internet, I can clearly remember knowing about this thing called piracy. My initial experiences with it came as a child using LimeWire to download music for free without knowing that what I was doing was illegal and had dangerous consequences. Luckily, my journey as an online pirate came to an abrupt end after being grounded for loading the family computer full of viruses. Thinking back on that time, I knew that I was downloading files through the internet, but I had no idea what exactly was happening in the background. I do know now of certain key words related to piracy like "torrent" and "p2p", but my knowledge on the topic is still very minimal, which is why I wanted to explore it a bit more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qXxJdpfR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/no6kj6mpbbxoig2fes60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qXxJdpfR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/no6kj6mpbbxoig2fes60.png" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Online Piracy?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Online piracy is essentially the unauthorized copying, distributing, and selling of licensed and copyrighted materials from the Internet. Whether you are the one who is uploading this type of material or the one who is downloading it, anyone that participates in this action is at fault and liable for their actions. The three most common forms of online piracy are music, software, and movie. For the majority of people who partake in online piracy, their main goal is to obtain goods that they would usually pay money for for free. One piece of information to consider is if it is a digital file, it can be pirated.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How Does it Work?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So how exactly does pirating work? There are actually a couple different methods, but the most popular involve what is known as peer-to-peer(p2p) file sharing. A peer is anyone that is involved in the sharing of files between one another. LimeWire was an example of a traditional p2p program. Like the name states, these programs allow users to share their files with other users. In the case of LimeWire, users would upload and download full files through digital transmission, which were oftentimes full of viruses (I wish I've known about this sooner). Nowadays, these traditional programs have been deprecated for the use of torrents and BitTorrent.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SKBQ4CkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/h21ycz0zhgo32v7er52z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SKBQ4CkQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/h21ycz0zhgo32v7er52z.png" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;
p2p file sharing is much faster without the need to go through a server




&lt;h2&gt;
  
  
  &lt;strong&gt;What is a Torrent?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I guess the next step is to elaborate on what a torrent is. Unlike traditional programs where you would share full files, you can now create a torrent file which stores metadata or pieces of those files. These torrents can be considered as the keys to initiating the download of the actual content. By using a BitTorrent client, users are able to then unpack the pieces of data included in the torrent file, which are then reassembled to create the original file. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;BitTorrent&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The sharing of information between individuals also becomes much faster with the introduction of torrents and the BitTorrent protocol. When creating a torrent, a tracker is added along with the file. This tracker acts as a server that provides new peers with a list of peers that have already downloaded or are downloading individuals files included in the torrent file. The BitTorrent client then uses the tracker as a server to talk to those peers in the list and begins to download pieces of the torrent file through multiple people at once. Simply speaking, torrent files include separate parts that make up the whole content. Users are able to download the parts that they don't have through those that do, while simultaneously sharing the parts that they do have with other peers, making the process much faster and more efficient. Common terminology used for peers are seeders, those that are uploading data, and leechers, those that are downloading data. People using this method to pirate will most likely be doing both actions at the same time. The image below illustrates this whole process. Individual members of the Beatles(peers) each have parts of a song(parts of a torrent file) that are downloaded and then put together to produce the full song(torrent file). It is really interesting to read about all the negative connotations surrounding torrenting, since it is mainly used for piracy. However, not all torrents are illegal and I do see the benefits of using p2p file sharing for legal purposes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ni84XW6J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tterum7u4lsew9cqc6xa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ni84XW6J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tterum7u4lsew9cqc6xa.jpg" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Dangers&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;After doing research on this topic, I can see why online piracy might be appealing to some, because in all honesty, it isn't very hard to do. Although I wouldn't recommend it, because there are actual dangers and consequences associated with partaking in piracy. Not only can it get you into a lot of legal trouble, but the act of sharing data across the internet with unknown peers puts you at risk for getting personal information about you stolen. Despite these risks, if you still want to dabble in file sharing, I would recommend learning more about it and probably using a VPN to have some sort of security.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>discuss</category>
      <category>writing</category>
      <category>torrent</category>
    </item>
    <item>
      <title>A First Attempt at Making Art with Code</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Thu, 21 Mar 2019 04:19:15 +0000</pubDate>
      <link>https://dev.to/mshin1995/a-first-attempt-at-making-art-with-code-43j0</link>
      <guid>https://dev.to/mshin1995/a-first-attempt-at-making-art-with-code-43j0</guid>
      <description>&lt;p&gt;To follow up on my first blog post, I wanted to learn about how to actually produce some sort of visual arts through a coding language. After doing some research on the subject, I discovered a program called Processing, which allows its users to do exactly that. This is by no means an in-depth tutorial, but rather my experience exploring this topic.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Processing?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Processing is an open-source software program created by MIT graduate students, Ben Fry and Casey Reas, initially designed around learning to code within the context of the visual arts. The program provides an Integrated Development Environment(IDE) that is able to run code and display the outcomes on a digital sketchbook. Although Processing can be considered on its own as a programming language, it uses the Java language for the most part. However, the program allows users to change the mode to different languages, such as Javascript or Python.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa8zz610sald9jwpyu03h.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa8zz610sald9jwpyu03h.png" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;The Canvas&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An important detail to consider before starting a project is getting to know your canvas. The canvas on the computer is essentially a coordinate system with the points being assigned to a pixel on the screen. However, unlike a traditional coordinate system, this one begins at (0, 0) from the top left corner. To set the size of this canvas, the function &lt;strong&gt;size(x, y)&lt;/strong&gt; is used, easy enough right?&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa4csselbdz6rfkoh95tw.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fa4csselbdz6rfkoh95tw.png" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;

A regular coordinate system and a computer coordinate system




&lt;h2&gt;
  
  
  &lt;strong&gt;Basic Shapes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;I found that a good starting point for making art with code was to get familiar with four basic shapes. These are a point, line, rectangle, and ellipse. Although that doesn't seem like a lot, I was pleasantly surprised at how much you can actually do by using just these four shapes. There are functions for each of these shapes that take in the coordinate points of the canvas as an argument to specify where they will appear. Those functions are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;point(x, y)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;line(x1, y1, x2, y2)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;rect(x, y, width, height)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;ellipse(x, y, width, height)&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Static vs. Interactive&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are two types of sketches you can make through coding. One is static and the other is interactive. Static sketches are made through a series of functions that create one individual, still image. There is no animation associated with this type and it does not require any interactivity with the viewer. Interactive sketches, on the other hand, are made through a series of frames and like the name states, allow viewers to interact with it. These are animated most of the time. &lt;/p&gt;

&lt;p&gt;This is an example of a static sketch that I modeled after a painting by Piet Mondrian along with its code.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Foy3lrfa9wg10bazofuw2.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Foy3lrfa9wg10bazofuw2.png" alt="alt"&gt;&lt;/a&gt;&lt;/p&gt;

On the left is the code version, on the right is the real one





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;285&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;285&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;110&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;325&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;175&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;325&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;165&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;175&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;325&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;215&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;475&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;strokeWeight&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;365&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;325&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;135&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;175&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Setup and Draw&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Coding a static sketch is pretty straight forward in that you can simply write lines of code that will run once and produce a still image. Interactive sketches require a little bit more organization. This is where &lt;strong&gt;void setup()&lt;/strong&gt; and &lt;strong&gt;void draw()&lt;/strong&gt; come into play. Like the name states, void setup is where you write the code that sets everything up, like the size of the canvas for example. Every piece of code within the setup block only runs once at the very beginning. As for all the code in the draw block, those get continuously looped resulting in animations.&lt;/p&gt;

&lt;p&gt;These next two images are examples of interactive sketches that I made along with the code used to create them.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Froo62bqngrte42gc4dm7.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Froo62bqngrte42gc4dm7.png" alt="alt"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;750&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;750&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;draw&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mousePressed&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt; 
  &lt;span class="n"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
  &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mouseX&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mouseY&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;375&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;375&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;mousePressed&lt;/span&gt;&lt;span class="o"&gt;(){&lt;/span&gt;
  &lt;span class="n"&gt;saveFrame&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above images are obviously different, but they were made using the same code. By setting the x and y coordinates of the line to wherever my mouse cursor was, I was able to interact with the program and produce different results based on how I moved my mouse. I also added functions for a mouse click that would reset the canvas to a blank slate as well as capture the image right before it was erased.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Takeaways&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Interacting with this program, I really enjoyed the fact that it didn't take all that much in order to produce a visible result on the screen. It was interesting to see how the code I had written was translated into a visual image. Although I had a great experience with this topic, seeing other people's works made me realize that I had only scratched the surface. Going forward, I hope that I will be able to learn more about coding as a whole, so that I can eventually apply that knowledge towards making more complex works.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Resources&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://processing.org/" rel="noopener noreferrer"&gt;https://processing.org/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>art</category>
      <category>java</category>
    </item>
    <item>
      <title>Finding the Art in Code</title>
      <dc:creator>Matthew Shin</dc:creator>
      <pubDate>Wed, 13 Mar 2019 07:34:41 +0000</pubDate>
      <link>https://dev.to/mshin1995/finding-the-art-in-code-243i</link>
      <guid>https://dev.to/mshin1995/finding-the-art-in-code-243i</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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1rnl3n35usnienq4xc75.jpg" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1rnl3n35usnienq4xc75.jpg" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To begin I wanted to give a brief introduction to who I am. My name is Matthew Shin and I reside in Seattle, Washington. I am a recent graduate from the University of Washington and am currently a software engineering student at Flatiron School.&lt;/p&gt;

&lt;p&gt;For my first blog post, I wanted to write about my experiences with learning to code as someone who comes from an art background. When I graduated from college with a degree in drawing and painting, like many people in my position, I didn’t really know where to take my career. After some deep reflection with myself and family, I decided that it wasn’t necessarily the right time to pursue a career in the arts just yet. Although making that decision was definitely hard, I was optimistic about what was to come next.&lt;/p&gt;

&lt;p&gt;This is where my journey into coding began. A couple of my friends suggested learning it, so I decided to try it out. And to be completely honest, I was very skeptical at first. Most people would never associate coding and painting together, including myself. Not only was it intimidating for me to start learning about something completely new, but my initial thoughts about not being able to apply and utilize the knowledge that I already had became a source for additional pressure. However, after starting my time at Flatiron and being exposed to coding everyday, I realized that coding and painting are actually similar in many ways.&lt;/p&gt;

&lt;p&gt;One reason that I fell in love with art is that there are many ways to do a single thing. Take for example the task of drawing a face. One person could start with the eyes while another starts with the head’s shape, but the end product in this case is always a face; no matter how different it looks from one another. Some may argue that there is a “correct” way to draw a face, but in the end, the artist is the one in control of how they want to come up with a solution.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fzgk1jhum61ny1tzlvq8j.jpg" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fzgk1jhum61ny1tzlvq8j.jpg" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coding is similar in this aspect of having various ways to go about solving a specific problem. Two individuals could be be given the task of creating an application that does the exact same thing, but their codes can (and probably will) look completely different.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;square&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;new_array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
  &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="n"&gt;new_array&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;square&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt; 
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above Ruby code is just a very simple and straightforward way to illustrate this idea that an individual can complete the same task with different lines of code. In this example, there are two methods that take in an argument of an array, written differently, but both squaring each number in the array and returning them.&lt;/p&gt;

&lt;p&gt;Realizing that I was still able to exercise my creativity while coding by having the freedom to solve problems in my own way definitely drew me into it the same way that creating art did. Coding being able to stimulate creativity became even more apparent as I started to work on labs/projects that required greater critical thinking and problem solving.&lt;/p&gt;

&lt;p&gt;Another similarity between coding and painting/drawing that I found interesting was the whole process behind actually creating something. I was able to see this connection by working through my first big project at Flatiron, which was to make a command line database application using Ruby. (I won’t go into depth about this particular project, but feel free to visit &lt;a href="https://github.com/njenga-kariuki/module-one-final-project-guidelines-seattle-web-career-021819" rel="noopener noreferrer"&gt;https://github.com/njenga-kariuki/module-one-final-project-guidelines-seattle-web-career-021819&lt;/a&gt; if interested in seeing what it was.)&lt;/p&gt;

&lt;p&gt;A piece of advice from one of my art instructors in college that really stuck with me when considering starting a new project was to think about artworks as an accumulation of smaller shapes and forms. You don’t immediately paint a masterpiece, you slowly build up to it. These smaller things create the foundation and eventually come together to produce the final result. An easy way to visualize this is through the characters in “The Simpsons”.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhrh0o1wc8hvqqg3jrzqg.jpg" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhrh0o1wc8hvqqg3jrzqg.jpg" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Looking at the above image, individual shapes are first drawn and put together to create what we see as Bart Simpson.&lt;/p&gt;

&lt;p&gt;The process behind creating a command line application was very similar to the steps I would have taken for a painting. Like starting a new painting on blank canvas, this project started with a text editor devoid of any lines of code. Beginning with the conceptualization of an idea to slowly building up the program with lines of code, I began to consider coding as an art form of its own. For me personally, I also think that there is something aesthetic about lines of code when it is presented in front of you.&lt;/p&gt;

&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fax9hh2wfxeq5k620aac1.png" 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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fax9hh2wfxeq5k620aac1.png" alt="Alt text of image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I had to literally compare making a program to making a painting, each individual line of code is like a brush stroke or line drawn. The individual files that consist of these lines of code are like the shapes and forms created by those very strokes or lines. All the files then come together to create the entire program much like the shapes and forms do in a painting. And when all is said and done, the feeling of gratification you get from finishing a coding project you spent hours on is exactly the same as when you finish a painting.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>art</category>
      <category>beginners</category>
      <category>writing</category>
    </item>
  </channel>
</rss>
