As known in world, names are used to define something. They are special items to call some particular objects. Yes, humans are also an object but this is not the topic now. In programming we also do have names and they have same behavior that we have talked a few seconds ago. However, the aim is sole, each programming language has its own rules related to defining names
For example in C99, internal names can only have 63 significant characters, however, in external names (those outside of the functions) it is 31 significant, which is almost half of the previous one.
Now, it is time to talked about how names can be formed. In most programming languages, names has same form. They can contain alphabetical letters, underscores and digits. In 1970s and 1980s most of the underscore was widely used to form names, such as my_stack and it was called snake case. Later on, snake case give his popularity to camel notation, in which all of the words of a multiple-word name except the first are capitalized, as myStack. You might wonder why it is called “camel” and the answer is because words written in it often have embedded uppercase letters, which look like a camel’s humps. In order to make it obvious that the use of underscores and mixed case in names is a programming style issue, not a language design.
In PHP, all of the variable names (if you don’t know what is variable, you wait for my next post or read it here) must start with a dollar sign ($). However, in Perl, the things are a little bit different. It has 3 special characters $, @, % and each specifies a type. Another, different usage of special characters at the beginning occurs in Ruby, where @ or @@ indicates that the variable is an instance or a class variable, respectively.
In names we have another important point on case sensitivity. If the language names are case sensitive, like most of the C-based languages it is, if you miss typed a case then you will get either wrong variable(if exist with that name) or compile time error. Like, if you have a variable called rose, and you cannot call it as ROSE. In Java, there are built in function names which are case sensitive(Java also belongs to C language group), like parseInt cannot be called ParseInt, or parseint. For sure sometimes this can create hard times, specially when you have to write code without code completion feature in the IDE(interactive development environment). In C, this problem can be avoided by the convention that variable names do not include uppercase letters, however, in Java and C# it is dead end. There is no way to escape. Most of the predefined names include both uppercase and lowercase letters. Repetition is not good therefore, see the above Java example. In meantime, it is useful to mention that this is a problem of writability rather than readability. Why? Because, the need to remember specific case usage makes it more difficult to write correct programs.
All of the programming languages has their own special words. They are used to make programs more readable by naming actions to be performed and to separate the syntactic parts of statements and programs. In most languages, special words are accepted as reserved words and most importantly cannot be redefined. There there are some, such as Fortran, they are not reserved words but rather keywords, which makes them open to redefining. Lets, now talk about “WHO IS THE EROL EGEMEN”, no joking, but we will talk about “WHAT IS A RESERVED WORD”. To define, it s a special word of a programming language that cannot be used as a name. As always, the problems still continue with this one as well like where it didn’t. If the language includes a large number of reserved words, the user may have difficulty making up names that are not reserved. Like think COBOL. There are 300 reserved words and it is just a nightmare to find a name not in that list (LENGTH, BOTTOM, DESTINATION, COUNT are all reserved and now you do understand that I do not joke). This kind of issues are somehow solved in most of the programming languages by program units, such as Java packages or C, C++ libraries. The predefined names are only visible to programmer only if they are explicitly imported and after that you cannot redefine them.
That is all from this article and in the next one as I have mentioned above, we will be touching to VARIABLES.
- Sebesta, R. W. (n.d.). Names, Bindings and Scopes. In Concepts of Programming Languages (12th ed., pp. 197–200).