I'm very much against rewriting an application if it can be avoided. I understand the rule that 9 times out of 10, it's better to refactor, but I'm in a situation where it might be the one time in ten, and I'm looking to find that line.
The current situation is:
- I took over the maintenance of a VB6/SQL application.
- The total lines of code is 75-100k (code-behinds, modules, and classes).
- The original developer left, so it's just me, and there's no opportunity to expand the team, at least for a few years.
- There was no architecture to the program (just straight SQL calls in plain text in the form code-behinds).
- Doesn't try to follow the DRY or OAOO principles.
- Database had some primary keys, but no foreign keys.
- Before this system was in place, everything was managed in big spreadsheets, so this system really is a huge improvement over what they had, but doesn't do what they're envisioning.
- I was able to write myself some tools to replace all literal instances of table names and column names with constants and look-ups, and I wrote a quick code gen script to generate those constants and look-ups from the database, so now I can safely make database changes and see everywhere that broke. I have started normalizing the database "around the edges", but it's like 3% of the way there.
- There are no unit tests, so every time I change the database, I basically have to rewrite whatever logic sits on top of it, and I use the two versions to compare functionality and make sure it's the same. So far so good.
- I started by just trying to fix critical bugs to stop the bleeding, and I can safely say that's mostly done, so now I'm stepping back for a moment to look at the big picture.
- Management is supportive and reasonable in their expectations.
- The long-term goal is to convert it to .NET anyway...
So, I'm weighing these options:
- Continue normalizing the database and modifying the VB6 app as I go (ends up being a piece by piece rewrite)
- Put the VB6 one into a maintenance-only state (no new features), pick one functional module at a time and rewrite that part in .NET on top of a normalized database structure.
My thought is that if I choose option 1, then at the end I just have a VB6 app that they still want to upgrade to .NET, and I've looked into that and it's costly and time consuming, and even with the tools you'll still get something that's somewhat of a Frankenstein. If I go with option 2, I believe I can be done sooner, and I'll jump right to the target technology.
In the small scale pieces that I've already rewritten during my normalization process, the result has been an improved module over what was already there, so there is value being added during the rewrite.
The existing app, for all its flaws, is a great talking point for discussion. The people using it can tell me what's working for them and what isn't, so there's certainly a lot of value there that way.
So, does this qualify as one of those "one in ten" times, or not?