Refactoring of unfamiliar system

by Analysis Paradisys   Last Updated May 15, 2018 19:05 PM

A couple of weeks ago I got a new position of Head of Development. I've never worked in that company before, so I'm completely unaware of a domain, how the code is organized, what it looks like and so on. The codebase is pretty impressive, it's about 500 kLoC. The code is about 10 years old, there were several teams involved in it during this period. Hence there is no single style, no single framework. There is one guy who works there for about 5 years and he knows this system the best. Others work there for less than a year and are more or less competent in some certain pieces of functionality.

My primary responsibility is to carry out refactoring so that features will be delivered faster and with fewer bugs. And I do mean refactor, not rewrite — I'm well aware that it fails most of the time.

So where do I start? That is,

  1. How to define what exactly should I start my refactoring with?
  2. Before refactoring itself, apparently, I need to read the code quite thoroughly. The problem is that roughly 50% of expertise is lost, so 50% probability that no one could answer my questions like "why is it so", "is it the way it's supposed to be", etc. Besides, it could take quite a long time, since there is a lot of code. Some recommendations on this item?
  3. What to do if the code is tightly coupled (and they say it is), so refactoring of one piece is impossible without refactoring of another, whose refactoring is impossible without the third piece and so on? Besides, there are no unit tests at all.

What I came up with by far are pair programming sessions, which are more like "interactive lessons", when I ask what is this, how is that, where is that, etc. My "Working Effectively with Legacy Code" copy is on its way, so I need some advice to start with, and some caveats to watch out in the future.

Tags : refactoring

Related Questions

Refactoring a god Manager class

Updated August 20, 2015 18:02 PM