Precise Searching for Smarter Changes


Professional programmers with serious needs benefit from more precise ways of looking for the parts of their code that they are considering changing, or have changed, to make sure they examine the correct impacts of those changes.

Using precise cross-references from static analysis tools like Understand tells you exactly where to look both for direct implications of what you are about to change and also, importantly, for subsequent impacts or side-effects of those changes.


Computer programming languages usually provide ways for the same names to be reused for similar but crucially different purposes.

Searching for those names with raw textual searches such as “grep” or “find in files” gives you less specificity, means more work, and also doesn’t provide insight (or a path) to explore follow-on effects from changes you may make. Static Analysis (parser) driven cross-referencing provides the EXACT uses you are looking for and can tell you ALL the places changes will affect.

Let’s explore some Ada code. And if you program in another language (C, C++, FORTRAN, Java, whatever)… stick with me here, what I’m going to describe applies to all of them. I’m just using Ada for the Google searches. Hey… I admit it!

We have an Ada subroutine called “Append”… this is in the AdaCoreVSS project available as an automatically downloaded Ada project in Understand’s example library.

Here I’ve searched for “Append” using different methods available in Understand:

Quick points:

  1. Instant Find, like grep but faster show 75 instances of the word Append.
  2. Find-in-Files can be set to exclude comments and strings and shows 17 uses of Append in the code.
  3. Using the entity filter I found 4 things with “Append” in their name. Basically, these are a hierarchy of a base and then 3 implementations of it for different types.
  4. If I click on the one of interest, the Information Browser will show me JUST uses of that particular override. In this case ONE use.

Clicking on Append in the Entity Filter gives me the ONE use I really need to examine. I like doing just what I need to do.

It gets better…. to really understand what happens if I change this override of Append, I’m going to have to consider how the calling function uses it, and also how the functions that call those functions might be affected.

So we’ve reduced work using a precise cross-reference, and now we are about to add work – the RIGHT work by looking at secondary, tertiary, and so on potential side-effects/impacts. We do this by expanding the Call-By tree in the Information Browser. And yes, there are a LOT of things to check:

Textual searches are not going to tell you where to look for side effects. At least, not easily.

How many I check, how I check them, and what I do if I find an issue is dependent on what I’m doing with this override of the Append subroutine.

Or I can look at this list and think “yikes” and reconsider changing this at all. Perhaps I’ll discuss that with the people who requested the change. Maybe they will reconsider. And maybe your team lead’s investment in a good static analysis tool will pay for itself in that one decision?

And if it is decided to proceed, I, or whoever I convince to do this for me, will have a nice organized and PRECISE always accurate set of places to check for side-effects and unaccounted for behavior based on my change.


Life is too short to not have the right tools for your work.

If doing electrical work, you could look at ALL the electrical outlets in your house, or you could put a tone on the circuit of interest and just check the outlets that match the tone.

You are a professional – demand the tools you need to make your job pleasant, efficient, and smart.

Static analysis can do what your amazing brain can’t… keep track of ALL the connections in your code, and help you navigate them while you maintain them.

Questions, comments, suggestions? Shoot me an e-mail. [email protected]