有没有任何代码分析工具,将使我的工作更容易? [英] Are there any code analysis tools that will make my job easier?

查看:196
本文介绍了有没有任何代码分析工具,将使我的工作更容易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近继承了一个由Managed C ++编写的程序,这个程序刚刚退休。花了一些时间挖掘它,我可以诚实地说,至少95%属于 thedailywtf

I have recently inherited a program written in Managed C++ from some guy who just retired. After spending some time digging through it, I can honestly say that at least 95% of it belongs on thedailywtf. However, I am now tasked with modifying it and porting it over to a language I'm comfortable with.

程序本身需要许多参数(50+)read(),但是我现在的任务是修改它,并将其移植到我很舒服的语言。从文件中执行一系列计算并输出报告。一旦我完成了我的方式通过3个字母变量的页面(其中许多被重复使用完全不相关的目的),我需要提出一种方法来测试我的代码,以确保它提出了与前面的相同的答案代码。

The program itself takes in many many parameters (50+) read in from a file and performs a series of calculations and spits out a report. Once I'm done plowing my way through pages of 3 letter variables (many of them reused for totally unrelated purposes), I need to come up with a way to test my code to make sure it comes up with the same answers as the previous code.

这是最有希望的想法,但是有什么自动化代码分析工具,可以帮助我在这个任务以任何方式或形式?

This is most likely wishful thinking, but are there any automated code analysis tools out there that can aid me in this task in any way or form?

我将移植到Java。

推荐答案

开始编写测试以确保移植代码不会破坏任何现有报告的行为。

I think you should start off writing tests to ensure that the ported code does not break any of the existing report's behavior.

对于自动代码分析工具,最有可能帮助您这个区域是数据流分析工具,它可以假设地模拟从文件到变量并流向报告的数据流。不幸的是,搜索这样的工具导致失败了几个星期前,对我来说。你可能想在地方有手绘的DFD,只是为了确保你不要跳过的东西。 Graphviz 可以帮助这一领域。

As for automated code analysis tools, the ones most likely to aid you in this area are the data flow analysis tools, which can hypothetically model the flow of data from the file into the variables and out to the report. Unfortunately, a search for such tools resulted in a failure a few weeks back, for me. You might want to have hand-drawn DFDs in places, just to make sure you don't trip over something. Graphviz can help in this area.

它可能帮助将功能复制到Java(我知道这听起来不正常),但你可以在PMD,FindBugs和Java中类似的代码质量保证工具的注意下仔细重构代码。

It might help copying over the functionality over to Java (I know this sounds perverse), but you could refactor the code carefully under the watchful eyes of PMD, FindBugs and similar code quality assurance tools in Java.

EDIT:我忘记了某个类别的工具可能有帮助的部分,这些是Java世界中的代码分割工具,我必须承认, t使用它们到目前为止。以下是可能有帮助的列表:

I had forgotten the part where in tools of a certain category could be of aid - these are the code slicing tools in the Java world, and I must admit that I haven't used them so far. Here's a list that might help:

  • JSlice
  • Other related tools listed on the JSlice page.

这篇关于有没有任何代码分析工具,将使我的工作更容易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