Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97378 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37191 invoked from network); 12 Dec 2016 19:29:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2016 19:29:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.28.122 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.28.122 mx201.easyname.com Received: from [212.232.28.122] ([212.232.28.122:52952] helo=mx203.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/2F-27518-49AFE485 for ; Mon, 12 Dec 2016 14:29:26 -0500 Received: from cable-81-173-133-127.netcologne.de ([81.173.133.127] 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 1cGWHo-0001jQ-Kc; Mon, 12 Dec 2016 19:29:20 +0000 Reply-To: internals@lists.php.net References: <2c979395-7b5c-f98e-57a4-ee8b8bd33e74@fleshgrinder.com> To: =?UTF-8?Q?Silvio_Mariji=c4=87?= , PHP Internals List Message-ID: <3916a246-1139-06db-478a-962101b459ce@fleshgrinder.com> Date: Mon, 12 Dec 2016 20:29:18 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV][RFC][DISCUSSION] - Immutable classes and properties From: php@fleshgrinder.com (Fleshgrinder) On 12/12/2016 8:19 PM, Silvio Marijić wrote: > @Fleshgrinder > > My opinion on that subject is still that features are mostly complete but > I'am willing to find also solution to ease modifying. > Modify function does not modify object in any way, it will operate on the > clone of the object and this was just prototype. Moreover it should be > restricted to be only callable from the scope of the object. Introducing > method modifier causes more problems then it solves, and has whole another > level of complexity. Regarding changing keyword, 'data' does not fit > because object is behaviour + data, with behaviour beeing (or at least it > should be) at the first place. Value can imply or create confusion with > Value Objects, on the other hand immutable clearly states what it is. > > Cheers, > The term data class comes from data transfer object (DTO). Uncle Bob uses the term extensively in his books. https://sourcemaking.com/refactoring/smells/data-class https://kotlinlang.org/docs/reference/data-classes.html https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.idas200/underdc.htm So it would be rather `$this->modify()` or `$this->copy()` and not simply `modify()` nor `copy()`. ;) The problem persists that you end up with lots of magic strings ... :( -- Richard "Fleshgrinder" Fussenegger