Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127006 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 8B3781A00BC for ; Tue, 1 Apr 2025 11:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1743506364; bh=Qxz+Cw3Q5K0/9aMFwdUaDO415b2EdJwz82sEbT2P1ms=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OAJVyGYjBd87nWRO97nQ+HcilBf9oG/QgWWSoV1j7HhayzcH56JvCe4RHmWpkQdcv Sw7z+u9KbavykpT+1SjuUrezFRSLZ8sdE/KInEPqM2f8h8diHyEkpcBJ5q602azjvy SlSQKN5WpkskQfWqJcJJjSAXmwbwycE2IUtNEcx44WUU+gTz3/b/wrw/9G+gz3KX+2 anFxTMDXhEnavWfnwk53KcQTznnoEd27sLdeKTi4qW5sGA3y4+JtIgBegnhsHYN89C rkI/1mtGaPVXWCUzNO7pc0XlmTVRjg9iH3us4aUM5qxrrFo7bHblaAfjWqA+i0B+Er BWLuJBlYNyedA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DD7F61804B4 for ; Tue, 1 Apr 2025 11:19:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 1 Apr 2025 11:19:23 +0000 (UTC) Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-e589c258663so4964017276.1 for ; Tue, 01 Apr 2025 04:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743506510; x=1744111310; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Qxz+Cw3Q5K0/9aMFwdUaDO415b2EdJwz82sEbT2P1ms=; b=ibqgjBAZIunQo2LG6omhsO7f/sPxJat220jtDcSZzAaQuDYbiiAfhAUEvy4M6h8n4x FmOFmyAmbguOd3tEwzgKYiHroIiEOmz77o01thTdFanmqt9DyCpTXoMJnQNZA1inmIBd Rzpy2Yonnc/T3U4FmGCYZQu7LuVEVsQBEKfP3b2CNAxLP+X2YmQwIZ0mMXTupdnG71pY fKyOcMgKTwq3gibcN0PRdreFWwIWdUbiHBRd0OMUwDgC00RdfJ/qVEofagrb1F9cxWoA WoqMGUik0h2p1e6x5aOt/WJ+jUx8+1lUFie5e9khLZvRTGMC/Oq0Bmz2cynMRdrlkhc1 gwLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743506510; x=1744111310; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qxz+Cw3Q5K0/9aMFwdUaDO415b2EdJwz82sEbT2P1ms=; b=opUQWoUCvNX33sl2BcLzBu59lRXVfj3RiaiJNURGnOADDc6ffOyrk/TpNMxbegXKnj m5ioTBth9YxlaS1aSOIkkkIyQQbpuM8eL12iOifO3vT7pTb7SsOHyhQHHw4UjFxpOTz4 QePWz0RMrk+ReLnDoNjukoLLJeF2k34eZkQ2Qkd3ygI4n6Mr9wB39JQzSBtavVTjjhXZ eZEgN/qreRdbTAIA39thziAkHom4tTq20HLoOCYx9+m1V+DsqMqRDmRiekEBG1tkgC32 wvPzM+bsnhzrC5jeL/hqBEkOaVIeo6sjwrj2wF826yh7mPGEJvKYjtZdY3f72GuWQNeR 2YEA== X-Forwarded-Encrypted: i=1; AJvYcCU/7YelEuCM+LAZrJvQ7pzFtRcFdYO7jTfVmKh4FeHES/Z01G9jz/OO1AS56Sf8JMm7DCUxpNcaRd8=@lists.php.net X-Gm-Message-State: AOJu0Yw7lU3ktkrVgIauwwwHQdQFgM3pQ8XIDO6iCHEruO3dEUYbYxVn e4gXCfMvaWLAKiWdrYqK2efQh5lGU6/Yezx3sl5lOvv20s1m2Y/VtKMbjh/w2BHiNVA5SBUc5g2 vBmCacSODWUQwBVaC7GpOuC5Sf08= X-Gm-Gg: ASbGnctehQh7U8LeVMS/5pOJS0Lf9wtuj9yW1y5Evqyhy0b+rWgYkO27gOyLZiZf8qB 1UVO5ZmhV86oMwVZWJ5/+GiRB5+9L7W1bnrfBXrGSjDygM8cgHjP90B2w4Z0kOEm+luzt/HOQan MDriX1r+sV0oUke1VcKxBXzcBAS8Zb X-Google-Smtp-Source: AGHT+IH1bQWvarfpLrOsWUWaiLZ+7S+gU4joamLRlui/u35fFrlnOoop03BXwOeWBg2SdY6ts1gowiAOVU0zLWgqcRE= X-Received: by 2002:a05:6902:a05:b0:e5b:43e1:2e84 with SMTP id 3f1490d57ef6-e6b838f3479mr18032897276.5.1743506509847; Tue, 01 Apr 2025 04:21:49 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <059201dba2ee$35c7bc00$a1573400$@glaive.pro> In-Reply-To: Date: Tue, 1 Apr 2025 14:21:37 +0300 X-Gm-Features: AQ5f1Joh_9PH79pxyLXjKKNpUK5rT8qgrHkVJLgFPAikxKO9HQ5vqnVNdfgUZ3U Message-ID: Subject: Re: [PHP-DEV] Usable classes? To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: Juris Evertovskis , php internals Content-Type: multipart/alternative; boundary="0000000000002ee90b0631b5be4c" From: zsidelnik@gmail.com (Eugene Sidelnyk) --0000000000002ee90b0631b5be4c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > The wording =E2=80=9Cspicy=E2=80=9D, =E2=80=9Cheretical=E2=80=9D, =E2=80= =9Cliterally unusable=E2=80=9D, =E2=80=9Cvibe=E2=80=9D, the use > of ChatGPT, and the current calendar date requires me to ask: > Actually, if we put aside all of this, and think about it more seriously, personally I myself find it somewhat tedious to have every class have interface for the sake of being able to decorate it. Everything we expose as api for the client code normally should have an interface, and usually it ends up with superficial name: either suffixed with Interface (I know it is in PHP), or prefixed with I (C#), or just a normal name, while the actual class is suffixed with Impl (Java), or any other naming that only shows the problem of superficial separation. In my opinion, it could be a good thing to consider if we could do it more easily. It reminds me of C++, where every class has .h file with headers without actual implementation (IOW, interface, client code uses it), and the actual implementation in .cpp file. Though the two are still physically separated, they still logically make the same unit. Having the ability to implement the class, we'd not need to suffix interfaces with Interface all around where there's only one implementation of it. On the other hand, it still makes sense to keep normal full fledged interfaces, since these are usable when there are multiple different implementations (say, we have BankTransactionsGateway as the interface, and PrivatBankTransactionsGateway, MonoBankTransactionsGateway as implementations), since in this case interface is a normal expected abstraction, that should be kept separate. Thank you > --0000000000002ee90b0631b5be4c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The wording =E2=80=9Cspicy=E2=80=9D, =E2=80=9Ch= eretical=E2=80=9D, =E2=80=9Cliterally unusable=E2=80=9D, =E2=80=9Cvibe=E2= =80=9D, the use
of ChatGPT, and the current calendar date requires me to ask:

Actually, if w= e put aside all of this, and think about it more seriously, personally I my= self find it somewhat tedious to have every class have interface for the sa= ke of being able to decorate it.
=C2=A0
Everything we expose as api for the client code normally should = have an interface, and usually it ends up with superficial name: either suf= fixed with Interface (I know it is in PHP), or prefixed with I (C#), or jus= t a normal name, while the actual class is suffixed with Impl (Java), or an= y other naming that only shows the problem of superficial separation.
=

In my opinion, it could be a = good thing to consider if we could do it more easily.

It reminds me of C++, where every class has .= h file with headers without actual implementation (IOW, interface, client c= ode uses it), and the actual implementation in .cpp file. Though the two ar= e still physically separated, they still logically make the same unit.

Having the ability to implem= ent the class, we'd not need to suffix interfaces with Interface all ar= ound where there's only one implementation of it. On the other hand, it= still makes sense to keep normal full fledged interfaces, since these are = usable when there are multiple different implementations (say, we have Bank= TransactionsGateway as the interface, and PrivatBankTransactionsGateway, Mo= noBankTransactionsGateway as implementations), since in this case interface= is a normal expected abstraction, that should be kept separate.

Thank you=C2=A0
--0000000000002ee90b0631b5be4c--