Cleaning up a large, legacy Java project

后端 未结 9 2242
抹茶落季
抹茶落季 2021-02-07 11:00

I\'ve been assigned to do some work on a huge Java project, and the influence of several iterations of developers is obvious. There is no standard coding style, formatting, nam

9条回答
  •  北海茫月
    2021-02-07 11:36

    What I like to do in this situation is:

    1. Firstly convert the project to use a maven build, so that I know what version the dependencies are.
    2. This also gives me some decent code quality reports to use as a benchmark, including checkstyle, findbugs, pmd and code coverage.
    3. And I (and many others) are used to this structure, so we know where to find the source, unit tests, resources etc.
    4. If it is a large project then a maven multi-module project layout is probably the correct structure to use.
    5. If it is currently one big-ball-of-mud, then that becomes the core module which can later be refactored into separate modules.
    6. The standard maven directory structure provides place for, and therefore encourages unit tests.
    7. The unit tests are a critical pre-requisite before refactoring can begin.
    8. Establish a continuous integration build cycle using Hudson.

提交回复
热议问题