Re: To Richard Heathfield: enough's enough

From: Richard Heathfield (dontmail_at_address.co.uk.invalid)
Date: 12/28/03


Date: Sun, 28 Dec 2003 12:58:10 +0000 (UTC)

Gerry Quinn wrote:

<snip>

> Personally I use Hungarian-like constructs quite often. I would use
> "nLayers" rather than "layers" to refer to a number of layers, even when
> it's in the same function. Buttons have names like "but_Quit".

Well, this is more in the original spirit of Hungarian notation, where the
prefix denotes not the /type/ of the data, but the /purpose/ of the data.
In your example, the but_ prefix refers not to the data type of the object,
but to its purpose - i.e. "this is the thing you click when you want to
quit".

You could reasonably change the type of this button (perhaps from a Button
into an ImageButton) without changing the name, since it would still be a
button of some kind. Indeed, by choosing a slightly more general prefix
(e.g. "cmd"), you could justify retaining the name even if you changed it
from, say, a button into a menu entry. Furthermore, the chances are very
low that you might change it to something so radically different (such as a
TreeView) as to justify a prefix change without having to rewrite much of
the code anyway. So there's no huge downside here. In such circumstances,
there is a certain amount to be said for the prefix.

-- 
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton

Quantcast