Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <4576501.4h626yCCDb@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 27 Feb 2014 18:29:28 +0100 User-Agent: KNode/4.11.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <0.914eafe42061d70d7566.20140224044930GMT.87fvn9ru79.fsf@bsb.me.uk> <0.176fb73a1430ceabf46e.20140224212342GMT.87y510qk69.fsf@bsb.me.uk> <0.0e19cf148bd81c84c7e8.20140225043254GMT.87eh2rrevd.fsf@bsb.me.uk> <0.8872fc115a445007d00d.20140225165618GMT.878uszjfm5.fsf@bsb.me.uk> <530cecd1$0$9508$9b4e6d93@newsspool1.arcor-online.net> <530d08cd$0$9523$9b4e6d93@newsspool1.arcor-online.net> <530d1140$0$9522$9b4e6d93@newsspool1.arcor-online.net> <530e4a38$0$9520$9b4e6d93@newsspool1.arcor-online.net> <92903185.IQx5DTPeva@PointedEars.de> MIME-Version: 1.0 Lines: 67 NNTP-Posting-Date: 27 Feb 2014 18:29:34 CET NNTP-Posting-Host: f127715f.newsspool1.arcor-online.net X-Trace: DXC=KaifGWU8fDTYI9]OHn9o5^ic==]BZ:af^4Fo<]lROoRQnkgeX?EC@@PgVYO=MmT0fZDZm8W4\YJN\YUVHKH;GI^W=blgR_]E3GZK^Yo?g:^V[W X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.php:13023 Jerry Stuckle wrote: > On 2/26/2014 7:00 PM, Thomas 'PointedEars' Lahn wrote: >> Christoph Michael Becker wrote: >>> Jerry Stuckle wrote: >>>> On 2/25/2014 6:22 PM, Adam Harvey wrote: >>>>> On Tue, 25 Feb 2014 17:01:52 -0500, Jerry Stuckle wrote: >>>>>> On 2/25/2014 4:55 PM, Christoph Michael Becker wrote: >>>>>>> Jerry Stuckle wrote: >>>>>>>> I know of no other OO language which would allow this. >>>>>>> Others may. >>>>>> None that I know of. Please name one. >>>>> >>>>> Python's pickle operates the same way: >>>>> http://docs.python.org/2/library/pickle.html#object.__getinitargs__ >>>>> >>>>> Providing a way to instantiate objects without calling the constructor >>>>> does have valid uses (mostly for testing), which is why PHP 5.4 and >>>>> later versions also provide a way to do so via reflection (avoiding >>>>> the unserialize() hack): >>>>> http://php.net/reflectionclass.newinstancewithoutconstructor >>>> >>>> Not knowing Python, I can't say. But if it is a true object, then they >>>> are also violating OO principles. >>>> >>>> OO demands creation of a new object requires a constructor call. >>>> Period. >>> >>> Do you understand, what's the purpose of a constructor? It is there to >>> *initialize* an instance. If there is nothing to initialize, it is not >>> strictly necessary to call any constructor. >> >> A constructor does not need to mean initialization; primarily it means >> *instantiation*: creating an object and, optionally, creating a relation >> between it and another object (in the general sense) it inherits from. >> However, both instantiation and initialization also can be done by a >> factory method. Factory is one of the GoF design patterns, and it does >> not violate principles of OOP at all (those people *literally* wrote the >> book on OOP). A factory is a function, usually (but not necessarily) a >> static method, that returns (a reference to) an object.¹ > > Incorrect (as usual). The constructor is designed to initialize an > object. In OO programming, an object is always valid, or, if not valid, > refuses any operations which depend on the object being valid. At this point I would refer you to “Design Patterns. Elements of Reusable Object-Oriented Software” (ISBN 3-8273-2199-9) if I not already knew that you knew everything that is to know about OOP :-> > A factory is only a means of instantiating the object. No, it can initialize the object, too. I have already given an example *in PHP*; you are not paying attention. > It does not replace or preclude the constructor being called. Nobody said it would. > [tl;dr Jerry's further misconceptions] PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann