Or just use a language that supports large scale refactoring, say Java, C#, perhaps even C++ if you are careful. I generally don't like dynamic languages for large projects exactly because of this. You can't safely and quickly do large scale refactorings, a point that will come back and haunt you sooner or later. No matter how good you are or how much care you take, the code will rot significantly more than in Java/C# because you just can't quickly refactor stuff across the entire codebase, so you won't.