2 ms·
You never want to 'rewrite' the codebase, but you do want to 'refactor' it. The concepts are basically the same, but you gain the incremental benefits by not st
by fleitz 16y ago
You never want to 'rewrite' the codebase, but you do want to 'refactor' it. The concepts are basically the same, but you gain the incremental benefits by not starting from a new codebase. Rewrites always suffer from second system effect and disperse your efforts away from the actual problem. Rewrites are the economic equivalent of quantitative easing, it's just a nice way to avoid dealing with the actual problem while pretending to fix it.
The process I always use for refactoring an existing project is to first isolate the code that you want to remove, then create an interface that so that the new interface is EXACTLY the same as the isolated code and then build a new implementation that utilizes the same interface. Then you change the interface so that the leaky abstractions from the old interface are gone.
This is the process I used to migrate from OpenLDAP to SQL Server. And yes, there was a DN field in SQL Server for many years that emulated the DN structure of LDAP, and we had a bunch of hacky stored procs that would emulate LDAP semantics for search.
Rewriting is the 'easy' answer, but its usually not the best. Even if you're 'refactoring' your app to another language it's usually best to create some bridges so that both work in parallel, if you have a web app use some proxy hackery, if you have a desktop app, use IPC. I've switched apps from Perl to ASP.NET using this method.
The other thing that refactoring in this manner benefits is team cohesion, by switching languages slowly it allows the people proficient in the old language to add a lot of value to the new team, transfer knowledge slowly, and also get up to speed on the new language. When people feel like they are going to be out of a job when the rewrite is complete they will not be thrilled about it. When they have an opportunity to learn a new language, contribute meaningfully to getting rid of things they always hated, they will be much more engaged.