Ka Wai Cheung
Or use keys

Making the code reading experience a little more delightful.

Over the years of building DoneDone, I kept a list of examples of how I like to name things in code. In 2020, decided to create a small web-based book, entitled Naming Things, to share them.

See the webbook here!

There are three hard things about programming

They say there are two hard things about programming: Cache invalidation and naming things. While working on this project, I discovered a third: Explaining code you've written to someone who hasn't seen it before.

I've had this problem with physical books and even documentation. Code authors suffer from the “curse of knowledge” just as much as other professionals do. They typically don't explain the entire context of code they've become so familiar with.

I wanted to make the experience of reading my book a little better. When rolling your mouse over a highlighted bit of text, the relevant code automatically highlights. You can take as long as you need to read the context and the code without getting lost.

Simple little touches: Using plain old jQuery and HTML data attributes, I tied my explanations of certain code with the code itself. Each highlighted text has a data-code-ref attribute whose value maps to code wrapped in<span> tags with the same class name.

Warm and fuzzyness

I am obsessive about the details of how words render on a page: Font styles, weights, letter spacing, line heights, padding between different sections and paragraphs. To me, a page that uses negative space well just makes reading words more pleasurable.

Screenshot of layout and style for Naming Things
The beauty of negative space: The space around letters, lines, and paragraphs can make good writing feel even better.

For this book, I wanted the content to have a warmth and approachability not typical of most technical books. I loved the playfulness of Fredericka the Great for the chapter titles and the inviting nature of Lora for the body text.

I ended up repackaging this webbook as an ebook through Leanpub under the new title “Landing on a Great Name”.


And finally, a few of the things I've written, drawn, and spoken about so you have a sense of how I try to communicate ideas.