Page 1 of 2 12>
Topic Options
#94347 - 2002-10-14 07:04 AM RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well, since Rod did not want to discuss other ideas about it in his topic

RFC - Hungarian Notation for KiXtart & KiXforms
http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=14;t=000101

I thought I would create another topic with similar name where the other ideas/opinions about it could be discussed.

RFC - Hungarian Notation for KiXtart & KiXforms - Discussion

Rod,

In ("my opinion") yes, what you propose is all well and good, but as far as making KiXtart easier to learn for newbies, I would disagree. This goes along the lines of most OOP (Object Oriented Programming) tools, which "most" are not easy for newbie programmers.

I challenge anyone with NO programming skills to install Visual Studio 97, or .NET and then fire up the program and write a "HELLO" program (without the Wizard). Then fire up KiXtart and write a "HELLO" script. This is an over exaggerated example, but part of what makes some of these programs difficult is all the STRICT Naming and case sensitivity associated with them, and as Lonkero pointed out, using a name for different functionality on the fly is perfectly okay in KiXtart, not so in any other language I'm aware of.

Should those in the know, or more advanced users NOT use it? No, I'm not saying that. If we all did start using it, it may prove to be beneficial in the long run. However, being realistic if I had to place money on a bet as to whether or not it will be accepted... I would bet against it. Partly for the reason Lonkero speaks of. Most of us may or may not be lazy, but it is easier to use $(anythingIwant) rather then having to memorize and/or think about what name I should use for a quick simple piece of code. Unless you are a die-hard VB or C++ programmer you have to constantly lookup the naming convention, which is probably why MS has built-in the smarts to prefix your code with this information for you while typing.

I'm not trying to be pessimistic about this, but unless people are forced into using this convention due to other requirements, I don't think most people will use it. As I say though, this is only (my opinion, and I may be full of SH**) [Big Grin]

Top
#94348 - 2002-10-14 07:47 AM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
 
off-topic side-note: 100th topic in the forum.
 
_________________________
!

download KiXnet

Top
#94349 - 2002-10-14 11:17 AM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
rclarke Offline
Starting to like KiXtart
*****

Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
Well NTDOC, thanks for hijacking my post [Razz]

My original argument goes something like this ... I want to use Hungarian Notation in my KiXtart programs, I know that there are others who would also like to use HN, therefore let's define a standard that coders can use if they wish to. It is better to have one accepted standard than hundreds of personal variations.

The discussion I was hoping for was more along the lines of ... should we use 'rg' (range) or 'a' to define arrays, should we still use 'b'oolean and 'c'har, even though those data types do not 'truly' exist in KiXtart, likewise should we use 'e' for error, and maybe consider prefixes for arguments passed to functions etc.

Alas, I feel that this will not happen now as the discussion has already gone in a different direction. [Frown]

Rod.

Top
#94350 - 2002-10-14 04:21 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Rod,
Don't be a sour puss. Ron didn't hijaak your post, he respected your request and started his own thread.

I think HN is a good thing and not because of my place of birth. Alas, I think it has little chance of broad acceptance. I would hazard a guess that most KiX programmers (if I can even call them that) come from a non-programming background and are mostly self-taught with maybe some batch or BASIC background. A lot of them are SAD (SysAmin by Decree) meaning they were thrust into it.

They have not been taught structure and their bad habits are now stuck with them. Have you ever tried to get someone to touch type after they did 'hunt and peck' for years?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#94351 - 2002-10-14 04:33 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
However, if somebody would like to use HN then it would be beneficial to have standard notations. Although, I have to agree that only a minority will use it, but most likely, this minority is the producer of the majority of code on this BBS, kind of the old 80-20 rule.
_________________________
There are two types of vessels, submarines and targets.

Top
#94352 - 2002-10-14 05:34 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
whoa guys ... might want to back and re-read Rod's original statement:

quote:

I want to concentrate on defining a standard for those who want to use Hungarian Notation.

I don't think Rod is suggesting we all use HN - not at all - but for those that DO want to use it - lets define a standard for it (for Kixtart that is).

I use HN sometimes. For short and simple scripts I think it can be overkill - but for long and complex scripts - especially forms scripts that have many forms - I find that it does help to keep all those variable names sorted (in my own mind anyways).

Heres a script that uses HN. I think it would be hard to argue with the fact that the HN variable names help - rather than hinder the reader.

