|
>> I came away from one of Jon's sessions at Common with the distinct impression that every subroutine should be changed to a sub-procedure. I think I heard him say that, but I probably misunderstood (as usual) what he was saying. I think what I said (it is what I normally say anyway) is that I _personally_ don't bother with subroutines. For me they serve no useful purpose. Subprocedures give me a natural language interface where the parameters are clearly spelled out, local variables (most subroutines define at least some 'local' data), parameter validation, some facilities for automatic conversion of parameter type/size, etc. etc. And subroutines give me ....... ? The performance difference is so minimal as to not be worth considering. What the IBM manual does not take into account is the overhead of 'parameter' handling in subroutines. Most subroutines effectively use some data as parameters. While an EXSR is faster than a subprocedure invocation, is it still faster than moving three 20 character fields to fake out parameters? If it is the difference I suspect will be small. Of course there are occasions when performance needs are paramount, but I'll swap readability and maintainability for performance most any day of the week. If you believe that your subroutines do not use any 'parameters' then simply cut that piece of code into a separate module, compile it and call it. If you can't do this and have the resulting combo work - your subroutines were using parameters <grin> I do disagree with John Carr (think it was you John) on one point - I don't believe that you should ever take the view that a coding style is acceptable because the program will not be subject to future changes. Business changes too fast to ever be able to make such a decision. I have programs in daily use that I wrote 15 years ago that I was convinced would only be in use for 6 months or so. There are also many examples of code that I thought would run forever .... but we won't talk about what happened to them <g> +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.