In my short career as a developer I have heard many many times the word optimisation and I am already sick of it...

  • You have to optimise your code so it runs faster.
  • Do not use an ORM, just write SQL in your code. If  you use store procedures even better! You have to optimise!
  • We will add all of this extra attributes in our objects. We don't need them right now, but we will do in the future. Is more effective doing it now that having to change the code in a later stage.
  • We need to create a caching system in our application so we optimise the times we access to the database.
  • etc.

At first you will think all of this is good. Why don't we want to optimise? Optimisation is good, really. Makes our systems faster, better! Doesn't it?

Well yes and no. We should be careful with optimisations, they add extra complexity to our systems, and we should aim for simplicity. Before optimising you should ask yourself: Do I really really really need that optimisation??

More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity.

W.A. Wulf

If you want to optimise check first the benefit you will get from it.  You shouldn't be optimising without measuring.  Use a profiler and measure it. Is it still worth it? If yes, go for it.

In my case, I try to avoid optimisation as much as possible, do that decision as late as possible. Don't  worry, when you really need it, you will optimise!

Rules of Optimization by MA Jackson:

Rule 1: Don't do it.
Rule 2 (for experts only): Don't do it yet.