Attitude when working with legacy code

Itโ€™s exhausting to work on a legacy project, frustration is natural when there are no people around that wrote that code, not tests, no documentation. BUTโ€ฆ

Moaning, complaining and cursing wonโ€™t make you life easier or better. If you want thing to be better, do something about it instead.

Try to understand the code and make it better, applying Boy Scout rule of making it better than how we found it.

Donโ€™t focus on a big ball of mud as a whole, but focus on the small parts instead, and gradually make it better: write tests, extract methods and classes, rename variables etc. Itโ€™s provides a rewarding experience.

You can treat it like a big jigsaw puzzle, that you are solving bit by bit.

Working with legacy code is not worse than working on a greenfield project, itโ€™s just a different kind of problem, and can be interesting in its own way: are you good enough to make it better?

At the end of the day, it does not matter if we are working on a green- or brown-field project. Itโ€™s our attitude toward our job that will make it more or less enjoyable.