In the fantasy world of the ExtremeProgramming crowd, everyone deals only with fresh code written test-first and subjected to the BestPractice RefactorMercilessly. In the RealWorld, where we don't have the clout to order our bosses to throw away tons of crap, we can only refactor it daintily. ''WorkingEffectivelyWithLegacyCode'' by MichaelFeathers covers these topics in great detail.