Don't ask to ask, just ask | |
PerlMonks |
Re: Clean code transition - how?by mstone (Deacon) |
on May 03, 2005 at 21:00 UTC ( [id://453731]=note: print w/replies, xml ) | Need Help?? |
Consider building another layer of abstraction into your current code. As I understand your question, you don't want to get stuck searching-and-replacing function names in the code that uses these two libraries. By and large, that means both your brain and your survival instinct are in good working order. ;-) A set of wrapper functions will let you modify your client code once, then switch between the two different libraries with ease. If your client code presently looks like this:
Swap in a generic function name, and then create a new function which calls the original one:
The payoff is that you can now write another wrapper that calls functions from your new parser library:
and it will work as a drop-in replacement for the old wrapper, even though the two parser libraries have completely different APIs. Writing a test suite that compares the two wrapper libraries then becomes a one-banana problem.
In Section
Seekers of Perl Wisdom
|
|