Let's Talk Naming Y'all
by Mike Mangino on August 23, 2018

There are only two hard things in Computer Science: cache invalidation and naming things.

– Phil Karlton

Naming is such an incredibly important part of software development. A well chosen name can make complex code significantly more readable by providing additional context.

For example, compare this version:

def self.hamming_distance(a,b)
    raise ArgumentError if a.size != b.size
    a = a.chars
    b = b.chars
    a.each_with_index.inject(0) do|memo,value_index_pair|
      value, index = value_index_pair
      if value == b[index]
        memo + 1

To a version with better naming

def self.hamming_distance(a,b)
    pairs_of_characters(a,b).map do |pair|
      pair_equal?(pair) ? 0 : 1

The implementations are identical, but by replacing procedural blocks of code with what that code is meant to do, it’s much easier for an unfamiliar user to reason about what is happening.

As the importance of naming becomes more and more clear, it’s leading me to change my language. One primary example is my increasing use of the word “y’all.”1 Over the last 12 years, I’ve worked on remote teams with female software developers more often that not. During that time, I’ve felt uncomfortable using the phrase “guys” as a collective. While people say it can be used in a gender neutral way, the fact that we say “guys and girls?” makes me uncomfortable.

To some folks, this may seem like a minor issue. That’s not the case if you’re one of the people being excluded. I saw this with my kids. When my boys were little, my youngest was very upset that he couldn’t be a doctor. I asked him why and he told me “because all doctors are girls.” In his life, he had only seen female physicians which made him think he couldn’t be part of that group. I want to make sure I’m not the one contributing to the gender an racial biases we see in CS.2

With as much time as good developers spend thinking about variable and class names, shouldn’t we spend at least as much time making sure our language isn’t exclusionary? What phrase do you use? Let me know at @mikemangino on twitter.

  1. I was happy to find a list of alternatives. I’ve tried most of these and settled on y’all in most cases. 

  2. Here’s a few other terms to think before using.