From the course: Agile Software Development: Clean Coding Practices

Acronyms and abbreviations

From the course: Agile Software Development: Clean Coding Practices

Start my 1-month free trial

Acronyms and abbreviations

- [Instructor] The software world is filled with all kinds of common acronyms and abbreviations. Many organizations and teams also have their own specific acronyms and abbreviations. We need to take care when using acronyms and abbreviations when we're naming things in our code. Failure to do so can create confusion for the people who read our code later. The program I have on the screen is a small command line application which grabs some information from GitHub's web API. Let's skim through it and look at some of the acronyms and abbreviations it uses. This line contains two acronyms. The first is HTTP, and the second is API. Since this name contains two different acronyms, if you don't know what they are, then it's very hard to tell where one starts and the other stops. Let's rename this to make things more clear. Here, we still have two acronyms, but because of the way that the letters are written, it's much easier to see the boundary between them. The general rule here is that when you're using multiple acronyms in a name, make sure that you can clearly distinguish between them. Let's take a look at the RetRepos method, which appears to be using some abbreviations. By reading the body of the method, we can infer that the name RetRepos contains abbreviations for both retrieve and repositories. Let's rename this method so that the abbreviations are currently spelled out. In the method body, we see a variable named "lizer", which we can guess from the context that it's a shortened version of the word serializer. Let's rename that to spell out the full word. On the next line down, there's a variable named "repos", which we can guess is a shortened version of repositories. Let's expand that out as well. There are still a few abbreviations in this file that we could clean up, but I'll let you do those on your own. The basic rule to remember for abbreviations is to avoid them unless they are very, very common.

Contents