Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102641 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75840 invoked from network); 7 Jul 2018 22:46:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jul 2018 22:46:30 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:43958] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 49/F5-55607-3C2414B5 for ; Sat, 07 Jul 2018 18:46:29 -0400 Received: (qmail 66905 invoked by uid 89); 7 Jul 2018 22:46:23 -0000 Received: from unknown (HELO mail-yw0-f171.google.com) (yohgaki@ohgaki.net@209.85.161.171) by 0 with ESMTPA; 7 Jul 2018 22:46:23 -0000 Received: by mail-yw0-f171.google.com with SMTP id 139-v6so5389358ywg.12 for ; Sat, 07 Jul 2018 15:46:23 -0700 (PDT) X-Gm-Message-State: APt69E2H/g6hiOrl6vHzdBY8ZCPMhBZT6JtWkgxfsXcaMMqSQtYh0l7M AWrzlAXEmCRgJKI7wFjBoKbc6Nfz1bnrnl/NAA== X-Google-Smtp-Source: AAOMgpdknup5hrQZqJPEcoqWFLHfJLXcVpqVKq6Ha1ZTfgU7huPB8g+bBA5mpwZt45r2Q2Qs8/Tr0jRnRQ8okewHqHA= X-Received: by 2002:a81:3586:: with SMTP id c128-v6mr7228327ywa.184.1531003577409; Sat, 07 Jul 2018 15:46:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 8 Jul 2018 07:45:40 +0900 X-Gmail-Original-Message-ID: Message-ID: To: mdwheele@ncsu.edu Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000061a66c0570708c98" Subject: Re: [PHP-DEV] [RFC] [VOTE] Class Friendship From: yohgaki@ohgaki.net (Yasuo Ohgaki) --00000000000061a66c0570708c98 Content-Type: text/plain; charset="UTF-8" On Sat, Jul 7, 2018 at 5:26 AM Dustin Wheeler wrote: > Hello, > > I've let this RFC linger for a long time and finally wrapped up the > remaining administrative items to put it to vote. This has been > discussed a few times in the past: > > https://externals.io/message/89732 > https://externals.io/message/90311 > > I would like to open the vote for an RFC to support Class Friendship in > PHP: > > https://wiki.php.net/rfc/friend-classes > > The vote ends 2018-07-13 21:00 UTC. > > "Friend" is powerful feature when classes are required to have "tight coupling", even if "tight coupling" is bad thing to have in general. Most obvious use case is "testing classes". Tests require tight coupling because tests have to know and test class internals to perform detailed tests. With "friend", we can remove A LOT of access methods solely for testing class. Less codes means less complexity. Having many codes for tests in production classes does not make much sense also. Having a lot of getter/setter methods for testing is pain and this fact leads developers to write inferior tests. "Friend" makes UNIT test and Contract Programming much simpler and easier. Therefore, it helps to develop more robust apps. Obvious risk is "friend abuse" where "tight coupling" isn't required nor useful. Big warning in the doc would be enough to prevent users from shooting their own foot. There are features like "friend", e.g. $GLOBALS I understand concerns, however simpler/cleaner production classes without test only methods and having detailed tests is worth to have. I would like to vote to "yes". However, RFC does not have benchmark result. Do you have some results? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --00000000000061a66c0570708c98--