2 title: Class inheritance or Containers?
8 While talking with Daniel and Lorenzo about "Tree Reincarnated" I regularly
9 stumble across the question what approach to use to implement different
10 backends: **"Class inheritance or Containers?"**.
12 I personally feel that using the container approach leads to massive code
13 duplication, while using class inheritance avoids the most (_most_, because
14 there's no real multiple class inheritance in PHP).
20 var $container; // SpecificAPI
22 function doSomething()
24 return $this->container->doSomething();
32 class SpecificAPI extends PublicAPI
34 function doSomething()
36 // do something only this class needs to do
42 So what do you feel about this topic and how you'd handle that?
46 While looking again at Daniel's [nice diagram](http://devel.webcluster.at/~daniel/pear/Tree/docs/Tree.png?),
47 I feel like we've already reached the point where solving this problem with class
48 inheritence is impossible (despite using aggregate*() - you're right Lorenzo,
49 again :) have nice holidays! ).
51 Tree_Admin_Simple_MDB2 would have to extend Tree_Simple_MDB2 **and**
52 Tree_Admin_Simple_RDBMS...
54 Mike's arrived at the dead end, again ;)