Google Premature Optimization Tip

20 Ocak 2013 Pazar - Unknown
Unfortunately Google Php performance tips avoid data hiding principle of object oriented programming to make software a little bit faster.

Under the Avoid writing naive setters and getters headline you can see the nonsense micro optimization tip "When writing classes in PHP, you can save time and speed up your scripts by working with object properties directly, rather than writing naive setters and getters."

Setters and getters are the cornerstone of data hiding so sacrificing them for a micro performance optimization makes your code ugly in the long run. It is good to remember what Knuth said about optimization "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil"

Etiketler: ,

Hiç yorum yok: