How to Name Things

Now that we’ve seen data commands, we have to ask ourselves a question: what names should we give to variables, lists, and tables? This topic is actually very important. When you start building bigger and bigger bots, you won’t be able to mentally keep track of all the different data nodes, so it’s important that you give them clear, concise, self-explanatory names. When you look at a data node, you should be able to know at a glance exactly what’s inside it.

In UScript, the convention for named nodes is a word or short phrase, all lower case, with single space between each word. It should be as short as possible, but long enough to be understood.  A variable should generally be a noun or a noun phrase. Lists should be plural nouns (since more than one item goes in a list). Tables should also be plural nouns, or a description of some kind of data.

Some examples of variables:

#username

#password

#first name

#animal color

#number of threads

A special point about that last one – many beginners would name this variable #threads instead of #number of threads. Yes, it’s technically quicker to type #threads, so you’ll save 2 seconds on the only time you’ll ever have to type it. But every time you look at it, your brain will have to mentally process what that means. It might not sound like a big deal, but when you have a lot of variables and you only have a moment to glance at each of them, you’ll be a lot happier if you don’t have to think too hard about each one. You brain will have plenty more to keep it occupied. #number of threads much more clearly describes what data this variable is actually holding, and therefore it is the best name. Oh, and we’ll talk about what threads are in a later tutorial.

Examples of lists:

%usernames

%proxies

%realtor names

%pizzeria addresses

%locations of burn wards

%names of girls I think are pretty

%cat picture urls

For the last one, I might have otherwise just called it %urls. In some cases that would be ok, like if it were the only list in the script that mentioned urls. A lot of the time, the best name is a judgement call. The rule of thumb is to name it whatever will make the most sense to you or anyone else who might later read the code.

Examples of tables:

&profiles

&user data

&stock prices

&owl related crimes by state

owls

Good naming technique comes with time and practice. It’s as much of an art as it is a science. It might seem inconsequential, but naming technique is one of the quickest way to spot an inexperienced uBotter. Get the hang of it now, and it will pay off. You’ll be happy, our support team will be happy, and most of all, your bots will be happy. And happy bots earn lots…. Of money… I’m gonna keep working on that one. This gif will describe what I mean.

futurama-robots-bender-uXtMLaQ5ppzhK