From: Bill Kelly Date: 2007-12-10T02:07:01+09:00 Subject: Re: How much would variable declarations in Ruby make you wince? From: "Dumaiu" > >> No, the solution is to stop writing monolithic top-down scripts where >> you can trip yourself up with such a mistake and/or write tests that >> would catch something so simple anyway. > > This sounds like Trans's objection. But it's a post facto solution. > Relentlessly refactoring and testing during development could fall > into the 'premature optimization' category. No. Optimizing almost invariably makes code more obscure and more complex. Thus the reason to do as little optimization as possible, as late in the project as possible. The drivers for refactoring are completely opposite from those of optimization. The point of refactoring is to improve and simplify the design of existing code. Refactoring tends to become more difficult the longer it is put off, and is more risky in the absence of good test coverage. As such, it is ideal if refactoring can become a straightforward daily occurrence; and a comprehensive test suite helps make this possible. Some kinds of applications are harder to test than others, but it's almost always worth it to find a way to write automated tests. In any case, comparing frequent refactoring to premature optimization is just wrong. . . . Regards, Bill