[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Does Style Count? (formally, 'file tests')



In article <mac-perl.v04011709b2654b9fe45b@[207.135.77.148]>, Vicki Brown
<vlb@cfcl.com> wrote:

>At 01:38 -0800 10/30/98, Jeff at MacTech wrote:
>> >For large programs, readibility depends on one's knowledge of
>> >programing more than choice of syntax and code formating.
>>
>> I disagree. Compare the readibility of the above to a reformatted snippet
>> of Chris' code from earlier in the thread:
>>
>>foreach(@ARGV){/.*:(.*)$/;$name=$1;$read=-r$_?"YES":"NO";$write=-w_?"YES
>>":"NO";$exec=-x_?"YES":"NO";$kind=-d_?"FLDR":"FILE";$size=-s_;$lastmodif
>>ied=-M_;write;}
>
>Sorry, but this does not follow.  One can agree with Xah's statement
>"readability depends more on one's knowledge tahn on..." without requiring
>it to mean that "readability has nothing to do with formatting and syntax".

I don't want to start a big debate, since it isn't really worth it, but
just to be clear, the context from which I quoted Xah was:

    Regarding "programing styles" as a matter how one format his code or
    syntax varieties, I
    think it is a energy drain and should be avoided. Instead, spend time
    studying the language constructs (aka ideoms), or even better:
    algorithms and CS theories.
    
    For large programs, readibility depends on one's knowledge of
    programing more than choice of syntax and code formating.

I was responding to the implication that worrying about how to format you
code is a waste of time, and I think that it is not. (At the same time,
I'm not sure how much there is to discuss about the actual details of
formatting.) It is just a fact that good formatting can enhance the
readibility of printed material, and poor formatting can detract, whether
it be code, poetry, a novel, or whatever. And some people are more
sensitive to this than others.

>A well-formatted but poorly written piece of code is still poorly written.
>On the flip side, obfuscated code is still obfuscated.

True, but the code snippet I gave was not obfuscated in the usual sense of
obfuscated Perl--it was just poorly formatted--and I picked an extreme
example as a demonstration. (And I've seen C code that looks nearly this
bad, by C.K. Haun, the author of AETracker, if memory serves, and he
wasn't trying to be obfuscatory.) And I think solid but poorly formatted
code is difficult to read. (And actually, "inordiantely difficult to
read," as opposed to "complicated" or "intricate" might be the definition
of "poorly formatted".)

>When one understands how the language works, constructs such as ?: become
>readable.  We do not need to take the question of whether or not one wishes
>to use a particular construct and disguise it as a question of "style".

I agree that this is a separate issue, and is not what I meant by "style".

I guess my background belief is that readablility is orthogonal to the
question of whether you understand what you are reading, _in a sense_.
What I mean is that I feel the question of readability presupposes an
understanding of the underlying language (be it Perl, English, or
whatever). So, of course, good formatting won't allow me to read Russian,
but nobody ever thought it would. But if we're talking about readablility,
we are presupposing that the reader undersands the language, and that the
underlying code is sound.

Sorry--I just had to get that out.
-- 
__________________________________________________________________________

Jeff Clites                Online Editor           http://www.MacTech.com/
online@MacTech.com         MacTech Magazine
__________________________________________________________________________

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch