Hey there

I enjoy writing software, reading books, listening to podcasts and playing games of all varieties :) Currently living out of a backpack.

Here there be Dragons

When you don't know what to call something, but you need to give it a name now, call it a Dragon.

I was refactoring type names in a TypeScript project last week and had an opportunity to use this trick. We wanted to rename something from a Metric to a Measurement and all the various names of variables of these types. About three quarters of the way through I came across some code that already had a thing called a Measurement that was a very different thing to the type I was renaming and that I couldn't decide on an appropriate new name for.

Rather than backtrack and lose track of all the changes I'd made I quickly renamed this newly discovered type to Dragon and moved on with my work. This rename was supposed to be a quick job and I had other work to do. A couple of days afterwards I'd let the naming problem percolate in my subconscious and had a new name ready.

It was easy to rename the Dragon because a Dragon is out of place. It's unlikely that your code has Dragons (though possible!) so it looks obviously wrong when you come across it. I find this helps with motivation to decide on a real name. If you do have Dragons in your codebase, congratulations! You'll have to use something else out of place.

The only caveat is: you must rename it quickly. The team I learnt this from weren't sure what to call an item in a list that could be a wide variety of media or text items. They called it a Dragon and after leaving it that way for a couple of months dragon, dragons, dragonLoaders, dragonViews, etc., etc. had spread all throughout the codebase. It's not that it's impossible to rename at this point, rather that it's a time consuming and error-prone process to weed out all the Dragons.

Finally, on that note, a shoutout to typed languages and IDEs. Visual Studio Code made my life simple with all this renaming work.

Introduce a Dragon to your codebase today :)