Search code examples
refactoringlegacyvb6-migration

Will "Working Effectively with Legacy Code" help someone working with an application ported from VB6 to VB.NET?


I would like to refactor a large legacy application originally written in Visual Basic 6.0 and subsequently ported to .NET. In order to do this with confidence, I want to have unit tests around the existing code so I can compare before and after. What's the easiest and most effective way of doing this?

There's a book called "Working Effectively with Legacy Code" that looks like it might help me. However, it looks like it only deals with object-oriented languages and Visual Basic 6.0 is not necessarily OO. Can this book still help me? I'm hoping someone who's read it can vouch for it.

Specifically, this application uses no classes other than the forms themselves. It accesses the database directly from the forms, and not consistently. There were several people working on this project all using their own styles with no standards whatsoever.

As I said, this project has been ported to VB.NET. However, it's only ported in the sense that it compiles under Visual Studio 2008. All of the coding concepts are Visual Basic 6.0.


Solution

  • It does not just deal with object-oriented (OO) languages. Large sections are about how to deal with legacy code in C.

    So yes, buy it!


    There is a whole chapter (Chapter 19) called:

    My project is not object oriented. How do I make safe changes?

    Also there is vbUnit, an xUnit implementation that may help you use TDD with Visual Basic 6.0.

    Actually, I misread the question and thought you were going to port, not that you already have ported. In this case, you have a ton of 'legacy' VB.NET code that this is totally the book for you. You can take advantage of VB.NET's OO capabilities and use the rest of the book.

    I really cannot recommend this book more.