I am trying to reorganize an existing Winform application to use the passive MVP lookup template. The application user interface, business logic, and storage code have been freely mixed for many years. It seems like it started with separate layers or someone was trying to separate it from the layers. In any case, the boundaries of the layers were not respected.
Since forms directly manipulate domain objects and a data source (and vice versa), my first task is to create presenter / controller objects and delegate these responsibilities.
The application is a .NET 1.1 application, and I am developing in VS.NET 2003 with a fairly limited refactoring add-in. I used a test generator for existing code to create boiler block tests, then went through and edited each test manually. Of course, this completes the code check, not necessarily what it should do. For new classes, I am doing TDD.
Any tips, resources, pitfalls you need to look for with refactoring of this scale?
A few resources that I already have:
- Collection of books on programming; Refactoring, PEAA, WELC
- Internet (obviously)
- Large quantities of caffeinated drinks
Update: As an example, what steps will you take to do this:
private void OneOfManyFormEventHandlers(object sender, System.EventArgs e)
{
string LocalVariable;
decimal AnotherLocal;
if (!this._SomeDomainObject.SomeMethod(ClassField, out LocalVariable, out AnotherLocal))
{
MessageBox.Show("An error occurred calling method");
return;
}
this.FormControl.Value = LocalVariable;
this.AnotherFormContorl.Value = AnotherLocal;
this.AnotherPrivateMethod();
}
In it:
private void OneOfManyFormEventHandlers(object sender, System.EventArgs e)
{
this.FormPresenter.DoSomething();
}