Pointed Development

On Naming

| Comments

On clever developers, clever naming and having a good sense of humor to maintain sanity.

Piggybacking the post I did the other day on my biggest failure, I wanted to spend some time talking about the importance of names.

I’ve created my fair share of crap variable and type names in code, everything from foo to describe a complex business process to OffsetFromZeroIntoArray to describe an index, possibly as a penance for avoiding self-describing variable names earlier in my career.

At one point, I even became enamored with naming interfaces after their desires and abilities, such as ICanRunThat or IEnjoyReading.

If I could, I’d go back in time an punch me in the face for personifying an interface.

It wasn’t until I was a mid-level developer (the horror!) that I really began to understand the importance of correctly applying names in code and really spending the cycles to consider a single good or even great name.

During my career, I’ve had the pleasure of reading a lot code written by people much more intelligent and creative than I. These developers understood long before I did the absolute criticality of good naming conventions and self-describing code, and they wrote code for other’s to read.

Clever Developers

Bright and creative developers take the time to really consider their classes and variables. They think of meaning and context. Working with clever developers is extraordinarily rewarding: Reading their code is insightful. They have unique insights and look at problems from different angles.

Reading their code makes you a better coder.

I’ve picked up a number of positive habits by pairing with better developers, by reading their code and by talking through naming issues. What should we name This Thing? What does it do? How will it work? What important information can we embed in the name itself?

Over my career, I’ve had many, many hour long (or longer!) developer discussions over the name of a single class. I’ve sat in code reviews that devolved into arguments over a single variable name. This highlights the importance of careful consideration, of taking your time and of writing code to be read.

My Favorite Class Name Ever

I present the award for My Favorite Class Name Ever to my former coworker and friend, jott. I still laugh at the simple brilliance of the class name to this day.

It went something like this:

class QuasiModal : Form { }

I’m almost positive jott took a tip from Jeff Raskin when he developed the QuasiModal class. Whether intentional or not, the class name perfectly described the quasimodes of the form in question.

At the time, jott and I were collaborating on a web-based user interface framework. We had a form that wasn’t quite modal, wasn’t quite modeless… but it was more modal than not (modal in the Windows dialog sense of modality).

Hence, jott deemed it quasi-modal.

QuasiModal wasn’t some ugly creation, though. In fact it was quite elegant. Victor Hugo’s Quasimodo would have been jealous, I think.

Perhaps we should have named the framework Esmeralda.