On 3/12/2017 11:29 AM, Michael Vostrikov wrote:
> 2017-03-12 14:58 GMT+05:00 Fleshgrinder <p...@fleshgrinder.com>:
>> The problem you are facing is that you are dealing with an anemic domain
>> object that does not enforce its own invariants.
>>
> 
> Incomlplete order with date and address not set yet is a valid state of
> order.
> Also, there are many cases when logic which includes many objects is placed
> in a service and not in any of that objects.

Sure, but you should still not have an anemic domain. Any object needs
to ensure its own invariants, that's nothing another service should do.
You are clearly dealing with two kinds of orders, hence, create two
kinds of orders. `IncompleteOrder` is the one without date, address, and
probably even products. You directly named it as such. Then you have
`ProcessableOrder` where this is impossible. **BAM** all problems solved.

On 3/12/2017 11:29 AM, Michael Vostrikov wrote:
> 2017-03-12 14:58 GMT+05:00 Fleshgrinder <p...@fleshgrinder.com>:
>> However, you do not require new features to do that.
> 
> I don't tell that we cannot make that with current features. I suggest a
> way to do that more easy. This is like type hinting. We can check types
> manually by calling functions like is_integer() or get_class(), but we
> don't have a question why we need to have type hinting in language.

The problem is that your proposal is meant to solve problems that are
already solved in a way that is not really understood by anyone so far.

-- 
Richard "Fleshgrinder" Fussenegger

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to