views:

333

answers:

1

We've got a legacy app to support. It's pure JSP, i.e. JSP opens connections, does business logic, submits forms (usually to the same JSP), and so on. It's 400+ pages, with some pages are as large as 100K.

The app is expected to be extended and modified over the next few years, so we're looking into ways to split presentation and business logic to simplify the maintenance. At the very minimum we'd like to port it into some simple MVC framework (Struts is #1 candidate).

Nobody is enthusiastic to refactor every page manually. We had an idea that may be somewhere there is a tool that does at least the partial refactoring, e.g. creates ActionForm based on request.getParameter() calls in JSP, moves all Java code into Action (though uncompilable), replaces some "<% if" with <c:if tags, and so on.

The remaining work is still very boring, but at least it has a much smaller scope.

Does anyone know such a tool?

+3  A: 

I don't think it worths it. You're saying you have 400+ pages with some beyond 100k?

100k!!!

Probably the best approach is to take a good analysis on that webapp, and modularize it. You can have totally new modules written in other frameworks and still be used in conjunction.

For the pages that are 100K, they are good candidates of their own modules.

I don't really see any advantage of simply translate the whole JSP mess into some other framework mess. What will happen is that simply it will broke into pieces and nobody will feel like fixing them.

The good part is? What modules will go first? What other should not change?

I would start with those that have had more changes in the last months. The fact a file is 100K only means that new features have to be added, but the model was so badly designed, that instead of creating new objects, some code was simply copy/pasted and placed with an if ( I almost feel like I have seen your code already ) and the file grow and grow.

Some parts seems easy to migrate, but the source control says no one have touched in 2 yrs. leave them alone.

More than using a nice framework. you should migrate and re-write the most impacted parts of the system, and create test cases this time.

Also, you should create a project style and validate it automatically with something like checkstyle, so nobody commits new quick patches.

Eventually not all the application will be migrated, but the new changes will be easier to perform, and the application easier to maintain.

OscarRyz
I totally agree with you that such approach would be a best one, but alas, we have a budget. And pretty tight one. Automation would actually free some hands to do exactly what you have proposed -- to refactors the worst parts.
Vladimir Dyuzhev
An additional reason then. Nobody want's to spend more time than needed fixing things that are not broken ( yet ) :P Focus on the core of the app, an migrate it by hand as needed. The investment will pay off. Automatically fix, only creates "robot mess"
OscarRyz
If I only knew where is the core in this damn mess! :-D
Vladimir Dyuzhev
heheheh ... At least take a look at the source control system ( you have one don't you ) The places that have more changes in the last months are the ones that deserve refactoring.
OscarRyz