<?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 Dalton Saffe on Medium]]></title>
        <description><![CDATA[Stories by Dalton Saffe on Medium]]></description>
        <link>https://medium.com/@daltonsaffe?source=rss-4dfd93da7601------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EwKo1oeG0cyvD-sTJS0S_Q.jpeg</url>
            <title>Stories by Dalton Saffe on Medium</title>
            <link>https://medium.com/@daltonsaffe?source=rss-4dfd93da7601------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 03:13:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@daltonsaffe/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[ICON Interactive Site Relaunch]]></title>
            <link>https://medium.com/@daltonsaffe/icon-interactive-site-relaunch-19c47c8cd7c5?source=rss-4dfd93da7601------2</link>
            <guid isPermaLink="false">https://medium.com/p/19c47c8cd7c5</guid>
            <category><![CDATA[jamstack]]></category>
            <category><![CDATA[forestry]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[gridsome]]></category>
            <dc:creator><![CDATA[Dalton Saffe]]></dc:creator>
            <pubDate>Thu, 16 Jan 2020 20:16:15 GMT</pubDate>
            <atom:updated>2020-01-16T20:16:15.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*mc0NcyTz2aLDbb_kwo7mCw.png" /></figure><p><a href="https://iconinteractive.com/">ICON Interactive</a> is a digital agency that’s been around for over 20 years so we’ve seen the crest of various waves of technology. While approaching our site relaunch we wanted to focus on developing a performant site that would showcase our work in a clear, concise manner while also prioritizing performance and the content management experience in the process. We’ve done just that, so we wanted to share how we did it.</p><h3>Make It Fast</h3><p>We opted to go with a site built around the <a href="https://jamstack.org/">JAMstack</a>, which is a modular &amp; performant approach to building websites. It centers around the idea of server-side rendering the site’s pages which are then served as code-split payloads with pre-rendered HTML through a CDN. One can also integrate a mesh of services via APIs &amp; framework plugins. This approach removes the need to directly manage web servers that host the site and makes for a performant &amp; secure user experience.</p><h3>Site Framework</h3><p>ICON enjoys utilizing Vue as our JS framework of choice so we went with <a href="https://gridsome.org/">Gridsome</a> as our site’s framework since it’s based on Vue and has a rich ecosystem of plug-ins &amp; documentation. Gridsome is heavily inspired by <a href="https://www.gatsbyjs.org/">Gatsby</a> which is a React-based site framework anyone new to this space should check out.</p><p>Gridsome compiles one’s website to code-split payloads with pre-rendered HTML. This differs from a typical site built with Vue or React where the HTML, JS, and CSS are sent as a large bundled javascript file and then parsed on the client’s browser. Lots of optimizations are included out of the box — link pre-fetching, image src sets, lazy-loading images, and more. These site generators are the cutting edge of the industry because they dramatically improve site performance &amp; SEO while allowing the developers to use JavaScript frameworks such as React or Vue that they’re already familiar with.</p><p>Gridsome pulls in data via GraphQL which offers a unified schema and syntax to manage various sources of data. The tooling around GraphQL is fantastic, there’s an included query editor to test queries during the development process which also integrates relevant documentation directly into the interface.</p><h3>CMS</h3><p>For the content management system we wanted to prioritize ease of use and create a fault-tolerant system for updating the website. We went with <a href="https://forestry.io/">Forestry</a> as our CMS since it updates the site by adding the content directly to the github repository as a commit which provides granular logging of each update and allows for version roll-back if needed.</p><p>Forestry’s templates are easily customizable to the developer through YAML files. They also provide a GUI interface to modulate and manage templates which is intuitive &amp; flexible. All the images are uploaded directly to a linked AWS S3 bucket via the Forestry interface which relieves bloat on the git repository and provides an integrated, seamless experience for the content editor.</p><p>Forestry is essentially creating and modifying markdown files for the site to ingest at compile time. Each update that is pushed up will take about 2–3 minutes before it is reflected on the live site because the entire site is being recompiled on each update. The benefits gained in site speed &amp; SEO performance from this compilation process are worth it.</p><h3>Deployment</h3><p>Our site is deployed through <a href="https://aws.amazon.com/amplify/console/">AWS Amplify</a> which links to our code repository and provides continuous deployment, which means our site gets rebuilt and deployed each time new commits are pushed to the repository or changes are added through the CMS. Amplify also provides deployment for feature branches so we can test updates of a different git branch before they’re merged into the main production branch. The compiled site is then served through the AWS CDN which provides a highly performant way to host &amp; serve the site.</p><h3>Open Source</h3><p>The site is being built from an open source <a href="https://github.com/iconinteractive">Github</a> repository since the Github API has fantastic support for CMS integrations like Forestry. We wanted to open source the site’s code to serve as an educational resource for anyone curious to learn more about building websites with the JAMstack.</p><h3>Lighthouse Performance Audit</h3><p>Our previous site was built on Wordpress and suffered from image bloat which impacted the performance. We’re incredibly pleased with the massive jump in performance, accessibility, &amp; SEO from utilizing a JAMstack architecture.</p><p>Previous ICON site:</p><figure><img alt="old google lighthouse audit" src="https://cdn-images-1.medium.com/max/480/1*te5O6V9ctztHvDQhi4kuLg.png" /></figure><p>New ICON site:</p><figure><img alt="new lighthouse audit" src="https://cdn-images-1.medium.com/max/480/1*_G-PDflpCyafW9b2r1YUcA.png" /></figure><p>Thanks for reading! If you’re curious to learn more about the JAMstack here’s an excellent <a href="https://www.netlify.com/pdf/netlify-whitepaper.pdf">whitepaper</a> from Netlify.</p><h3>Links:</h3><p><a href="https://iconinteractive.com/">https://iconinteractive.com/</a></p><p><a href="https://github.com/iconinteractive/icon-interactive-www">https://github.com/iconinteractive/icon-interactive-www</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19c47c8cd7c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Destructuring in JavaScript]]></title>
            <link>https://medium.com/@daltonsaffe/destructuring-in-javascript-cf2782772c03?source=rss-4dfd93da7601------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf2782772c03</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[destructuring]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Dalton Saffe]]></dc:creator>
            <pubDate>Mon, 29 Oct 2018 04:20:56 GMT</pubDate>
            <atom:updated>2018-11-23T22:09:27.709Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rQOxRCC4oU-odHcusLZ_Bw.jpeg" /></figure><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">Destructuring</a> is a way of extracting &amp; assigning values within objects and arrays to variables. It was standardized by the ECMAScript committee in 2015 for the ES6 release of JavaScript. Destructuring is one of the key ES6 features that will enable developers to trim down verbose syntax and compose modern &amp; legible JavaScript programs.</p><p>Objects in JavaScript are initialized and structured like so:</p><pre>const obj = {<br> firstName: ‘Gaby’, <br> lastName: ‘Perez’<br> }<br> </pre><p>Before ES6 one would extract values into variables one by one:</p><pre>const firstName = obj.firstName<br>const lastName = obj.lastName</pre><pre>console.log(lastName) // ‘Perez’</pre><p>Now with destructuring the variable assignment:</p><pre>const { firstName, lastName } = obj</pre><pre>console.log(lastName) // ‘Perez’</pre><p>We now have two variables assigned to their respective values from one line of code. Destructuring is a clear &amp; concise way to declare only the variables you need and associate them with a value within the same line. When using destructuring assignments remember that the variable name and key name should correspond so the program knows which value it needs to access.</p><p>The same extraction pattern applies to arrays in JavaScript. Instead of keys, the variables are declared relative to the index position within the array.</p><pre>const [ fifty, lol ] = [50, 82]</pre><pre>console.log(lol) // 82</pre><p>The destructuring assignment pattern shines when dealing with accessing values within nested object structures.</p><pre>const student = {<br>  name: ‘Ray Lo’,<br>    subjects: {<br>      math: ‘B+’,<br>      science: ‘A’,<br>    },<br>  }</pre><pre>const { math, science } = student.subjects</pre><pre>console.log(science) // ‘A’</pre><p>Within the destructuring assignment there’s the target on the left side of the equal sign and the source on the right. This distinction is fundamental to illustrating the next few concepts of this assignment style.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JjD0hyELmiVDhkfuUvrlg.png" /></figure><h4><strong>Elision</strong></h4><p>When dealing with arrays it’s possible to skip values with commas in the target so you can access the values you need within an assignment. This technique is known as elision which is defined as the omission of a sound or syllable when speaking.</p><pre>const arr = [‘hey’, ‘hello’, ‘sup’, ‘destructuring is cool’];<br>const [greet, , , message] = arr</pre><pre>console.log(message) // ‘destructuring is cool’</pre><h4><strong>Default Values</strong></h4><p>If it’s possible that the value in your object may return as undefined one may assign default values within the target to avoid bugs from popping up in the program.</p><pre>const { a = 5, b = 12 } = { a : 200 }</pre><pre>console.log(a) // 200<br>console.log(b) // 12</pre><h4><strong>Reassignment</strong></h4><p>It’s also possible to reassign the names of variables within the destructuring target itself. This can be useful for making your variables more semantic for later usage in your program.</p><pre>const obj = { greeting: ‘HEY’, wait: ‘HOLD UP’ }</pre><pre>const { greeting : sup, wait : chill } = obj</pre><pre>console.log(sup) // ‘HEY’<br>console.log(chill) // ‘HOLD UP’</pre><h4><strong>Nested Access</strong></h4><p>Building off the reassignment syntax examined above is the idea of nested access. This pattern is useful for accessing deeply nested objects that contain separate objects that you’d like to extract values from. Absorbing this idea will help keep your code <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a>.</p><p>The key difference here is that in the variable after the colon in the target we are wrapping the variable on the right with another pair of braces to access the value stored within. Since that variable name corresponds to an object’s key nested within our parent object we are able to layer the destructuring syntax within itself and access the nested values we need.</p><pre>const nestedObj = {<br>  students:{<br>    autumn:{<br>      graduated: 1312<br>    }, <br>    winter:{ <br>      total: 1337<br>    }<br>  }<br>}</pre><pre>const { autumn: {graduated}, winter: {total} } = nestedObj.students</pre><pre>console.log(graduated, ‘/////’, total)<br>&gt; 1312 ‘/////’ 1337</pre><h4>Summary</h4><p>Destructuring is a powerful assignment syntax to make succinct variable declarations and applying this concept in programs will enable one to write elegant JavaScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf2782772c03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>