On 4/7/21 3:09 PM, Alvaro Herrera wrote: > On 2021-Apr-07, Andrew Dunstan wrote: > >> Aren't you likely to end up duplicating substantial amounts of code, >> though? > No — did you look at his code? Each version is child of the one just > above, so you only need to override things where behavior changes from > one version to the next. >
yes >> I'm certainly not at the stage where I think the version-aware >> code is creating too much clutter. The "forest of conditionals" seems >> more like a small thicket. > After comparing both approaches, I think ioguix's is superior in > cleanliness. > a) I'm not mad keen on having oodles of little classes. I should point out that this will have to traverse possibly the whole hierarchy of classes at each call to get the the actual method, which is not very efficient. But to some extent this is a matter of taste. OTOH b) as it stands pgaTester.pm can't be used for multiple versions in a single program, which is a design goal here - it sets the single class to invoke in its BEGIN block. At the very least we would need to replace that with code which would require the relevant class as needed. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com