When a program is bad because it has duplicate code, it usually becomes shorter once we rewrite it to make it better. But, if its problem is not being properly structured into several classes and methods, if we rewrite it according to the best practices, it will probably end up longer.
A program is an animal
If the code is bad and you can make it shorter, that’s because the mean had too much fat in it. When you improve it you’re making its meat leaner.
But if the code gets longer after being rewritten according to the best practices, then, even though the meat was already lean, it didn’t have bones nor muscles to hold the meat in place. The extra lines added are the skeleton and the muscles that will give shape to the meat.
A strong and agile animal needs lean meat, strong bones and fit muscles.
Greetings from Abapinho.