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?
Sounds like you'll just be maintaining old code until it's time to port it to .NET. So save some work and start today, rewrite. My 2 cents.
Make sure the existing app can still be used while you rewrite as sounds like it can't be done in a day or two. The "maintenance-only" state sound like a good idea to me.
Start converting the different modules one at a time, phasing them out of the VB6 application.
Prioritise according to what is mission critical/strategic, so you can also add value as you go along.
Since the database will be the integration point, make sure you fix the relevant parts (relavant to whatever you are working at the time), so you are building on a solid foundation.
In the short term, you will have more work (both VB6 code and .NET to maintain), but with a cleaner architecture, you will be able to start moving away from the legacy application faster and faster.
This way you will have both systems running at the same time for a while, so you have a fall back, and you can add proper structure (architecture, database integrity etc).
I think it might take you quite a while (too long) to rewrite a 100KLOC application (including reverse-engineering the specifications, and testing), without help.
First off - you poor s*d. never a nice place to be marooned on.
However, it really sounds like you've grabbed the bull by the horns and pursuing a steady course. I would be tempted to put into the mix that VB6 will no longer be supported next year (as far as i can remember) which will mean that should the application become broken as a result of os changes, then you'll basically be stuck. That aside, i'd try to see how much parallel developemnt you can pursue with this in .net as the interop shouldn't (famous last words) be too difficult to work out.
as you're on the precipice, i'd say leap but with caution.
I'll add more details when I'm able to jump back to the topic.
That was a great write up. However IMHO its missing an important piece. What is the value of the rewrite in terms of the customer and what are the costs and risks. I'm guessing here but it might be the following
Customers may get the following
Costs/Risks
You should consider what you can do to mitigate the risks and also see if the value your adding outweighs the risks and costs.
I had a project that was originally written in VB6 and they hired me to convert it to .NET. I recently left that job. I'm fairly convinced that the program probably shouldn't have been rewritten.
Here's some factors to consider if you take the re-write approach (based on my project)
Those are all experiences from a real life migration from VB6 to .Net. I was the only .Net developer. There was no resources to hire additional help. The main differences between my situation and yours is 1. the original developer was still there - just in a new role (making it harder at times) and 2. The original app didn't need a lot of bug fixes.
I think if I had it to do all over again, I would try to create some .NET dlls and incorporate those in the VB6 app. Piece by piece converting to .net. So perhaps you move the data and business logic for Accounts Receivable to .NET. All the other aspects stay the same. The GUI, the other features etc. Then after that's rolled out and marked as complete, take on the Shipping section and do the same thing. The final step is to create a new .NET GUI that uses your DLLs.
This gives you a couple benefits
I would be VERY weary of deciding as a single developer to re-write this application and deliver them a working product. I think a conservative estimate of that (assuming no scope creep etc) would be 24 months. Probably more likely 3-4 years.
The project I left had been worked on for 3 years and was servicable, but was not yet a 100% replacement for the original app. Like I said... even though it would have meant me not having a job, I don't think it should have been re-written.