摘要: 高效的对象应该像PHP的整型那样运作:如果你把同一个对象资源赋值给两个不同的变量,然后改变其中的一个变量,另一个变量仍然不受影响。事实上,这就是Value Object模式的目标所在。 阅读全文
posted @ 2010-05-14 15:07 Algorithms 阅读(61) 评论(0) 推荐(0) 编辑
摘要: class BadDollar { protected $amount; public function __construct($amount=0) { $this->amount = (float)$amount; } public function getAmount() { return $this->amount; } public function add($dollar)... 阅读全文
posted @ 2010-05-14 14:47 Algorithms 阅读(83) 评论(0) 推荐(0) 编辑