Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Calculate date of Easter or Good Friday
Date: Sun, 03 Mar 2024 10:23:03 -0800
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <864jdntbso.fsf@linuxsc.com>
References: <87sf1d8iav.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="8e6876f3e46194a45503e9d93596105d"; logging-data="2776269"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DOs9paYWyxuAvRpGb6g1/s9Uo22nJfW4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:Vo/EXjuPzzPzGYnuufPZH+gUdwM= sha1:GsRiLl5Gb1mgtAbjKawEAtV8FUc=
Xref: csiph.com comp.lang.c:383269
Ben Bacarisse writes:
> Lew Pitcher writes:
>
>> On Sat, 24 Feb 2024 21:15:56 +0000, Mike Sanders wrote:
>>
>>> Calculate the date of Easter Sunday or Good Friday:
>>>
>>> https://busybox.neocities.org/notes/is-easter-or-goodfriday.txt
>>
>> I don't have the expertise to discuss whether or not your code
>> properly implements the calculations necessary to determine the
>> date of Good Friday and/or Easter. However, I /do/ have some
>> expertise on writing understandable code.
>>
>> My suggestions, with respect to your program, would be to
>> a) name your objects with relevant, understandable names
>> You code uses quite a lot of meaningless one-letter
>> objects, and it is difficult to keep track of the
>> purpose of the calculations using them.
>> b) Don't place your calculations /in/ the object initializations.
>> Doing so obfuscates the intent of the logic, and makes
>> problem determination and resolution difficult.
>
> I urge those making these suggestions to have a go at doing both. I
> suspect the result will be far less understandable.
I have the same reaction regarding point (b). Regarding
point (a), I have mostly the same reaction, although in some
cases I think there are meaningful names that could be given.
Whether it is better to do that by changing variable names or
by describing what's going on in a block comment is another
matter.
In my view the key issue here is not what names are used but the
structure of the algorithm. Someone has taken a complicated set
of integer relationships and put them into a meat grinder, with
the result being a method that is (perhaps) computationally
efficient but horribly difficult to follow. If the goal is
understandability, I suggest taking a different approach so that
both the method and the code itself are directly comprehensible.