Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MESSAGEBOX
Message
From
03/05/2000 23:15:12
 
 
To
03/05/2000 22:54:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00365597
Message ID:
00365937
Views:
18
Hi Doug,

PFMJI

>What about coming up with some kind of "mix" of mnemonic and value definition?
>
>For example, MB_YESNO could perhaps become something like MB_YESNO_4...

I see the limitation with this as what happens when the constant changes (maybe not a system defined one, but certainly possible in your own headers) so...
#DEFINE MY_MEANINGFUL_ABSTRACTION_4       4
Becomes:
#DEFINE MY_MEANINGFUL_ABSTRACTION_4       64  &&name no longer meaningful
...for some reason, and the whole abstraction is lost.

As per the reference Erik alluded to and others, the main advantages of Named constants like these are the abstraction and decoupling of the actual value from where it is reference (sort of an encapsulation), and the increased code documentation, rather than the ease of rememberance that everyone is saying.

I have been trying them a lot lately(but then I just read Code Complete *s*) and I have been seeing the limitations that Erik mentioned, but I am finding that defining a .h for each class, giving the .h a standard structure, and using them consistently has worked well so far.

>Don't know how workable that would be but just a thought...
Same here, just thought I would state what I saw as a limitation of that idea.

Later,
Bill
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform