Naatan
Well-known member
Generally optimising should be in the back of your head all the time and it comes down to the code design you do before writing a thing, even if it is 10 minutes thinking about it in your head. And what you do is also correct, you see somewhere that could be done better for performance (especially important with queries like your example) and you fix it there and then unless it would take a lot to fix, in which case you make a note.
I'm teaching someone to program in PHP with XenForo and we are making a little staff tracker add-on and I spent a good 30 minutes (should have been less but I had distractions) simply thinking about how to query the posts in the best way. Looking at vb5 they don't do any of this kind of code design at all. They just write crap.
Exactly, architecting and thinking of ways to optimize your code even before you write it is half the fun of coding
