Re: [RFC][DISCUSSION] - Immutable classes and properties

From: Date: Mon, 12 Dec 2016 19:29:18 +0000
Subject: Re: [RFC][DISCUSSION] - Immutable classes and properties
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-97378@lists.php.net to get a copy of this message
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

« previous php.internals (#97378) next »