The Psychology of Quality and More |
CHAPTER 5 : Naming
<-- Prev Chapter | Next Chapter -->
One of the most difficult and yet one of the most common tasks a programmer has to do is to find suitable names for all of the 'int's, 'char's, etc. in his program. It is often too easy to underestimate this task, and identifiers that convey little or insufficient meaning are remarkably common:
a, b, buf, temp, temp1, first, count, ptr
Books, articles and lectures on C often use such names not so much because of a lack of style, but more because they are illustrating a point of language, and the code fragments they use are sufficiently small that the limited meaning of these names does not matter. So how do you make a name meaningful? The best approach must be to describe what the named item does, what it is for, etc. When read, it should sound natural, and should help the reader understand its purpose without having to read the rest of the code ("Ah, so that's what it's for!"). This chapter looks at some methods for creating names, and their applications and limitations when used for identifiers in C.
|
Site Menu |
Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive | |
And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact | |
Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate | |
You can buy books here |
And the big |