Question

I've recently joined a company that is using a .NET Compact Framework 3.5 application that is supposed to be a typical 3-tier application (Client / UI, Business, Data). Unfortunately the application is in a sad state of affair - business logic on controls, no unit tests / mocking, etc.... We have a chance to try and change it but was wondering if anyone has any similar experience with how to tackle this? As this is a production system, we can't just steam-roller in and change it over night, so will need more of a phased approach.

Any recommendations or links to any best practices, please?

Was it helpful?

Solution

If it works and is tested by being used I wouldn't touch anything unless there is a change needed. If the need arises I would do the following:

  1. Locate the part that needs change.
  2. Refactor that part to make it testable.
  3. Write enough tests to feel safe for current logic and get them to green.
  4. Refactor into new design.
    1. If current design is truly messy divide into smaller parts as needed.
    2. Write tests for those new parts.
  5. Then change tests and parts bit by bit to reflect new functionality.
  6. Get tests to green.

In reality I would probably execute step 4 through 6 together to not have to write to many tests and logic for stuff I'm changing anyways, but it's all about how much you can keep track of in your head, and how safe you feel with your knowledge of how the part you are changing affects the other parts of the system.

If the changes affect huge parts of the app, it's going to be tricky to do without completely re-writing everything. On the other hand how can I successfully re-write that that which I don't understand? Basically it's a balance between the time to find out what it's supposed to do and then re-write the app versus the time it takes takes to understand the current app and add the changes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top