JM2CW™ ...
This scenario smacks of what I un-affectionately refer to as
"Tinkertoys.®" (Or maybe, "kit-
bashing.")
You are confronted with a whole bunch of
bash scripts, all studiously implemented in Bash, all closely related to one another because they are manipulating the same files and so on, but none of them sharing any common code. And "they work, sort of, as long as you hold your mouth just right." But, if you "tinker" with one of them, you break another. And, when you "tinker" with another to fix that break, the cycle repeats. The whole damned thing is
fragile. Far too much staff time is
spent wasted fixing stupid breaks.
Therefore, be sure to step back and reconsider the
whole picture from a business point-of-view. These things can suck up a lot of maintenance time, and as for me, I don't like calls at 2 am.
In many past lives, I have rewritten blocks of such recalcitrant code, say, in Perl-5. The scripts are reduced to one
use statement referencing a
common .pm file containing all of the
common code, including (in this file or in another one) the "guts" of all the various once-independent scripts. Now, you can
see them together, you can
edit them together, and you can write test-suites to verify that everything continues to work. Furthermore, you can avail yourself of the
contributed libraries that these languages readily provide.
Quote:
Originally Posted by cpan.org:
The Comprehensive Perl Archive Network (CPAN) currently has 180,090 Perl modules in 35,058 distributions, written by 13,013 authors, mirrored on 249 servers.
|
(This is typical ...)
The most ridiculous example of "kit-bashing" that I encountered out in the field appeared to be an earnest attempt to implement a
web server in Bash.
It never did work. I proceeded to tell the client that Perl's CPAN library has a fully-tested web server (object) that lets you implement a HTTP(S) server in about 10 lines of your-code.
(They didn't know that.) It took about half a day to replace their "Rube Goldberg contraption" with something that caused no further trouble. The trouble was simply that a previous programmer had the attitude of,
"there goes a white rabbit! Let's chase it!" And he did so, without further thought, using what was apparently the one-and-only programming tool he knew well. I guess it never occurred to him that someone
else had already seen the same rabbit.