#94319 - 2002-10-13 11:32 PM
RFC - Hungarian Notation for KiXtart & KiXforms
|
rclarke
Starting to like KiXtart
   
Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
|
KiXtart scripts are increasing in complexity, particularly with the advent of floating point support and extensions such as KiXforms and KiXGUI. Naming conventions such as Hungarian Notation can improve the legibility of code, therefore I would like to propose the definition of a variable naming convention for KiXtart and its associated plug-ins. Obviously, adoption of the convention is purely a matter of personal preference, however it would be beneficial to have a recognised and agreed upon standard that can be referred to by KiXtart programmers.
I have compiled an initial Table of variable prefixes at the KiXforms web site and would like to solicit your feedback and general opinion. This first pass has been compiled from a variety of sources including, the original document by Dr. Charles Simonyi, standards defined by Microsoft Consulting Services, and several papers on Visual Studio best practices. I appreciate that some programmers do not like using Hungarian Notation, however for those of us that do, I would prefer if this topic concentrated on the definition of a standard, rather than on the pros and cons of its use.
Many thanks in advance,
Rod.
|
|
Top
|
|
|
|
#94321 - 2002-10-14 12:10 AM
Re: RFC - Hungarian Notation for KiXtart & KiXforms
|
rclarke
Starting to like KiXtart
   
Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
|
Hi Lonk,
Thank you for the feedback, however as I stated in the last sentence of my first post, I want to concentrate on defining a standard for those who want to use Hungarian Notation. Furthermore, most data type prefixes only increase the variable name by one character, and it is still only three characters for object types. As for 'losing the freedom of KiX's syntax', I disagree, HN is all about making code more legible and if that helps new starters with learning KiX by studying other programmer's code, then I'm all for that.
Rod. [ 14. October 2002, 00:10: Message edited by: rclarke ]
|
|
Top
|
|
|
|
#94324 - 2002-10-14 06:44 PM
Re: RFC - Hungarian Notation for KiXtart & KiXforms
|
rclarke
Starting to like KiXtart
   
Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
|
Certainly, I assume you are referring to this post for the actual naming of the UDF rather than just adding the fn prefix, in which case it is a good idea and will be added to the web page.
So what does everyone think of the prefixes proposed so far? Are there any missing? Are there any that just don't work? Let's hear about it.
Rod. [ 14. October 2002, 18:45: Message edited by: rclarke ]
|
|
Top
|
|
|
|
#94325 - 2002-10-14 07:05 PM
Re: RFC - Hungarian Notation for KiXtart & KiXforms
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Rod,
fn is already shown as a Float (32-bit floating point)
Part of what I think needs to be done is to have a more decisive understanding of what is what.
I often use $x or $nul simply for blanking the numbers from KiXtart to the screen. Is that a function, action, or what? How should it be used then. As a function $fNul or $fx ???
p.s. Sorry for the hijacking of your post... but it was the only way I knew to try and keep this one here cleaner. I think it is too difficult to leave most topics without another venue to air ones thoughts, so I created another so as to hopefully keep this one on topic as you requested.
|
|
Top
|
|
|
|
#94326 - 2002-10-14 08:38 PM
Re: RFC - Hungarian Notation for KiXtart & KiXforms
|
rclarke
Starting to like KiXtart
   
Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
|
Hi Ron,
In actual fact f is Floating Point and fn is Function. As for the handling of dummy variables, the prefix should reflect the data type returned, so $sDummy is a dummy string, $lDummy is a dummy long integer etc. As for the creation of a second topic, no worries, I think all is back on track now
Rod.
|
|
Top
|
|
|
|
#94327 - 2002-10-18 12:06 AM
Re: RFC - Hungarian Notation for KiXtart & KiXforms
|
rclarke
Starting to like KiXtart
   
Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
|
Ok, to cut to the chase, does anyone have any issue with defining the following as standard KiXtart Hungarian Notation:
b is Boolean (not a 'real' KiXtart data type) c is Char (also not a 'real' KiXtart data type) f is Float fn is User Definable Function l is Integer (Long) s is String
... plus we then have two other prefixes which are used with the data types above, namely:
a is Array g is Global (as in variable scope)
The following are up for further discussion:
e is for Error i is for Index (as in Array) v is for Variant (as in undetermined data type)
So, please tell me what you think, I'm sure you will
Rod.
|
|
Top
|
|
|
|
#94330 - 2002-10-17 02:44 PM
Re: RFC - Hungarian Notation for KiXtart & KiXforms
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
quote: I sort of agree that we should drop the 'c' prefix for Char. Anybody else have any thoughts on this one?
I'd be inclined to leave it in.
I use it as a mnemonic for a variable that will hold a single character. Typically these are variables which are assigned a value by things like "Get" or "Chr()".
As the prefixes are simply to provide documentation or programming hints, using "c" to indicate a variable which must only have a single character assigned to it is still valid.
Of course it would still be valid to use "s" for a variable length string, even if that length were always one character.
The difference is that the "c" prefix implies that the variable must never exceed a single character, and in the event that it does only the first character is ever considered - extra information may be lost. As such it still has a purpose.
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1050 anonymous users online.
|
|
|