Page 1 of 1 1
Topic Options
#93564 - 2002-09-02 09:26 PM Should UDF collections be allowed?
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Should UDF collections be allowed?

I could create this as a poll, but i would rather raise it as a discussion [Wink]

I sent this post Collection of UDF's for Excel
under the assumption that UDF's are always 'standalone', but should they always be?

In my oppinion, in some situations a collection are more usefull, specially when they include COM objects.
You don't have to create/destroy a handle for each function call (Better performance), and you can minimize the number of parameters nessasary (Smaller code)

An example could be Sealeopard's DB/SQL functions. They are not as dependant as my Excel functions, but it would be easyer to make an explaining example script.

My question is: Should UDF collecttions be allowed in the UDF forum, and if so should global variables be allowed?

Of course i could be veto'ed out by DrillSergeant [Big Grin]

-Erik

Top
#93565 - 2002-09-02 09:51 PM Re: Should UDF collections be allowed?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
My two cents, most certainly, UDF collections should be allowed ... Global variables ? Sure why not, if they are vital to the collection and well documented - what the heck. Would certainly be "cleaner" if there were no globals ... but they shouldn't be outlawed or anything.

-Shawn

Top
#93566 - 2002-09-02 10:04 PM Re: Should UDF collections be allowed?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
We wouldn't need Global VARS if we could define functions within functions or more accurately if we could define functions within a specified named block or package.

That way all vars for a UDF collection would be held within a named container.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#93567 - 2002-09-02 10:36 PM Re: Should UDF collections be allowed?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
My wish, for Kixtart v5.0 and beyond, would be if Ruud could incorporate more Object Oriented syntax into native Kixtart, eg, a Class structure that could contain "global" (private) class variables, and calling UDF's would work just like using COM methods and properties...
Top
#93568 - 2002-09-02 10:40 PM Re: Should UDF collections be allowed?
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Howard,

I like your idea of contained functions and variables, that would include semi-globals(scope variables).
Anyway this would be laying another burden on Ruud's shoulders:
Allowing functions inside functions AND scope of called scripts only vissible from current block!

I avoid globals if possible. But if i have a reason i will use globals. Reasons still being faster executing or smaller code.
The smaller code dosn't way heavy though.

Please don't start another dicussion of 'allowed globals' like: $, $_, $i, $j, $RC.... whatever [Wink]

-Erik

[ 02. September 2002, 22:52: Message edited by: kholm ]

Top
#93569 - 2002-09-03 03:26 AM Re: Should UDF collections be allowed?
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Sounds like an OK idea to me. I liked the package of UDFs that jens put together for his administrative scripts. Very helpful. The only issue I see is a potential for redundencies.
_________________________
Jack

Top
#93570 - 2002-09-03 09:32 AM Re: Should UDF collections be allowed?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
UDF collections where the components are closely related make sense, especially if there is some inter-dependance amongst them.

It makes it easier for less experienced users to gather a working tool set, rather than using a pick-and-mix approach.

More experienced users will drop (redundant) elements in favor of UDFs which do a similar job and provide the functionality that they require.

If the content of the collection is loosely linked (not inter-dependant), perhaps also post as individual UDFs with a link to the collection for those that want a bundled solution.

On the subject of globals, Ruud mentioned some time ago that he was planning on implementing static variables. If they appear, they can be used in a number of ways to emulate variables that are "global" to a set of functions.

This has a small advantage over true globals, in that if the functions are not stored in a seperate file they will still not pollute the variable name space.

The disadvantage is that there will be a processing overhead associated with setting and getting the variables.

Top
#93571 - 2002-09-03 06:49 PM Re: Should UDF collections be allowed?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I was already thinking of renaming my UDFs to create pseudo-OO code. For example my database UDF would be renamed DATABASE.CONNOPEN, DATABASE.CONNCXLOSE, DATABASE.GETRECORDSET and they would all be part of the DATABASE.UDF file that is called at the beginning of my scritps. However, I do have the advantage that I do not care about filesizes at all. Another set of UDFs would be REGISTRY.UDF, ARRAY.UDF, and so on. I would make it easier to find a specific UDF in my UDF collection.
_________________________
There are two types of vessels, submarines and targets.

