Naming Names - Anonymity is Dead

There are only two hard problems in computer science: cache invalidation,
naming things, and off-by-one errors.

Phil Karlton, but I can't find a name for the original source...

Contriving names for things is so commonplace for computer programmers that we
may be thinking up names more often than any other profession. Every day,
usually dozens of times, I find myself trying to imagine the perfect name for a
function or variable or module. Then I remember that there’s a term for the
process of formulating the perfect name for a thing.

I just can’t remember what it’s called…

Then I find myself sitting there, trying to think of the perfect name for the
process of creating the perfect name for a thing when I should be actually
dreaming up the perfect name for that thing.

Naming is hard.

Can you relate? The word, by the way, is…

onomastics - n.

1. The study of the origins and forms of proper names.

2. The study of the origins and forms of terms used in specialized fields.

3. The system that underlies the formation and use of proper names or terms used in specialized fields.

Short, but informative names are important in all programming languages, though
JavaScript’s anonymous functions do pose a unique temptation.

For those unfamiliar, an anonymous function is, unsurprisingly, a function
declaration without a name.

A named function:

functioncount_sheep() {
/* code */
}

An anonymous function:

function () { /* code */ }

One has a name, one doesn’t. Other than two low-level (and usually
inconsequental) behavioral differences, they’re drop-in replacements for one
another. The primary difference is that one has a name, so you can tell what
it does. So, pick the one that has the name! Easy choice, right?

I wish! Choosing a name is a very real mental tax. Choosing a good name
is time-consuming and often impossible. That is why, I feel, anonymous
functions are used so commonly in JavaScript programs.

Anonymous functions free the programmer from the responsibility of choosing a
name.

There are much (much!) more deeply nested examples of the Pyramid of Doom,
but this one serves well as an example. If it had been implemented with short,
named functions, it would be something like the following.

This updated code isn’t perfect, to be sure, but the first line really
exemplifies this benefits of this approach, to me. $(document).ready( create_datatable ) reads so clearly.

The joy of small functions is a discovery I’m making and re-making every day.
I’ve been craving a programming style like this for years, but it wasn’t
until I read Functional JavaScript (and all the FP talk on
r/programming) that my eyes opened.

Very, very small, reusable functions are a joy to work with. Give it a try, if
you haven’t yet!

Dimo: Particles is an artistic particle physics simulation and interactive art exhibit I created (along with fellow Red Hat engineers Ian Hands and Ben Pritchett) for the SPARKcon festival in 2014.
Launch live demo!
Pictures These pictures are from the art exhibit at geekSPARK in 2014.
$GALLERY
After the event, I wrote this opensource.com article about the experience.
The source code is, of course, open.

I spent a bit of time this weekend building an RGB color cube for ColorPal, using Three.js. Drag and drop any image, and you’ll see a cube with all the pixels of your image mapped into 3D space.
Launch live demo! and view the code.
Your web browser must support WebGL, which at this point in history means a fairly recent Firefox or Chrome. In case your web browser doesn’t support WebGL, here’s a video to enjoy while you download Firefox Nightly.

Hi pals.
This is a speedy post about a speedy update I made today to ColorPal, an HTML5 tool I wrote that automatically generates color palettes from a photograph.
Previously, ColorPal provided hex codes for each color extracted from the image. Eight individual <input>s at the bottom of the page displayed the colors.
I use ColorPal a lot (my own dogfood and all that) when designing websites, and it wasn’t long before I got fed up (hah!