The issue: PHP5 has cool OO features
- OO is cool, but sometimes just overhead
- Each object consumes a lot of memory in PHP
- Each mezthod call consumes a lot of time in PHP
<?php
class Integer {
protected $value = 0;
function __construct($int) {
$this->value = $int;
}
}
?>
Nice OO, but much too much overhead in PHP
The solution: Knowing where the limits are
- Do not implement every data structure as a class, arrays are useful, too
- Don't split methods too much, think, which code you will really re-use
- You can always split the code of a method later, when needed
- Do you really need a that deep class tree?
- Before applying a cool OO pattern, think if it really fits your case