Объекты домена и объекты-значения - они равны?

Глядя на пример объекта домена в учебнике Zend Quickstart и другие примеры, рассматривающие шаблоны DAO / VO, они оба кажутся очень похожими.

Может мы делаем вывод, что сказать «Объект-значение» - это то же самое, что сказать «Объект домена»?

Если нет, не могли бы вы прояснить разницу между ними?

Какова функция одного и что, если функция другого?

Я спрашиваю об этом, потому что оба состоят из геттеров и сеттеров и не более того. Похоже, они выполняют одну и ту же функцию ...

Обновление:

Итак, в документации Zend Framework Quick Tutorial это называется, объект домена:

 // application/models/Guestbook.php

    class Application_Model_Guestbook
    {
        protected $_comment;
        protected $_created;
        protected $_email;
        protected $_id;

        public function __construct(array $options = null)
        {
            if (is_array($options)) {
                $this->setOptions($options);
            }
        }

        public function __set($name, $value)
        {
            $method = 'set' . $name;
            if (('mapper' == $name) || !method_exists($this, $method)) {
                throw new Exception('Invalid guestbook property');
            }
            $this->$method($value);
        }

        public function __get($name)
        {
            $method = 'get' . $name;
            if (('mapper' == $name) || !method_exists($this, $method)) {
                throw new Exception('Invalid guestbook property');
            }
            return $this->$method();
        }

        public function setOptions(array $options)
        {
            $methods = get_class_methods($this);
            foreach ($options as $key => $value) {
                $method = 'set' . ucfirst($key);
                if (in_array($method, $methods)) {
                    $this->$method($value);
                }
            }
            return $this;
        }

        public function setComment($text)
        {
            $this->_comment = (string) $text;
            return $this;
        }

        public function getComment()
        {
            return $this->_comment;
        }

        public function setEmail($email)
        {
            $this->_email = (string) $email;
            return $this;
        }

        public function getEmail()
        {
            return $this->_email;
        }

        public function setCreated($ts)
        {
            $this->_created = $ts;
            return $this;
        }

        public function getCreated()
        {
            return $this->_created;
        }

        public function setId($id)
        {
            $this->_id = (int) $id;
            return $this;
        }

        public function getId()
        {
            return $this->_id;
        }
    }

1) Строго говоря, мы сталкиваемся с «объект анемической области»?

2) Называется ли он «объектом домена» просто потому, что он содержит логику домена?

3) Если это так, то средства отображения, содержащие такие методы, как findBookByAuthor (); они ведь тоже имеют дело с логикой предметной области? Могут ли они также считаться объектами домена?

Большое спасибо

7
задан MEM 2 May 2011 в 20:59
поделиться