Many developers think that Legacy Code is an old code base that they inherit. A working application that other developer or other team wrote and you inherit it to maintain or enhance or to migrate to a newer platform. This is not entirely true, according to the definition of Michael Feathers in his book, Working Effectively with Legacy Code. And is this definition I like to take.
You may own a new working application, written from scratch, by you or by your team and even these, you might have been written legacy code. Did you write tests cases ? Well, if you didn’t you wrote legacy code. Someone on your team, right now, might be writing legacy code. The difference between legacy or non-legacy code is test or lack of test.
Usually, you fear to change an old code base due to you are not sure what might you be breaking… well, a code base can be very old, but if it comes with a good test harness, then you will be able to improve it even if you are new to that old code base.
And if you inherit an old code base, without test, read Michael Feathers’ book, it is full of very good advises.