Saturday, September 20, 2008

New Installer, a Fix and an Idea

Changed the installer from the Visual Studio Installer to WiX. Shamelessly ripped it from Agent Smith.

Added a Value Analysis check to Assignment Check Smart Generate. Pretty difficult as I needed to temporarily insert an if statement at the caret to get an IReferenceExpression, run Value Analysis, and then cancel insertion. Worried about performance.

Considered how to detect code similarites to highlight common code blocks. Common code blocks could be extracted into methods which would increase maintainablility.

Each important element of a code block; statement, invocation, assignment etc. could be represented as an integer. A code block would then be a list of integers. I could then use Levenshtein distance to compute the difference between two code blocks. If the distance is small, the code blocks are similar.

It is a nice idea, but probably not workable in real life.

2 comments:

Sergey Zyuzin said...

Hi, Jakob

I've just found your blog.
I'm glad that you reused Agent Smith's installer:).

About code similarities. When I was reflectoring Resharper, I think I've seen code that finds similarities, it was just absent in R# interface.

--Sergey Zyuzin.

Unknown said...

You could try to use Sift: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html. Just be careful to use a parameter that works for you, not the default 5, which is used to check for typos.