Just a quick story; In my initial days in a company I was hanging around and trying to read code and trying to solve spaghetti codes with hardly written multi-threaded applications.
As a team, we gathered up things and had a deal to write better code with design patterns, unit tests, and principles. In a few days, we build a development pipeline first, then I analyzed it to understand the start point to refactor the code to make proper clean code.
I have started with basic refactoring steps by writing unit tests for days, weeks, and months. Done that, do that… you know the drill.
Days passed, the business grew, and customer requirements were kept coming… When I looked at my teammates, they have not changed their perspective and they were coding as they used to it. I was feeling alone as a developer I was wondering if am i only the one who considers technical debts, unit-test, clean code, etc.
Their main excuse was tight deadlines. But we had lost our motivation because of hard-working. Endless demands of feature developments. Business requirements that were changing in one-day caused changes in all the subsystems or design of implementations. We were lack of analysis of the development process which gave us extra work for development.
So at the end of the day, we were all exhausted and not motivated for doing better code. We were just looking to finish the workload asap.
So I gave up with the team that I was only trying to keep my code clean and documented. Anyways refactoring is not only a tool that makes your code better, it is also a culture of development. I think if you work in an environment with no culture like that, it is meaningless to fight or prove it.
We had many discussions about how our code base was trash and all team was aware of it but in the end, they have no values or culture of it to make reliable, readable, scalable code. And of course, we had no motivation for it. The discussions about re-writing applications were on the table and also some of our APIs had re-written.
As a result, I don’t have any suggestions or whatever. A maintainable, sustainable clean code can be only produced by the common sense of each member of the team. Motivation is important. It does not matter if the business is growing or demands. It is a kind of a developer’s point of view that how a developer wants to code.