Rustic wooden door, nearly indistinguishable from planks of wood
Rustic wooden door, nearly indistinguishable from planks of wood
Photo by Jonathan Ybema on Unsplash

React Hooks have taken the web development community by storm. A lot of people talk about how hooks are great. How hooks allow them to do things they never could do before. How they enable code sharing and reduce the size of your codebase. But I haven’t heard anyone talk about custom hooks as a tool for abstraction and encapsulation.

Abstraction is the ability to engage with a concept while safely ignoring some of its details… If you refer to an object as a “house” rather than a combination of glass, wood, and nails, you’re making an abstraction. If you…

Photo by Dan Farrell on Unsplash

The Problem

Today, I was deploying a serverless backend to AWS with with Serverless. At one point, I ran into a cryptic error from the Lambda like “Server Error”. In the Lambda logs in the AWS console, I discovered the cause of the error: the DynamoDB table name in the serverless.yml config file was different from the table name in the Lambda function. So the Lambda was trying to access a DynamoDB table which didn’t exist. I thought to myself, there has to be a better way. Can the table name be shared between the config and the code? …

Photo by Dominik Dancs on Unsplash


Your apps can’t access your photos on iPhone. You’ve tried a half dozen supposed solutions but nothing works. Do not despair!

Follow these steps to grant apps access to your photos on iPhone:

  1. Settings > Screen Time > Content & Privacy Restrictions > Photos > Make sure it’s set to “Allow changes”
  2. In the app you’re trying to grant access to your photos, try accessing your photos again; It should prompt you to give permission; Accept
  3. Now back in Settings > Privacy > Photos, you should see the app and you can give it Read/Write permissions, for example
  4. If you…

This article has been moved to my personal website/blog:

Stay up-to-date with what I’m working on by following me on Twitter!

Photo by David A. Good (CC BY-NC-ND 2.0)

This article corresponds with the launch of my GitHub repo, clean-code, which is meant to serve as a reference for myself and others on the topic of clean code and architecture. It is based on my experience studying these principles and includes code examples, analogies, and other observations. The two books I mention below are Effective Java and Design Patterns.

Clean, maintainable code is very often undervalued and underappreciated by product managers and engineering managers who are more focused on short-term deliverables than maintainability over the long-term. Sort of like investors who can’t see beyond short-term profitability and returns. There’s…

Photo by David A. Good (CC BY-NC-ND 2.0)

I had never published an NPM package, so I went through the process from start to finish and documented the steps hoping that it will help others.


First, I had to think of an idea for a new package. I wanted it to be dead simple so I could focus on the stated goal of publishing a new package from scratch. I came up with a simple idea based on my experience of copying and pasting CSS across various projects in order to create HTML elements which override the default user agent stylesheet. The classic example of this is a…

Photo by David A. Good (CC BY-NC-ND 2.0)

TypeScript has really come of age. Type definitions are widely available, the community has grown by leaps and bounds, the productivity gains from tooling are off the charts, compilation times are fast, and adopting TypeScript is easier than ever.

My TypeScript Moment

For the past few years, I was never really convinced to go all-in on TypeScript. I had tried it out and become frustrated by the lack of type definition availability and long compilation times slowing down the development feedback loop. But the nail in the coffin was a cryptic TypeScript error that broke my project’s build. …

Photo by David A. Good (CC BY-NC-ND 2.0)

Getting Started

Depending on your setup, adding TypeScript to your existing project might take as little as a minute or two.

Note: These steps only describe how to get started using TypeScript in your project. This will give you a lot of benefits right away, but you should also explore tools like fork-ts-checker-webpack-plugin to make sure your app won’t even build if there are TypeScript errors. Without this, you will only see IDE warnings and errors (assuming you’re using an editor that support this like VS Code), but those can easily be overlooked or ignored.

Project Uses Create React App

  1. Run this yarn add typescript @types/node @types/react…

Fresh water from mountain spring, Photo by David A. Good (CC BY-NC-ND 2.0)

If you’ve just purchased a Dell (or similar) computer, you probably won’t be surprised to find it loaded with bloatware such as Dell utilities and McAfee AV. And if you’re like me, you’ll be terrified when McAfee automatically installs a Chrome extension, annoyed by Dell pop-ups and reminders, and unsatisfied with system performance with all those processes hogging resources.

So naturally, you’ll want to reformat and install a clean copy of Windows. However, times have changed, so if you haven’t done this in a few years, you may need some pointers. I was also surprised that I couldn’t find a…

First Unit Test

Mocking a component’s call to Moment.js seems like a great candidate for our first unit test in Jest. However, it‘s not as straightforward as you might think. You could use a manual mock placed in a __mocks__ directory. But that’s not very elegant. Here, we show a simple, one-line solution in a basic test scenario.

Stateless Functional Component

To get started, we have a stateless functional component which calls Moment.js to get the current timestamp.

import React from 'react';
import moment from 'moment';
const Clock = () => {
return (<h1>{moment().format()}</h1>);
export default Clock;


David Good

Software engineer crafting full-stack, cloud-native solutions for enterprise

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store