Preparing to remove a tightly coupled service provider out of source code [closed]

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.

There are no unit tests at all. Very few pages of documentation. Also it’s a JavaScript code-base, built on top of ExtJS 3.4, a badly designed custom wrapper around objects to mock classic inheritance and class hierarchies, and Bing being used all over the code and referenced through functions 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 =;  // LEGACY: 3

If you’re on a Unix-type system, find(1) and 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.


Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *