Re: What's the Best Way?

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Thu, 15 Jun 2000 13:03:51 -0500, cklester wrote:

>I've got a big project I'm workin' on, and I've come across a question for
>which my experience cannot yet provide a reliable answer... so, I'm
>throwing it out here:
>
>I'm creating an include file to help me with data management. Right now I
am
>accessing the include's procedure with abc( COMMAND , Parameters ), where
>abc is the procedure, COMMAND is the particular command, and Parameters is
a
>sequence containing the parameters for the COMMAND. (Duh, right? smile )
>
>Right now, any output is automatically sent to a global variable,
abcOutput,
>for the programmer to parse himself.
>
>It goes something like this:
>
>    abc( GET_DATA , { recID, field } )
>
>and abcOutput would contain the data returned by that command.
>
>But would it be better for me to make individual procedures/functions?

IMO, I would say yes, break it into individual functions.  My personal
prefence is to avoid global variables when they are not necessary.  If you
are using one procedure 'abc' to perform any given number of commands, you
are likely to lose some speed doing a bunch of 'if...then's to figure out
what the command was.  Plus, you are going to end up with one huge
procedure that will be difficult to maintain later on.  If you are doing it
that way because there is some shared code for all possible commands, just
make that shared code a private routine (accessible only by your library).

-- Brian

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu