Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any tool that can analyze the dependencies between variables in c# programs?

There are many tools that we can use to show the dependencies between modules, source code files, classes, or functions etc. But there seems no tool for analyzing the dependencies between variables. Given a dependency graph of variables would be helpful for understanding and refactoring the code.

For example, if variable b is only used for calculating the value of variable c as follows:

b = a;
....
c = b + 2;

Maybe we could remove variable b to make the code more readable:

....
c = a + 2;

This kind of refactory may be hard if the code is very complex or has many bad smells.

Is there any tool that can analyze the dependencies between variables in c# or other programming languages?

like image 326
askalee Avatar asked Nov 06 '22 16:11

askalee


1 Answers

The Phoenix Project at Microsoft Research has enabled some pretty interesting tools. One demo I've seen shows highlighting of data-dependencies. So you could hover over 'c' in your example, and all expressions that contribute to that calculation would be highlighed. It was more a demo of phoenix, than a fully fledged developer tool, but very cool to see that it could be done. Phoenix is a free download, so you can see what kind of sample apps are included.

like image 166
TheDon Avatar answered Nov 12 '22 16:11

TheDon