Explore chapters and articles related to this topic
Digital systems 1 – Arduino output
Published in Charlie Cullen, Learn Audio Electronics with Arduino, 2020
In this listing, the variable names show that we are working with two points in 2D space relative to an origin (assumed to be x = 0). Although the names do not enforce the data (i.e. simply calling a variable myIntegerX does not make it an integer, only the type declaration counts) they do help to give descriptive meaning to operations – even simple mathematical calculations like the addition and subtraction examples in the listing above. You may also notice that the first letter of each word in these variable names is capitalized – this is called Camel Case. This makes descriptive variable names easier to read, alongside adding comments that relate to what the instruction is doing with the data. Another aspect of variables is the use of constants for values that do not change. C allows us to use the const keyword to declare read-only variables – once assigned they cannot be reassigned, only copied:
Computer Programming
Published in Quamrul H. Mazumder, Introduction to Engineering, 2018
Another common convention is known as CamelCase. In CamelCase variables, the first word of a variable name begins with a lowercase letter while the first letter of any additional words is capitalized. Thus, the variable that would be used to store the number of vacation days that an employee has earned would be named vacationDays.
Identifying rename refactoring opportunities based on feature requests
Published in International Journal of Computers and Applications, 2022
Ally S. Nyamawe, Khadidja Bakhti, Sulis Sandiwarno
Furthermore, source code identifiers are decomposed into separate individual words. Normally, identifiers are made up of at least two words separated by an underscore or capital letters. Our approach assumes that identifiers are named based on standard naming conventions, i.e. camel case or snake case naming. For example, an identifier named getUserStatus is split into get, User, and Status. Consequently, an identifier is presented as a list of a sequence of individual words: The decomposition is straightforward and effective provided that the identifiers are named based on the mentioned conventions. In case the naming of identifiers do not follow the standardized conventions, then more sophisticated tools can be applied for tokenisation. For example, Butler et al. [31] proposed a tool that can tokenise identifiers into their semantic constituents even though their names do not follow the standard camel case naming convention.