syque.com

The Psychology of Quality and More

| Menu | Books | Share | Search | Settings |

C Style: Standards and Guidelines (contents)

CHAPTER 5 : Naming

PART 2 : COMMENTING AND NAMING

CHAPTER 5 : Naming
5.1 Constraints upon naming
5.2 Abbreviations
5.3 Short names
5.4 Separating words
5.5 Spelling of names
5.6 Naming functions
5.7 Indicating functional group
5.8 Naming variables
5.9 Indicating type
5.10 Naming replacement items
5.11 Naming Files and Directories
5.12 Summary

<--Prev page | Next page -->

 

5.2  Abbreviations

Abbreviations are useful for reducing the length of a name, making it more manageable (and sometimes more readable too!). Thus:

 

ParagraphStatus    ..becomes..    ParaSts

 

The danger with abbreviations is that they are often over-used, and names become unintelligible. The author is so accustomed to using his own abbreviation standards and methods, that 'FstPghLnSz' clearly means 'First paragraph line size' to him. Too many abbreviations put together like this are clearly unclear.

Abbreviations are often clear within context, but are unclear when viewed on their own. Does 'Wgt' mean 'Widget', or 'Weight', or something else?

A good test of an abbreviation: can it be pronounced? A really good abbreviation significantly reduces the number of letters used and can be understood both when looked at and when spoken:

 

Char, Curs, Len

 

There are several strategies for generating abbreviations:

  1. Use the beginning of the word, e.g.  Char, Para, Buf
  2. Remove the vowels from the word, e.g.  Chrctr, Prgrph, Bffr
  3. Retain the major sounds of the word (use the sounds of letters), e.g.  Crctr, Pgph, Bufr
  4. Select critical letters of the word, e.g.  Chr, Pgh, Bfr
  5. Use well-established abbreviations, e.g.  c, Para, Buf

Once an abbreviation is used, then it is important that the same spelling is used consistently. If a different spelling for the same abbreviation is used, then it can easily cause confusion. eg. 'WinHgt' uses 'Win' as an abbreviation for 'Window' and 'Hgt' as an abbreviation for 'Height'. It would be confusing to subsequently use names like 'WndwWidth' or 'CharHght'.

 

<--Prev page | Next page -->

 

Site Menu

| Home | Top | Settings |

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

More Kindle books:

And the big
paperback book


Look inside

 

Please help and share:

 

| Home | Top | Menu |

© Changing Works 2002-
Massive Content -- Maximum Speed