Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Programming exercise/challenge
Date: Thu, 24 Dec 2020 11:35:38 -0800
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <861rffyp2t.fsf@linuxsc.com>
References: <86wnxwkyol.fsf@linuxsc.com> <871rg2rffu.fsf@bsb.me.uk> <86v9dehts2.fsf@linuxsc.com> <87360hq0si.fsf@bsb.me.uk> <86wnxq2do9.fsf@linuxsc.com> <87eejx9tna.fsf@bsb.me.uk> <86tuss2a6i.fsf@linuxsc.com> <87wnxm8ztm.fsf@bsb.me.uk> <868sa21i7m.fsf@linuxsc.com> <874kkp99rh.fsf@bsb.me.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="420230f19e4989c44eb0b3a54f412058"; logging-data="14501"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ye1X/+kfDOvVPL0R5RCD9CHTv7hQIja0="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:YzRW753CUo6W13uZ6M56GbaDZIY= sha1:J0QiYOhY36G3FNxnvRFpFPf0Ork=
Xref: csiph.com comp.lang.c:157703
Ben Bacarisse writes:
> Tim Rentsch writes:
[...]
>> I think a program based on processing a character array is easier
>> than a program that deals with input only one character at a time
>> (as for example using a finite state machine). Here easier means
>> easier to write, easier to understand, and easier to get right. My
>> impression after trying both approaches supports that conclusion.
>> Your comment leads me to think you aren't sure if an approach based
>> on processing the input in a character array is easier than a more
>> conventional one-character-at-a-time approach. Or at least that you
>> weren't sure in the past. My question is meant to ask about what
>> your impression is now.
>
> I have not tried both, which is why I was not sure enough to agree
> with your assessment.
Okay.
> And if I did try both, I don't think my
> personal assessment would be worth much because (unless I hit some
> fundamental unforeseen problem), I almost always find the second
> version of any program easier (in your sense of the word).
Sure, the second program will likely be easier than the first.
But can you not get a good sense of the two approaches, even
if the particular programs are influenced by the history of
the order in which they were tried?
This question isn't meant as rhetorical. In many (or most?)
cases I think I get a pretty good sense of how different
approaches compare, even if approach A programs are all done
before approach B programs. I'm curious to know more about
your comment, since I find it surprising.