<?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 James Adams on Medium]]></title>
        <description><![CDATA[Stories by James Adams on Medium]]></description>
        <link>https://medium.com/@jamesadams0?source=rss-1c6a65a4eeb7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YqLOHtjon-tlYZFcP0ZauA.jpeg</url>
            <title>Stories by James Adams on Medium</title>
            <link>https://medium.com/@jamesadams0?source=rss-1c6a65a4eeb7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 07:13:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jamesadams0/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[I Broke IE: A Post-Mortem]]></title>
            <link>https://levelup.gitconnected.com/i-broke-ie-a-post-mortem-6201c4861d64?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6201c4861d64</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[create-react-app]]></category>
            <category><![CDATA[internet-explorer]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Wed, 28 Nov 2018 21:36:32 GMT</pubDate>
            <atom:updated>2018-11-30T11:26:54.198Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*bARGnwpJVM5r_MA4A_0Bqw.jpeg" /><figcaption>This is how my day started..</figcaption></figure><h3>TL;DR: Read release notes. And check your create-react-app in Internet Explorer!</h3><p>Things were looking good as I got out of bed that day. The weather was doing the Melbourne thing — the sun was nowhere to be seen — but I’d slept well and had no tangible complaints. As I do most mornings, I made some coffee and jumped on Slack. I meandered through my unread messages — news articles, some banter, maybe a few book recommendations. Until this doozie:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XXBotP3CgldO2U2xqCOfVA.png" /></figure><p>Take a look in the top left corner of that screenshot and you’ll see this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*k5FXUC1SgpJKCXmJgTJHog.png" /></figure><blockquote>Let’s be honest. Every web dev has broken IE at least once in their career.</blockquote><p>However, it’s not super often that you’re responsible for the app being completely borked in production. I’d like to explore the chain of events that lead to this happening — and potentially delve into what we can do to prevent this kind of thing from reoffending in the future.</p><p>For the last few months, I’ve been pushing for us to use TypeScript on our front-end.</p><blockquote>TypeScript is a strongly typed superset of JavaScript that compiles down to plain JavaScript. <a href="https://www.typescriptlang.org/">https://www.typescriptlang.org/</a></blockquote><p>There hasn’t been any pushback (which is great). Everyone’s on board — there’s only two of us on the front end though, so I already had 50% of the vote. Yay for quasi-dictatorships!</p><p>But every app is beautiful in its own way, so it required a bit of fiddling to get working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*GZ39VYiW3WVCV3kWWuT3jQ.png" /><figcaption>My scratched branches…</figcaption></figure><p>As you can see above — it took me a few times to integrate it to completion without getting distracted by more pressing priorities. 3 attempts in total.</p><p>Given we’re a CRA — <a href="https://github.com/facebook/create-react-app">Create React App</a> — it initially meant using <a href="https://github.com/wmonk/create-react-app-typescript">create-react-app-typescript</a>. However, before that attempt was merged and production ready, CRA v2 shipped, adding TS support. 🎉</p><p><em>Or so I thought.</em></p><p>Anyway, last week I was feeling pretty good with what I had setup with CRA v2 to configure TypeScript in our codebase. I had added some examples, made sure all the build/test stages work, and I had even added a <a href="https://github.com/storybooks/storybook">storybook</a> in a previous PR that supported TS!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4I8SlQ2Vk4f9Q_hVBTR1A.png" /><figcaption>Add typescript take #3: PR</figcaption></figure><p>The diff wasn’t too crazy, and around half those changes come from the yarn.lock file.</p><p>In this PR, I bumped react-scripts to ^2.0.0 to get support for TS out of the box. Nothing seemed to break so I didn’t spend too much time investigating the <em>what ifs.</em></p><h3>Red flag #1. 🚩</h3><p>This was merged, however I didn’t release anything because it wouldn’t have any visible effect in production.</p><p>Eventually, we merged something into master that warranted shipping.</p><p>This release dropped ~24 hours before Hannu sent that message on slack. A pretty decent amount of time for IE to be broken in production. Not good enough, one might say.</p><p>This is what we found on initial diagnosis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oHlrjWSgUmKOYUw1XmPlhA.png" /><figcaption>fetch is undefined</figcaption></figure><p>What?!? How are we missing the <strong>polyfill</strong>* for fetch ?!?!</p><blockquote>*A polyfill, or polyfiller, is a piece of code (or plugin) that provides the technology that you, the developer, expect the browser to provide <em>natively</em>. Flattening the API landscape if you will. Source: <a href="https://remysharp.com/2010/10/08/what-is-a-polyfill">https://remysharp.com/2010/10/08/what-is-a-polyfill</a></blockquote><p>A quick explore through the git tree branded the commit merging TS support to be the offending gremlin.</p><p>To get this fixed in production ASAP, I quickly added the most popular cross-browser polyfill for fetch, <a href="https://github.com/github/fetch">whatwg-fetch</a>, confirmed it fixed <strong>everything</strong>, and shipped.</p><p>It didn’t fix <strong>everything.</strong></p><h3>The story in emojis: 🚢 -&gt;🎉 -&gt; ⏲️ -&gt;😭</h3><p>2 hours later, this was the next issue reported. Luckily, it was only reported internally by our super awesome QA team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ericvNbtcGbq-eWPkZNIBQ.png" /><figcaption>Woahhh — broken CSS.</figcaption></figure><p>Woahhhhh. Wild. Those are some funky design decisions. It’s eclectic. It’s avant-garde.</p><p>It’s really, really <strong>ugly</strong>.</p><p>This is what it should look like in a modern browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLb5ke5V70YWz6ScdhhYyQ.png" /><figcaption>Sleek, uniform…opulent.</figcaption></figure><p>So what could be causing the CSS to break in IE? And why hadn’t I noticed it on my run through the app before I shipped?</p><p>A quick muck around in the dev tools showed that a CSS property that should be background-color: transparent had somehow been transpiled into background-color: initial . What the hell, build tools? You’re meant to love me, not spite me!</p><p>Diffing with the compiled CSS prior to the offending commit resulted in the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1a2707975b5671cf4fb72a25b14536f/href">https://medium.com/media/b1a2707975b5671cf4fb72a25b14536f/href</a></iframe><p>Clearly something had changed from react-scripts 1.x -&gt; 2.x .</p><p>But it was only in the compiled CSS. The CSS was <strong>100% okay</strong> when served from the dev server.</p><p>I’ll save you the 20 minutes of googling, and tell you what I should have done from the very start. Before I could even consider bumping react-scripts — before the thought had even teetered on the very brink of entering my mind — I should have read the release notes. It’s a breaking change, after all. <a href="https://semver.org/">SemVer</a> exists for a reason. They can do whatever they want in a major version update, and the <em>release police</em> — 🚓 — can’t do a damn thing.</p><h3>Red flag #2 🚩.</h3><p>Well, here’s a snippet from the release notes for the first offical v2 release of react-scripts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*g75r5V95YJXQ9lWotSnFfA.png" /><figcaption>Uhhhh…</figcaption></figure><p>So this explains why we had <em>lost</em> the fetch polyfill. I quickly removed the whatwg-fetch I had added earlier, and switched it out for the recommended react-app-polyfill (which includes whatwg-fetch ).</p><p>But I was still at a loss for what had happened to the CSS tooling. Again, I’ll save you the 20 minutes of manual web scraping. react-scripts 2.x added PostCSS and AutoPrefixer. Relevant link: <a href="https://facebook.github.io/create-react-app/docs/post-processing-css#docsNav">https://facebook.github.io/create-react-app/docs/post-processing-css</a>.</p><p>This relies on a browersList key in your package.json .</p><p>Relevant docs: <a href="https://github.com/browserslist/browserslist#readme">https://github.com/browserslist/browserslist#readme</a></p><p>If only I had been less careless when I ran yarn start for the first time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*3BhCXiDVlTsHrQwElEkonw.png" /><figcaption>Y</figcaption></figure><h3>Red Flag #3 🚩</h3><p>But one might ask, what are the default browsers? 🎩</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*0sbhXe8F_Gg2x5u2YxSkiQ.png" /><figcaption>uh oh…</figcaption></figure><p>Woops.</p><p>This is easily rectified by removing the line not ie&lt;= 11 . With that change, the compiled CSS was now correct and functional for IE11 (as well as all other modern browsers). One more PR, one more merge. Another run through CI and IE was now functioning…as best as it can.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*k5FXUC1SgpJKCXmJgTJHog.png" /></figure><h3>Moving forward</h3><p>What can we do better in the future to prevent things like this happening in the future?</p><ul><li>Read release notes before bumping major version. Hell, read a damn dictionary, go play ping pong, eat a sandwich. A bit more deliberateness and presence should be employed before merging things that could 100% break your app.</li><li>Cross browser testing.<a href="https://github.com/cypress-io/cypress/issues/310#issuecomment-434150624"> Coming soon to Cypress (woot).</a> If we had a single test running in CI in IE, then this could have been prevented. But the options are a bit slim at the moment, so it would have a high cost to set up.</li><li>Tangential: <a href="https://github.com/greenkeeperio/greenkeeper">https://github.com/greenkeeperio/greenkeeper</a> I wonder if this would have made us fail faster…</li><li>Could there be some way to automate/make it harder to bump certain dependencies? As a CI guard, you could parse the package.json and confirm that updates to particular dependencies were deliberate. Not sure if this would be too much red tape.</li><li>Got any other suggestions? Comment below!</li></ul><p>Summing up — this was a major major bug. Fortunately the resolution process was less than 4 hours from when I nearly spit out my coffee in surprise, to our app being usable again.</p><p>I question whether this was the right decision for the create-react-app maintainers to make. I understand that removing support for IE11 and non-modern browsers reduces the size of the bundled CSS and JS. But that behaviour could have easily been opt-in, rather than forced automatic opting out when the previous status-quo was to support IE11.</p><p><strong>I’m James —My daytime activities involve doing <em>cool web stuff </em>for </strong><a href="https://drawboard.com/"><strong>Drawboard</strong></a><strong>, climbing rocks, and drinking coffee. When the planets are travelling at the right speeds and temperatures, I write about the Web/JS/React/my <em>feelings</em>. Follow me on </strong><a href="https://twitter.com/@jamesadams0"><strong>twitter</strong></a><strong> for shorter form rants that were formerly limited to 140 chars!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6201c4861d64" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/i-broke-ie-a-post-mortem-6201c4861d64">I Broke IE: A Post-Mortem</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Functional React. Is it possible?]]></title>
            <link>https://levelup.gitconnected.com/functional-react-is-it-possible-ceaf5ed91bfd?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ceaf5ed91bfd</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[recompose]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Wed, 24 Oct 2018 21:44:10 GMT</pubDate>
            <atom:updated>2018-10-26T11:12:30.369Z</atom:updated>
            <content:encoded><![CDATA[<h3>Functional React. Is it possible? Exploring functional programming techniques in React using Higher Order Components</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI12lTja7v6HnWbW7fuhEg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/wOHH-NUTvVc?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Braydon Anderson</a> on <a href="https://unsplash.com/search/photos/puppy-with-glasses?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><strong>Warning</strong> — this post contains lots of <strong>code</strong>. If you’re triggered by seeing large blocks of javascript, please consult your loved ones, religious leaders and or a comfort puppy before proceeding.</p><p><strong>Table of Contents</strong></p><ul><li>Intro</li><li>Definitions</li><li>Same component written both ways</li><li>Recompose</li><li>Rolling your own Higher Order Components</li><li>Real world examples</li><li>Advantages</li><li>React Native</li><li>Potential downsides</li><li>Alternatives</li><li>Conclusion</li><li>Resources</li></ul><p>Sorry for the clickbait-y title. Let me be more upfront with you.</p><p><strong>Yes. Yes it is.</strong></p><p><strong>And I’d like to show you how</strong>. But first, a little background.</p><p>I started out with React in the second half of 2017. I was pretty green with web development, but something about React stuck with me — more so than any other framework.</p><p>I was able to learn bits and pieces of React at my previous job, but it was only proofs of concepts and new codebases that weren’t getting shipped anytime soon.</p><p>I was pretty hungry to work with React full time. Luckily, I found <a href="https://drawboard.com.au/">Drawboard</a> and the rest is history.</p><p>A few weeks before starting, I was emailing with one of my then-future colleagues — the other front-end dev — and he gave me a list of technologies/frameworks that were being used on the web app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECgKXCzYp0L59cnUnuIN2w.png" /></figure><p>Now initially, I’d never heard of <a href="https://github.com/acdlite/recompose"><em>recompose</em></a>. I only knew vaguely what a HOC — <em>Higher Order Component </em>— was. And functional programming was something whispered in the dark hallways, propounded by the gods — an unattainable paradigm that I knew nothing about.</p><p>So, before I started at Drawboard, I was writing pretty typical React code. It looked a little bit like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6Ble7fCLuV2vY2jY" /></figure><p>Since then, everything has changed. It’s very infrequent that I have to use the class keyword. Most of our view logic is composed of Higher Order Components and utility functions. Small building blocks that are easily grokked (understood) in isolation, but powerful and all-mighty upon composition.</p><h3>James Adams on Twitter</h3><p>@ryanflorence Have you tried https://t.co/TpmZKQ0QBO? We&#39;re down to 50 usages of the `class` keyword in a big codebase - it&#39;s abstracted a way a bit when necessary using HOCs, but it&#39;s super rare that you really need it. Here&#39;s some code from a talk I gave recently: https://t.co/joeKbIA9Ru</p><p>Before we dive into the magnificent rabbit-hole that is writing functional React — let’s start with a few explanations/definitions.</p><p><strong>Higher Order</strong></p><p>The <em>order</em> of a function refers to how deep it is. Your typical function is single order. Upon execution — with some stuff (arguments) or otherwise — it does a thing, and then finishes execution (by returning some stuff or nothing).</p><p>A higher order function behaves on a <strong>grander</strong> <strong>scale</strong>. It has loftier aspirations.</p><blockquote>A higher order function either takes a function as an argument or returns a function. Or both.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qcF5Gxc4dL5fr1F805rXrQ.png" /><figcaption>Higher Order Functions</figcaption></figure><p>But this is too general. We’re talking React!</p><p>Hang on a second. Isn’t a component just an abstraction from a function?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/0*j_DEmqeVIoJABZXr" /></figure><p>This naturally leads us to the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qaYUEoAFwUGl-MIVJI8nyw.png" /><figcaption>HOCs or Higher Order Components</figcaption></figure><p>It’s okay if this isn’t crystal clear yet. But persist, and I assure you you’ll be using higher order functions and components all over the place once you can grasp their <strong>POWER</strong>.</p><p>If you’ve jumped on the React/Redux bandwagon anytime in the last couple years — you’ve probably used higher order components without even realising it.</p><p>Here’s a common one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UbNxUSiQrqBPTLPH" /><figcaption>react-redux connect</figcaption></figure><p>connect takes some arguments — mapState and mapDispatch — and spits out a higher order component. This HOC takes your TodoList component, and spits out a new, <em>enhanced </em>component. In this sense, connect behaves like a HOC factory.</p><p>Just to really send it home:</p><blockquote>Generally when we talk about a Higher Order Component <strong>(HOC)</strong>, it is a <strong>thing</strong> that takes a <strong>component</strong> and spits out <strong>another component</strong>. A new, <strong>enhanced component</strong>.</blockquote><p>Enough talk! Let’s take a look at the same component written in two different styles.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F4UJyRK2TXNhgk%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fspoilers-august-4UJyRK2TXNhgk&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F4UJyRK2TXNhgk%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/4f25431ff32ba748d4c88e69a96a7036/href">https://medium.com/media/4f25431ff32ba748d4c88e69a96a7036/href</a></iframe><p>Here is our <em>Farm</em> Component, written as a class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0b2cabb3d732666b5eade7e6e7f49d7/href">https://medium.com/media/a0b2cabb3d732666b5eade7e6e7f49d7/href</a></iframe><p>I’ve exaggerated a bit to prove a point — how often are you <em>actually </em>implementing shouldComponentUpdate ?— but otherwise it’s a pretty typical component.</p><p>And this is the same component, written functionally. Note that I use some helpers from the aforementioned library, recompose. I’ll explain exactly how recompose works later on.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0cc5e111a7889dbba047b4c1f6f16112/href">https://medium.com/media/0cc5e111a7889dbba047b4c1f6f16112/href</a></iframe><p>Or even better, using recompose/compose:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/525a2c65e7b16c74d0bcd7a95fded9c1/href">https://medium.com/media/525a2c65e7b16c74d0bcd7a95fded9c1/href</a></iframe><p>At first glance, the two different styles can seem extremely different — but they really do the same thing.</p><p>Let’s say you have a Workshop component. And it’s used on a separate view or even in an entirely different application. You’d be able to ‘steal’ all the business logic from the Farm component— you could pick and choose the smaller HOCs or grab the composed enhance HOC — without even breaking a sweat.</p><p>How would you do this in typical, class-based components? You can’t. This is what makes writing React functionally with HOCs so damn awesome.</p><p><strong>Introducing recompose:</strong></p><blockquote>“Recompose is a react utility belt for function components and higher-order components. Think of it like lodash for React.”</blockquote><p>That’s taken directly from the README. Simply put, it’s a useful collection of HOCs and helpers that blaze the trail for you to write high-quality, functional React code.</p><p>Let’s deep dive into some recompose code. I promise it’s quite approachable — it isn’t doing anything mega funky under the hood.</p><p><strong>Recompose/mapProps (Edited for brevity. </strong><a href="https://github.com/acdlite/recompose/blob/master/src/packages/recompose/mapProps.js"><strong>original</strong></a><strong>)</strong></p><pre>import { createFactory } from &quot;react&quot;</pre><pre>const mapProps = propsMapper =&gt; BaseComponent =&gt; {</pre><pre>    const factory = createFactory(BaseComponent)</pre><pre>    return props =&gt; factory(propsMapper(props))</pre><pre>}</pre><p>You can use mapProps to ‘<a href="https://en.wikipedia.org/wiki/Map_(higher-order_function)">map</a>’ the props coming in to your component before they get there. Let’s say our props look like this initially:</p><pre>{routerProps: {location, query, hash}, tools, ...props}</pre><p>But your component doesn’t care where the routerProps come from — it just needs them as they are. An example propsMapper could be:</p><pre>const propsMapper = <br>   ({routerProps, ...props}) =&gt; ({...routerProps, ...props})</pre><p>Nothing crazy, it just spreads the routerProps .</p><p>So to use mapProps you’d do something like this:</p><pre>const myMapProps = mapProps(propsMapper)</pre><pre>const myEnhancedComponent = mapProps(myBaseComponent)</pre><pre>// alternatively, all in one go:</pre><pre>const myEnhancedComponent = mapProps(propsMapper)(myBaseComponent)</pre><p>I think you’re starting to get the hang of this whole <em>higher order </em>thing.</p><p>Now — recompose has some really useful HOCs. But they’re basic, general and won’t solve every problem specific to your application. No worries —you can and should<strong> </strong>roll your own Higher Order Components to suit your needs. We have hundreds in our codebase.</p><p>Here is an example of an HOC that I wrote called withStateOfTypeSet .</p><p>It’s useful for avoiding reimplementation of the same logic across many components that have to store some local state which belongs in a Set. For those unfamiliar with how Sets behave in JS —check out the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set">MDN docs</a>.</p><p><strong>withStateOfTypeSet</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e84339a5fd0d59d572cb7fd1510f9e86/href">https://medium.com/media/e84339a5fd0d59d572cb7fd1510f9e86/href</a></iframe><p>I’m hoping the code is pretty self-documenting. It’s a <em>nifty</em> HOC which abstracts away some of the funky stuff you have to do when initialising or adding/removing from a Set . The only thing I should really explain here is that recompose/withHandlers adds functions to your component that are called with the most up to date props. <a href="https://github.com/acdlite/recompose/blob/master/src/packages/recompose/withHandlers.js">Check it out.</a></p><blockquote>The extent to which you can compose HOCs is endless. These are the building blocks with which your application is built.</blockquote><p>So far — I’ve only showed learning examples. Whilst cool — they don’t really show what functional React can look like when taken to the <strong>extreme.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F4520523&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fkid-dancing-funny-100-yes-gif-4520523&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2Fae008287b7d45f3f2bd984c008131048%2Fraw&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/70016794a11cbd796db2306f5e3fa014/href">https://medium.com/media/70016794a11cbd796db2306f5e3fa014/href</a></iframe><p>Below is the default export for one of our biggest components. It has <em>a lot </em>of behaviour and is one of the uglier of the bunch. But all of its functionality is composed of many small buildings blocks. All the handlers are tiny functions. And the view logic is a stateless functional component that does nothing besides declare how the component should <em>look.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E9k2c0B7MU7VQA2H" /><figcaption>You can take these ideas and go pretty deep</figcaption></figure><p>Now — I’ve written a whole chunk about the <em>what</em>. But let’s jump to the extensive and overwhelmingly positive <em>why</em>.</p><p>I won’t cover the benefits of writing functional code in general — of which there are many — as this article would turn into a sermon. But it’s certainly within scope to explore some of the React-specific upsides.</p><p><strong>Intra-component code reuse is significantly more feasible</strong></p><p>You can now share code between components without copy-pasting. This is probably the biggest win. Your codebase will be more succinct, you’ll only have to change business logic in one place rather than 10, and code will be infinitely more readable. Plus, it’s so much easier for new developers to grok smaller functions and components than to try and grok 500 line monsters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rR_i5KSRKqis1gVa.jpg" /><figcaption>Sorry Mr. 500 line Class component. Take a hike!</figcaption></figure><p>The effect is compounding once your whole codebase follows the same patterns. Because as time progresses — as it inevitably does — you’ll find that you’ve already done this new thing that you’re trying to build. And you’ve written 90% of the HOCs you need! So it’s just plug and play and then you can ship! 🚢 (Kidding, but optimistic delusions aside, sometimes it actually feels like that.)</p><p>Often, components you end up crafting are composed of 1-many HOCs wrapping some generic component such as a modal, a button, or a link.</p><h3><strong>How the benefits extend to React Native</strong></h3><p>Earlier in the year I talked about my <a href="https://levelup.gitconnected.com/a-one-week-stand-with-react-native-or-how-deep-do-we-plunge-cbb6ca44bb54">experiences</a> integrating React Native into an existing iOS application. I also spoke about it at <a href="http://melbjs.com/">MelbJS</a> — the slides are on my <a href="https://james.now.sh/">site</a>. It’s something I’m <strong>really</strong> excited about. And one thing that always stands out to me as revolutionary is the ability to share code between the two applications.</p><p>I’ve set up the web repo as a submodule in the iOS project, so any code that we write for the web can easily be used in the iOS application. There are a lot of cool parts to this — the iOS application is even ‘repping’ the same data layer as the web! — and if you write your React like we do, then you can share component business logic cross-platform.</p><p>Let’s take a real world example of this. A few months ago we built out issue management in our web application. Think of it as <em>Jira</em> for architects/engineers to raise issues on drawings.</p><p>Isn’t there some rule that states that every software project that grows <em>sufficiently large </em>will eventually build its own implementation of <em>Jira</em>? 🤔</p><p>Anyway, the export for one of the core components, Issue , looked a little bit like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mog6vSk0TJdJhI7U" /></figure><p>Notice the red. We needed this same logic when I began building the same feature set in the iOS application in React Native. So a natural refactor followed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u_39dZy2GWjxasPM" /><figcaption>Refactoring…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/0*fpmxiDWItRfZIjRj" /></figure><p>And then I could use this same HOC to wire up the React Native Issue component!</p><p>Again, not a crazy complicated example, but I hope you can see how these ideas can extend to entire features, codebases or even cross project like in this instance. I didn’t even have to go looking for this example! When I gave the talk that morphed into this write-up, I’d just finished building this feature — it’s pretty cool how easy it was to find examples of why functional programming in React is so damn awesome, just from my day-to-day work.</p><p>Our ability to experiment so successfully/quickly with React Native was entirely driven by our web codebase being structured in this manner.</p><p>You can actually go one step further and share view logic as well using <a href="https://github.com/necolas/react-native-web">react-native-web</a> or <a href="https://github.com/lelandrichardson/react-primitives">react-primitives</a> but I’ve yet to bring these ideas into our applications.</p><p><strong>Potential Downsides</strong></p><p>I’m not a massive fan of selling some methodology so enthusiastically whilst at the same time, entirely neglecting to cover any pitfalls.</p><p>Let’s explore a few downsides of writing all your code like this.</p><ul><li>Performance characteristics are a bit of a grey area. I denoted this section as <em>potential</em> downsides because I’m really not sure about this one. I’m not saying that React code written functionally is <em>less</em> performant than functionally identical ‘traditional’ React view logic — but I’ve never seen any experiments and I’m yet to delve into it. This is because so far, we haven’t had any problems with jank on the Bullclip web app. I’d be very interested to hear if anyone has looked into this — especially with the profiling capabilities of the new <a href="https://reactjs.org/docs/optimizing-performance.html#profiling-components-with-the-devtools-profiler">React dev tools profiler</a>— so please get in touch if you do so!</li><li>Sometimes there are certain things that you either can’t do, or are made harder than they should be using this pattern. Using refs is doable but less intuitive. If you’re hooking into the lifecycle and doing very complex stuff — you might find it easier to use a class. But you can treat these things similarly to how you should treat impure, side-effecty code in a predominately functional codebase. <strong>Isolate it, acknowledge that you’re using some impure code, use it, and move on.</strong></li><li>React dev tools go deep. Exploring the component tree is significantly more difficult (but far from impossible) because each HOC adds another component into the tree. Funnily enough I don’t often need to do this because one of the upsides of writing code like this means I usually can work out pretty quickly where the bug is.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XRnrdSEgQgpeaIz7" /><figcaption>Yo react dev tools are thickkkkk gurl</figcaption></figure><p>But, you could see this as a plus if you appreciate the ability to see which HOC added which props into the chain.</p><p><strong>Exploring the alternatives</strong></p><ul><li>Render props. If I didn’t have access to HOCs (cut to an apocalyptic, dystopian future where functions max out at single order) — I like this pattern the most. It’s out of scope for this article, but check it out at the official react <a href="https://reactjs.org/docs/render-props.html">docs</a>.</li><li>Collections of pure functions that you hook into from class components? (A bit ugly but still allows code reuse. Dealing with this could be a bit yuck though.)</li><li>Prototypal/Class based (<em>extends</em>) inheritance everywhere? <strong><em>Please</em></strong><em> don’t do this.</em></li><li>Copy/Paste code everywhere? (I’m joking. Stahp, pls.)…(I’m joking. Stahp, pls.)</li></ul><p>I hope I’ve given a tasty enough selection of what’s possible when you write React functionally. And maybe a little bit of insight into the journey I’ve undertaken in the last year or so.</p><p>I’m a big fan of putting my work out in public. It could save someone a lot of time — or give another person an opportunity to explain to me why my views are wrong. Please get in touch if you have any questions/want to tell me why you think this is bad, why I’m wrong or that I smell. I promise not to yell functional programming terms at you.</p><p>I’ll just put all that angst into a <a href="https://en.wikipedia.org/wiki/Currying"><em>curry</em></a><em>.</em></p><p>You can find out more about me at <a href="https://james.now.sh/">https://james.now.sh</a>. Or by stalking my GitHub <a href="https://github.com/james-E-Adams">@James-E-Adams</a>. Or tweet me <a href="https://twitter.com/jamesadams0">@jamesadams0</a>!</p><p>Resources:</p><ul><li><a href="https://reactjs.org/docs/higher-order-components.html">https://reactjs.org/docs/higher-order-components.html</a></li><li><a href="https://drboolean.gitbooks.io/mostly-adequate-guide-old/content/">https://drboolean.gitbooks.io/mostly-adequate-guide-old/content/</a></li></ul><p>The content for this article was fuelled by a talk I gave at the August React Meetup in Melbourne. You can find the slides at <a href="https://james.now.sh/">https://james.now.sh</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ceaf5ed91bfd" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/functional-react-is-it-possible-ceaf5ed91bfd">Functional React. Is it possible?</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some musings on how we write code]]></title>
            <link>https://levelup.gitconnected.com/some-musings-on-how-we-write-code-bc0e4fb5cab2?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc0e4fb5cab2</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Sat, 07 Jul 2018 02:25:01 GMT</pubDate>
            <atom:updated>2018-07-16T16:08:37.260Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UwfRCH-UYh2raOXmNkQFaQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/8zdEgWg5JAA?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Rob Schreckhise</a> on <a href="https://unsplash.com/search/photos/computer-thinking?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Every codebase is different. Likewise, every team (cohort…pride? What’s the collective noun for engineers? A byte?) of developers have different standards for what constitutes quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WjN-aQ65mIfgIbh2vYxWpw.jpeg" /><figcaption>Developers, developers, developers!</figcaption></figure><p>Often, code smells that are considered heresy for one gaggle of devs are taken for granted as ‘the way to do things’ by their counterparts across the road.</p><p>I don’t just mean things like semicolons, tabs v spaces, or formatting. These things don’t change how the program executes (in JavaScript at least!) . I’m talking paradigms (functional vs declarative vs imperative), how to separate concerns, or even whether using nested ternaries is considered immoral. And I think many of these quirks, preferences and ideals are influenced by your environment, your coworkers (fellow pod members), and the technologies you adopt.</p><p>Let’s go through a few of these.</p><h4>Environmental influences</h4><p>No matter how you spin it, your priorities are going to be a function of the size of your company/team (amongst other things, of course).</p><p>Take two similarly sized covens of devs. One is weighted under the bureaucracy of middle/upper management and enterprise release cycles — and the other is fighting to ship a product ASAP before they run out of money.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jw9auVNlchC2TG0kM89A4w.jpeg" /></figure><p>The core agent at work here is urgency. If your day-to-day isn’t influenced by the rate at which you’re shipping software, then there is no urgency. And you won’t get things out the door as quickly as you could have. But — you <em>might </em>write more tests or less future legacy code. My thoughts on how the size of your team influences the manner in which you write code is summarized in the bulleted list below.</p><p><strong>Big company:</strong></p><ul><li>You’re not in a hurry. Your output will be diminished. Your job is not on the line because money is less of an issue in established, profitable companies.</li><li>You may have to deal with legacy code. This means, unfortunately, you will probably write <em>more </em>legacy code. You could also be dealing with technologies that aren’t well documented or easy to work with. Or worse…shudder…it could be <em>bespoke. Closed-Sourced. Roll your own!</em> This will add time to your work. This will make you slower.</li><li><strong>If</strong> someone more senior or more involved has done their job properly, you will have the dev-opsy side of things abstracted away for you. CI/CD will ‘just work’<strong>(TM)</strong>, you can spin up any number of environments/pipelines easily. You won’t have to spend time mucking around with the infrastructure. This should make you faster and more likely to write good tests.</li><li>Big companies rarely have horizontal org structures. This means there could be someone(s) on your team that will only merge code if it satisfies their definition of ‘good code’. This could be good or bad.</li></ul><p><strong>Comparatively, at a smaller company:</strong></p><ul><li>You have to get shit done. This could mean you’re writing less unit tests. There could be less people looking at your code before it’s shipped. You might not even have a round of manual QA before users are on it. Write less brittle code, or find an efficient, effective way of writing automation that ‘guarantees’ your code does what is says on the packaging.</li><li>You will still have to deal with legacy code. You will probably still write code that should be thrown out and rewritten eventually. Ideally you keep in mind that every chunk of code has a timeline and you should write it accordingly.</li><li>It is easier to fight for standards that you believe in. Hopefully, it’s more of a meritocracy.</li></ul><h4>Coworker/Tech choice influence</h4><p>I’ve been fortunate enough to work with some wicked smart, switched-on programmers. Elusive 10xs. Downright motivated human beings. But I’ve also been on teams with developers who write shit code, don’t give a fuck about the product, and just want to do their 9–5, poorly, and gtfo.</p><p>Here it comes. Here comes the wild, corny, shudder-inducing thesis.</p><blockquote>No programmer is an island.</blockquote><p>There. I said it. Now the troublemakers out there might be smiling smugly to themselves as they ask, ‘What about me? I’m on a team of one/I code 20 hours a day in eternal moonlight/I turned my startup into a unicorn without a single hire.’ You still use open source frameworks. You will still run into problems. You’re still dependent on other human beings!</p><p>But more seriously, who you work with strongly impacts how your code turns out. If the most value you can add is mentoring, code reviewing or ‘architecting’, it may be that you won’t even be writing code.</p><blockquote>Productivity is my personal output. Generativity is the difference between the team’s output with me and without me. Source: <a href="https://the-composition.com/the-origins-of-opera-and-the-future-of-programming-bcdaf8fbe960">https://the-composition.com/the-origins-of-opera-and-the-future-of-programming-bcdaf8fbe960</a></blockquote><p>It could be that the greatest value proposition you have for the team is being an ‘enabler,’ assisting others to write great code.</p><p>Moving on, certain developers, as humans are wont to do, have opinions. Predilections, if you will. Whoever started building the product you work on could have LOVED jQuery and refused to let it die. (I’m sorry.)</p><p>Or they might have hated seeing style.css files in their React projects, so your whole app is built with inline styles.</p><p>But the scope of opinions is even wider. Even the choices and actions of programmers on other parts of the product will strongly influence how you write your code. If you’re a front-end developer, you’ll probably need to get some data. You might think you get it from the back-end, but it’s the back end engineers who are going to tell you how and when you can get it. (Ideally you can find a way to play nicely together.) And this will influence how you write your ‘data layer’ and your interactions with the API.</p><p>Your teammates can also have a strong impact on your personal ability and growth. Spend a year with a developer who is significantly smarter, more experienced than you, and who actually gives a fuck about you getting better, and you’ll see what I mean. I promise— you will write progressively better code.</p><h4>Looking back</h4><p>Lately I’ve been reflecting on how the way I ‘<em>do</em>’ programming has undergone radical shifts in the last couple years. Writing this article has allowed me to explore the hows and whys, without getting too much into the technical nitty-gritty. In a future post, I may actually explore what’s changed in the React code I’m churning out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc0e4fb5cab2" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/some-musings-on-how-we-write-code-bc0e4fb5cab2">Some musings on how we write code</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A one week stand with React Native — Or, how deep do we plunge?]]></title>
            <link>https://levelup.gitconnected.com/a-one-week-stand-with-react-native-or-how-deep-do-we-plunge-cbb6ca44bb54?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbb6ca44bb54</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Sun, 13 May 2018 01:33:15 GMT</pubDate>
            <atom:updated>2018-06-26T11:59:38.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PapSJP84ew9_YPmLRrOGlw.jpeg" /></figure><h4>Our team’s experience with trying React Native and integrating it into our workflow</h4><p>Our team is huddled around a black wall, littered with cryptic, coloured post-it notes. It seems to have some tabular qualities, but they’re prescriptive rather than restrictive. Some notes have escaped the confines of the masking taped columns. Pictures of people’s disembodied heads have attached themselves to various notes, indicating some sort of possession over the various components of the organised chaos.</p><p>By now, you’ve probably guessed it. We’re about to perform the ancient ritual of stand-up . Millions (?) of years of evolution have lead us to this point — and coffee cups in hands, it’s not something to be missed.</p><p>This is a how the day starts at Drawboard. A few ‘<em>good morning</em>’s are passed around, we hook up a hangout for whoever’s working remotely that day — maybe someone holds up Huey to the camera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KLQaozte5HAk8ZikNSvdbQ.png" /><figcaption>Huey!</figcaption></figure><p>We’re building <a href="https://www.drawboard.com/bullclip/">Bullclip</a> — a collaborative platform for the design and construction industries — and part of the technical challenge is developing across multiple platforms. Currently, we’re on UWP (Universal windows platform), iOS, and Web. As we push toward feature parity across the different platforms, we’re always on the lookout for ways to collaborate and help one another get stuff out the door.</p><p>In walks React Native.</p><p>I’ve kept a lazy eye on how far RN was coming along over the last year or so, with my only real experience being a half day hackathon at iress, my previous employer. We built a simple financial market data application for mobiles, hooked up to a GraphQL backend. I was pretty impressed how quickly we got it up and running, but I didn’t push the interest in RN any further.</p><p>But realising that we have two enthusiastic web devs itching to build cool stuff (myself included), and some heavily requested features to build for iOS — on paper RN seemed enticing.</p><p>That afternoon, we got into a room and bashed around a few ideas. 20 minutes later, and I’ve been given some time to explore if React Native would be suitable for our purposes.</p><p>Spoiler alert — I’m pretty psyched.</p><p>Second spoiler alert — I have 0 experience writing native mobile code. <a href="https://en.wikipedia.org/wiki/Swift_(programming_language)">Swift</a> means quick and <a href="https://en.wikipedia.org/wiki/Objective-C">Objective-C</a> is an impartial <a href="https://en.wikipedia.org/wiki/List_of_seas">Atlantic Ocean</a> — I don’t know either of these programming languages 🤷.</p><p>But given sufficient quantities of caffeine, an internet connection and a block of time, I was ready to give this a whirl.</p><p>My first course of action was to type into google:</p><blockquote>Integrate react native into existing iOS app</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FbrHaCdJqCXijm%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fhappy-spongebob-squarepants-happiness-brHaCdJqCXijm&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FbrHaCdJqCXijm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="315" frameborder="0" scrolling="no"><a href="https://medium.com/media/abaf0b1171de6dd38ab85decac3e70d1/href">https://medium.com/media/abaf0b1171de6dd38ab85decac3e70d1/href</a></iframe><p>And I found <a href="https://facebook.github.io/react-native/docs/integration-with-existing-apps.html">this</a>.</p><p>I was excited.</p><p>Having had no idea whether this was doable or not — mish-mashing RN and native code — it was encouraging to find out it was possible.</p><p>So, I start following it. And I’m hitting walls <em>everywhere</em>.</p><p>The damn thing won’t compile. We have conflicting Podfile requirements, XCode is yelling at me to step up my game. It can’t find React when I try to import it in Swift — it has no idea what I’m talking about and refuses to take the time to understand my feelings. Yaaaaarg!</p><p>A half day’s head bashing condensed into a sentence: I had to use a version other than the latest (0.51.0 worked for us), and I had to trim the fat from our growing list of dependencies.</p><p>The blocker at this point was walking in the dark any time I had to write some native code. Luckily, our iOS engineer was able to unblock me quite a few times. We managed to add buttons in the right places that opened React Native Views. (I personally prefer portals into a magical javascript land where James feels comfortable and safe, but whatever.)</p><p>It started with this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*bqFGt_T085hnDI5mpXxKpg.png" /><figcaption>Which opened into the high scores screen from the guide</figcaption></figure><p>Yes, it’s 4:26am whilst I write this article. 🦉</p><p>The next step was to try build a feature that we’ve wanted in our iOS app for a while now, but haven’t had the capacity to prioritise. It’s our timeline/comment feed for talking to other people marking up a drawing.</p><p>If we were to build this without insane levels of difficulty, it would mean finding solutions to the following technical concerns:</p><ul><li>Handling authenticated network IO without calling native code</li><li>Full or partial code reuse from our existing web app.</li><li>Performant integration of native components and react views</li><li>Ability to debug. (i.e — have a similar experience to developing on the web)</li><li>Ability to go back and forth easily between native and react views</li></ul><p>Spoiler alert: I’ve ascertained that 4 out of 5 are possible, so far.</p><p>Once I was in the javascript runtime, my first goal was to see how easy it was to get data from our back end and display it on the screen.</p><p>It actually turned out to be pretty easy! The biggest hiccup was when I had to write some swift code to get the bearer token into the JS runtime, but again, our iOS engineer stepped in to unblock me.</p><p>Our web app is written 99% in a functional style, so code reuse was 2% copy-paste, 98% webpack/babel config magic. (I wanted <a href="https://github.com/react-community/create-react-native-app/issues/171#issuecomment-316994039">absolute imports</a>). This ticked box number 2. An important caveat is that view logic, because we have divs and spans everywhere, is not shareable at this point. This is fine for now, but we’ll probably have some hurdles to solve down the line if we’re super keen on the whole ‘write once’ idea. Think <a href="https://github.com/necolas/react-native-web">react-native-web</a>.</p><p>And now we get to debugging. Yes, web-esque hot reloading debugging sorcery is doable! Out of the box too!</p><p><a href="https://github.com/jhen0409/react-native-debugger">GitHub - jhen0409/react-native-debugger: The standalone app based on official debugger of React Native, and includes React Inspector / Redux DevTools</a></p><p>You just have to flick a few switches and you’re in the game. It’s incredible.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FMO9ARnIhzxnxu%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FMO9ARnIhzxnxu%2Fgiphy.mp4&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FMO9ARnIhzxnxu%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="422" frameborder="0" scrolling="no"><a href="https://medium.com/media/8f7ca492f05387a99fc7fb9767f0c37d/href">https://medium.com/media/8f7ca492f05387a99fc7fb9767f0c37d/href</a></iframe><p><strong>With the build tooling in check, it was time to write a feature.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*ntWjZnjgFzIY-CuucanrTw.gif" /></figure><p>Of course, I had to make sure users knew what the feature was — so they’d click the button of course.</p><p>Spot the odd one out. Click it.</p><p>This is another ‘portal’ into a react native view. It opens a very basic, bug-riddled timeline, but it’s a successful proof of concept showing that we can indeed build small features in react native at this point.</p><p>The biggest blocker here was telling the native runtime that I wanted to hide the react native view, from javascript.</p><p>I originally achieved this using the <a href="https://developer.apple.com/documentation/foundation/notificationcenter">NotificationCenter</a> — since there wasn’t any clean navigation stack to pop on and off to.</p><p>But basically I exposed a swift function to javascript by following this:</p><p><a href="https://facebook.github.io/react-native/docs/native-modules-ios.html#exporting-swift">Native Modules · React Native</a></p><p>I don’t think we’re ready to dive in the deep end and do a complete re-write. Nor do I think that would be smart. But right now, building out small, isolated features in react native makes perfect sense for us. The web platform is further along than iOS or Windows, so there’s no issue of lagging behind if we step off the gas on the Web front.</p><p>A few things I’m yet to tackle include:</p><ul><li>Different screen sizes.</li><li>Deployment</li><li>Performance characteristics</li></ul><p>But I don’t foresee any crazy roadblocks.</p><p>Please HMU in the comments below if I’ve done something silly or if you have any questions about how react native is going for us.</p><p>BTW — we’re hiring! Come work with me at Drawboard! We have cookies.</p><p>We’re looking for an iOS developer (or two). We’re remote friendly, and we have a whole stack of interesting technical problems to solve. <a href="https://stackoverflow.com/jobs/companies/drawboard">https://stackoverflow.com/jobs/companies/drawboard</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbb6ca44bb54" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/a-one-week-stand-with-react-native-or-how-deep-do-we-plunge-cbb6ca44bb54">A one week stand with React Native — Or, how deep do we plunge?</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decision Making At Scale]]></title>
            <link>https://medium.com/@jamesadams0/decision-making-at-scale-ae227068f1e9?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae227068f1e9</guid>
            <category><![CDATA[responsibility]]></category>
            <category><![CDATA[social-change]]></category>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[corporate-culture]]></category>
            <category><![CDATA[coffee]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Sat, 03 Feb 2018 07:51:21 GMT</pubDate>
            <atom:updated>2018-02-03T07:52:49.731Z</atom:updated>
            <content:encoded><![CDATA[<p>Ever since I was a kid, I’ve held pretty libertarian beliefs.</p><blockquote>“Mum I’m a libertarian.” — James at 3 years old.</blockquote><p>I hated being told what to do. And I never had much interest in convincing other humans to do my bidding.</p><p>Maybe it stems from a lack of faith in large corporate entities, governing bodies, or ‘grown-ups’. Or maybe I’m just a…rugged individualist. 🙇</p><p>However, something recently shook this long-held belief. Or rather, it took a shit on this pretty little libertarian paradise I’d fabricated in my head where humans behave nicely to themselves and each other, act responsibly, ethically, morally — and don’t trash the world.</p><p>Let’s construct a thought experiment together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNVLG2gWikvJzUeTTM7PiA.jpeg" /><figcaption>Beans for thought?</figcaption></figure><p>Company X has a decision to make, with two options available. The decision will directly impact some task that employees will often do. It could be washing hands or coffee preparation and consumption. Both options have the same economic feasibility and the same implementation cost, but they differ in that employees might have to do a little bit more work when performing that task. This could mean the difference between providing coffee capsules, or some other means of caffeinating your staff.</p><p>However, capsules have a higher environmental cost. This opens us up to the following question:</p><blockquote>Does Company X have an ethical obligation to make the better decision?</blockquote><p>Personally, <strong>I think so.</strong></p><p>Let’s look at a few rationalizations for this position.</p><p><strong>1. Scale</strong></p><p>This is the main factor that’s been bugging me. When a company makes a decision that affects the coffee consumption of 2000 people, some simple arithmetic can make things seem quite <strong><em>concerning</em></strong>.</p><blockquote>2000 people * 2 cups/day * 5 days/week * 46 working weeks = 920,000 cups of coffee/year.</blockquote><p>This is ludicrous! A mid-sized company of 2000 people changes something about their coffee facilities, and they’re affecting almost a million cups of coffee per year.</p><p>If Company X decides to switch to say, Nespresso capsules, this means they’re making a decision that instantly means 920,000 capsules will be used.</p><p>Now, <a href="https://www.nespresso.com/pro/au/en/pages/recycling-process?icid=B2B_Auen_Homepage_Universe_2017_02_Recycling_2">Nespresso</a> does offer a recycling facility. Good. But my basic understanding of the environmental impact still brings me to the conclusion that this is an immoral decision to make. <a href="http://theconversation.com/the-trouble-with-aluminium-7245">A crazy amount of energy</a> is required to extract aluminium from bauxite (one of the principal ore sources) — and I’m highly skeptical that all that energy comes from renewable means.</p><p>The alternatives — an automatic coffee machine which grinds the beans for you, a separate grinder and espresso machine, or even a drip filter machine. None of these options call for more raw materials than just coffee and potentially some biodegradable filter paper.</p><blockquote>“But what about the inconvenience?”</blockquote><p>Whinge. Whinge whinge. Whinge whinge. Go make yourself a damn coffee. Spend the two minutes it takes to prepare it. You can’t possibly be that busy. And if you are — I assure you, you’re not productive. There are enough studies that suggest that taking a break or doing a habitual task could help you solve whatever problems you’re working on.</p><p><strong>2. Most people just don’t care enough.</strong></p><p>I’m fortunate enough to have crossed paths with many smart people. Brilliant problem solvers, hotshot programmers, or socially switched on geniuses.</p><p>So many of them have the brain power to understand why something is bad for the world, and what extra little task they could do to reduce their impact.</p><p>But they don’t do it. Good luck convincing them otherwise.</p><p>The average human being, scrupulous or otherwise, doesn’t actually care about the environment. They won’t go out of their way to do the right thing. I’m vaguely switched on and I care about these things, but I’m still not a perfectly upstanding participant.</p><p>In its own right, this is enough of an argument for why these kinds of decisions have to be made en masse. You can’t give people a choice — they will, like water down a slope, just take the path of least resistance.</p><blockquote>Think more carefully, more deliberately, if you have to make decisions that affect the footprint of more than just yourself.</blockquote><p>I’m a firm believer in not being a useless consumer. Trying to reduce your plastic usage, not touching take-away coffee cups with a ten foot barge pole, maybe eating a little less meat. These are all good things, but ultimately, the choices you make in your personal life just don’t scale the same way that decision-making at the corporate/governmental level do. Something something, <a href="https://en.wikipedia.org/wiki/Corporate_social_responsibility">Corporate Social Responsibility</a>.😕</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae227068f1e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What to do with your money]]></title>
            <link>https://medium.com/@jamesadams0/what-to-do-with-your-money-4ae536f504e1?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ae536f504e1</guid>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[opinion]]></category>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[personal-finance]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Mon, 29 Jan 2018 00:35:55 GMT</pubDate>
            <atom:updated>2018-01-29T00:35:55.643Z</atom:updated>
            <content:encoded><![CDATA[<h3>What To Do With Your Money</h3><p><a href="https://medium.com/@jamesadams0/some-ramblings-on-money-895e6e94c8cb">Last post</a>, I touched on my personal relationship with money. I talked briefly, optimistically, on the concepts of frugality and <a href="https://www.mrmoneymustache.com/">moustachianism</a>.</p><blockquote><strong>Moustachianism</strong>: Financial Freedom through badassity.</blockquote><p>In this instance of my ramblings— as promised — I want to delve into what to do with your money once you’re not spending it all.</p><p>Conventional wisdom tells you to buy a house, but it could take you years to accumulate enough money for a deposit — especially in a city like Melbourne, where <a href="http://www.abc.net.au/news/2017-12-10/one-in-three-melbourne-suburbs-million-dollar-median-house-price/9243408">1 in 3 suburbs have a median house price of over $1 million.</a></p><p>Next up, people will misinform you to go buy a few <em>blue chip </em>stocks, or worse, they’ll tell you about this great new small company whose shares are currently valued at 3.5c, but <em>they’ll totally hit a dollar by this time next year.</em></p><p>Or even better, they’ll invite you to invest in their <strong>shitty startup idea</strong>!</p><p>These ideas all suck as suggestions on where to put the bulk of your earnings.</p><p>Choosing a few stocks and<em> holding steady</em> means you’re over-investing in a small handful of companies.</p><p>Startups and speculating on more volatile securities = gambling. And don’t even get me started on ‘investing’ some number greater than 0.5% of your monthly salary in bitcoin. (<strong>Spoiler alert</strong>: This isn’t investing.)</p><p>Surprisingly, most people don’t know what <strong>index funds</strong> are. Even though they are the most suitable long term investment for 99% of people. (<strong>Disclaimer</strong>: I’m not a financial adviser — so take my advice with a few grains of salt.)</p><p>Simply put, index funds work as follows: You give them your money, either directly or via purchasing ETFs (like shares) — and their job is to track the market, maintaining a balanced collection of shares, weighted by market cap. You can buy in funds that track one or more markets — and you can diversify by investing in more than one fund.</p><p>They are a long term investment.</p><p>The crazy thing is — you don’t need to know any of this. If you’re working in Australia, you already invest in index funds in the form of superannuation, and 99% of people have no idea how it works. But it does. The trick is to go beyond super, and put away half of your paycheck into index funds for your entire working career. And you’ll end up rich. By doing nothing. This is called passive investing — and it’s incredibly powerful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0sTML-WdSn1JB1Ad5_XSA.jpeg" /><figcaption>Einstein probably didn’t say this. But let’s call it…paraphrasing.</figcaption></figure><p>The market goes up and down, but on average, for the last 100 years, you could safely double your money or more, every 7-10 years. Here’s the Dow Jones for instance: <a href="http://www.macrotrends.net/1319/dow-jones-100-year-historical-chart">http://www.macrotrends.net/1319/dow-jones-100-year-historical-chart</a>.</p><p>$1 dollar now equaling $2 in 10 years, $4 in 20 years, $8 in 30 years. Doesn’t seem like much, right?</p><p>Let’s look at the median Australian salary of $80,000. You have the option of spending or saving each dollar that you earn. But that means, in 20 years, you’d have to be earning $320,000 to match the value of the dollars you earn now. Do you see yourself being able to quadruple your salary in the next 20 years? If you answer yes — great, share your secrets with us. But more likely than not, you won’t be earning such a ludicrous sum. However, you could achieve the same effect by putting some money away now.</p><p>Hopefully I’ve triggered some sort of curiosity — maybe you’re even trying to calculate how much money you’ll have in <strong>x</strong> years of putting away <strong>z </strong>dollars.</p><p>Let me do the maths for you.</p><p><a href="https://networthify.com/calculator/earlyretirement?income=80000&amp;initialBalance=0&amp;expenses=40000&amp;annualPct=5&amp;withdrawalRate=4">Early Retirement Calculator</a></p><p>So, starting from nothing, you could retire in 16 years. This doesn’t take into account super (+), savings (+), or inheritance (+). Or debt (-). Or Melbourne’s ludicrous property market (- -).</p><p>This form of investing can be attributed to <a href="https://en.wikipedia.org/wiki/John_C._Bogle#Investment_philosophy">John C. Bogle</a>, the founder of Vanguard — one of the largest providers of funds in the world. (They have $4.5 trillion in assets under their management.)</p><p>I’d highly recommend getting started with <a href="https://www.amazon.com/gp/product/1118921283/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=1118921283&amp;linkCode=as2&amp;tag=jamesadams0-20&amp;linkId=95f0a11b485dae3d02538913c89d272c&quot;&gt;The%20Bogleheads&#39;%20Guide%20to%20Investing&lt;/a&gt;&lt;img%20src=&quot;//ir-na.amazon-adsystem.com/e/ir?t=jamesadams0-20&amp;l=am2&amp;o=1&amp;a=1118921283">The Bogleheads’ Guide to Investing</a>. It’s a little bit more tailored towards the US investor, but the lessons can be applied anywhere. Especially given we can invest in Vanguard in Australia really easily through ETFs. <a href="https://www.vanguardinvestments.com.au/retail/ret/articles/insights/research-commentary/etfs/etfs-how-to-get-started.jsp?lang=en">Check it out.</a></p><p>I honestly believe that this is what 99% of people should do with most of their money. Or you could just put it in bitcoin…(/sarcasm, please don’t do that.)</p><p>Thanks for taking the time to read this article! Feel free to leave a comment if you agree or disagree!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ae536f504e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fix your powershell window not opening when you…open powershell!]]></title>
            <link>https://medium.com/@jamesadams0/how-to-fix-your-powershell-window-not-opening-when-you-open-powershell-f14a40c908b?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f14a40c908b</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Sun, 07 Jan 2018 21:16:05 GMT</pubDate>
            <atom:updated>2018-01-07T21:16:05.994Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2g8ET5PIcHh7YqwOhS3G9A.png" /><figcaption>Damn you, powershell!</figcaption></figure><p>I’ve been plagued by this annoying issue for a long time.</p><p>You’re all ready to hack the world and get something productive done. Full of excitement, trepidation, and maybe lethal quantities of caffeine — you hit the start button, type `powers` (because power alone might open powerpoint) and clearly you have more than one power. Then you hit Enter.</p><p><strong>What you expect</strong>: a powershell window opens, full frontal, and all your emotional, marital, and chiropractic problems are solved.</p><p><strong>What happens</strong>: The powershell icon appears on the taskbar, but even clicking it does nothing. You try everything — nothing seems to bring the damn window into focus.</p><p><strong>How to fix:</strong></p><ol><li>Hover over the icon until you see the window itself, only ant-sized.</li><li>Right click this window, and hit properties.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*zyyLNR0-ektVwu6QVJdgPA.png" /><figcaption>Hit properties…for glory!</figcaption></figure><p>Now, you should see this dialog:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*QVL4J_0MmhbfSwnsHvFh0A.png" /></figure><p>Switch to the layout tab, and tick the box that says ‘Let system position window’. Hit ‘OK’.</p><p>Now, I can’t quite remember whether you have to restart powershell or whether it works straight away. But if you don’t see your powershell window now or after clicking it in the taskbar — just kill it and open powershell again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qlkoLdLWh2YfJCaLVfLNbA.jpeg" /><figcaption>Happy hacking!</figcaption></figure><p>I can’t remember where I read this piece of wisdom, but it was along the lines of — if something takes you more than 2 minutes to type/explain, write a post and put it online. I’m going to start following this from now on. 🎉</p><p>Thanks to <a href="https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/21/weekend-scripter-the-case-of-the-disappearing-powershell-console/">https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/21/weekend-scripter-the-case-of-the-disappearing-powershell-console/</a></p><p>and</p><p><a href="http://www.tomshardware.co.uk/forum/id-3501103/powershell-window.html">I can&#39;t see the Powershell window. - Windows 10 - Tom&#39;s Hardware</a></p><p>for showing me the way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f14a40c908b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some ramblings on money]]></title>
            <link>https://medium.com/@jamesadams0/some-ramblings-on-money-895e6e94c8cb?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/895e6e94c8cb</guid>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[habits]]></category>
            <category><![CDATA[consumerism]]></category>
            <category><![CDATA[personal-finance]]></category>
            <category><![CDATA[money]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Thu, 04 Jan 2018 07:30:28 GMT</pubDate>
            <atom:updated>2018-01-04T07:30:28.544Z</atom:updated>
            <content:encoded><![CDATA[<p>Or, dollarydoos!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-w3iPFl-cfI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-w3iPFl-cfI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-w3iPFl-cfI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1748e546af99fd08acf677e87f9ec28/href">https://medium.com/media/f1748e546af99fd08acf677e87f9ec28/href</a></iframe><p>I often talk about money. Almost as often as I think about it. And the lovely humans I’m fortunate enough to have in my life will confirm these claims.</p><p>But this fixation on money seems somewhat different to the approach of those around me.</p><p>You see — I don’t crave immense wealth or luxury or status symbols. They just don’t interest me. I have 0 emotional attachment to money itself.</p><p>But I do believe money buys freedom. Specifically, the ability to choose where you spend your time. And when. And how much of it you invest.</p><p>Sure — you can work <strong>x</strong> hours a week indefinitely, and all the <strong>(168-x) </strong>hours a week remaining are yours to spend how you wish. Minus the time spent commuting <strong>(y)</strong>, the time spent playing catchup outside work hours <strong>(z)</strong>, and the hours of investment required to advance in your career <strong>(a)</strong>. Well, and the time you should be investing in sleep, too <strong>(s)</strong>. Those <strong>(168-x-y-z-a-s) </strong>hours quickly whittle away, right? Not to mention that you’re probably pretty zonked out from full time work to properly appreciate those spare hours and use them for cool shit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ltdb9Fqcv5-NSTsGAty8RQ.jpeg" /></figure><p>But if you had all your living expenses covered, you would probably choose to spend your time a little differently, right? Hell, you might even choose to go to work anyway because you love your job so damn much.</p><p>There’s a school of thought (or a few intersecting schools of thought) postulating that you don’t actually have to work your whole life — mandatorily at least. Labelled as frugality, financial independence, or even my personal favourite, <a href="https://www.mrmoneymustache.com/">moustachianism</a>, the idea is that you work hard for anywhere between 10–25 years — depending on your circumstances — learn to live off a little bit less (which is still plenty), and put away the rest. You keep putting wealth away until one day, your annual passive income = your annual expenses. Now you are no longer forced to work, and you can do as you please with your time. Maybe you could even do something good for humanity?</p><p>Don’t believe me? Check out this post by Mr Money Moustache: <a href="http://www.mrmoneymustache.com/2012/01/13/the-shockingly-simple-math-behind-early-retirement/">http://www.mrmoneymustache.com/2012/01/13/the-shockingly-simple-math-behind-early-retirement/</a></p><p>The premise is that we already have such rich, luxurious lives being in first world countries — this Casually Explained video puts it well, regarding how your life will turn out based on where you’re born (skip to 0:16s to see the map) — that you should really be able to have a stupidly comfortable life living on 30–70% of your income.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FgWIi6Pytde8%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DgWIi6Pytde8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FgWIi6Pytde8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5e30c2c7a3e67fa51df8ce26455802f/href">https://medium.com/media/d5e30c2c7a3e67fa51df8ce26455802f/href</a></iframe><p>And I tend to agree. Is eating out an extra few times a week really worth adding a year or two to your working career ? Seriously, do a few calculations of different expenses over the course of 10–15 years. It’ll scare you. Just for shits and giggles, let’s take buying lunch every day at work as an example. Average cost of a meal in Melbourne is probably around $15. Multiply that number by 5 for each day of the working week. That’s $75. Then, assuming you’re working 48 weeks a year in the city, multiply that number by 48. $3600.</p><blockquote>$3600 spent just on eating lunch out each work day. For a single year!</blockquote><p>Hang on. It gets worse. Let’s look at a 25 year career. Which is pretty damn short by today’s standard, with preservation age set at 60. So you eat out every day at work for 25 years. This means you’ve spent $3600 * 25 = $90000.</p><p>This adds 4 <strong>years</strong> to your working career, assuming you can live a comfortable life on $22500 cash annually. Was it worth it?</p><p>Cut out a few expenses in your life, consumerist ones especially, and you’ll quickly see how much money you waste. Or hopefully, you used to.</p><p>Better yet, track every dollar you spend for a year and see where your money is actually going. There are a few apps that help with that. <a href="https://getpocketbook.com/">Pocketbook</a> in Aus or <a href="https://mint.com/">Mint</a> in the US. If you take anything from this article, it should be this. The epiphanies will follow if you just start to track what happens to your money — at scale.</p><p>I’m only one year into my career. And who knows what the future will hold with regard to job prospects, what I want to do with my time, or where I want to be. But at this point, I don’t want to spend my entire life trading hour by hour for material shit that won’t actually make me happy. So I’m stach’ing<strong>*</strong>. And I think you should too.</p><p>(*): In a future post, I’ll talk about what you could do with all this new found cash you have lying around — now that you’re not burning it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=895e6e94c8cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Efficiency, Or: Getting shit done.]]></title>
            <link>https://medium.com/@jamesadams0/efficiency-or-getting-shit-done-de3b10f91695?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/de3b10f91695</guid>
            <category><![CDATA[efficiency]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[happiness]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[social]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 11:47:38 GMT</pubDate>
            <atom:updated>2018-01-02T11:47:38.762Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m still not sure whether to classify it as a problem, or a blessing. But no matter which way I spin it — I like my life to be efficient. I do things quickly and I try to pack in a lot into a day. I optimise <em>everything</em>.</p><p>Chores don’t stand a chance against the regime. When I clean my apartment, I whirlwind around, completing more than one task at a time. I’ll have multiple things in my hands that belong in different parts of my small home — even whilst I’m on the way to the kitchen to turn off the heat so the rice doesn’t overcook.</p><p>Theoretically, this means I should be ‘<em>earning</em>’ myself plenty of extra leisure time, right?</p><p>But as one might be able to predict — I have trouble relaxing. I can’t sit still for very long, nor can I be happily idle. Put simply, I have zero chill.</p><p>Okay, I’m exaggerating a little bit.</p><p>But this efficiency, optimisation mindset does come at a cost. I really struggle to take enjoyment in everyday activities when I know they could be done better, faster, with less waste. Enough to subconsciously stress me out, until I make myself be present and aware of what I’m feeling. It only takes a moment, but I’ll catch myself and realise — “Hold on, this doesn’t actually matter. Remove the emotional investment.”</p><p>The thing is — I haven’t concluded yet whether I would like to change this or not. One benefit is that I get a lot done. I think I’m a fairly productive person, if you could come up with a universal metric and rank my productivity. But undoubtedly this is a result of the <a href="https://en.wikipedia.org/wiki/Illusory_superiority">Lake Wobegon Effect</a> — wherein most people think they are above average in pretty much any metric: attractiveness, scholastic ability, job performance.</p><p>So trying to optimise my life means I probably allow myself to get things done. Or, better put, I set the stage and provide myself the opportunity to do so. However, it’s hard to stave off the guilt when I’m sitting on the couch. “I should either be out climbing/cycling, or learning more javascript” — I tell myself.</p><p>And this could be a mistake. A lot of studies have shown that having <a href="https://psmag.com/social-justice/throw-out-your-computer-and-grab-some-legos">unstructured play time</a> is important for adults too. But I’m usually happiest when I have a project. Or several. Maybe my unstructured play time is being able to work on a project/solve a problem without having to consider any other factors. No office politics, no design meetings — just trying to solve the challenge in the coolest, cheapest<strong>(*) </strong>way possible.</p><p>I think it’s commonplace to equate relaxing with doing activities which don’t directly net any benefit. A lot of people relax by binge watching Netflix — I’m not completely innocent, I promise — or going out drinking with friends, but usually I’m just as drained after doing either of these things. I find that what most recharges my batteries is learning something new, trying to create something. And I’m certain I’m not alone in that. Just look at the number of javascript projects on GitHub. Most of the participants in the open source community already work full time jobs as developers. But for whatever reason or combination thereof, they spend most of their leisure time working on their side projects. And do you know why?</p><p>Humans like having problems to solve. It’s in our nature. And if we don’t have any tangible problems to solve, like finding food or shelter, we create our own! And a key component to being happy, is choosing the right set of problems to invest your time and energy into. There’s a great book, called <a href="https://www.amazon.com/gp/product/0062457713/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0062457713&amp;linkCode=as2&amp;tag=jamesadams0-20&amp;linkId=f4a4cae881145256493acc2fece5e7b8">The Subtle Art of Not Giving a F*ck</a> by <a href="https://en.wikipedia.org/wiki/Mark_Manson">Mark Manson</a> that touches on this very concept.</p><p>I know it’s okay to take a break. Well, at least I’m cognisant of this. Whether I implement it is a whole other story.</p><p>I’m off to bed now. That counts as productive, right?</p><p>(*): I’m going to touch on this topic in another post in the coming weeks, but I’m frugal and proud of it. A lot of fun experiences in my life have come from adopting this mindset. Numerous ludicrous couch-surfing experiences, hitchhiking with a bicycle across Europe, and turning my car into a campervan (ish) for under $100. And these <em>projects </em>have made me immensely, immeasurably happy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de3b10f91695" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t be a dick.]]></title>
            <link>https://medium.com/@jamesadams0/dont-be-a-dick-74add610d2aa?source=rss-1c6a65a4eeb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/74add610d2aa</guid>
            <category><![CDATA[social-change]]></category>
            <category><![CDATA[interpersonal-skills]]></category>
            <category><![CDATA[opinion]]></category>
            <category><![CDATA[motivation]]></category>
            <category><![CDATA[humanity]]></category>
            <dc:creator><![CDATA[James Adams]]></dc:creator>
            <pubDate>Mon, 01 Jan 2018 01:07:33 GMT</pubDate>
            <atom:updated>2018-01-01T01:07:33.944Z</atom:updated>
            <content:encoded><![CDATA[<p>I wrote this about 6 months ago when I decided, again, that I was going to start a blog. That spark of motivation fizzled pretty quickly, but here are the ashes:</p><p>Time for my first blog post. Sort of.</p><p>I tried my hand at blogging for a brief 12 hour stint when I was 20 and travelling through Asia. I think I got bored/distracted/forgot. Anyway, it didn’t stick.</p><p>Take 2.</p><p>And like every well behaved developer who tries to write something that isn’t code, I’m writing this in Sublime. Old habits die hard, I guess.</p><p>Last night, my housemate and I were sitting on the couch watching a movie. The movie* watching attempt was a failure. But a few glasses of wine, and a haunting episode of Black Mirror later, we got onto the topic of people. More specifically, how easy life would be if humans followed one simple rule.</p><p>Don’t be a dick.</p><p>We dabbled in defining what that means. All the basic moral codes came up first — no murder, rape, infidelity, theft, using up the last ice cubes from the freezer without refilling the tray. The conversation eventually moved on — relating morality back to religion, and ending in a half-ass viewing of:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fn7IHU28aR2E%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dn7IHU28aR2E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fn7IHU28aR2E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3998060f66b8079f4083223afb8be560/href">https://medium.com/media/3998060f66b8079f4083223afb8be560/href</a></iframe><p>But the next day, I was curious as to the origins of this simple axiom. “Don’t be a dick.” It’s something I believe in, and attempt to embody as much as possible. But it surprised me to see the not so official context in which it was <a href="http://knowyourmeme.com/memes/wheatons-law">coined</a>.</p><p>Essentially, it was Wil Wheaton at PAX ’07 (Video game convention) in the context of interacting with people on online games. Neat, right?</p><p>But this penny of wisdom has broader implications. It can and should be applied to many other facets of your life.</p><p>If less people were dicks to each other, everyone would benefit. You don’t even have to go out of your way to be nice and benevolent and perform wholesome altruistic deeds. You just have resist the urge to be a dick. It’s that easy.</p><p>Sure, it’s even nicer when people go out of their way to do nice things for others, that’s awesome. But as a society, the net gain would be greater if everyone were to simply avoid being a dick. This means no judging others for decisions/life choices that might go against your personal beliefs but have no direct impact on you. This means avoiding aggression and violence and harassment. This means going about your day to day life without making someone else’s life worse because you’re in the world.</p><p>It’s so easy. Just do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JBh9G8mBhce29mKT9sh0g.jpeg" /><figcaption>Shia doing his thing.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74add610d2aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>