Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Best Coding Practice
General "best practice" question here, for an "inherited" program.
There is a flat file with 9 different record types (for brevity, RT1,
RT2, ... RT9). The file serves as a queue of sorts - its records must
be processed in the order they are received, independent of record
types. About 40% of the logic for each record type must be done for
all record types (that is, 40% of the code that is exectued for RT1 is
also executed for RT2 - RT9); about 20% of the logic overlaps a
fraction of record types (RT2, RT5, and RT6 might require the same
code); and the remaining 40% of the logic is unique to each Record
Type.
Most of the logic is brief; however, the code for 2 of the record types
is in excess of 3,000 lines of code.
The current program reads a line of the file, determines the RT, and
simply passes all appropriate fields for that type to the appropriate
package (there are, therefore, 10 packages - the master and 9 slaves).
Naturally, each slave package has the the full amount of code
(redundancies and all) repeated throughout - any change to any of the
shared 40% of logic requires synchronized changes between 9 different
packages.
Obviously, this is bad. My question is, what would be the best way to restructure to packages?
My inclination is to have one package, period. Have the driving logic simply run all records through the "40% universally shared logic", then call a sub-procedure for each RT.
The only downside is that the more complex RT's make this package,
well, huge (a total of nearly 9,000 lines, even after eliminating
redundant code). This gives me a "bad gut" feeling that I can't quite
put my finger on: the code itself will be as modular as ever; yet the
idea of merging 10 manageable packages into 1 bohemoth "feels" wrong
(particularly in leu of the possibility that multiple changes to
different RT's might need to be worked concurrently by different
developers).
My question is - is it valid programming practice to merge the packages; or should I look for more of a middle-ground solution? Received on Tue Jan 25 2005 - 17:40:45 CST
![]() |
![]() |