Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

About to embark on the initial phases of a project to rewrite a legacy application from the ground up (existing business rules will change somewhat, and be extended to incorporate a large number of new requirements that the existing infrastructure cannot handle). I am looking for items that are important to remember when working to reengineer an existing application.

share|improve this question
    
Differences from what? –  user1249 Dec 28 '10 at 1:02
    
yeah, i wanted to change that to items...but my thought was differences from a project for a brand new application. –  jellyfishtree Dec 28 '10 at 1:08
    
and, changed it. thx –  jellyfishtree Dec 28 '10 at 1:09
    
Throw the old app out and don't even look at it. Seriously, you're adding functionality and changing existing rules; "From the ground up" means start fresh. –  kirk.burleson Dec 28 '10 at 1:50
1  
@kirk.burleson: throwing away the old app at once, without a complete transition (and verification, fallback) plan would be career suicide. –  rwong Dec 28 '10 at 2:10

8 Answers 8

up vote 15 down vote accepted

Write a suite of unit tests for the existing functionality first. When you do your rewrite, you can use this unit test suite to verify that your existing business rules still work in the new application.

share|improve this answer
    
+10000 for making life easier down the road –  David Dec 28 '10 at 0:37

Come up with an incremental transition plan. That is, make it so the project is always in a runnable state, transitioning from old code to new code without getting in the position of requiring effectively all of the new code to be written first before anything works.

There might be some things still done "the old way," while other features are done "the new way," and the user interface might be less than desirable for a while. But this approach will significantly reduce your risk, because you can always ship something. (Actually, if you have a gradual UI transition too, this might work nicely with Joel's notion of the Iceberg Effect: management/customers will see progress and have a notion of what remains to be done.)

This depends somewhat on the circumstances of your code base, but look carefully before deciding if this base is the exception to the rule or not, because it probably isn't.

share|improve this answer
  1. Understand what the existing code base is doing. In any old legacy application there may be a good number of special cases that users are expecting, be wary of these and only intentionally and rationally change existing behaviour.
  2. Coupled with 1. you must also test that the new functionality is doing what is intended (based off the understanding of what it is currently doing, or will be changing).
  3. If it is a large application or code-base, plan for the change to be incrementally introduced, this should mitigate the danger of one large release and show progress.
  4. Be especially careful if operating in an environment that is heterogeneous in versions of the software: beware file formats, network protocols, shared memory formats. Test and ensure compatibility between versions.
  5. If changing a data storage system, be prepared to mirror writes for a while into the new system to test load and gradually transition reads onto the new system while retaining writes into the old system. Once the new system is solid, add the new functionality.
share|improve this answer

There are a lot of good answers here that are really good points. There is one thing that I think is also important. Look at how technology has progressed from the point where the original code was written and what is out there now:

By all means, you must assess the existing code; unit test, plan, research, development, more testing. But you also have to take into consideration new technologies that may extend the lifetime of version 2.

share|improve this answer

Trying to come up with things not already said:

  1. Secure management involvement. Remember that the success of a high-risk project often depends on management buy-in. Make sure you have legit and active stakeholders who want this badly. If not, you may find serious roadblocks if you meet resistance to change, and when changing systems, you will meet resistance to change. In one project where we were moving people to a new system, all they could talk about was how much better the old system was. Management gave people a chance to get on board, and if there were serious dissenters, they were released. The sad truth is that there were parts of the old system that were indeed better (a long story that's too depressing for me to retell here) but because management was serious, the implementation team got the backing it needed.
  2. Secure a champion on the user side for the project. If the previous application's product manager is on board and actively involved, that's a plus. If not, an expert user that's respected in the community will be important. Demarco and Lister said something once to the effect of, "Every time a new system comes online, someone gains power and someone loses power." If a good leader on the user side is onboard with things, they'll potentially smooth the way for user acceptance.
  3. Treat the new system like a new project and have a really good analyst involved. That analyst might be a senior developer, but whatever, you don't want to make the mistake of saying, "Oh, this'll be easy, just do what the old system does, but better." The problem is that if the old system is anything like most of those in corporate America, then identifying exactly "what the old system does" might not be as easy as it sounds...there's probably outdated, if any, documentation, and lots of crufty old ways of doing things in the system that might not even be relevant anymore. Lots of times systems do things just because that's the way it was done in the old manual process, and you can save a lot of work and wipe out a lot of convoluted logic by removing unneeded complications. Sometimes the best code is the line you don't write.
  4. Look at the reporting component first. Reporting is often forgotten or left do finish as an afterthought, but this is losing out on a great tool for information. The old system's reports can tell you what the users needed most, and can be a good starting point for verifying what the new system's output should be. Be careful though to vet every report...probably some are not even used anymore.
share|improve this answer
    
+1 for business buy-in (both management and user population). Without both of these you will only face a tremendous struggle. –  mpeterson Dec 28 '10 at 4:31
    
I'm sure Demarco & Lister are paraphrasing Macchiavelli's The Prince, but I can't find the reference. –  Frank Shearar Dec 30 '10 at 0:37
    
@Frank Shearar Now that I think about it, I may have mis-attributed it. It might have been Demarco alone in an article I read in a magazine within the last few years. But you're right, that does sound like something Macchiavellian, though I'm not sure Demarco meant it as advice to would-be dictators but rather as recognition of the natural fallout of system turnover chaos. –  Bernard Dy Dec 30 '10 at 1:30
    
Well, Il Principe isn't really about dictators in the way we understand the term today: it's about how to maintain your power. A number of princes in his book were deservedly loved by their people. –  Frank Shearar Dec 30 '10 at 10:13

I really wanted to leave it at those three steps, but just in case someone took it as me being lazy, rewriting from scratch is almost doomed to fail. Incrementally adapting and refactoring code is the best way.

share|improve this answer
    
I am wondering why someone downvoted this? –  jellyfishtree Dec 28 '10 at 7:00
    
As someone that has been apart of a rewrite before, it's a very dangerous road. Maybe they have a personal grudge against Joel? lol –  Andrew Finnell Dec 28 '10 at 15:52
    
i got your back on this one. Im not sure in this case a rewrite is avoidable. I've taken your advice to heart and tried to start thinking of ways we can gradually transition between the two and if its possible to just refactor and adapt the existing codebase. My gut tells me that by the time we finish "refactoring," though, we will have rewritten most of the application anyway. The nice thing about this though, will be that it will help us maintain existing business logic. –  jellyfishtree Dec 28 '10 at 19:49

Lots of good answers so far. (I assume the existing system is either a hopeless jumble or coded on the wrong platform)

Here are my thoughts:

  • Build your test system!: Chances are the current project doesn't have one, and this is a great time to start out doing things right. This includes making the code easily testable as well.

  • Define success upfront: When will you know the project is done? Without this you could end up reproducing much of the original system, but get mired in 'just one more thing' additions to the functionality.

  • Say NO to synchronization jobs!: I spent 2 years of my development life cleaning up the mess these made in one company trying to run side-by-side systems. Poor planning and lack of business buy-in created these jobs and in the end significantly slowed the final development time.

share|improve this answer

One big thing to remember when rebuilding from scratch is domain knowledge. Companies often engage in 'complete rewrites' - using the most recent technologies and development projects to ensure the highest order of buzzword compliance - leading to dissappointing results because the people who knew most about the topic were not consulted with extensively.

There's nothing wrong with complete re-writes. Or mostly complete rewrites. There's a time and a place for them. Platforms change, technologies change... sometimes they just have to be done. But, they are best done under the guidance of the people who are the most expert at the topic - those involved in the previous implementation - for the best chances of a positive outcome.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.