DEV Community

Cover image for Code Smell 223 - Racial Naming
Maxi Contieri
Maxi Contieri

Posted on • Originally published at maximilianocontieri.com

7 1

Code Smell 223 - Racial Naming

Software evolves, and so does culture.

TL;DR: Avoid old terms like whitelists, blacklists, master, etc.

Problems

  • Racial Connotations

  • Exclusionary Language

  • Diverse Perspectives

Solutions

  1. Use alternative terminology

Context

Language evolves, and technical terms should follow it.

You can change racial names with alternative terminology:

Allowlist: Replace "whitelist" with "allowlist." This term maintains the intended meaning without racial connotations.

Denylist: Substitute "blacklist" with "denylist." This term conveys the same concept without perpetuating negative racial associations.

Permit List and Block List: Another option is to use "permit list" in place of "whitelist" and "block list" instead of "blacklist."

Main branches: You can replace "master" with "main".

Master/Slave: You can replace them with Primary/Replica/Mirror etc.

Sample Code

Wrong

val whitelist = listOf("Barbie", "Ken")

val blacklist = listOf("Midge")

val gitCommand = "git pull origin master"

val process = Runtime.getRuntime().exec(gitCommand)
Enter fullscreen mode Exit fullscreen mode

Right

val allowlist = listOf("Barbie", "Ken")

val denylist = listOf("Midge")

val gitCommand = "git pull origin main"

val process = Runtime.getRuntime().exec(gitCommand)
Enter fullscreen mode Exit fullscreen mode

Detection

[X] Semi-Automatic

You can set up a denylist (not a blacklist) of terms you need to double-check for accuracy.

Exceptions

  • References to old manuals

Tags

  • Naming

Conclusion

Just as we refactor code to enhance its quality, we should also refactor our language and terminology to promote inclusivity and diversity.

By eliminating racially insensitive terms like "whitelist" and "blacklist" in favor of more inclusive alternatives, we contribute to a more equitable and welcoming tech industry.

Let's embrace change and create a coding environment where everyone feels valued, regardless of their background or ethnicity.

Relations

More Info

Prevalence of racist language in discussions of predatory publishing

Wikipedia

Rename master to main

Disclaimer

Code Smells are my opinion.

Credits

Photo by Aarón Blanco Tejedor on Unsplash


An ultimate joint challenge for the biological and the computational sciences is the understanding of the mechanisms of the human brain, and its relationship with the human mind.

Tony Hoare


This article is part of the CodeSmell Series.

AWS Q Developer image

Build your favorite retro game with Amazon Q Developer CLI in the Challenge & win a T-shirt!

Feeling nostalgic? Build Games Challenge is your chance to recreate your favorite retro arcade style game using Amazon Q Developer’s agentic coding experience in the command line interface, Q Developer CLI.

Participate Now

Top comments (5)

Collapse
 
mcsee profile image
Maxi Contieri

I respect your opinion. Let's hear what other people have to say about it

Collapse
 
dumebii profile image
Dumebi Okolo

Okay, this is good.

Collapse
 
emtiajium profile image
Emtiaj Hasan

What do you suggest for the "slave"? You know, master-slave is heavily used in DB replication.

Collapse
 
mcsee profile image
Maxi Contieri

I think Mirror/Replica/Secondary are better names.

Will add them to the article as well

Gen AI apps are built with MongoDB Atlas

Gen AI apps are built with MongoDB Atlas

MongoDB Atlas is the developer-friendly database for building, scaling, and running gen AI & LLM apps—no separate vector DB needed. Enjoy native vector search, 115+ regions, and flexible document modeling. Build AI faster, all in one place.

Start Free

👋 Kindness is contagious

Discover fresh viewpoints in this insightful post, supported by our vibrant DEV Community. Every developer’s experience matters—add your thoughts and help us grow together.

A simple “thank you” can uplift the author and spark new discussions—leave yours below!

On DEV, knowledge-sharing connects us and drives innovation. Found this useful? A quick note of appreciation makes a real impact.

Okay