From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19699 invoked from network); 12 Dec 2022 02:17:11 -0000 Received: from minnie.tuhs.org (50.116.15.146) by inbox.vuxu.org with ESMTPUTF8; 12 Dec 2022 02:17:11 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id C308442423; Mon, 12 Dec 2022 12:17:06 +1000 (AEST) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by minnie.tuhs.org (Postfix) with ESMTPS id AA5C842414 for ; Mon, 12 Dec 2022 12:16:59 +1000 (AEST) Received: by mail-qt1-f173.google.com with SMTP id z12so4998465qtv.5 for ; Sun, 11 Dec 2022 18:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iitbombay-org.20210112.gappssmtp.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=u3CdpMIjIRBzU0Tnc89dpqYeM9XBriBvA42zkkKy2Hk=; b=N0/KDKQOMm7gVSvhBtozIMcblFXb1TaBbmnHrLY6jiHAIhlbRifT9oHFwFM8r04iBz w3g0prSV+R1MaOtZUDORf/170NNQHEbkwyLB5XK5JN/hc4ugq1JvOazuTFQgyWH63aw3 BvxD1pqTrkPUNDlgWVcvx/0S0buaKhWnDCKEusrzltHcU2Qx8rGNrJHmxpb4P4e0KN7d jTVZsIWrbDMTDLCY6Ajo8I4/XClXoBCLbTeUVAf2nUfNWy6BQzmn5jc4n1gC+CAXeptt GTS1dr7XidGK++fp9GdnkdKiDxWkfrvMTQWlnEu0paMeX8aeoB10WkPw8GkMMbFDtQdg +MJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u3CdpMIjIRBzU0Tnc89dpqYeM9XBriBvA42zkkKy2Hk=; b=esfGPNaoGjJumq/lZyA4cDVPZsbtZMf4ejVj0vvjWmFuOLyfnl0FQvHecXatI0ajwp L6OvkwPJFoXsPhsEp+ZiqxEJmFX2tXB5F0Dz9Bb0z7lcnClALm4JUl2EKaf+fJ6Yr7Ed x64eu/w3vPRUUIqZu8pXPUU2Kk08ILCNGZs42E+WZ8bfdWk4DowPbdpBtqe7NpMK4JDz iiCnKPp3+yj16fALCV4EC0m5CqnYv5xDL9M6Bu7m7aDKC4HkfvUAXqOk7OXZvTVR20Zz X72on5uwasPE1dFUYdjoyXh/WNiWA2nbiA1/atIGO97UiSJUZQm6lIDsM8SxixXgfyUe D2IQ== X-Gm-Message-State: ANoB5pnDqQpxCHi37uiBQRfq1VOizaV6E5nUJo6JbLtJ4+fDY60W53bs psTYZpumJfthtn/Nw0U1rOzuDNY6PIAN144/ X-Google-Smtp-Source: AA0mqf7pgfCcejYmLrc+iIDVvvfSZYuctAkZTku/UWrLDQFeTmWT+x61V/Mxf46snFMrSznBkOMalA== X-Received: by 2002:ac8:4cc3:0:b0:3a8:10c2:1eaf with SMTP id l3-20020ac84cc3000000b003a810c21eafmr7385811qtv.2.1670811358797; Sun, 11 Dec 2022 18:15:58 -0800 (PST) Received: from smtpclient.apple (107-215-223-229.lightspeed.sntcca.sbcglobal.net. [107.215.223.229]) by smtp.gmail.com with ESMTPSA id s16-20020ac87590000000b003a6934255dasm5108236qtq.46.2022.12.11.18.15.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Dec 2022 18:15:58 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) From: Bakul Shah In-Reply-To: <20221211200327.GC8801@mcvoy.com> Date: Sun, 11 Dec 2022 18:15:47 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <8F5B431B-3789-42C7-8E34-0B6A417B41CF@iitbombay.org> References: <20221211200327.GC8801@mcvoy.com> To: Larry McVoy X-Mailer: Apple Mail (2.3731.200.110.1.12) Message-ID-Hash: KKQMLSCJT6VUYSIQJXBTQJZIDYLHACQ2 X-Message-ID-Hash: KKQMLSCJT6VUYSIQJXBTQJZIDYLHACQ2 X-MailFrom: bakul@iitbombay.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tuhs.tuhs.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: The Eunuchs Hysterical Society X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Clever code (was Re: Re: Stdin Redirect in Cu History/Alternatives? List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Dec 11, 2022, at 12:04 PM, Larry McVoy wrote: >=20 >=20 >=20 > =EF=BB=BFOn Mon, Dec 12, 2022 at 06:55:31AM +1100, Dave Horsfall = wrote: >> On Sun, 11 Dec 2022, Michael Kj??rling wrote: >>=20 >>> By definition, if you write code as cleverly as you can, then you = aren't=20 >>> clever enough to debug it... >>=20 >> Indeed... >>=20 >> I've always used the maxim "Write code as though the next person to=20= >> maintain it is an axe-wielding psychopath who knows where you live". >=20 > My main job, for the 20 years until I retired, was to keep telling=20 > people that code that you wrote 6 months ago might as well have been > written by someone else. Optimize for reading the code, not writing > the code. It's read many. >=20 > 99.9% of the time, I detest clever code. .1% of the time, I need it. > The problem is that smart engineers adore writing clever code. They > usually, eventually, wise up. Agree that clear code is preferable to complicated code. But in practice people sacrifice clarity for performance improvement all the time. Look at the kernel code of any modern os. Everybody pays lip service to this but most anything other than toy programs ends up getting needlessly complicated over time. As an example, building "Unix as a service" as user processes on top of a small microkernel could provide the same functionality using much clearer and much less code but it would be slower so we don't do it. Plan9 sort of went in that direction and it is much simpler (but that could also be because it is not hacked on so much). I do prefer clever/smart design to locally clever/smart code. For = example, using Sch=C3=B6nhage-Strassen algorithm for multiplying very large = numbers. Or transforming a problem to use a much more efficient data structure or making equivalent transforms which may be more efficient to compute. Such code may not be immediately clear but with proper documentation it is not difficult + you can solve much larger problems. But agreed these come up much less often.=20=