James Sinclair
jrsinclair.bsky.social
James Sinclair
@jrsinclair.bsky.social
I type for a living. Sometimes code, sometimes not.
A maze that exists only as a data structure in memory is a bit useless. We need some way to make it legible to human beings. So I’ve written an article that addresses how we do that.

​https://jrsinclair.com/articles/2025/rendering-mazes-on-the-web/
August 25, 2025 at 8:18 AM
I felt like writing about something fun. So I wrote an article about creating mazes with JavaScript. Things got out of hand and it grew to two articles. Second one will be published soon.

jrsinclair.com/articles/202...
The joy of recursion, immutable data, and pure functions: Generating mazes with JavaScript
Generating mazes might not be something you do a lot in your typical front-end job. Some might call it a waste of time. Why bother if you’re not a game developer? Who needs that kind of thing? Sure, i...
jrsinclair.com
August 18, 2025 at 7:54 AM
I can't believe I haven't come across this talk by @kentbeck.com before. It has so much explanatory power.
www.youtube.com/watch?v=Wazq...
3X Explore, Expand, Extract • Kent Beck • YOW! 2018
YouTube video by GOTO Conferences
www.youtube.com
July 23, 2025 at 10:22 PM
@charity.wtf talks a lot of sense, as usual:

> [10x Engineers exist] So what? It doesn’t matter. […] What matters is how fast the team can collectively write, test, review, ship, maintain, refactor, extend, architect, and revise the software that they own.

charity.wtf/2025/06/19/i...
In Praise of “Normal” Engineers
This article was originally commissioned by Luca Rossi (paywalled) for refactoring.fm, on February 11th, 2025. Luca edited a version of it that emphasized the importance of building “10x engi…
charity.wtf
July 9, 2025 at 6:40 AM
I wrote a thing about all the ways you can summon a function in Javascript. It even includes a flow-chart to help check if you're picking a suitable incantation.

jrsinclair.com/articles/202...
What’s the difference between named functions and arrow functions in JavaScript?
Arrow functions (also known as ‘rocket’ functions) are concise and convenient. However, they have subtle differences compared to function declarations and function expressions. So how do you know whic...
jrsinclair.com
June 30, 2025 at 8:44 AM
I have a theory. People struggle with TDD because it feels like hard work. This is because many of us code to think. We're assigned a task, and we start hacking away in the IDE. The solution languidly emerges as we learn more by writing code.

But TDD won’t let you do that.
April 2, 2025 at 9:37 AM
A couple of array utilities you won't find in Array.prototype 🧵
April 1, 2025 at 3:24 AM
In some ways, this is so obvious it shouldn't need stating. But it does. And the tension is real. We want our code to be elegant, simple, concise. Yet, we rarely trade that off against the complexity that elegance creates in the interfaces (user interfaces and APIs) we develop.
March 30, 2025 at 9:34 PM
From the archives: jrsinclair.com/articles/201...

Functional programmers are obsessed with purity. “Pure functions let you reason about your code”. “They give you referential transparency!” And they have a point. Purity is good. But what do you do with the impure bits of your code?
How to deal with dirty side effects in your pure functional JavaScript
If you start learning about functional programming, it won’t be long before you come across the idea of pure functions. And as you go on, you will discover functional programmers appear to be obsessed...
jrsinclair.com
March 27, 2025 at 9:22 PM
Four ways to remove duplicates from an array in JavaScript. 🧵
P.S. Use the last one.
March 26, 2025 at 10:39 PM
Did you know that you can use an array tuple in place of a Maybe structure? It elegantly handles empty values using familiar `.map()`, `.flatMap()`, and `.reduce()` methods. I think it's rather neat. Credit goes to @[email protected] for introducing me to the idea.
March 25, 2025 at 9:48 PM
I love this quote from John Ousterhout:

> I have found over and over that specialization leads to complexity; I now think that over-specialization may be the single greatest cause of complexity in software.

On the surface, it appears to contradict YAGNI, but not necessarily.
March 24, 2025 at 10:07 PM
It's old news now, but swapping variables with destructuring still blows my mind every time I see it.
March 23, 2025 at 9:21 PM
I still see lots of people setting default values in JS using the || operator. This is fine if the values you're dealing with are always objects. But if you deal with numbers, booleans or strings, this can be problematic. In most cases, the ?? operator is a better choice.
March 20, 2025 at 10:26 PM
Guilty.

“Rules for Writing Software Tutorials”
by Michael Lynch @mtlynch.io
refactoringenglish.com/chapters/rul...
Rules for Writing Software Tutorials
It's easier than you think to write an exceptional software tutorial. You can stand out in a sea of mediocre guides by following a few simple rules.
refactoringenglish.com
January 3, 2025 at 10:18 PM