Refactoring is nothing else but a technique that allow you to keep the balance. But what balance? Emotional one? Also, as it is good to when you can keep calm that code is readable, testable, maintainable and most likely works as expected!
But the most important is the one called P/PC Balance. “P” refers to production, the money you earn TODAY based on business value your software delivers. “PC” refers to production capability so it is a response to the question if you are able to continue TOMORROW when you need to extend your software by adding new features,adjusting the existing ones or also correcting defects quickly.
Let’s have a closer look at what happens if the balance is not kept.
The most common case is when the company only care of delivering business value quickly and (implicitly) with poor quality. In other words it is called as “Client is first, client is the most important”. Based on my experience I call it as “Time Driven Development” (do not confuse it with TDD, please). It might allow you to earn money for a while, but the technical debt is growing mercilessly. Sooner or later (probably much sooner than you expect) it will be very difficult and time consuming to deliver new features or correct defects reported by frustrated clients.
Complexity of the project will grow. Soon developers start leaving your project or company. Ten the company will be employing new developers who will be staying for a while (as the salaries will be bigger than market) until they realize how the development process looks like… Finally it’s too expensive to continue, other companies are faster, more efficient with similar products as they took care of quality as well…
I have to to be honest and look at the opposite case: what happens if you care about quality too much? You might end up with software of excellent quality, conforming to all the best practices, like SOLID, DRY, TDD, KISS, BDD, DDD,…. (I guess the list of good practices is much longer) but of little business value so you are not able to sell your product!
In such a case I need to emphasize : Developers! You are employed to earn money for your company! Be pragmatic!
Where is the truth then? As it is often the case : in the middle. Both sides needs to respect each other, trust each other, collaborate. Each side should allow to keep the wage unbalanced for a while towards the other side. Sometimes we need to deliver software quickly to sell/delivery product so we have money to spent on technical debt. Sometimes we need to wait for a while with providing new features as the technical debt is too big and slows us down (or stops us) to continue. Even in such a case tech people should receive new business requirements so they can perform revamping of the architecture / refactorings towards these requirements but without big/close deadline pressure and they can do it right.
Did you ever think about what kind balance refactoring can give
- to your growth
- to your family
- to your health
- to your company