Kixforms: Manage User Details - Here`s MUD in your eye !

Heres a snippet of code:

code:
If $chkAccountLocked.Value = 0
$adsUser = GetObject($strUserPath)
$adsUser.GetInfo
$adsUser.IsAccountLocked = 0
$adsUser.SetInfo
EndIf

Anyone familiar with HN should know exactly what is going on here - they could also tell you - without looking at the rest of the code - exactly what variable types are being used here - and whether they are being used correctly or not. Funny thing is - even someone with just VB experience alone could probably read this script and figure it out (HN very widely adopted in programming circles).

Anyway - don't mean to be preachy - im not a consistent user of HN - but a documented standard is good to have if choose to use it.

Top
#94353 - 2002-10-14 05:48 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Thanks Shawn but I can read. Also, Ron wanted to take the discussion to another thread as obviously someone there did not respect his wishes.

As for the virtues of HN, you're preaching to the choir. I already stated that "I think HN is a good thing". Anyone else that thinks so need not be sold (but you might swing a few converts).

So... if you want to better the cause, reply in the original thread, bring it back on topic, and offer some input, leaving this thread to discuss its merits.

Hint: perhaps Rod's original thread should have a link to this one in order to draw the undesired commentary this way.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#94354 - 2002-10-14 06:35 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
rclarke Offline
Starting to like KiXtart
*****

Registered: 2001-06-08
Posts: 178
Loc: Oxfordshire, United Kingdom.
Well I am pleased to see that this topic has generated some debate after all. Les, I wasn't really being a sour puss and I appreciate that Ron started a new topic, however my light hearted disappointment, as marked by the [Razz] emoticon, was due to the fact that his post had drawn attention away from mine [Wink]

Anyway, I am pleased to see that you, Jens and Shawn appreciate that this is a worthwhile initiative. What is interesting is that your definition of a KiXtart programmer fits me perfectly in that I have had no formal training. Furthermore, I only found out about HN 6 months ago, however I am very keen to change my bad habits and adopt it as soon as a standard has been defined - maybe I'm unusual to do that.

Rod.

[ 14. October 2002, 18:35: Message edited by: rclarke ]

Top
#94355 - 2002-10-14 06:46 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK, I take back the part about "sour puss". I missed the emoticon thingy altogether. I had to scroll back to see if it was really there.

You know, they don't show on the "Today's Active Topics" view, and with my 26.4kbps connection, they don't appear until after most of the post had been read.

I'm glad that on the road to Damascus, you saw the light. [Cool]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#94356 - 2002-10-17 11:11 AM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I think the first time that this came up in discussion was here.

(The eagle-eyed will see that I don't keep to my own rules in the posted code [Wink] )

One word of warning from painful experience though:

If you are going to take the time to create self-documenting variable names using some type of SFH notation make sure you set "EXPLICIT" on. Not only will it help tighten up your code (no more unexpected globals!) but you will avoid the problem of looking at your code for 15 minutes before spotting that your calculation is returning gibberish simply because you've used "$sProcessCount" rather than "$iProcessCount" in the expression.

The problem is that you see the "ProcessCount" part of the variable name and miss the typo in the prefix, leading to robust exercising of the head/brick wall interface.

Top
#94357 - 2002-10-17 02:46 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I just had experience of that interface ten minutes ago.
and after all it was just wrong development version of dll registered.
_________________________
!

download KiXnet

Top
#94358 - 2002-10-17 03:31 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I have to agree with the EXPLICIT=ON. All my scripts and UDF are now complient with this and it already caught a couple of incorrectly spelled variables.
_________________________
There are two types of vessels, submarines and targets.

Top
#94359 - 2002-11-01 05:38 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Question re:
KiXtart Hungarian Notation Data Type Boolean

Is Definition only True or False or does/should it include Yes|No, On|Off, 1|0 ?
_________________________
We all live in a Yellow Subroutine...

Top
#94360 - 2002-11-01 05:52 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
to be pure, the boolean has only true and false. that is the name too.
so, kinda it can't even be null.

but doing:
$boolean="true"

is not boolean as real true comes from:
$boolean=not 0
_________________________
!

download KiXnet

Top
#94361 - 2002-11-01 06:25 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Let's try again...

Example: An integer variable, "$Flag", that can have values of 1 or 0

What is the 'proper' Hungarian Notation?
  • $lFlag
  • $lbFlag
  • $bFlag
  • ???
_________________________
We all live in a Yellow Subroutine...

Top
#94362 - 2002-11-01 06:32 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Id' say '$bFlag', however, if the permissible values are
code:
$Flag='1'
$Flag='0'

then they should be treated as char or string.

We might need examples for each HN option.
_________________________
There are two types of vessels, submarines and targets.

Top
#94363 - 2002-11-01 06:32 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
i think it's none of those.
even though there is no "i" specified in the list manual identifies it.
closest would be "l"

{edit}

ok, there is change.
manual says that there are integers (as vartype 2) but having:
$integer=1+2

is 3.
so, there is bug or ruud should correct the manual as 2 is impossible to construct.

[ 01. November 2002, 18:38: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#94364 - 2002-11-01 06:45 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
The values assigned to the $var are integer [1|0] and not string ["1"|"0"].
In the absence of further clarification of the Boolean definition, I'm going with $lFlag just because it 'feels' right.
Thanks...
_________________________
We all live in a Yellow Subroutine...

Top
#94365 - 2002-11-01 07:37 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
My 2 cents (cdn) if $flag is a boolean that means something is true or false, it should be:

$bFlag = 0/1

But more importantly to this - you should do whatever feels right because thats the most important thing.

-Shawn

[ 01. November 2002, 19:38: Message edited by: Shawn ]

Top
#94366 - 2002-11-01 07:42 PM Re: RFC - Hungarian Notation for KiXtart & KiXforms - Discussion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I started to think that boolean, and if it does not meet actual boolean definition, there is no actual boolean in kixtart.
meaning that you can't create false and true in "normal" way.

this in mind, as long as you keep the same rule all the way in the script, it will pass.
_________________________
!

download KiXnet

Top
Page 1 of 2 12>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 202 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.074 seconds in which 0.027 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org