Top
#93572 - 2002-09-03 07:11 PM Re: Should UDF collections be allowed?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey - very cool - it works beautifully !!!

code:
Break On

? Object.Method("Text123")

Exit 1

Function Object.Method($Text)

? "text = $text"

EndFunction

Did I mention Happy 2K Jens ?

Top
#93573 - 2002-09-03 07:23 PM Re: Should UDF collections be allowed?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Thanks, I already start feeling old [Big Grin]

The first 1000 was definitely work, now it's smooth sailing in the threads.

BTW, I was surprised, too, that the '.' was valid in a UDF name but it would make some UDF calls soo much nicer and create the aura of OO programming. However, it would make scripts longer.
_________________________
There are two types of vessels, submarines and targets.

Top
#93574 - 2002-09-03 10:32 PM Re: Should UDF collections be allowed?
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Jens,

hapy 2k from me to.

Nice thought with the OO (dot) notation, like you i say size is second priority.

But, you could even end up with smaller scriptsizes by using descriptive var/function-names because you can limit the amount of remarks.

-Erik

Top
#93575 - 2002-09-06 12:18 AM Re: Should UDF collections be allowed?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
congrats to you (as late as mine comes...)
you are one of the big one's now.

anyway, to get back to this collection stuff, there is allways the problem of having 2-5 udf's with same namespace just with different topic or with different everything but the functioning...

what I mean with this is that, how we collect just the best udf's as lately there has come up dublicates with just little diff... like, the author is different.

making a "class library" would need much time to collect and connect them all together... parse and connect again.

what comes to global vars, we discussed it pretty much about an year ago and I think shawn had the thing between the lines:
global vars are only allowed if well documented.

as they can be changed by any other udf using globals or the mainscript, never ever would I want to use them anymore...
_________________________
!

download KiXnet

Top
#93576 - 2002-09-06 02:34 AM Re: Should UDF collections be allowed?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Congrats on the 2k posting Jens. Really nice to have good people like you on the board.

As for this topic... I don' mind "new" functionality, but DON'T lose sight of the fact that KiXtart is a LOGON script processor designed to help Network Administrators perform their job more easily.

By me saying Network Administrator, I'm meaning that at least a few of you guys on the board have programming backgrounds and or do it on the side, whereas I would think (IMHO) that most Network Administrators have little to no background in programming (myself included).

So, having new or enhanced functionality is great, but when options or features are "mandated" or forced as the "default" that only make it easier on those with some programming skills under their belts, I think is a step in the wrong direction.

If we want it all VB or .NET like, then why not just jump ship and use VB (We don't because KiX is often easier).

So Ruud, please continue to make it a very robust, powerful, easy to use program.

Okay, well that is my opinion on the subject. Bring on new stuff, but don't force C, or OO type classes onto masses that may or may not understand how to use it.

Top
#93577 - 2002-09-06 02:50 AM Re: Should UDF collections be allowed?
Redback Offline
Getting the hang of it

Registered: 2002-03-20
Posts: 71
Loc: Albury Wodonga, Australia
Having all kinds of funky advanced features is all well and good, but you need to make things so that you dont have to use these things

we dont want to scare to many people away

GW Jens 2k

Top
#93578 - 2002-09-06 03:11 AM Re: Should UDF collections be allowed?
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Doc,

In the case of OO code it's only pseudo.
(Also awailable in logonscripts)

Is this more readable:
xl.AddRov($Row)

Than this:
xlAddRov($Row)

I belive that if we (on this board) agree to the . (dot) notation we can add the posibbility to see that a function call is from a collection/class

I belive that the charcter '.' is illegal in varnames, haven't tested
AND by using DIM and GLOBAL you should be able to encapsulate vars in the scope you want.

I really like Redback's comment. Make it easy to start coding, then make it easy to improve.

[ 06. September 2002, 03:12: Message edited by: kholm ]

Top
#93579 - 2002-09-06 03:28 AM Re: Should UDF collections be allowed?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Just tested it. I cannot use the '.' in variable names at all which means that though I can call a UDF that contains a '.' I am unable to return variables.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1110 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.134 seconds in which 0.093 seconds were spent on a total of 12 queries. Zlib compression enabled.

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