SPUG: Change a namespace after loading?

Jack Foy jack at foys.net
Wed Apr 11 20:59:53 PDT 2007

Bill Warner wrote:
> The idea is to implement phased deprecation of old code.
> The situation: a library with hundreds and hundreds of clients (modules 
> that 'use' the library) is to be deprecated.
> The solution: write a new version that looks identical to the clients. 
> Simple enough, but I don't want to switch all clients to the new code 
> simultaneously. I'd prefer to switch a few at a time. In other words, for 
> some clients the old version is used, for the rest the new version is 
> used.

Do you have ownership of the clients as well as the module?  If so, the
simplest solution may be to use a new name for the new module.  For each
client, implement enough of the old module's interface to support what
that client is doing, then port that client's code as necessary to point
at the new module.

Alternately, add another level of indirection.  Rename the old module to
something like OldFoo and implement a new Foo whose sole purpose,
initially, is to pass client calls through to OldFoo.  Then you can
gradually reimplement OldFoo into Foo in a manner invisible to clients.
This approach is probably the fastest way to get up and running.

(Depending on specifics, the second approach may also require a bit of
re-engineering to set up OldFoo, but that would hopefully be minimal --
the aim of that work is "bug-for-bug compatibility".)

Jack Foy <jack at foys.net>

More information about the spug-list mailing list