I'm writing a PHP application where a block/module of domain logic is subject to frequent, significant changes over time.
The complication is the application needs to be able to use not just the latest version of the module, but any version that it has previously used, so it can reproduce the results of data that that version would have made.
I would use a facade and/or adapters or similar so the application's main code can switch between which versions of the module it uses without too much trouble.
As for the module, I was planning to use namespacing for each major revision (where the domain logic produces different results); duplicating all the classes in that domain logic module. I.e. effectively copy-and-paste the entire thing, including classes within the module that haven't changed.
This is a pungent code smell and I can't think of any way round it, let alone a simple way, given that the module may also undergo complete restructuring.
Any ideas?