Blog

Posts on software development, careers, and craft.

For me, coding in the early 2000’s was terrifying

For me, coding in the early 2000’s was terrifying. I had no tests. I had no types. I had no autocomplete. Runtime errors were extremely common. Our...

I worried an EV would give me range anxiety

I worried an EV would give me range anxiety. After 4 months I realize it’s a non-issue. Here’s why: The typical American drives about 13k miles a y...

A home needs housekeeping or it slowly becomes a mess

A home needs housekeeping or it slowly becomes a mess. A codebase needs housekeeping too. But developers are busy. So they're often so focused on s...

Problem: We need to upgrade an npm package

Problem: We need to upgrade an npm package. But upgrading in one PR will create a big, risky PR. Solution: 1. Use npm package aliases. This allows...

Some people hate nested ternaries

Some people hate nested ternaries. Some people like 'em. If your codebase has nested ternaries, upgrade Prettier. Prettier now indents nested terna...

TypeScript Problem: I want a string literal union type, but I also want to...

TypeScript Problem: I want a string literal union type, but I also want to call a function that accepts a string in a type-safe manner. (Assume I c...

This is what it looks like to colocate related code

This is what it looks like to colocate related code. Long paths like this: "../../../../" Become short paths: "./" I like diffs like this. 👍

Problem: Code reviews delay feedback

Problem: Code reviews delay feedback. Solution: Stack pull requests. (Open a few small PRs, each based off the previous) ✅ Get feedback early and o...

It's shocking how often teams "lie" to TypeScript

It's shocking how often teams "lie" to TypeScript. A needlessly wide type is a lie. Avoid: 🚩 userId: string; 🚩 isActive: number; 🚩 ages: <str...

Wow, I just watched @BHolmesDev implement React Server Components from...

Wow, I just watched @BHolmesDev implement React Server Components from scratch in under 20 minutes. 🤯 Phenomenal video for understanding the basic...

Just bought the Apple 5K Studio display The good: ✅Super bright ✅Gorgeous...

Just bought the Apple 5K Studio display The good: ✅Super bright ✅Gorgeous color ✅Very crisp text ✅I can easily split the screen when needed. ✅Even...

A recipe for tech debt: 1

A recipe for tech debt: 1. Create a giant pull request. 2. Say “It’s urgent, so I’m going to merge this now. We can fix any feedback later.”

Problem: Optional fields are overused in TypeScript

Problem: Optional fields are overused in TypeScript. Sometimes they’re applied when they’re not even necessary. Solution: In code reviews, if the o...

Problem: We need to replace an old feature with a similar new feature

Problem: We need to replace an old feature with a similar new feature. Solution: Do it in phases. PR 1: Rename the old feature to “old-x” and mark...

Problem: URL search params are evaluated at runtime

Problem: URL search params are evaluated at runtime. So they aren't strongly typed, and they're a hassle in TypeScript. Solution: 1. Abstract reads...

I work with many teams who use different languages and repos for their web...

I work with many teams who use different languages and repos for their web UI and the backend. Example: 1. React UI 2. C# .NET JSON API Problem: It...

CSS Grid is powerful, but I honestly don't use it often because I'm more...

CSS Grid is powerful, but I honestly don't use it often because I'm more familiar with Flexbox. This post by @JoshWComeau does a wonderful job walk...

In TypeScript, the narrower the type, the more safety and clarity we have

In TypeScript, the narrower the type, the more safety and clarity we have. So if a PR widens a type, that’s a code smell. When this happens, I ask:...

When React launched in 2013, every component was a class

When React launched in 2013, every component was a class. When stateless function components arrived in 2015, I only used class components when I n...

Problem: JavaScript’s .sort mutates the array

Problem: JavaScript’s .sort mutates the array. Solution: Use .toSorted instead. It returns a new sorted array.

I like how React hooks centralize and encapsulate a chunk of reusable logic

I like how React hooks centralize and encapsulate a chunk of reusable logic. And I like how the hook provides a nice clear name that documents inte...

I often see HTTP requests that forget to do one or more of these: ✅ Show...

I often see HTTP requests that forget to do one or more of these: ✅ Show loading status ✅ Display a confirmation when complete ✅ Timeout the reques...

Problem: We need to fix a production bug, but the development branch...

Problem: We need to fix a production bug, but the development branch contains work that isn’t ready for prod. Solution: Only merge code to that can...

Import paths tell a story

Import paths tell a story. Short import paths are a good sign - It tells me related code is colocated. 👍 Stuff that can often be located near the...

⚛️4 questions I ask before using useState: 1

⚛️4 questions I ask before using useState: 1. Should I store this state in the URL? 2. Can I derive the value from other state? 3. Is this state re...

Problem: You need to switch your app’s CSS to Tailwind

Problem: You need to switch your app’s CSS to Tailwind. Solution: Use Windy. It converts CSS into Tailwind. https://usewindy.com

Code review principle: If the check can be automated, it should be automated

Code review principle: If the check can be automated, it should be automated. Examples: ✅Do tests pass? ✅Does the app build? ✅Are there spelling er...

Claim: “I need a barrel to specify the feature’s public API.” Reality: There...

Claim: “I need a barrel to specify the feature’s public API.” Reality: There are alternatives. 1. Use one file. Only export the public API. 2. Use...

PSA 📢: Avoid Barrels (A barrel is a file that exports code from other...

PSA 📢: Avoid Barrels (A barrel is a file that exports code from other files) Barrel benefits: ✅ Shorter import paths ✅ Support importing many file...

Problem: Our code has old patterns that we don’t want people to copy

Problem: Our code has old patterns that we don’t want people to copy. Solution: 1. Move the old code to a folder called “legacy”. 2. Tell everyone....