<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Matt Shelley on Medium]]></title>
        <description><![CDATA[Stories by Matt Shelley on Medium]]></description>
        <link>https://medium.com/@mattscripted?source=rss-29fbc8ee048e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*m3vTxRV4b6-NpQN4NIX1PQ.jpeg</url>
            <title>Stories by Matt Shelley on Medium</title>
            <link>https://medium.com/@mattscripted?source=rss-29fbc8ee048e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 00:00:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mattscripted/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to prioritize your learnings]]></title>
            <link>https://mattscripted.medium.com/how-to-prioritize-your-learnings-ae8b4d5b4353?source=rss-29fbc8ee048e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae8b4d5b4353</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[Matt Shelley]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 11:37:59 GMT</pubDate>
            <atom:updated>2021-06-01T11:39:55.503Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D22d3wY7AVIUXXVg" /><figcaption>Photo by <a href="https://unsplash.com/@markuswinkler?utm_source=medium&amp;utm_medium=referral">Markus Winkler</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In <em>The Clean Coder</em>, Robert C. Martin emphasizes that we are responsible for our careers. We must <em>practice</em> outside of work, so we can <em>perform</em> at work. It is our responsibility to learn new skills to further our careers.</p><p>Taking his lesson to heart, I use a skills matrix to guide my learnings, so I can level up from where I am today to where I want to be tomorrow.</p><h3>First, create a skills matrix</h3><p>Create a skills matrix spreadsheet with at least the following columns:</p><ul><li><strong>Skill:</strong> The name of the skill</li><li><strong>Importance:</strong> How necessary the skills is to your current and future positions</li><li><strong>Current Level:</strong> Where your ability currently stands</li></ul><h3>Second, identify skills</h3><p>Review job postings, developer profiles, blog posts, and anywhere else skills may be listed for both your current and desired positions.</p><h3>Third, identify skill importance</h3><p>Research each skill to identify how important it is to your current and future positions.</p><ul><li><strong>Low:</strong> I won’t use this skill often, if at all</li><li><strong>Medium:</strong> I think this skill is good to know</li><li><strong>High:</strong> I will use this skill regularly</li></ul><h3>Fourth, identify your current skill levels</h3><p>Reflect on each skill to identify your current skill level.</p><ul><li><strong>Zero:</strong> I don’t know this skill at all</li><li><strong>Low:</strong> I have a high-level understanding of this skill, and could struggle through it</li><li><strong>Medium:</strong> I can use this skill regularly</li><li><strong>High:</strong> I can use this skill with confidence</li></ul><h3>Fifth, prioritize skills to learn</h3><p>Review each skill, considering its importance and your current skill level.</p><ul><li>Where are the largest skill gaps?</li><li>Which skills are easier to learn?</li><li>Which skills will help you learn other skills?</li></ul><p>Prioritize each skill by its return on investment (ROI), and highlight it:</p><ul><li><strong>Red:</strong> High priority, very important to learn, will have a large impact</li><li><strong>Yellow:</strong> Medium priority, would be nice to learn, will have an impact</li><li><strong>Neutral:</strong> Low priority, not too important to learn for a while, will have some impact</li><li><strong>Green:</strong> Very low priority, already really great at it, very little impact</li></ul><h3>Sixth, learn the highest priority skill</h3><p>With your list of skills prioritized, pick the most important skill, and learn it.</p><ol><li>Find tutorials, books, or courses</li><li>Pick a time to learn consistently, such as every morning before work for an hour or every Saturday for 4 hours</li><li>Apply those skills on side projects or at work</li></ol><h3>Seventh, keep on learning</h3><p>Once you level up a skill, update your skills matrix. If you are satisfied with that skill, pick up the next priority skill, learn it, and repeat.</p><h3>Example</h3><p><a href="https://docs.google.com/spreadsheets/d/1FwlSR3C5eEkWt0nzm9y0jMgH7oBu0Ol-4IM-EEkW0Io/edit?usp=sharing">See the skills matrix I use a Senior Full-Stack Developer</a></p><p><em>Originally posted on </em><a href="https://github.com/mattscripted/til">https://github.com/mattscripted/til</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae8b4d5b4353" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A RESTful Guide to APIs]]></title>
            <link>https://mattscripted.medium.com/a-restful-guide-to-apis-e4a3513d7fff?source=rss-29fbc8ee048e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4a3513d7fff</guid>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Matt Shelley]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 02:43:11 GMT</pubDate>
            <atom:updated>2020-07-15T16:53:33.003Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Sleeping fox" src="https://cdn-images-1.medium.com/max/1000/0*N1MQS3bKgNv8S05Q" /><figcaption>Photo credit: <a href="https://unsplash.com/@obkim">Qijin Xu @obkim</a> via Unsplash</figcaption></figure><p>Jumping into back-end from front-end (or vice versa) can be intimidating. Sure, both sides are just code in the end, but the technology and practices are different. With back-end, we manage data. With front-end, we manage user experience. But, in between them lies a bridge: the API.</p><p>When we write better APIs, we improve our teamwork and our applications.</p><h3>What’s an API?</h3><p>On the web, an API (Application Programming Interface) is how the front-end (client) communicates with the back-end (server).</p><p>For example, the client may want to display a list of products in a catalogue. So, the client asks the server which products are available. Then, the server answers with the list of products.</p><p>On the front-end, we send a <strong>request</strong>. On the back-end, we send a <strong>response</strong>.</p><p>This exchange is performed through an API.</p><h3><strong>CRUD</strong></h3><p>With resources, we have four actions: <strong>C</strong>reate, <strong>R</strong>ead, <strong>U</strong>pdate, and <strong>D</strong>elete.</p><p>Consider a collection of products:</p><ul><li><strong>Create:</strong> Add a product</li><li><strong>Read:</strong> Get the details of a product</li><li><strong>Update:</strong> Change a product</li><li><strong>Delete:</strong> Remove a product</li></ul><p>We can perform these actions on resources through an API.</p><h3><strong>RESTful APIs</strong></h3><p>RESTful APIs are one approach to communicating CRUD actions between the client and the server.</p><p>REST (Representational State Transfer) refers to <a href="https://en.wikipedia.org/wiki/Representational_state_transfer#Architectural_constraints">architectural constraints</a> for web services. However, web APIs may not fulfill all of those constraints, so instead are called REST<em>ful</em>.</p><p>With RESTful APIs, we use HTTP methods to create, read, update, and delete resources given a <a href="https://en.wikipedia.org/wiki/Clean_URL">clean URL</a> and a URI (Unique Resource Identifier), like an id (42) or slug (towel).</p><p>Specifically, HTTP supports <strong>GET</strong>, <strong>POST</strong>, <strong>PATCH</strong>, <strong>PUT</strong>, and <strong>DELETE</strong> methods.</p><p>With a <strong>resource</strong>:</p><ul><li><strong>GET: </strong>Retrieve resource</li><li><strong>POST: </strong>Create a new “sub-resource,” and return its URI</li><li><strong>PATCH: </strong>Update resource with given instructions</li><li><strong>PUT: </strong>Replace resource</li><li><strong>DELETE: </strong>Delete resource</li></ul><p>With a <strong>collection</strong> of resources:</p><ul><li><strong>GET:</strong> Retrieve all resources</li><li><strong>POST:</strong> Create a new resource, and return its URI</li><li><strong>PATCH: </strong>Update all resources with given instructions</li><li><strong>PUT: </strong>Replace all resources</li><li><strong>DELETE: </strong>Delete all resources</li></ul><p>RESTful APIs support CRUD actions on collections and resources.</p><h3><strong>JSON:API</strong></h3><p>There is no standard format for requests, responses, and errors in RESTful APIs. However, I personally like to use <a href="https://jsonapi.org/">JSON:API</a> for most of my projects.</p><p>Each <strong>request</strong> includes an HTTP method, URL, and sometimes instructions.</p><p>Each <strong>response</strong> returns an HTTP status code and a JSON object with either <strong>data</strong> or <strong>error</strong> — but never both. Optionally, responses may return a <strong>meta</strong> object to tell us more about the data, such as pagination.</p><p>Let’s see how to create, read, update, and delete from our products collection.</p><p><em>(These examples will not cover every possible situation. For thorough details, please refer to the </em><a href="https://jsonapi.org/format/"><em>JSON:API</em></a><em> specification.)</em></p><h4><strong>GET</strong></h4><p>To request all products:</p><pre>GET https://api.example.com/products</pre><p>To respond, we return an array of products:</p><pre>200 OK</pre><pre>{<br>  data: [{<br>    type: &quot;products&quot;,<br>    id: &quot;toaster&quot;,<br>    attributes: {<br>      name: &quot;Toaster&quot;,<br>      price: 29.99<br>    }<br>  }, {<br>    type: &quot;products&quot;,<br>    id: &quot;alarm-clock&quot;,<br>    attributes: {<br>      name: &quot;Alarm Clock&quot;,<br>      price: 15.99<br>    }<br>  }]<br>}</pre><p>If there are no products, we respond with an empty array:</p><pre>200 OK</pre><pre>{<br>  data: []<br>}</pre><p>To request a specific product:</p><pre>GET https://api.example.com/products/toaster</pre><p>To respond, we return the product:</p><pre>200 OK</pre><pre>{<br>  data: {<br>    type: &quot;products&quot;,<br>    id: &quot;toaster&quot;,<br>    attributes: {<br>      name: &quot;Toaster&quot;,<br>      price: 29.99<br>    }<br>  }<br>}</pre><p>If we cannot find the product, we respond with an error:</p><pre>404 Not Found</pre><pre>{<br>  errors: [{<br>    status: &quot;404&quot;,<br>    detail: &quot;The requested product could not be found.&quot;<br>  }]<br>}</pre><p>Further, we can sort, filter, and paginate by providing a <strong>query</strong>:</p><pre>GET https://api.example.com/products<strong>?sort=price&amp;filter=0,100&amp;page=5</strong></pre><h4><strong>POST</strong></h4><p>To request the creation of a product:</p><pre>POST https://api.example.com/products</pre><pre>{<br>  data: {<br>    type: &quot;products&quot;,<br>    attributes: {<br>      name: &quot;Frying Pan&quot;,<br>      price: 19.99<br>    }<br>  }<br>}</pre><p>To respond, we return the new product with its <strong>id</strong>:</p><pre>201 Created</pre><pre>{<br>  data: {<br>    type: &quot;products&quot;,<br>    <strong>id: &quot;frying-pan&quot;,</strong><br>    attributes: {<br>      name: &quot;Frying Pan&quot;,<br>      price: 19.99<br>    }<br>  }<br>}</pre><p>If we cannot create the product, we respond with an error:</p><pre>403 Forbidden</pre><pre>{<br>  errors: [{<br>    status: &quot;403&quot;,<br>    detail: &quot;You do not have permission to create a product.&quot;<br>  }]<br>}</pre><h4><strong>PATCH</strong></h4><p>To request updates to a product, we send the updated values and leave out the ones we do not want to change:</p><pre>PATCH https://api.example.com/products</pre><pre>{<br>  data: {<br>    type: &quot;products&quot;,<br>    id: &quot;toaster&quot;,<br>    attributes: {<br>      <strong>description: &quot;This product has a new description&quot;</strong><br>    }<br>  }<br>}</pre><p>To respond, we return the updated product:</p><pre>200 OK</pre><pre>{<br>  data: {<br>    type: &quot;products&quot;,<br>    id: &quot;toaster&quot;,<br>    attributes: {<br>      name: &quot;Toaster&quot;,<br>      price: 29.99,<br>      <strong>description: &quot;This product has a new description&quot;<br></strong>    }<br>  }<br>}</pre><p>If we cannot update the product, we respond with an error:</p><pre>403 Forbidden</pre><pre>{<br>  errors: [{<br>    status: &quot;403&quot;,<br>    detail: &quot;You do not have permission to update this product.&quot;<br>  }]<br>}</pre><h4><strong>PUT</strong></h4><p><strong>PUT</strong> is not supported by JSON:API. However, we can mimic<strong> PUT</strong> by providing all attributes to <strong>PATCH</strong>.</p><h4><strong>DELETE</strong></h4><p>To delete a product:</p><pre>DELETE https://api.example.com/products/toaster</pre><p>To respond, we simply confirm with no content:</p><pre>204 No Content</pre><p>If we cannot delete the product, we respond with an error:</p><pre>403 Forbidden</pre><pre>{<br>  errors: [{<br>    status: &quot;403&quot;,<br>    detail: &quot;You do not have permission to delete this product.&quot;<br>  }]<br>}</pre><h4>Error Handling</h4><p>When an error occurs, we respond with the HTTP status code and an array of errors containing <strong>status</strong>, <strong>details</strong>, and <a href="https://jsonapi.org/format/#error-objects">other attributes</a>.</p><h3><strong>Final Thoughts</strong></h3><p>As developers, we often place ourselves on either the front-end or back-end. It is very easy to stick to the side we prefer, where we are comfortable, but as a result we limit our breadth of skills. Learning to build RESTful APIs is a great opportunity to expand our skills to the other side.</p><p>Ultimately, writing better APIs improves our teamwork and our applications.</p><h3><strong>Further Reading</strong></h3><ul><li><a href="https://hackernoon.com/restful-api-design-step-by-step-guide-2f2c9f9fcdbf">RESTful API Design — Step by Step Guide</a></li><li><a href="https://medium.com/backticks-tildes/restful-api-design-put-vs-patch-4a061aa3ed0b">RESTful API Design — Put vs PATCH</a></li></ul><p><em>Originally published at </em><a href="https://mattshelley.dev/"><em>https://mattshelley.dev</em></a><em> on February 22, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4a3513d7fff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Big O Notation]]></title>
            <link>https://mattscripted.medium.com/introducing-big-o-notation-5686a17bad08?source=rss-29fbc8ee048e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5686a17bad08</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Matt Shelley]]></dc:creator>
            <pubDate>Sat, 22 Feb 2020 13:10:04 GMT</pubDate>
            <atom:updated>2020-07-15T15:33:54.574Z</atom:updated>
            <content:encoded><![CDATA[<p>As programmers, we write code to tell computers what to do. The computer translates this code into operations, and then executes those operations with some amount of space in memory in some amount of time. We say that one block of code is more efficient than another if it uses less space or time.</p><blockquote><strong>Efficient:</strong> performing or functioning in the best possible manner with the least waste of time and effort (<a href="https://www.dictionary.com/browse/efficient">dictionary.com</a>)</blockquote><p>Suppose we want to to find the minimum value from an array of values.</p><pre>function getMinimum(values) {<br>  let minimum = Infinity</pre><pre>  values.forEach(value =&gt; {<br>    if (value &lt; minimum) {<br>      minimum = value<br>    }<br>  })</pre><pre>  return minimum<br>}</pre><p>With this function, we step through the array of values; update the minimum whenever we find a new minimum; and, then return the minimum.</p><pre>function getMinimum(values) {<br>  // Sort values from lowest to highest<br>  values.sort((a, b) =&gt; a - b)<br>  return values[0] || Infinity<br>}</pre><p>With this function, we sort the list so the minimum is the first element, and then return the first element.</p><p>But, sorting is expensive, since we may need to compare every value against every other value. Therefore, it is more efficient to use the first function, even if there are more lines of code.</p><p>With software, efficiency means using less space or time.</p><h3>Measuring Efficiency</h3><p>To measure efficiency, we can use <a href="https://en.wikipedia.org/wiki/Big_O_notation">Big O Notation</a>. This notation measures the worst-case complexity of space or time for a function in relation to its inputs.</p><p>Let’s look at some examples.</p><h4>O(1)</h4><p>With O(1) time, the work does not increase in relation to the input.</p><pre>function logName(name) {<br>  console.log(name)<br>}</pre><p>In this case, we will always call console.log() one time. It doesn&#39;t matter what name is.</p><pre>function logNameThreeTimes(name) {<br>  console.log(name)<br>  console.log(name)<br>  console.log(name)<br>}</pre><p>In this case, we will always call console.log() three times. Again, name does not matter.</p><p>We say that these functions run in <strong>constant</strong> time.</p><h4>O(n)</h4><p>With O(n) time, the work increases linearly with the input.</p><pre>function logUserNames(users) {<br>  users.forEach(user =&gt; console.log(user.name))<br>}</pre><p>In this case, we call console.log() once per user.</p><pre>function logUserNamesThreeTimes(users) {<br>  users.forEach(user =&gt; console.log(user.name))<br>  users.forEach(user =&gt; console.log(user.name))<br>  users.forEach(user =&gt; console.log(user.name))<br>}</pre><p>In this case, we call console.log() three times per user, so the work still grows linearly.</p><p>But, what happens when we add more logic to our code?</p><pre>function logPublicUserNames(users) {<br>  users.forEach(user =&gt; {<br>    if (user.isPublic) {<br>      console.log(user.name)<br>    }<br>  })<br>}</pre><p>In this case, we may need to log 0 names, 1 name, some names, or every name. So, we assume the worst-case scenario: log every name. Thus, we still have O(n) time.</p><p>We say these functions run in <strong>linear</strong> time.</p><h4>O(n²)</h4><p>With O(n^2) time, the work increases quadratically with the inputs.</p><pre>function countAppearances(values) {<br>  const appearancesByValue = {}</pre><pre>  values.forEach(value =&gt; {<br>    appearancesByValues[value] = 0</pre><pre>    values.forEach(comparison =&gt; {<br>      if (value === comparison) {<br>        appearancesByValues[value]++<br>      }<br>    })<br>  })</pre><pre>  return appearancesByValue<br>}</pre><p>In this case, we step through all values for each value we check. If we increase the length of values by 1, we have to check every value yet again.</p><p>We say this function runs in <strong>quadratic</strong> time.</p><p>As you may have guessed, this function can be made more efficient:</p><pre>function countAppearances(values) {<br>  const appearancesByValue = {}</pre><pre>  values.forEach(value =&gt; {<br>    // hasOwnProperty() runs in O(1) time<br>    if (appearancesByValue.hasOwnProperty(value)) {<br>      appearancesByValues[value]++<br>    } else {<br>      appearancesByValues[value] = 1<br>    }<br>  })</pre><pre>  return appearancesByValue<br>}</pre><p>By stepping through all values only once, we have reduced this function to O(n) time. Much better!</p><h4>O(n^c)</h4><p>In general, the more loops you nest, the worse your efficiency.</p><pre>// O(n^3)<br>values.forEach(value1 =&gt; {<br>  values.forEach(value2 =&gt; {<br>    values.forEach(value3 =&gt; {<br>      // Do some work<br>    })<br>  })<br>}</pre><pre>// O(n^4)<br>values.forEach(value1 =&gt; {<br>  values.forEach(value2 =&gt; {<br>    values.forEach(value3 =&gt; {<br>      values.forEach(value4 =&gt; {<br>        // Do some work<br>      })<br>    })<br>  })<br>}</pre><pre>// and so on ...</pre><p>We say these functions run in <strong>polynomial</strong> time.</p><h4>And so on…</h4><p>Constant, linear, quadratic, and polynomial times are just the beginning. As you dig deeper into complexity, you will see many more — like O(log<em>n</em>) for <a href="https://www.khanacademy.org/computing/computer-science/algorithms/binary-search/a/binary-search">Binary search</a>.</p><h3>Don’t Forget Space</h3><p>As mentioned earlier, Big O Notation can also be applied to space. That is, the memory required to execute the code, excluding the input and output.</p><p>Consider a function that runs in O(1) time of 10 seconds, but requires up to 10 gigabytes of memory to execute. Is it worth sacrificing some time to reduce the space?</p><h3>The Worst Factor</h3><p>With Big O Notation, efficiency is measured by the worst factor. If part of a function takes O(n) time, but another takes O(n^2) time, then the whole function takes O(n^2) time.</p><p>Therefore, to improve efficiency, we must reduce the worst factor.</p><h3>Writing More Efficient Code</h3><p>Once we have a solution to a problem, we can make our code more efficient by reducing the worst factor. After all, there can only be minor improvements if we only optimize the good parts.</p><p>Some quick tips:</p><ul><li>Avoid loops within loops</li><li>Use objects for O(1) lookup</li><li>Check the complexity of functions you use</li><li>Catch easy cases as soon as possible</li></ul><p>By finding and reducing the worst factor, we can write more efficient code.</p><h3>Further Reading</h3><ul><li><a href="https://en.wikipedia.org/wiki/Big_O_notation">Wikipedia: Big O Notation</a></li><li><a href="https://en.wikipedia.org/wiki/Analysis_of_algorithms">Wikipedia: Analysis of Algorithms</a></li><li><a href="https://en.wikipedia.org/wiki/Time_complexity">Wikipedia: Time Complexity</a></li><li><a href="https://cs.stackexchange.com/questions/83574/does-space-complexity-analysis-usually-include-output-space">StackExchange: Does space complexity analysis usually include output space?</a></li></ul><p><em>Originally published at </em><a href="https://mattshelley.dev/"><em>https://mattshelley.dev</em></a><em> on March 26, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5686a17bad08" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>