I always found getters and setters very helpful for this case. In C++ and in Java. Doubly so in Java because the following works:<p>1) field is no longer important, gets replaced<p>2) write a getter that still gets the value of it, but delete the field itself.<p>--- this is where it stops for C++<p>3) use the &quot;inline function&quot; refactoring on your entire codebase<p>Done&#x2F;done. You don&#x27;t even have to rewrite the tests, in fact it might be better not to.<p>(Of course getters and setters are somewhat verbose in most cases. Object pascal has the perfect solution though)