Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98504 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34530 invoked from network); 12 Mar 2017 10:35:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Mar 2017 10:35:53 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.162 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.162 mx206.easyname.com Received: from [212.232.25.162] ([212.232.25.162:35437] helo=mx206.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/CA-38004-88425C85 for ; Sun, 12 Mar 2017 05:35:52 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cn0qp-00065B-RY; Sun, 12 Mar 2017 10:35:49 +0000 Reply-To: internals@lists.php.net References: <60608cfe-5ac3-937b-9184-913f76cde82c@fleshgrinder.com> To: Michael Vostrikov , PHP Internals Message-ID: <6ad6bb4d-ba1b-5dc0-2254-58c9b4287144@fleshgrinder.com> Date: Sun, 12 Mar 2017 11:35:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Type variants From: php@fleshgrinder.com (Fleshgrinder) On 3/12/2017 11:29 AM, Michael Vostrikov wrote: > 2017-03-12 14:58 GMT+05:00 Fleshgrinder : >> 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 : >> 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