The Psychology of Quality and More |
CHAPTER 3 : General Principles
3.4 Be explicitThere are a number of occasions when writing a C program where novel features of the language may be used. 'Novel' is defined here as meaning 'unclear to the average reader'. This includes all implicit uses of the language. For example, consider the if statement, where the expression is implicitly compared with zero:
if ( WordCount )
This is using a feature of the language (albeit explicitly defined) in a manner which is not immediately clear. What is really meant is:
if ( WordCount != 0 )
It commonly occurs, as in the above example, that the principle of explicitness is in conflict with the principle of simplicity. In such cases the principle of explicitness usually wins, although common sense should be used in all cases. A complementary acronym to the KISS principle may be used for the principle of explicitness: the SWYM principle - Say What You Mean.
|
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 |