The very first task that we do while starting to program is naming from the creation of directory to files, to classes, to functions. Name is everywhere, we cannot escape it, and we do so much of naming, we should be fulfilled if we can do it better.

Beginners do marvel at how the seniors snap out great names that fit the context to be applied. How the names are crafted seem like magic, they end up seeing themselves not so close when they see that wack name their brain could best provide.

Fortunately, Micheal Jordan was not born a perfect athlete, and he learned it all. We can learn how to craft proper names by following a set of guidelines laid out by experts in the field of computer programming.

In this series, Clean Code – Rules For Name Crafting, we will be learning how to write proper names in our codebases and the rules to guide our thoughts when we require a name. All lessons are taken from Clean Code by Robert C. Martin, and the lessons here are going to be illustrated using JavaScript from the Java Robert used in his book.

Robert stated below rules, and we also see them as essential for naming considerations in our codebase:

  • Always use intention revealing names
  • Avoid disinformation
  • Make meaningful distinctions
  • Use pronounceable names
  • Use searchable names
  • Avoid encodings
  • Avoid mental mappings
  • Do not be cute
  • Pick one word per concept
  • Do not Pun
  • Use solution domain names
  • Use problem domain names
  • Add meaningful context
  • Do not add context gratuitously

It is an undeniable list with thoughtful and straightforward rules, and we will be going over all of them throughout the next few posts.

By the end of this series, we would be informed of why we make bad names, and how we can make good ones. Let us get started with the Rules for name crafting – Part One.

We will meet on the other side!