dilettante
This discussion veered of into another direction...but that is ok!
You seem to be a passionate analyst.
I say analyst and not programmer because I consider programming less important than the analysis itself.
This is my background (and passion!)...
In my experience I have found little (to none) code that is actually being re-used.
And re-using is something else than using!
An example of using is the ever famous date routine!
Every shop seem to have their own version and many shops even have multiple versions!
That is not re-use!
But you can only re-use functionality when it is stable (the code) and known (reliable, clear, easy-to-retrieve and up-to-date documentation) and has a well defined purpose (refactored function(ality)).
I like javadoc, even though crude, it does generate limited but reliable source information.
I worked on that idea and created a kind of 'coboldoc' or actually 'sourcedoc' because it is language independent!
But getting reliable documentation is not even half the story!
(correctly) Refactoring is another major part!
More so!...I consider this the hardest part!
And then of course these (hopefully!) well documented and (hopefully!) well factored functions should be protected (re-used as black boxes). For this I use a class-based approach (note: OO is not possible using COBOL85. I [still] use COBOL85).
In one of the projects I participated in we re-used functionality for both batch as well as event driven transactions.
And there are definitely some issues here!
For instance with event driven transactions you want to verify the input for every single transaction (to preserve data integrity).
But batch runs may consists of millions of pre-formatted, already verified, records being processed of which each record to be processed can be considered to be a single event!
It would be foolish, as you said in your own terms, to verify or initialize that which has already been verified and initialized!
Now, the class based system I worked on has some 'awareness' (state data!) and 'knows' whether it is batch or an online transaction. More so, it even auto-magically calls the correct polymorphic method coded as a contained program within a class-based program.
Programs of the class-based systems do contain very little if-then-else or evaluate constructs, very little switches, no abuse (=redefine) of record structures at all, not a single record contains an at-end filler, no unnecessary loops, all this because there is absolutely no need for it!
And at the same time it is extremely easy to re-use the functionality using a completely different interface with a completely different purpose!
It sounds impossible but it really isn't!
BUT
It's weakness is the programmer!
As is the case for all long-life software the code/system tends to deteriate from the
ready-set-go moment!
And, again, this was the basis for my original question.
By the way...whenever I encounter a spagetti system I
happily add the next bit of spagetti code!
As you said, and I quote you:
The problem is that I have my own job to do, and unraveling the disasters caused by misguided attempts to stylize Cobol source is just more work I must pack into my workday (or worse yet get dragged in to handle, unpaid, on weekends).
To which I only can add the comment:
And when you actually do invest the time to clean the code and you make the smallest mistake everybody will point the finger at you!
A thankless task indeed!
It either takes your free time ELSE you make mistakes.
Or worse still:
You may make mistakes DESPITE investing your free time!
A lose-lose situation indeed!
As for performance:
I could not care less if a batch run that can start after midnight and needs to be finished before 5 in the morning runs 30 minutes instead of 15 minutes when optimized.
Of course, it is a totally different ball game, when it runs 6 hours and needs to be finished in 5!
However, I rarely encountered this situation!
Quite the opposite!
In fact, but this was over 10 years ago, I optimized the complete nightly batch processing in such a way (parallel processing) that it finished around 3 in the night! And the night shift had nothing to do between 3 at night and 7 in the morning.
And I too am concerned about money!
But from a different perspective!
I put the emphasize on change!
A system should
adapt (as seven of nine would say
![[wink] [wink] [wink]](/data/assets/smilies/wink.gif)
) to the ever changing business rules reliably and within a practical timeframe!
And, in my humble opinion, this is where the money is!
(note: not for the
creative programmer but for the
business).
Many collegues that I know consider it an unnecessary burden to invest some time into (attempting) to create a re-usable system. And indeed, the initial effort is a greater burden on (mainly human) resources! But, eventually well worth the effort!
I enjoy to exchange viewpoints with you and I do hope not to burden you (...too much)!
Regards, Wim Ahlers.
Considering programmatic performance (in general) this is my often used answer:
"I can increase the performance of
your system by about 5% by doing absolutely nothing!"
"That is...I observed that this is, on avarage, about the yearly standard performance gain due to standard hardware, software and network upgrades!