如何重构数千行Java代码?有没有可用的工具? [英] How to refactor thousands of lines of Java code? Is there any tool available?

查看:128
本文介绍了如何重构数千行Java代码?有没有可用的工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序中,我们有两个或三个类,其中包含整个Java Swing应用程序逻辑。这两个或三个类包含大约7k行代码。

In our application we have two or three classes which contains the entire Java Swing application logic. These two or three classes contain around 7k lines of code.

现在我已经分配了重构此Java代码的任务。

Now I have been assigned the task to refactor this Java code.

我该如何开始?有没有可用的工具可以进行重构或至少引导我们?

How do I start? Is there any tool available that will do the refactoring or at least guide us?

推荐答案

我认为你是在尝试分手这些大型课程变成了小型课程。最常见的方法是使用 Extract Class 重构。碰巧这是我博士论文工作中的一个主要话题。

I assume that you are trying to break up these large classes into smaller ones. The most common way to do this is with the Extract Class refactoring. It just happens that this is a major topic in my PhD thesis work.

其中一个难点是决定新课程的内容。我知道有两种公开可用的工具 - ExtC (我的工具)和 JDeodorant 。两者都是Eclipse插件,我将它们归类为原型。如果你想尝试使用我的工具,我会很乐意提供帮助。

One of the hard parts is deciding what goes into the new classes. There are two publicly available tools that I know of that help - ExtC (my tool) and JDeodorant. Both are Eclipse plug-ins, and I would classify both as being prototypes. If you want to try to use my tool, I'll be glad to help.

一旦你决定进入新课程的内容,你必须做到实际把班级分成别人的工作。 Eclipse的Extract Class重构命名错误,并且并没有真正帮助。 IntelliJ的IDEA要好得多,但仍有一些bug。 JDeodorant也可以执行拆分,但它也有一些错误。

Once you decide what should go into the new class, you have to do the actual work of separating the class into others. Eclipse's Extract Class refactoring is misnamed and isn't really helpful. IntelliJ's IDEA is much better, but still has some bugs. JDeodorant can also perform the split, but it also has some bugs.

这篇关于如何重构数千行Java代码?有没有可用的工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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