<?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 Dan Fyfe on Medium]]></title>
        <description><![CDATA[Stories by Dan Fyfe on Medium]]></description>
        <link>https://medium.com/@danfyfe?source=rss-dcf0c0496e7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*s1uoY7Bk8H3xEop_QzWkVA.jpeg</url>
            <title>Stories by Dan Fyfe on Medium</title>
            <link>https://medium.com/@danfyfe?source=rss-dcf0c0496e7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:51:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@danfyfe/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[Let’s get Sass-y!]]></title>
            <link>https://medium.com/@danfyfe/lets-get-sass-y-2448f31467d5?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2448f31467d5</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[front-end-web-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Mon, 18 Nov 2019 15:08:12 GMT</pubDate>
            <atom:updated>2019-11-18T15:14:18.231Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GiiYmxzi7J15pj5u" /><figcaption>Photo by <a href="https://unsplash.com/@dcastro89?utm_source=medium&amp;utm_medium=referral">Daniela Castro</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Let’s take a look at Sass, a CSS preprocessor.</strong></p><h3><strong>Why do we need it?</strong></h3><p>You may not, but as the CSS for your projects get larger, Sass can be a good tool to make things easier. Essentially, it gives you access to special features that don’t really exist, or are harder to use, in regular CSS. Things like variables, nesting, mixins, and inheritance that you get with Sass will make your code more powerful and make it easier to handle the large scale CSS that is required to make your project beautiful.</p><h3><strong>Boring stuff: Making it work</strong></h3><p><strong><em>First things first: Installing SASS (using npm)</em></strong></p><pre>npm install -g sass</pre><p>This will give you a global install of Sass through npm. To test that installation went well, try getting the version by running this command in your terminal:</p><pre>sass --version</pre><p>or</p><pre>sass --help</pre><p>Either will give you what you asked for if installed correctly.</p><p><strong><em>Next: Letting it do its thing</em></strong></p><p>You write your Sass code in <em>.scss</em> files. Since that code isn’t really CSS yet, you need to tell Sass to compile it into regular ol’ CSS before your application can use it. They’ve made it pretty easy. You can do this by using the <em>sass</em> command in your terminal.</p><pre>sass input.scss output.css</pre><p>The above command will take the file <em>input.scss</em> and compile it into <em>output.css</em>, which can be used by your application. Note that this command will not continuously update that <em>output.css</em> file. If you would rather have it watching for changes, you can use the <em>watch</em> flag:</p><pre>sass --watch input.scss output.css</pre><p>This will continuously check <em>input.scss</em> for changes and update <em>output.css</em> with those changes. You can have Sass watch for changes in directories by adding a colon between directories:</p><pre>sass --watch src/styles:public/styles</pre><p>Note that compiling entire directories will automatically name the <em>.css</em> files after their <em>.scss</em> counterpart. So in the above example, our <em>input.scss</em> file will compile into <em>input.css</em>.</p><p>Nice. Now we can work with Sass inside our <em>.scss</em> files and have them compiled to regular CSS, which our app can use.</p><h3><strong>Now the fun stuff!</strong></h3><p><strong><em>Variables</em></strong></p><p>Variables in Sass are just like variables elsewhere: a way to store a value. This is helpful in CSS for things like colors and fonts. Imagine you are creating an app for a brand that wants to use specific colors and fonts all over the place. Instead of writing it every time, you can use a variable and as Sass compiles to CSS, it will replace that variable with your value wherever it may be. Then, when the brand wants to change a color, you can just change the value of your variable and it will change it everywhere you used it.</p><p>Variables are denoted with the <em>$</em> symbol followed by whatever name you want to give it.</p><pre>$primary-color: #2db8c2;<br>$secondary-color: #edd793;</pre><pre>.main {<br>   color: $secondary-color;<br>   background-color: $primary-color;<br>}</pre><p><strong><em>Nesting</em></strong></p><p>We can easily create nested selectors by writing them out in a more visually similar way to HTML, in that the hierarchy will be very clear at first glance.</p><pre>nav {<br>    a {<br>      text-decoration: none;<br>      margin: 2vh 2vw;<br>      background-color: $primary-color;<br>    }</pre><pre>    button {<br>      background-color: $secondary-color;<br>    }<br>}</pre><p>Using this syntax lets anyone looking at it see all of the nested selectors in a more visually direct way. As opposed to the CSS that this will compile to:</p><pre>nav a {<br>   text-decoration: none;<br>   margin: 2vh 2vw;<br>   background-color: #2db8c2;<br>}</pre><pre>nav button {<br>   background-color: #edd793;<br>}</pre><p>Since our example is simple, it’s easy to tell what is going on in the CSS, but the Sass version is much more readable.</p><p><strong><em>Partials and Modules</em></strong></p><p>Sass lets you spread out your code into different files. This can be helpful for keeping everything clean and maintainable. When you create a <em>.scss</em> file with an underscore before the name, <em>_colors.scss </em>for example, the compiler will not create a CSS file for it, but will allow the file’s contents to be accessed by other <em>.scss</em> files.</p><p>Currently, the version we are using through npm does not support the ‘@use’ rule (check out <a href="https://sass-lang.com/guide">Sass’s page</a> for more about it ), so in order to use these files, we need to ‘@import’ them.</p><pre><em>// src/styles/_colors.scss</em><br>   <strong><em>// we declare our color variables</em></strong></pre><pre>   $primary-color: #2db8c2;<br>   $secondary-color: #edd793;</pre><pre><em>// src/styles/_fonts.scss</em><br> <em> </em><strong><em>// we declare a font variable and include the body selector with   that font property</em></strong></pre><pre>   $font-stack: Helvetica, sans-serif;</pre><pre>   body {<br>      font: 100% $font-stack;<br>   }</pre><pre><br><em>// src/styles/input.scss</em><br>       <strong><em>// we import both colors and fonts (we do not need to include the underscore or extension), which gives us everything inside of both files and we can use it like we did in the above examples</em></strong></pre><pre>@import &#39;colors&#39;;<br>@import &#39;fonts&#39;;</pre><pre>   nav {<br>       a {<br>         text-decoration: none;<br>         margin: 2vh 2vw;<br>         background-color: $primary-color;<br>       }</pre><pre>   button {<br>         background-color: $secondary-color;<br>       }<br>   }</pre><p>Our compiled <em>input.css</em> file will now have the correct values for our variables as well as the body selector and font property that we declared in <em>_fonts.scss</em>.</p><ul><li>* Quick note about the ‘@import’ rule. When we import, we get all of the code from the <em>.scss</em> file, which gives us access to the variables, but doesn’t really give a good way to know which of those files our variables came from. Lucky for us, we only have two imported files, but you could imagine it getting less intuitive as you import more. It looks like this is where ‘@use’ would come in handy. Sass says that the ‘@use’ rule will enable you to access variables like you would properties in javaScript. I can’t test the code below, but it looks like it would work something like this:</li></ul><pre>@use &#39;colors&#39;;</pre><pre>nav {<br>       a {<br>         text-decoration: none;<br>         margin: 2vh 2vw;<br>         background-color: <strong>colors.</strong>$primary-color;<br>       }</pre><pre>button {<br>         background-color: <strong>colors.</strong>$secondary-color;<br>       }<br>   }</pre><p>This makes it much more readable and easier to follow, which is pretty great!</p><p><strong><em>Mixins</em></strong></p><p>This is pretty cool. A mixin lets you make groups of declarations that you want to reuse. Using it for a reusable box-shadow would be a good example, or perhaps any properties that have vender prefixes (-ms- , -webkit-). Mixins also allow variables to be passed in for the properties inside of the mixin.</p><pre>@mixin box-shadow($shadow) {<br>   -webkit-box-shadow: $shadow;<br>   -moz-box-shadow: $shadow;<br>   box-shadow: $shadow;<br>}<br></pre><pre>.box {<br>   @include box-shadow(10px 10px 5px 0px rgba(0, 0, 0, 0.75));<br>}</pre><p>This will allow you to set all of the properties inside of our mixin with one line. Nice!</p><p><strong><em>Inheritance with Extend</em></strong></p><p>This is pretty neat too and is a good way to keep your Sass DRY. We will use what is called a ‘placeholder class’, which is only printed when it is extended, meaning it won’t be in your compiled <em>.css</em> file unless you have used it.</p><pre>%message-shared {<br>   border: 1px solid lightgrey;<br>   padding: 10px;<br>   color: white;<br>   border-radius: 5px;<br>   width: 50%;<br>   margin: auto<br>}</pre><pre>.message {<br>   @extend %message-shared;<br>}</pre><pre>.success {<br>   @extend %message-shared;<br>   border-color: green;<br>}</pre><pre>.error {<br>   @extend %message-shared;<br>   border-block-color: red;<br>}</pre><pre>.warning {<br>   @extend %message-shared;<br>   border-color: yellow;<br>}</pre><p>This will give each class selector that extends %message-shared, the properties of %message-shared. This can help keep the need to use multiple selectors on an HTML element to a minimum.</p><p><strong><em>Operators</em></strong></p><p>This helps your CSS do math! You can use all of the basic math operators: +, -, /, *, and %. Say you are given a layout based on 960px. It is designed so that there are two pieces: a larger, 600px piece, and a smaller 300px piece, with space in the middle. Easy enough. However, this is not responsive and will end up looking pretty wonky, so you now want to use percentages instead. You don’t have to rethink the basic design or figure out the percentage including the open space in the middle. Instead, we can use operators in Sass to figure it out for us, and make it responsive.</p><pre>.left {<br>   float: left;<br>   width: 600px / 960px * 100%;<br>}</pre><pre>.right {<br>   float: right;<br>   width: 300px / 960px * 100%;<br>}</pre><p>This will compile to have the correct percentage for the width of each selector. Dope!</p><p>Thats a good overview of Sass! It might seem like a lot, but it gets pretty intuitive as you continue working with it. You’ll find that when your CSS gets out of hand, using Sass is a good way to rein it back in. Check out the link below for more info! Thanks for reading!</p><p><a href="https://sass-lang.com/">Sass: Syntactically Awesome Style Sheets</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2448f31467d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using React Context with Functional Components]]></title>
            <link>https://medium.com/@danfyfe/using-react-context-with-functional-components-153cbd9ba214?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/153cbd9ba214</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-context]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-hook]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Tue, 12 Nov 2019 14:20:04 GMT</pubDate>
            <atom:updated>2019-11-12T14:20:04.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VwT0zurNbFIbwJLG" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Are you sick of prop drilling? Does redux make your brain hurt? Lucky for you, there’s React Context!</p><p>Context is a way to share data with multiple components and their descendants without having to pass them down through each layer of the component tree.</p><p>Say you have a piece of an app that displays a set of ‘things’ as a list and also as a graph in a different section. Component-wise, we might end up with something like this:</p><pre>InfoContainer</pre><pre>   - ListContainer<br>      - ListDisplay<br>        - ListItem</pre><pre>   - GraphContainer<br>      - GraphDisplay<br>     </pre><p>We have a parent component, InfoContainer, which has two children, ListContainer and GraphContainer, which each have their own components for displaying. We will need to get the same set of ‘things’ from InfoContainer down to the Display components. Just pass it through each component! Not a big deal, right? Since this is a simple example, it may seem silly not to, but just imagine if you had a lot more going on and more components needed access to the same data. It can get real messy, real fast.</p><p>Let’s use Context! First lets make a file called <strong>thingsContext.js</strong> and fill it like so:</p><pre>import React from &#39;react&#39;</pre><pre>const ThingsContext = React.createContext({})</pre><pre>export const ThingsProvider = ThingsContext.Provider</pre><pre>export default ThingsContext</pre><p>We are doing a few things here: Creating the context ( I put an empty object as an argument, which will be filled later ), then creating a way to ‘provide’ the context to components as ThingsProvider. We will be accessing the context with the useContext Hook later.</p><p>Our InfoContainer component would look something like this:</p><pre>import React from &#39;react&#39;<br>import ListContainer from &#39;./ListContainer&#39;<br>import GraphContainer from &#39;./GraphContainer&#39;<br>import { ThingsProvider } from &#39;../thingsContext&#39;</pre><pre>const InfoContainer = props =&gt; {</pre><pre>    // pretend we are fetching these &#39;things&#39;<br>    const things = [<br>        {id: 1, name: &#39;thing 1&#39;, length: 5},<br>        {id: 2, name: &#39;thing 2&#39;, length: 2},<br>        {id: 3, name: &#39;thing 3&#39;, length: 6},<br>        {id: 4, name: &#39;thing 4&#39;, length: 10},<br>        {id: 5, name: &#39;thing 5&#39;, length: 1}<br>      ]</pre><pre>return(<br>        &lt;div&gt;<br>            &lt;ThingsProvider value={things}&gt;<br>                &lt;ListContainer/&gt;<br>                &lt;GraphContainer/&gt;<br>            &lt;/ThingsProvider&gt;<br>        &lt;/div&gt;<br> )<br>}</pre><pre>export default InfoContainer</pre><p>Pretty simple. All we have done is made an InfoContainer component that contains a ListContainer and a GraphContainer. We then wrapped both of those components together in our ThingsProvider and passed in our ‘things’ as the value property. This will give any child, grandchild, etc. of the components access to our ‘things’.</p><p>Next we can access our context. Our ListContainer will contain another component called ListDisplay that we will use to display the ‘things’ as a list. It should look something like this:</p><pre>import React, { useContext } from &#39;react&#39;<br>import ThingsContext from &#39;../thingsContext&#39;<br>import ListItem from &#39;../components/ListItem&#39;</pre><pre>const ListDisplay = props =&gt; {</pre><pre>   const things = useContext(ThingsContext)</pre><pre>   const renderThings = things =&gt; {<br>     return things.map( thing =&gt; {<br>         return &lt;ListItem key={thing.id} thing={thing}/&gt;<br>     })<br>   }</pre><pre> return(<br>        &lt;ul&gt;<br>            {renderThings(things)}<br>        &lt;/ul&gt;<br>    )<br>}</pre><pre>export default ListDisplay</pre><p>The important part here is the useContext Hook. We import our ThingsContext and pass it into our useContext Hook, save it as a variable and thats it! We have access to the data we need and that data can also be accessed by other components. We also skipped right over the ListContainer component altogether and didn’t have to pass anything down! Very cool, very handy.</p><p>Like everything, there is a little more to this, but this should get you started. There is a different approach when using Class components too, which was not covered here, but you can check out in the link below. Thanks for reading!</p><p><strong>Helpful Links</strong></p><p><a href="https://reactjs.org/docs/context.html#reactcreatecontext">Context - React</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=153cbd9ba214" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is that that input valid? …is it though?]]></title>
            <link>https://medium.com/@danfyfe/is-that-that-input-valid-is-it-though-f10b878cc228?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f10b878cc228</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[forms-design]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Sat, 26 Oct 2019 23:11:09 GMT</pubDate>
            <atom:updated>2019-12-12T13:01:30.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is that input valid?</h3><p>This week’s topic: <strong>Form Validations using React Hooks</strong>.</p><p>Following my trend of topics that keep us puny humans from making mistakes, let’s talk about form validations!</p><p>Have you every been filing out a form on a site that is constantly giving you feedback on the quality of a password, or wether or not what you typed in is an email? Of course you have! These are called form validations and are there to make sure what you are inputing into the form will end up working in whatever system is setup to handle the data you are supplying. This idea is pretty great and is certainly something that I have personally completely overlooked in my journey learning web development. Unlike with a typed language or TDD, my ignorance here comes from being impatient at times, not wanting to take the time to deal with it, and figuring my database and API will handle supplying errors if bad inputs were supplied. This meant that I was not thinking about the end user experience, which is incredibly important and, honestly, it’s pretty embarrassing to admit that I had barely even thought about it. Obviously, warning the user that what they typed in isn’t going to work before they hit ‘submit’ is much better than having them fill out an entire form only to have it bounce back at them. Lesson learned.</p><p>How do we do this? It’s actually pretty simple. We just need something that looks at the input somehow and checks the value to make sure it fits whatever guidelines we want. Let’s take a look at a very simple example where we validate that the input to this form is formatted as an email. In this example, we will be using React. Note: I have some very basic styling that isn’t shown in the examples.</p><pre>import React, { useState } from &#39;react&#39;</pre><pre>const EmailForm = props =&gt; {</pre><pre>const [ email, setEmail ] = useState(&#39;&#39;)<br>  <br>  return(<br>    &lt;&gt;<br>      &lt;h1&gt;Email Validation!&lt;/h1&gt;<br>      &lt;div&gt;<br>        &lt;input id=&#39;email-input&#39; placeholder=&#39;Please enter email&#39;<br>        value={email}<br>        onChange={e =&gt; setEmail(e.target.value)}<br>        /&gt;<br>        &lt;button id=&#39;email-submit-btn&#39;&gt;Submit&lt;/button&gt;<br>      &lt;/div&gt;<br>      &lt;span id=&#39;email-validation-span&#39;&gt;&lt;/span&gt;<br>    &lt;/&gt;<br>  )<br>};</pre><pre>export default EmailForm</pre><p>Above is a basic functional component that has a controlled input, which uses the ‘useState’ hook to keep track of what has been entered into the input and sets the value. If you are not familiar with Hooks, I highly recommend checking them out <a href="https://reactjs.org/docs/hooks-intro.html">here</a>. Basically, the useState hook is a way to add the convenience of state to a functional component.</p><p>Next we need a way to apply a function every time our ‘email’ value changes. Enter React’s useEffect hook. The useEffect hook takes a function and an array of dependencies. Whenever an element in the array of dependencies changes, the function will run. Side note: if the array is empty, it will only run once, which is a good place to fetch any data if needed.</p><p>In our case, we want our function to use the value of our ‘email’ state to manipulate our elements accordingly, which means we need our ‘email’ state to be in the dependency array.</p><pre>import React, { useState, <strong>useEffect</strong> } from &#39;react&#39;</pre><pre>const EmailForm = props =&gt; {</pre><pre>const [ email, setEmail ] = useState(&#39;&#39;)</pre><pre><strong>useEffect( () =&gt; {</strong></pre><pre><strong>    // do something every time email value changes</strong></pre><pre><strong>}, [ email ]);</strong></pre><pre>return(<br>    &lt;&gt;<br>      &lt;h1&gt;Email Validation!&lt;/h1&gt;<br>      &lt;div&gt;<br>        &lt;input id=&#39;email-input&#39; placeholder=&#39;Please enter email&#39;<br>        value={email}<br>        onChange={e =&gt; setEmail(e.target.value)}<br>        /&gt;<br>        &lt;button id=&#39;email-submit-btn&#39;&gt;Submit&lt;/button&gt;<br>      &lt;/div&gt;<br>      &lt;span id=&#39;email-validation-span&#39;&gt;&lt;/span&gt;<br>    &lt;/&gt;<br>  )<br>};</pre><pre>export default EmailForm</pre><p>Above is the same example as above, but with the added useEffect hook (changes are in bold).</p><p>Great! Now we have a way to keep track of the ‘email’ state changes and run some code that manipulates our elements to inform the user and disable the ability to submit the form if the input is not properly formatted.</p><p>What does proper email formatting look like? I’m not 100% sure, but a quick Google search landed me <a href="https://www.w3resource.com/javascript/form/email-validation.php">here</a>, which gave me a beautiful regex ( with a VERY helpful explanation ) for making sure that the input would likely be an email. Thank goodness for the internet and the wonderful people who figured that out! Note that this does not actually make sure that the email exists, it just takes into account quite a few logical pieces that a valid email address would have.</p><p>Progress! Now we have a way to test the validity of the ‘email’ value to pass into a conditional statement. Next we should manipulate the DOM to warn the user about what they have typed in and keep them from submitting the form, if necessary. I ended up with something like this:</p><pre>import React, { useState, useEffect } from &#39;react&#39;</pre><pre>const EmailForm = props =&gt; {</pre><pre>const [ email, setEmail ] = useState(&#39;&#39;)</pre><pre>useEffect( () =&gt; {<br>    <strong>const emailInput = document.querySelector(&#39;#email-input&#39;)</strong></pre><pre><strong>    const emailSubmitBtn = document.querySelector(&#39;#email-submit-btn&#39;)</strong></pre><pre><strong>    const emailValidationSpan = document.querySelector(&#39;#email-validation-span&#39;)</strong></pre><pre><strong>    const emailRegEx = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/</strong></pre><pre><strong>if (emailRegEx.test(email)) {<br>      emailInput.style.borderColor = &#39;&#39;<br>      emailValidationSpan.innerText = &#39;&#39;<br>      emailSubmitBtn.disabled = false<br>    } else if (email === &#39;&#39;) {<br>      emailInput.style.borderColor = &#39;&#39;<br>      emailValidationSpan.innerText = &#39;&#39;<br>      emailSubmitBtn.disabled = true<br>    } else {<br>      emailInput.style.borderColor = &#39;red&#39;<br>      emailValidationSpan.innerText = &#39;Please enter a valid email&#39;<br>      emailSubmitBtn.disabled = true<br>    };</strong></pre><pre>}, [ email ]);</pre><pre>return(<br>    &lt;&gt;<br>      &lt;h1&gt;Email Validation!&lt;/h1&gt;<br>      &lt;div&gt;<br>        &lt;input id=&#39;email-input&#39; placeholder=&#39;Please enter email&#39;<br>        value={email}<br>        onChange={e =&gt; setEmail(e.target.value)}<br>        /&gt;<br>        &lt;button id=&#39;email-submit-btn&#39;&gt;Submit&lt;/button&gt;<br>      &lt;/div&gt;<br>      &lt;span id=&#39;email-validation-span&#39;&gt;&lt;/span&gt;<br>    &lt;/&gt;<br>  )<br>};</pre><pre>export default EmailForm</pre><p>Sorry if Medium’s formatting makes it look funny, but here is the basic idea of the added code inside our useEffect hook:</p><ol><li>Find the input, button, and span and save them to variables</li><li>Validate the input value. Use our beautiful regex (saved as a variable for readability) to verify the input is formatted correctly (note that I also added a condition that checks if the email is an empty string (our default value) so that the form does not obnoxiously tell the user the input value is not an email before the user has a chance to type anything into the input.</li><li>Manipulate the elements to warn the user. I have chosen to change the color of the input border to red, add some innerText to the span, and disable the button unless a valid email format is entered.</li></ol><p>If all goes well it should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*cHZlR3n3woBYZtxGZY0BfQ.gif" /><figcaption>😎</figcaption></figure><p>Validating forms is an easy way to keep the data flowing through your app somewhat predictable and a little more secure. There is definitely a whole other world when it comes to backend validations for security, but using the idea of what we went through in this post can be one of the many layers of protection to make sure your data is clean and doesn’t contain anything harmful. It also makes for a much better user experience!</p><p>Hopefully this was as helpful as it was fun to make! Feel free to ask any questions below! Thanks for reading!</p><p>Helpful links:</p><ul><li><a href="https://reactjs.org/docs/hooks-intro.html">Introducing Hooks - React</a></li><li><a href="https://www.w3resource.com/javascript/form/email-validation.php">JavaScript : email validation - w3resource</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f10b878cc228" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing in Development: Who needs it?!]]></title>
            <link>https://medium.com/@danfyfe/testing-in-development-who-needs-it-51277cc6dbb5?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/51277cc6dbb5</guid>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Thu, 17 Oct 2019 15:21:14 GMT</pubDate>
            <atom:updated>2019-10-17T15:21:14.233Z</atom:updated>
            <content:encoded><![CDATA[<p>I do. You do. We do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K29Gsmg-VBaL9boe" /><figcaption>Photo by <a href="https://unsplash.com/@sharegrid?utm_source=medium&amp;utm_medium=referral">ShareGrid</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>My last post was a very brief, high level intro to TypeScript and why having a typed language can only help you in the long run. This post will be preaching the same basic underlying idea: We are all puny humans who make mistakes and that is okay. Other than being a part of a great life philosophy, in my opinion, this idea means that we should embrace the tools that help us overcome it. Just as TypeScript might help us realize we accidentally passed a string into a function that takes a number, having tests for your code can help ensure that everything continues to work as expected over time and lets you know when it doesn’t.</p><p>Personally, I can really appreciate the need to test things. In my former life, I worked as an audio engineer on many large scale sessions, whether it be a Broadway Cast Album, or film score of some sort, where you have 20–30 musicians and 40–50 microphones recording at the same time and an incredibly (often irresponsibly) dense, high pressure recording schedule where going into over time for musicians meant large bills for the production company, for which you do not want to be responsible for. This meant that everything on the engineering team’s side had to be as bullet proof as possible. We did this by having the entire thing setup and tested before anyone from the actual production showed up, which in this case meant scratching the grill of, or talking into, every single microphone to make sure the signal was clear and the headphones were routed correctly. This ensured that if we had to add anything or change anything once the musicians arrived, we were at least confident that the basics were working and we could do what we needed to do. We can use that basic idea for our code — kind of.</p><p>The main idea I want to discuss is known as Test Driven Development (TDD). The idea here is pretty simple: write a test, write the code to make that test pass. This might seem backwards at first read, but it makes a lot of sense if you think of it in a real world application. Say you are working on a team that is building a brand new app. They have all of their models and such planned out exactly how they need it and you are given the task of coding a piece of it. Your task is to add something to a User model to ensure each User has a unique username. <strong>That’s your test.</strong> Before you add a single line to that User model, write the test that ensures a User will have a unique username. In this test you might have a scenario in which you try to create two Users with the same username. The test will assert that you should <strong>not</strong> be able to create two Users with the same username. The first time you run the test, it should fail because you have not written any actual code to change the functionality. Now you can go into the User model and add the necessary pieces to make that test pass. Once it passes, you can move on to the next task. 👍</p><p>Doing it this way helps keep errors to a minimum when adding or changing something down the road. Say for instance, someone else on the team accidentally changes your original validation for User’s usernames and that functionality breaks. Without the test, this would likely slip through the cracks since it might not break a ton of other functionality. However, with the test, you know it broke and you know where to find the problem and fix it without having to track it down. In the end, they say the time it takes to write the tests will likely be less consuming than the time it will take to track down and fix issues caused by not having coverage. Powerful! 🎉 🎉 🎉</p><p>Hopefully this has convinced you of the power of having basic test coverage for your code and to try it out if you have not already. There are quite a few frameworks for writing tests. For instance, there is rSpec for Ruby, Rails comes with its own, Jest is great for React/JS and actually comes with it when using create-react-app. See links below for more details on how implement each one. Thanks for reading!</p><ul><li><a href="https://jestjs.io/">Jest</a></li><li><a href="https://rspec.info/">RSpec: Behaviour Driven Development for Ruby</a></li><li><a href="https://guides.rubyonrails.org/testing.html">Testing Rails Applications - Ruby on Rails Guides</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51277cc6dbb5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TypeScript: An Brief Intro to Responsible JavaScript]]></title>
            <link>https://medium.com/@danfyfe/typescript-an-brief-intro-to-responsible-javascript-453c1dc28cc9?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/453c1dc28cc9</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Fri, 11 Oct 2019 17:09:44 GMT</pubDate>
            <atom:updated>2019-10-11T17:09:44.047Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="TypeScript logo" src="https://cdn-images-1.medium.com/max/816/1*TpbxEQy4ckB-g31PwUQPlg.png" /><figcaption>TypeScript!</figcaption></figure><p>Everyone loves JavaScript, right? It is one of the most popular languages in front end web development and has even found its way to the back end with Node. Personally, I think JavaScript is super fun to use and equally as powerful, but it can get a little dicey at times — mainly with the way it handles, or doesn’t handle, errors.</p><p>For instance, say you have a simple ToDo app. You create a function that takes in a number and uses that number to find the correct ToDo object to do some with. However, you are on such a productive roll that you forget to take everything step by step and wind up accidentally passing in something that isn’t a number into the function when invoking it. The function does its thing and spits out a something unexpected, which is then used in the next part of the functionality and totally ruins everything. You can see that if this process happens at a low enough level, but you are looking at everything at a much higher level, it might be hard to track down exactly what is causing your app to give you unexpected results. This is where TypeScript can be very helpful.</p><p>TypeScript is a typed superset of JavaScript. When something is considered typed, it essentially means that the type of whatever you are using or declaring needs to be stated when writing the code. This ensures that the correct type of data structure is accepted into the function or whatever you are working with. It is important to note that after writing your TypeScript, it then gets compiled to regular old JavaScript and in doing so, gives you helpful errors if your types are not correct. Honestly, I didn’t really appreciate this at first. My original thought was “Just pay attention, be perfect, and don’t make any mistakes!” Ha! How quickly I fell from that high horse and realized that we are all just puny humans and maybe its not a bad idea to make sure everything is getting what it needs before finding out that one little piece of it is broken that makes the whole thing burst into flames.</p><p>Lets look at a <strong><em>very</em></strong> simple example:</p><p>Vanilla JavaScript: We have a simple function, addNumbers, that takes in two numbers and returns the sum. We then use our addNumbers function. First, we use it properly and we get the expected result. Next, we try to add together a string and the number 5, which just plops a 5 on the end of the string. Nice.</p><pre>// example.js</pre><pre>function addNumbers(num1, num2){<br>    return num1 + num2<br>};</pre><pre>const myName = &#39;Dan&#39;</pre><pre>addNumbers(1,2);<br>// returns 3</pre><pre>addNumbers(myName, 5);<br>// returns &#39;Dan5&#39;</pre><p>As you can see, without utilizing typing, JavaScript can get a little weird. If we used TypeScript to write this code, it would error when we compile it and even let us know it will error before we try.</p><p>Here is how to do it in TypeScript:</p><pre>// example.ts</pre><pre>function addNumbers(num1: number, num2: number){<br>    return num1 + num2<br>};</pre><pre>const myName = &#39;Dan&#39;</pre><pre>addNumbers(1,2);<br>// returns 3</pre><pre>addNumbers(myName, 5);<br>// still returns &#39;Dan5&#39;, but will let you know <em>myName</em> is not the correct type</pre><p>Notice that we stated the type when giving our arguments as we declared the function. Even before compiling this, TypeScript will tell you that the variable <em>myName</em> is not the correct type for the function. Neat!</p><p>As you can see, TypeScript can be a powerful tool for making sure the correct kind of data is passed around in your code to help limit errors down the road and help with scalability. It also gives you some great tools in your editor! For instance, if you are importing a function, it will tell you what the function accepts as arguments and what types they are when you use the function. Dope!</p><p>Of course, as with most programming topics, there is a lot more to this. I highly recommend checking out TypeScript’s own <a href="https://www.typescriptlang.org/docs/home.html">documentation</a>. Hopefully this has inspired you to checkout TypeScript or at least to give it a try! Thanks for reading!</p><p>Sources:</p><p><a href="https://www.typescriptlang.org/docs/home.html">https://www.typescriptlang.org/docs/home.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=453c1dc28cc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Copy to clipboard using JavaScript]]></title>
            <link>https://medium.com/@danfyfe/copy-to-clipboard-using-javascript-70d1d24b3cee?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/70d1d24b3cee</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 23:42:00 GMT</pubDate>
            <atom:updated>2019-07-24T11:21:33.302Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating an element that copies something to the user’s clipboard looks pretty impressive and can be equally convenient for the user. Let’s take a look!</p><p>In order to do this we need to use two tools that I had never seen before in my several months 😬 of coding experience: HTMLInputElement.select() and document.execCommand(‘copy’)</p><p>HTMLInputElement.select()</p><ul><li>HTMLInputElement.select() does exactly what you would think: it selects something in an HTML input element. It is important to note that this only works with an HTML input element, such as a text area or an input that has a text field. The method literally selects the value of the input element it is called on, like any user would by double clicking or clicking and dragging to highlight a portion of text. We will be using it to select the value we want to copy.</li></ul><p>document.execCommand(‘copy’)</p><ul><li>You guessed it, it copies whatever is selected in the document. Neat!</li><li>Note that this is only guaranteed to work if used in an event listener or some kind of user action, which is just the way document.execCommand works.</li></ul><p>Here’s what we will need: an HTML input element and a way to trigger the copy</p><ul><li>HTML input element…</li></ul><pre>&lt;input type=&#39;text&#39; value=&#39;copy this!&#39; id=&#39;copy-input&#39;/&gt;</pre><ul><li>Our trigger…</li></ul><pre>&lt;button onClick=&quot;copyIt()&quot;&gt;Copy that!&lt;/button&gt;</pre><p>For this example, I have a simple button that will trigger our copy when clicked. Our onClick event should look something like this…</p><pre>function copyIt(){<br>  // find the element we will select<br>  let copyInput = document.querySelector(&#39;#copy-input&#39;)</pre><pre>  // select that input<br>  copyInput.select()</pre><pre>  // copy it!<br>  document.execCommand(&quot;copy&quot;)</pre><pre>}</pre><p>Note that you may have to add the onClick event listener to your element in a different way depending on your setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*fkhGsO5UrAIja8614KDAjA.gif" /><figcaption>dope!</figcaption></figure><p>It works!</p><p>Nice!</p><p>…we should be proud.</p><p>…yup.</p><p>…its ugly, though.</p><p>…not exactly what I wanted…</p><p>Sooooooo yea! This is a great example of how it works and a great way to see what is really happening (notice the text being highlighted as it is selected), but we can be slick about this, right? We can make it so we don’t see that input box. Our example is cool if you want the user to be able to copy whatever is in the input field after they have added something to it, but I don’t want to do that. I want to make something that copies a specific thing that the average user shouldn’t be able to change.</p><p>So how would we do that? The kicker is, it seems the input needs to be displayed to be selected, so we can’t just make it a hidden field and expect it to do anything. However, we CAN create a hidden field, then set the display to ‘block’, do our selecting and copying, then set the display back to ‘none’, which should work and not be noticeable cause computers are <em>real</em> <em>fast</em>.</p><p>Our copyIt function would then look like this…</p><pre>function copyIt(){<br>  // find the element we will select<br>  let copyInput = document.querySelector(&#39;#copy-input&#39;)</pre><pre>  // display the input<br>  copyInput.style.display = &#39;block&#39;</pre><pre>  // select that input<br>  copyInput.select()</pre><pre>  // copy it!<br>  document.execCommand(&quot;copy&quot;)</pre><pre>  // hide the input<br>  copyInput.style.display = &#39;none&#39;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*FJIUZ0q0YK-J8QIcPYy-AA.gif" /><figcaption>niiiiiiice</figcaption></figure><p>😎</p><p>That’s more like it!</p><p>This is the bare-bones, no real styling, ugly version, but hopefully this will be helpful for anyone in getting basic functionality. You could, of course, put the onClick listener on anything you wanted to create whatever wonderful, 5 star user experience you can think of.</p><p>Hope this was helpful!</p><p>Have fun!</p><h4>sources:</h4><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select">https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/select</a></li><li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard">https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70d1d24b3cee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Animation!]]></title>
            <link>https://medium.com/@danfyfe/css-animation-a2fc7c7ee1df?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2fc7c7ee1df</guid>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Mon, 01 Jul 2019 17:58:52 GMT</pubDate>
            <atom:updated>2019-07-01T17:58:52.538Z</atom:updated>
            <content:encoded><![CDATA[<p>CSS can be very frustrating. It can sometimes feel impossible to do something as simple as line up elements in the manner that you want and styling overall always seems to takes longer than planned. Thankfully, there is a way to have fun with CSS that is relatively easy to understand: Animations! Here is a brief overview:</p><p>Basics:</p><p>@keyframes</p><ul><li>@keyframes is an at-rule in CSS that describes to CSS how to control an animation sequence by giving styles for the stages of the animation.</li><li>When using @keyframes, one must give the rule a start or end state, or the browser will use the element’s existing style for the start or end.</li><li>You can describe the @keyframe stages with ‘from’ and ‘to’, as well as percentages.</li></ul><p>Syntax: (NOTE: the below syntax is for Chrome only and for your animations to work elsewhere, you must include the rules below, in the same fashion:</p><ul><li>@-webkit-keyframes</li><li>@-moz-keyframes</li><li>@-o-keyframes</li></ul><pre>@keyframes animationName {</pre><pre>   from {<br>     style to start with;<br>   }</pre><pre>   to {<br>     style to end with;<br>   }</pre><pre>}</pre><pre>OR</pre><pre>@keyframes animationName {<br>  0% {<br>    style at 0%;<br>  }</pre><pre>  30% { <br>   style at 30%;<br>  }</pre><pre>  100% {<br>    style at 100%;<br>  }</pre><pre>}</pre><p>Once you have your @keyframes set up, all that is left to do is attach it to an element. The basic syntax is as follow:</p><pre>elementToAnimate {</pre><pre>   animation-name: animationName;<br>   animation-duration: Xs; /* or Xms */<br>   animation-iteration-count: integer or infinite;<br>   animation-direction: normal; /* or alternate*/<br>   animation-timing-function: ease; /* or ease-in, ease-out, linear,<br>   cubic-bezier(x1, y1, x2, y2) */<br>   animation-fill-mode: forwards; /* or backwards, both, none */<br>   animation-delay: Xs; /* or Xms */<br>   animation-play-state: running; /* or paused */</pre><pre>   OR</pre><pre>   animation: animation-name duration timing-function delay direction iteration-count fill-mode play-state</pre><pre>}</pre><ul><li>animation-name: name of the animation declared, you can include two animations by separating the names with a comma;</li><li>animation-duration: how long the animation takes;</li><li>animation-iteration-count: how many times the animation will happen;</li><li>animation-direction: the direction in which the animation will play;</li><li>animation-timing-function: how the animation progresses between keyframes;</li><li>animation-fill-mode: what values will be applied to the element outside of animation, ex: animation-fill-mode: forward; will apply the last state of the animation to the element after the animation finishes;</li><li>animation-delay: a delay in seconds or ms before the animation begins</li><li>animation-play-state: paused or running</li></ul><h3>Examples!</h3><p>Text starts extra small, grows, spins, and returns to reasonable size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*zTO7x6AxbGLwiAD9CnA-pQ.gif" /><figcaption>SPIN THE CHEEZE</figcaption></figure><pre><a href="http://twitter.com/keyframes">@keyframes</a> grow-and-spin {<br>  0%{<br>    transform:rotate(0deg);<br>    font-size: 0px;<br>  }<br>  30%{<br>    transform:rotate(180deg);<br>    font-size: 50px;<br>  }<br>  50%{<br>    transform:rotate(360deg);<br>    font-size: 100px;<br>  }<br>  100%{<br>    transform:rotate(0deg);<br>  }<br>}</pre><pre>h1 {<br>  display: block;<br>  text-align: center;<br>  animation: grow-and-spin 2s;<br>}</pre><p>Image shrinks and fades in</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Vj9xWcXB9LtGdp_iKZ-wlQ.gif" /><figcaption>The Cheese Appears out of NOWHERE!</figcaption></figure><pre><a href="http://twitter.com/keyframes">@keyframes</a> shrink {<br>  from{<br>    width: 400px;<br>    height: 400px;<br>  }<br>  to{<br>    width: 200px;<br>    height: 200px;<br>  }<br>}<br><a href="http://twitter.com/keyframes">@keyframes</a> fade-in {<br>  from{<br>    opacity: 0;<br>  }<br>  to{<br>    opacity:1;<br>  }<br>}</pre><pre>.cheese {<br>  display: block;<br>  width: 200px;<br>  height: 200px;<br>  margin: 10% auto;<br>  animation-name: shrink, fade-in;<br>  animation-duration: 2s;<br>  animation-iteration-count:1;<br>  animation-direction: normal;<br>}</pre><p>CSS animations are a relatively easy way to add some fun content to your project and improve the user experience. We can use these animations in combination with other techniques to create unique experiences. Trigger an animation with CSS:hover, apply an animation on click with javaScript or troll your users by animating a submit button to move across the page before they have a chance to click the button. CSS animations are both powerful AND fun.</p><p>Sources (check these out for more info!):</p><p><a href="https://drafts.csswg.org/css-animations/#animation-fill-mode">https://drafts.csswg.org/css-animations</a></p><p><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes">https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes</a></p><p><a href="https://css-tricks.com/snippets/css/keyframe-animation-syntax/">https://css-tricks.com/snippets/css/keyframe-animation-syntax/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2fc7c7ee1df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developers Developing Development]]></title>
            <link>https://medium.com/@danfyfe/developers-developing-development-6505343ce409?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6505343ce409</guid>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Tue, 28 May 2019 16:43:52 GMT</pubDate>
            <atom:updated>2019-05-28T16:43:52.192Z</atom:updated>
            <content:encoded><![CDATA[<p>:part 2</p><p>If you are one of my millions of dedicated fans 😎, you will be familiar with <a href="https://medium.com/@danfyfe/developers-developing-development-967cae202fe">part one</a> of my exploration into software development practices, which politely scratches the surface of the waterfall model and rapid application development (RAD). In part two of this journey, I will take a general look at Agile Software Development and a framework known as Scrum.</p><p>Agile Software Development comes from years of experience practicing rapid application development. In February 2001, a group of seventeen software engineers met and put together the Agile Manifesto, which is conveniently available to download <a href="https://www.agilealliance.org/manifesto-download/?utm_source=manifesto_page&amp;utm_medium=sidebar_banner">here</a>. The Manifesto centers around four main values:</p><p><strong>Individuals and interactions</strong> over processes and tools</p><ul><li>Having competent people working together effectively is more important than the process and tools used</li></ul><p><strong>Working software</strong> over comprehensive documentation</p><ul><li>Having a product that works is more important than having super detailed documentation. Documentation is of course important, but other techniques, like the waterfall model, focus on it in a way that almost becomes restrictive.</li></ul><p><strong>Customer collaboration</strong> over contract negotiation</p><ul><li>Having the costumer involved during the production steps makes more sense than having strict contractual deadlines.</li></ul><p><strong>Responding to change</strong> over following a plan</p><ul><li>As we learned when comparing the waterfall model with RAD, the ability to adapt while building the product leads to completing a project in time and on budget.</li></ul><p>These statements can seem harsh at first, but it is important to note that the process values all of the items in the above list, but the items on the left in bold are valued a bit more and are thought to be more effective if focused on.</p><p>The Manifesto also highlights 12 principles:</p><ol><li>Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.</li><li>Welcome changing requirements, even late in development. Agile processes harness change for the customer’s competitive advantage.</li><li>Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.</li><li>Business people and developers must work together daily throughout the project.</li><li>Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.</li><li>The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.</li><li>Working software is the primary measure of progress.</li><li>Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.</li><li>Continuous attention to technical excellence and good design enhances agility.</li><li>Simplicity — the art of maximizing the amount of work not done — is essential.</li><li>The best architectures, requirements, and designs emerge from self-organizing teams.</li><li>At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.</li></ol><p>I know what you’re thinking: “those copy-paste skills are on point!” 😎 These 12 principles seem to simply be a deeper look at the core values. They highlight the need to have face to face interactions and open communication with the customer, while emphasizing team work that should be able to govern itself. On a side note, the self governing teams and self reflection are very reminiscent of the idea of smaller companies working as tribes, detailed in the book <a href="https://www.triballeadership.net/">‘Tribal Leadership’</a> by Dave Logan, John King, and Halee Fischer-Wright.</p><p>Agile Development is a broad term that covers a general way of thinking when it comes to developing software. There are many branches and processes that come from agile development. I plan on looking into more specific examples in the future, but first a quick look at something I came across while looking into all of this: <strong>Scrum</strong>, which you can find the complete guide to <a href="https://www.scrumguides.org/docs/scrumguide/v2017/2017-Scrum-Guide-US.pdf#zoom=100">here</a>.</p><p><strong>Scrum</strong> is not a process or technique in itself. It is a framework that has been used since the early 90’s to employ processes, manage workflow and helps with the overall understanding of the effectiveness of that process. Scrum works through empiricism, which is a fun way to say that it runs on the idea that knowledge comes from experience and to make decisions based on known data. It has a somewhat rigid structure of values, teams and events. Scrum works in an iterative way to assure the data and predict risk in a project. Scrum sits on three basic pillars:</p><ol><li>Transparency — a process must be defined and referred to in a way where everyone knows what is going on. Language must be clear and everyone needs to have the same definition of ‘done’.</li><li>Inspection — frequent inspections of progress are needed to make sure everything is on track, but should not be frequent enough to cause a disturbance.</li><li>Adaptation — if, at any point during the process, progress is deemed unacceptable, the process must be adjusted as quickly as possible to make sure everything is on track.</li></ol><p><strong>Scrum Teams</strong> are self-organizing, meaning they decided how to get their work done, and cross-functional, meaning they have all of the elements and skills needed to accomplish their goal. They fall into these categories:</p><ul><li>Product Owner — one person who is responsible for managing the Product Backlog, which is an ordered list of everything that is needed in the product and is the single source of requirements for any changes that need to be made. The Product Backlog evolves as the product evolves.</li><li>Development Team — self-organizing, cross-functional, small enough to be nimble, but large enough to get significant work done. Scrum does not allow for titles in a Development Team, regardless of what they do. Each team member might have a specialty or an arguably more important job, but everyone is accountable to get everything done.</li><li>Scrum Master — exactly how it sounds. The Scrum master advices and shows all other members of the teams the rules and flow of Scrum to help everyone understand the steps and why they are important.</li></ul><p><strong>Scrum Events </strong>are used to create structure and regularity to the process and have a set, maximum duration. The main event in Scrum is called a Sprint. A Sprint is usually timed to be at maximum, a month or less long and a new Sprint starts immediately after the last Sprint ends. A Sprint is made up of:</p><ul><li>Planning — when the Sprint is planned. Time allocated for planning is a maximum of 8 hours. The entire Scrum team works on these details. The team decides what will be done during the Sprint (Sprint goal), why it’s being done, and how they will do it in the Increment.</li><li>Daily Scrum — A 15 minute daily meeting to discuss what happened the day before, what will happen today, what troubles are keeping the team from making progress.</li><li>Development Work — After the Daily Scrum, the Development team creates their own plan and starts their work.</li><li>Review — After a Sprint ends, a review meeting, maximum 4 hours. The attendees of the meeting include the Scrum team as well as product stakeholders. They discuss what elements of the Product Backlog were completed, any problems that arose, how they worked passed those problems, and how the next Sprint could be better. An important part of these meetings is a review of the product and how its marketplace and use might have changed, which would, of course, change the approach to development. At the end of the review, the Product Backlog is revised for the next Sprint.</li><li>Retrospective — This is the Scrum team’s chance to use the review to plan improvements for the next Sprint. The meeting, maximum three hours, allows the team to focus on everything that went well, or went poorly, and objectively use that information to make formal improvements for the next Sprint.</li></ul><p><strong>Conclusion:</strong></p><ul><li>Agile Development seems to be the best general guideline to getting things done. It focuses on letting people get work done in a collaborative, peaceful manner. Its principles define the importance of working with the customer in an iterative and adaptive way. I look forward to taking a deeper dive into the different implementations of agile development (one is called <strong>Extreme Programming</strong>, which is super exciting 😎).</li><li>Scrum is also pretty interesting. The daily work in my last profession was not long term enough to have any real structure most of the time, so it was interesting to find that things like Scrum exist. It makes a lot of sense, of course, but it amazes me to see how much work goes into making sure work gets done in a clear, organized way.</li></ul><p>Sources:</p><ul><li><a href="https://www.agilealliance.org/">https://www.agilealliance.org/</a></li><li><a href="https://en.wikipedia.org/wiki/Agile_software_development">https://en.wikipedia.org/wiki/Agile_software_development</a></li><li><a href="https://www.scrum.org/">https://www.scrum.org/</a></li><li><a href="https://www.scrumguides.org/">https://www.scrumguides.org/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6505343ce409" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developers Developing Development]]></title>
            <link>https://medium.com/@danfyfe/developers-developing-development-967cae202fe?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/967cae202fe</guid>
            <category><![CDATA[waterfall-model]]></category>
            <category><![CDATA[rapid-app-development]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Tue, 07 May 2019 13:18:10 GMT</pubDate>
            <atom:updated>2019-05-07T13:18:10.179Z</atom:updated>
            <content:encoded><![CDATA[<p>:part1</p><p>As a student, it’s very easy not to think about the practical applications and real life work flow of the code you are learning to write. Obsessing over syntax and trying to make everything work the way it should can often overshadow the logistics and organizational practices of working on a large project with multiple people. We do paired programming exercises, which mimic some sort of work place environment and teach us how to get along and work well with others, but there is no real hierarchy, and while they are incredible, absolutely useful and definitely necessary, they seem to fall short in giving the full experience of working on a real life, bonafide software engineering team. Or so I am told.</p><p>I have grown to truly love coding and the way it pushes me and makes me think critically. I am incredibly excited to make it my career, to do it everyday, and be a part of a team that’s purpose is to create something great. My past career did not have me in an office working with groups of people in a super structured way, which almost concerns me when I think about getting a job after school ends, so I decided to take a quick look further into how these development teams work on their products.</p><p><strong>Waterfall Development</strong></p><p>The Waterfall model is a linear approach to design, meaning the progress flows in one direction. Historically, it was used to design and build structures, like bridges and buildings, which is a great way to do that, but does not seem to work as well when applied to things like software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*y4LZn36a1r1RI-vrZX-BSg.png" /><figcaption>Diagram of Waterfall Development*</figcaption></figure><p>Waterfall Model Phases: these phases are not set and stone and can changed depending on the team or product, but the basic ideas are here. It is important to note that the waterfall model flow usually depends on each step being fully completed, reviewed, and verified by the powers that be before moving to the next step. However, people make mistakes, so the system is flexible enough to repeat steps if the completed steps are not deemed acceptable.</p><ul><li><em>Requirements</em>: documentation detailing the required functionality and anything else that the product needs to do or have.</li><li><em>Analysis</em>: team looks at requirements to start building models, schema, and business rules that are necessary for the finished product</li><li><em>Design</em>: team starts to design the basic architecture of the product or software. This step results in the software architecture, seen above.</li><li><em>Coding</em>: developing and integrating the software or product, which results in the software, seen above.</li><li><em>Testing</em>: debugging, finding issues, etc.</li><li><em>Operations</em>: installation, support and maintenance of the finished software or product.</li></ul><p>Pros:</p><ul><li>It needs to be organized well to function: the flow helps the team focus on the important details fully and completely before moving on to the next steps</li><li>Places a lot of emphasis on documentation: this includes the requirement docs and the design docs, which are all important and keep everyone informed, especially if the team changes throughout production.</li><li>It is a simple structure: the whole process is laid out plainly and is easily understandable</li></ul><p>Cons:</p><ul><li>It needs to be organized well to function: this is harder than it sounds and can lead to problems if it is not organized well.</li><li>The flow depends on the Client, or user, needing to know exactly what requirements they have when the project starts, which is easier said than done. Costs are increased when the requirements change mid production, since the team essentially has to start over.</li></ul><p>There have been many adaptations of the waterfall model, which leads us to the next big step: Rapid Application Development, or RAD.</p><p><strong>RAD(Rapid Application Development)</strong></p><p>RAD came to be in response to the short comings of the waterfall model when it came to software development. It is a term that applies to a general idea as well as a specific model created by James Martin. Perhaps the biggest difference between RAD and waterfall is the implementation of prototypes. Having a usable prototype during development means that the client, or user, can interact with the product before it is completed and as it is being created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*K8iL5otqWoJtGZqzXwZ7Gw.jpeg" /><figcaption>Diagram of RAD **</figcaption></figure><p>RAD method: below is a walkthrough of James Martin’s RAD method</p><ul><li><em>Requirements planning</em>: like the waterfall model, RAD has a step for planning and analyzing before jumping into creating the product. Everyone on the team gets together to layout and agree on business and technical needs, as well as project scope, constraints, and system requirements.</li><li><em>User design phase</em>: The client, or user, works together with the analysts to create models for a prototype that gives a general view of the overall system. This step helps the client, or user, understand what is happening in the process and allows them to approve a working model of the system.</li><li><em>Construction phase: </em>The product continues to be developed into a functioning system. The client, or user, continues to work together with the development team to give feed back and approval. This is the step when the actual code is written and the product is made. This step is repeated with the <em>user design phase</em> until the product is ready.</li><li>Cutover phase: The product is tested and implemented in this phase.</li></ul><p>Pros:</p><ul><li>The iterative nature of RAD allows for an easier time adapting to the client, or user, needs and requests, which leads to a higher quality product.</li><li>Risk factors in the plan are noted early and can be adapted to much easier than in the waterfall model.</li><li>Faster and cheaper. RAD is said to deliver a product in budget and on time more than the waterfall model. The iterative design of RAD allows the development to happen in smaller pieces that build as the process continues, which, usually, keeps any catastrophic problems from arising. Apparently, it was common place for things to get out of hand while using the waterfall model if the team needed to change a piece of the system that required a total overhaul of the product.</li></ul><p>Cons:</p><ul><li>Change is hard. At first, this new approach was difficult to implement because humans fundamentally do not like change. It would be hard for a team to switch gears so rapidly if they were coming from the waterfall model.</li><li>Client’s Employee. The advantage of having the client, or user, work with the development team is invaluable for the developers, but can often be difficult for the clients. It is highly likely that the client’s representation in the process will be a higher level employee that has a deep understanding of the domain. This means that the business will have to be without this high level employee for quite some time, which may not be what the company wants.</li><li>Scalability. RAD works well with smaller teams, but can often be hard to implement with larger teams on larger projects because it requires so many people working together, side by side.</li><li>Design problems. This model can often lead to a “hack and test” mentality while working on the product, since it is always changing, it is easy to abandon the overall process’s structure.</li></ul><p><strong>Conclusion</strong></p><ul><li>The RAD method seems to make much more sense to me. I can see why the waterfall model would be used, but RAD seems like the only way to work with today’s products. This is just a small intro to all of the processes out there, I will likely be posting about more relevant techniques soon!</li></ul><p><strong>::Stay tuned for :part2: Agile Software Development and Scrum!::</strong></p><p><strong>Sources:</strong></p><ul><li><a href="https://en.wikipedia.org/wiki/Waterfall_model#Modified_waterfall_models">https://en.wikipedia.org/wiki/Waterfall_model#Modified_waterfall_models</a> *</li><li><a href="https://en.wikipedia.org/wiki/Rapid_application_development">https://en.wikipedia.org/wiki/Rapid_application_development</a> **</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=967cae202fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unicode]]></title>
            <link>https://medium.com/@danfyfe/unicode-7626c437e62b?source=rss-dcf0c0496e7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7626c437e62b</guid>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dan Fyfe]]></dc:creator>
            <pubDate>Tue, 16 Apr 2019 17:55:40 GMT</pubDate>
            <atom:updated>2019-04-16T17:55:40.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*M4SaWv3zhmb-fh-4zWHZoQ.jpeg" /><figcaption><em>“Unicode provides a unique number for every character,<br>no matter what the platform,<br>no matter what the program,<br>no matter what the language.” *</em></figcaption></figure><h3>History</h3><p>The Unicode Consortium was established in 1991 after years of discussing a new character encoding called ‘Unicode’ by Xerox’s Joe Becker and Apple’s Lee Collins and Mark Davis.</p><h3>Unicode Consortium</h3><p>The Unicode Consortium’s goal is to develop and promote the use of the Unicode Standard and other related standards throughout the world.</p><h3>Unicode Standard</h3><p>Simply put, the Unicode Standard uses numbers to represent a character set and leaves the conversion up to whatever software that is being used. There are plenty of other standards that do similar things, but the Unicode Standard is compatible with the most used international standards, which makes multilingual computing much easier.</p><h4>A few other Standards</h4><p>ASCII: (ASS-kee) <em>American Standard Code for Information Interchange</em></p><ul><li>encodes 128 characters into 7-bit integers</li><li>contains English alphabet (capital and lowercase), numerical digits 0–9, and 33 non-printable control codes that were designed to give printers instructions, but are no longer used</li></ul><p>ISO/IEC 8859: <em>International Organization for Standardization/ International Electrotechnical Commission</em></p><ul><li>a series of standards to encode the various Latin characters needed to express many European languages</li></ul><p>GB 18030: Official Character Set of The People’s Republic of China</p><ul><li>supports simplified and traditional Chinese</li></ul><h3>Why is Unicode important?</h3><p>Fundamentally, computers deal with numbers, not characters or letters. The Unicode Standard describes useful characters as numbers to enable software to convert data easily and without a high risk of corruption. Before there was a general, unified standard, computers would use proprietary systems to convert text, which could easily lead to corrupt and incorrect data if the information was being passed around to different computers. The need for a standard became undeniable once the Internet allowed for enormous amounts of data to be passed around by tons of computers, whose users preferred uncorrupted data.</p><h4>How does it work?</h4><ul><li>The Unicode Standard uses a few types of character encoding, but the smallest, more usable type is UTF-8 (Unicode Transformation Format 8bit). Other types include UTF-16, UTF-32, but they are not backwards compatible with ASCII, while UTF-8 is. HTML 5 supports both UTF-8 and UTF-16. Major operating systems, like Microsoft Windows, utilize UTF-16.</li><li>UTF-8 encodes characters using 1 to 4 bytes per character. The first 128 characters are encoded in the exact same way as ASCII, which makes them completely backwards compatible. It uses Decimal as well as Hexadecimal values to represent the characters.</li><li>Unicode is the character set that translates characters to numbers and UTF-8 is the encoder that translates numbers into binary.</li></ul><p><em>Below are visualizations of ASCII and UTF-16 to help understand the massive difference in capabilities.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Gk0C_jBSqekfAI4Os9lMpg.png" /><figcaption>ASCII characters **</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iKFwexXg4OKTWL_jeedE_w.png" /><figcaption>UTF-16 ***</figcaption></figure><p><em>There is a lot more to the Unicode Standard. Explore the sources below for in depth reading!</em></p><h3>Now for the fun stuff: Emojis!</h3><p>Unicode also deals with the wonderful world of emojis! The Unicode Consortium accepts submissions to alter or add emojis. The submission process is somewhat lengthy and is surprisingly in-depth considering some of the subject matters. However, one could argue there is significant cultural weight behind the emojis themselves. Below is a link to a submission that a few of my classmates might find very exciting!</p><ul><li><a href="https://www.unicode.org/L2/L2018/18341-bubble-tea-rgi.pdf">https://www.unicode.org/L2/L2018/18341-bubble-tea-rgi.pdf</a></li></ul><h3>Conclusion</h3><p>Unicode is an important part of computing in today’s world. One can argue that the Internet/World Wide Web would not work as well as it does without it. This post only scratches the surface of a very large system. It would be worth checking out the sources below if you are interested in a more technical look at Unicode. Thank you to all of my sources!</p><p>Thanks for reading!</p><h4>Sources</h4><ul><li><a href="https://www.unicode.org/">https://www.unicode.org/</a> *</li><li><a href="https://en.wikipedia.org/wiki/ASCII">https://en.wikipedia.org/wiki/ASCII</a> **</li><li><a href="https://www.w3schools.com/charsets/ref_html_utf8.asp">https://www.w3schools.com/charsets/ref_html_utf8.asp</a></li><li><a href="https://en.wikipedia.org/wiki/ISO/IEC_8859#Relationship_to_Unicode_and_the_UCS">https://en.wikipedia.org/wiki/ISO/IEC_8859#Relationship_to_Unicode_and_the_UCS</a></li><li><a href="https://en.wikipedia.org/wiki/Universal_Coded_Character_Set">https://en.wikipedia.org/wiki/Universal_Coded_Character_Set</a></li><li><a href="https://en.wikipedia.org/wiki/GB_18030">https://en.wikipedia.org/wiki/GB_18030</a></li><li><a href="https://en.wikipedia.org/wiki/UTF-8">https://en.wikipedia.org/wiki/UTF-8</a></li><li><a href="https://en.wikipedia.org/wiki/UTF-16">https://en.wikipedia.org/wiki/UTF-16</a> ***</li><li><a href="https://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings#Eight-bit_environments">https://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings#Eight-bit_environments</a></li><li><a href="https://en.wikipedia.org/wiki/ISO/IEC_8859#The_parts_of_ISO/IEC_8859">https://en.wikipedia.org/wiki/ISO/IEC_8859#The_parts_of_ISO/IEC_8859</a></li><li>https://unicode.org/emoji/future/emoji-provisional.html</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7626c437e62b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>