From Booleans to Strings in Frontend State

When it comes to controlling frontend presentation, developers often rely on booleans. However, this approach can be limiting. In this post, I’ll explore the drawbacks of using booleans and introduce a more versatile alternative: plain old strings with type safety. While this example uses React, the principles can be applied to other frontend frameworks as well. The Setup The React useState hook gives us local state, and it’s often instantiated with a boolean. Open any complex React codebase, and you are sure to see something like this: ...

August 4, 2023

The Case Against "Try This" Debugging

In many group debugging sessions I’ve joined, a major technique being deployed is something I call “Try This” debugging. In this post, I’d like to talk about this anti-pattern, and consider a better way. “Try This” Debugging Defined What is “try this” debugging? Imagine we’re debugging as a pair and we’re stuck. The easy answers aren’t working. Suddenly, I produce an idea. It might be a: Stack Overflow answer GitHub Gist Popular comment on a GitHub issue Slack post from a colleague I share this with you and say the magic words: “try this.” ...

June 26, 2023

Absolute Imports in TypeScript and React: A Practical Guide

Absolute imports are an essential developer experience feature for me in any JavaScript application. In this post, I’ll explain what they are, how to use them, and why they matter. What Is An Absolute Import? It’s easier to think of an absolute import in contrast to a relative import, which looks like this: import { Page } from '../../views/pages/Page'; Translating this code into words: “Bring in the named export Page, which can be found ‘up’ two directories and then inside the views/pages directory.” ...

May 2, 2023

My Daily Programming Routine as a Senior Software Engineer

Over the past decade, I’ve settled into a daily programming routine that helps me stay productive. It centers on code review, moving tickets forward, finishing in-progress work, and documenting what I learn. Here’s the exact workflow I use. Why Have a Routine at All? Many programmers don’t have a routine. So, first let me answer: why have one at all? A routine at work can be a double-edged sword; overemphasize it, and your day can feel too predictable. ...

April 10, 2023

Variable Name Antipatterns Named and Explained

There are only two hard things in Computer Science: cache invalidation and naming things. – Phil Karlton Let’s talk about variable name antipatterns! I use the term ‘antipattern’ a lot on this blog. To make sure I’ve defined it at least once, an antipattern is a technique that seems good but has more bad consequences than good ones. These are antipatterns because they often make sense in isolation and can propagate through a codebase, to the detriment of developer experience and maintainability of the codebase. If you’re interested in a similar take on this idea but from the ‘pattern’ perspective, check out Pick a Good Name on the Hashrocket blog. ...

April 3, 2023

Making Sense of Code Coverage

Code coverage, the percentage of your code covered by automated tests, is a metric associated with code quality. In this post, I’d like to explore the limits of this idea. The higher-coverage-is-better metric I’m discussing could be summarized as: Coverage percentage up: good job! Coverage percentage down: let’s fix write more tests to raise the percentage. This perspective is not a Straw Man argument; it’s real! And here are the challenges I’d offer: ...

March 28, 2023

Does ChatGPT Mean Software Engineering Is Over?

Here’s an argument that’s gaining momentum in my field: AI will eliminate or greatly reduce the programming profession. To elaborate: AI like ChatGPT and GitHub Copilot is very good at writing describable code (“translate feet to meters”) This is the kind of code entry-level programmers are often asked to write AI could eliminate programmer jobs, particularly entry-level Is this correct? Great question! We’re all watching this unprecedented phenomenon unfold. Predictions are plentiful. ...

March 26, 2023

One-Sentence Summaries of Popular Technology Books

Here are some one-sentence summaries of books that have helped me understand programming and technology. Some are technical and some are general. I’m only including books here that I’d recommend reading. This format is reductive by design, so please explore these books to consider the nuances I’m omitting. One-Sentence Summaries Beck, Kent and Andres, Cynthia. Extreme Programming Explained: Embrace Change. If an engineering practice is good (code review) we should do it all the time (pair programming). Carr, Nicholas. The Shallows: What the Internet Is Doing to Our Brains. Our brains change rapidly between generations and the internet is changing them right now. Ford, Martin. The Lights in the Tunnel: Automation, Accelerating Technology and the Economy of the Future. Automation will make some jobs obsolete– not the ones you might think– and also create new jobs. Godin, Seth. Linchpin: Are You Indispensable? As work becomes automated, the people who will still be indispensable at work will have mastered skills like authenticity, passion, and communication. Godin, Seth. The Dip: A Little Book That Teaches You When to Quit (and When to Stick). Participating in any venture requires an important skill: knowing when to walk away. Hoover, Dave and Oshineye, Adewale. Apprenticeship Patterns: Guidance for the Aspiring Software Craftsman. Advancing beyond entry-level quickly is possible with the right strategy. Hunt, Andrew and Thomas, David. The Pragmatic Programmer: From Journeyman to Master. Programming is a craft and we can learn from other established crafts. Isaacson, Walter. Steve Jobs. Steve Jobs’ genius was seeing potential in ideas that other people underestimated or dismissed. Krug, Steve. Don’t Make Me Think: A Common Sense Approach to Web Usability. Great user interfaces ask their users to make very few arbitrary decisions. Lanier, Jaron. You Are Not a Gadget. The internet has strayed from its founding ideals and could be replaced with something more humane. Metz, Sandi. Practical Object Oriented Design in Ruby. Object-oriented programming can be modeled as a series of messages passed between bicycle components. Newport, Cal. So Good They Can’t Ignore You: Why Skills Trump Passion in the Quest for Work You Love. If you want to be passionate about your work, first focus on being good at it. Norman, Don. The Design of Everyday Things. Design is inseparable from psychology. Sinek, Simon. The Infinite Game. Organizations that succeed in the long run choose to play games that don’t have an end (Walt Disney builds Disneyland, a place that can be endlessly improved). Stanier, James. Become an Effective Software Engineering Manager: How to Be the Leader Your Development Team Needs. Engineering management is teachable, but it takes effort because the proficiency it took to be become one doesn’t guarantee you’ll succeed at it. Swartz, Aaron. The Boy Who Could Change the World: The Writings of Aaron Swartz. Thoughtful essays about technology and ethics from one of the web’s founders. Conery, Rob. The Imposter’s Handbook: a CS Primer for Self-Taught Developers. Quickly learn the fundamentals of CS from a self-taught ‘imposter.’ What’s Next The following books are in my to-read pile: ...

March 21, 2023

How to Run an Agile Retrospective for Leaders

Retrospectives are one of my favorite engineering team practices. In this post, I’ll explain why and how I run retros. I’ll be covering: What is a retro? Why should we retro? Retro setup Running the retro Let’s get started! What is a Retro? What is a retro? From a dictionary: Retro, short for retrospective: ‘a surveying of the past.’ Retros are a Scrum/Agile ‘ceremony’, a collection of best practices for software engineering teams. ...

March 15, 2023

Type Your TypeScript Library Functions

There’s been a lot of recent discussion in the TypeScript community about typing functions. These arguments tend to take binary positions: always type your functions, or never type them unless the compiler demands it. Which is the best option? Today I’d like to present one you might not have considered, that I think is just right: Use implicit types most of the time Type library functions Use Implicit Types Most of the Time Most of the time, we should use implicit types. Here’s a React click handler with implicit typing: ...

March 1, 2023