Brutzman, Bill wrote:

> I need a UniBasic program that uses a lot of code from
> another program.
>
> I am inclined to move all of the common code out to an include file.
>
> I am reluctant to use an external subroutine because if the
> needs of one
> main-program change and I then re-compile the sub, then the other
> main-program (which depends on the sub) could get whacked.
>
> Insightful commentary would be appreciated.

Bill,

My advice is that the small amount of extra pain involved in putting your
common code into a real external subroutine is always worth it in the end.

I'm a great believer in INCLUDEs, but only after an extreme amount of
thought will I put significant logic in them.  If processing is necessary it
should nearly always be done in the main program, or if needed in more than
one place then in an external subroutine that you CALL.

You chances of stuffing up a program that INCLUDEs logic by a small change
to that logic are much higher than if you CALL it as an external routine.
Immediately you eliminate the risk of someone introducing a new local
variable into either your main line or the INLCUDE and finding that it
collides with something else which was also supposed to be local.

That's my 5c.  YMMV

Cheers,

Ken
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to