|
> From: David Gibbs > > I agree that a procedure is not a 1 for 1 replacement for a subroutine, > but I would argue that using procedures instead of subroutines makes a > program better. "Better" is a pretty powerful phrase, Mr. Gibbs. If a chunk of code has no parameters, and affects only global variables like fields on the screen, then how exactly is it better to wrap that chunk of code in a procedure? You have to add the begin and end procedure as well as the rather redundant one-line prototype at the beginning of the code. It gets even more painful with /free, since you have to also add the /free and /end-free, since the P and D specs aren't free-form. And procedures can be misused most horribly. One of the worst offenses I see is procedure with a bunch of return opcodes strewn throughout it. At least with a subroutine you can stick a breakpoint on the ENDSR and know it will get there. > Since I have gotten comfortable using procedures, I have not written a > single new subroutine. Anytime I come to a situation where I might have > considered a subroutine, I always find that a procedure is a better > solution. I'd say 95 times out of 100 I agree. Yeah, that's probably right... I'd say I write 20 procedures for every subroutine these days, maybe more. But I still do use subroutines occasionally. > I'm not saying that there is NO place for subroutines ... I just think > that a procedure is usually a better choice for the overall health of a > program. I agree completely, when you use terms like "usually" and "not...NO place". It's when people get zealous and start trashing other people because they use subroutines that my blood pressure rises. Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.