The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

refactoring legacy Database and Application

There is a badly designed app that works fine from an end user's point of view but is all rotten on the inside. It has been designed as naively as I could. Many of the tables do not have primary keys, the DB design isnt proper and so on.

The user field is being intrepreted by the application in the following way XXYYZZZZuserrrrrr where XX is the Org name, YY is the department name and ZZZZ is the role of the user in the Organization. Everywhere in the code, substring(user,1,2) sort of statements are common.

The XX is a character datatype (2 charaters). Taking all allowable characters, we found that XX can take around 1000 values. Now once we reach this threshold, there is no new value that can be assigned to XX. In other words, the app reaches its end of life.

There are around 200 tables, 3000 jsp pages and since user is the centre of it all, all of these pages have to do with this user field. Also, SQL queries are not isolated and are strewn all over these 3000 jsps.

To increase the lifespan of the application, the user field needs to be split into 4 columns OrgID, DeptID, RoleID and userID. To think of changing all the jsps etc is just mind boggling. Is there any efficient strategy that I can follow to achieve this ?
Sathya Send private email
Thursday, August 07, 2008
oops ... read the line "It has been designed as naively as I could." as "It has been designed as naively as it could've been". Yes ... it wasnt me :-)
Sathya Send private email
Thursday, August 07, 2008
Starting now, you can change the table, and leave a view which replicates the old one -- if it's a simple structure the view should be writeable into the non-computed fields.

Meanwhile, it's time to start converting those applications to use fields rather than hacking strings apart.

The easiest way to do that is in the dev environment, rename the "user" field. All the apps will fail when they use it, meaning you won't miss any.

You can gradually deploy altered components because the legacy ones will work.
Katie Lucas
Friday, August 08, 2008
"Is there any efficient strategy that I can follow to achieve this ? "

I would write a script/program, probably using some regular expressions, to accomplish this.
Monday, August 11, 2008

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz