sasori Posted December 21, 2019 Share Posted December 21, 2019 can someone please help me understand the concept how to implement the "Domand Driven Design" strategy in PHP ? ok let's say for example I have a user and a user got multiple addresses. so the user got e.g class User { public $userId; public $name; public $age; public function setUserId($userId) { $this->userId = $userId; } public function getUserId() { return $this->userId; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function setAge($age) { $this->age = $age; } public function getAge() { return $this->age; } } Then Address got e.g class Address { public $addressId; public $country; public $city; public $zip; public function setAddressId($addressId) { $this->addressId = $addressId; } public function getAddressId() { return $this->addressId; } public function setCountry($country) { $this->country = $country; } public function getCountry() { return $this->country; } public function setCity($city) { $this->city = $city; } public function getCity() { return $this->city; } public function setZip($zip) { $this->zip = $zip; } public function getZip() { return $this->zip; } } So how to apply the concept of the Domain Driven Design here ? Quote Link to comment https://forums.phpfreaks.com/topic/309726-ddd-concept-help/ Share on other sites More sharing options...
requinix Posted December 21, 2019 Share Posted December 21, 2019 "Domain driven design" is a term made up by a guy who wanted to publish the first My Big Book of Buzzwords about it. The gist of it is that the models in your application reflect how the business needs to work. So the question is how the user and the addresses fit into the business. Which I can't possibly know on your behalf. That line of thought will bring you to the same set of questions other development strategies will bring you to: how do users and addresses relate to each other? You fill in the sentence " (one | many) user(s) have (one | many) address(es)". Quote Link to comment https://forums.phpfreaks.com/topic/309726-ddd-concept-help/#findComment-1572751 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.