Over-optimization

It has been said that premature optimization is a bad thing. What is optimization, though? Generally, to optimize is to reduce the number of steps from point A to point B. In a computer program, that means to reduce the number of cycles required to compute a result.

An unfortunate side effect of optimizing code is that the code usually becomes much more difficult to read and comprehend. Optimizations tend to obfuscate the code in such a way that the only person who can understand it is the person who wrote it, and after some time, they may not be able to understand it either.

It is a fact that hard to understand code is code that is hard to change. This is the reason why optimizations that happen before they are needed are a bad thing.

So, when is an optimization needed? An optimization is needed when it is clear that the current implementation will not be able to meet the demands on the system within a reasonable timeframe in the future.

What makes a timeframe reasonable depends on the complexity of the needed optimization and the speed of the business. When a business is growing quickly, demand will follow along the same curve.

A slower moving company may require several months of planning and preparation before assigning work to a developer. In this situation, it is reasonable to plan for optimizations several months before they are needed. It is important to monitor the performance of an application so that these needs can be predicted.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.229.161