Menu Sidebar

Avdi Grimm

Hacker; code documentarian.

Matching hostnames with pcase in Elisp

I am not what you might call a “competent” Emacs Lisp programmer. More of a cargo-culter, really. But I’m trying to get better.

I create RubyTapas episodes across two different machines: “hazel”, my main development box, and “caroline”, my Windows video editing box. I needed to be able to recognize my synchronized episode directory on either machine, but the paths are different. So I wrote this:

This uses cond , the general-purpose conditional macro. It works, but it’s clunky. I keep repeating the string comparison code. As a Ruby programmer, I want something closer to Ruby’s pattern-matching case statement.

Today I read up on the pcase macro. It turns out it is both simpler and more powerful than I had realized. I haven’t used any of the power yet. But for this very trivial problem, it was as simple as replacing the equality tests with literal strings.

Easy, and nicer to look at!

Edison Phonograph ad

Hacker terminology: “Golden”

When I was starting out as a young programmer, I worked on (among other things) an air-traffic control system. A full set of hardware for the system—including multiple rack cabinets containing maybe a couple dozen computers and specialized boards, user consoles, testing apparatus, and the cabling to connect it all was called a “channel”. A full installation consisted of the radar itself, plus two redundant channels.

We had one channel that lived in our lab. It was known as the “golden channel”. As a newbie, it was a puzzle to me why it was called “golden”. No part of it was made of gold, nor was it gold in color. But I was junior and I didn’t want to ask silly questions, so I just accepted it. It was the golden channel, and that was that.

There’s another usage of the term “gold” or “golden” that you’re more likely to be familiar with. It used to be, when a software shop decided that their project was “done” and ready to ship, they would create a “golden master” copy. This was known as “going gold”.

In the days when CD-ROMs were ubiquitous, this often meant burning an official “golden master” CD, and putting it somewhere safe. Subsequent copies of the software would be copied from the golden master, and then distributed.

The writeable CD media of the time was often golden in color, but I think this was a (potentially confusing) coincidence. As far as I can tell, the use of the term “gold master” dates back much farther than the use of CDs to distribute software.

A third usage of the term “gold” or “golden” in the software field is in the context of testing. “Gold master testing” refers to a technique wherein you produce some output with the software, manually verify its correctness, and then save that output as a “gold master”. Later, after making changes to the code, you can compare the new output to the master output to ensure that the output only changed in ways that were intended and expected. Once verified, the new output replaces the old gold master.

I’ve seen speculation that the usage of the terms like “golden master” stems from the recording industry’s custom of producing a gold CD when an album sells a million copies. But believe this is another coincidence. For one thing, as I said I think the term predates CD technology. For another, “going gold” in software terms means “ready to ship”. Whereas in the recording industry it means “shipped and very successful”.

The most likely source of the term that I’ve run across also comes from the recording industry, but from a much earlier era. In 1902, Edison developed a new “Gold moulded cylinder” process for mastering wax phonograph cylinders. The cylinders produced by this process had much better consistency and fidelity to the original recordings than the ones which preceded them.

Whatever the etymology, this is a term which I’ve heard throughout my software career, but which was never explicitly explained to me. In hopes that it will save a few younger programmers some head-scratching, here’s my definition of “golden” as it pertains to software development:

In the context of programming, to call some artifact “gold” or “golden” means that it is the reference copy or version. It is the version from which other copies should be made, and/or to which other systems or artifacts should be compared for correctness.

Newer Posts
Older Posts

Virtuous Code

"The three virtues of a programmer: laziness, impatience, and hubris" — Larry Wall


News, notes, and commentary from Avdi, weekly-ish.

Books and Screencasts

RubyTapas Screencasts

RubyTapas Screencasts

Small plates of gourmet Ruby code.

Confident Ruby

Confident Ruby cover

32 Patterns for joyful coding.

The Making of

Confident Ruby cover

Watch me build an app in Sinatra and Rails

Objects on Rails

Objects on Rails

A developer notebook on applying classic Object-Oriented principles to Ruby on Rails projects.

Exceptional Ruby

Exceptional Ruby

The definitive guide to exceptions and failure handling in Ruby.