I’m working on a huge legacy codebase that uses Bing Maps API as a service provider and I have got the task to scrap Bing which is the foundation of the software and has been referenced through the source code everywhere.
My question is: How should I document and count the references of Bing through out the code? I’m hoping to use this to make a better time estimation, and later, help ease the refactoring process.
I have already started browsing the code-base but I’m not sure what’s the best way of documenting references.
If your IDE supports task tagging (e.g. TODO/FIXME comments), then you can use them to annotate your usages on the same line they occur on. Define a new tag (if you can), mark up your source as you go along, and let the IDE do the work of aggregating the results into a neat little report.
As you make changes to the code and remove/consolidate unwanted usages, your report will stay up-to-date. You can also include information after the comment tag and parse it out with regex. For example, including an estimate of effort:
var foo = Bing.bar(); // LEGACY: 3
If you’re on a Unix-type system,
grep(1) will enable you to pull together a list of references by file to the calls you want to identify. If you put this in a script, you can run it periodically to verify that you’ve removed all the references. Just remember to skip any compressed/minified versions of your files, or you’ll get duplicate references.