× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



john e wrote:
I don't think this is purely style, like indenting two or four
spaces. It's about a quite important principle and that is "don't
repeat yourself".

Funny: I have a Bachelor of Science degree in computer science, and I'm fluent (or at least was fluent at one time) in (depending on whether or not you count traditional BASIC and the QBASICs as separate languages) a dozen HLLs and three different assemblers. I've probably forgotten more HLLs than most programmers seem to have any interest in learning. By the time I got out of high school, I knew BASIC (3 dialects) and FORTRAN (WATFIV and IBM G1). The class I took almost 28 years ago (my freshman year at the University), in structured programming was taught in Pascal, and many of the more advanced classes were taught in PL/I. I've dealt with COBOL, and I've dealt with LISP, and I've written recursive descent parsers (including two in ILE RPG!).

Not once in two years of high school programming, five years at the University, or the over two decades since I got my sheepskin have I ever heard of any "quite important principle" of "don't repeat yourself."

I've certainly heard that if you're going through the same non-trivial steps, in the same order, two or more times, you should probably consider a subroutine, but I've never once heard of the notion that explicitly referring to the same file more than once constitutes "repeating oneself," or that doing so was in any way undesirable.

To repeat myself:

I. Have. Never. Once. Heard. Of. Such. A. Notion.

Furthermore, if implicitly referring checks for EOF or FOUND to the most recent file accessed were such a good idea in the general case, then why is it that I can't think of any other language (with the possible exception of C, which is a language notorious for not only giving programmers enough rope to hang themselves, but helping to tie the knot) where this happens?

To reiterate what I said before, this "implicit default to the last file accessed" is extremely useful if you've got, say, a bunch of file access statements in a SELECT structure, each accessing a different file, but when checking for FOUND and/or EOF, you don't care which one you'd accessed. But in general, allowing those functions to default to the last file accessed will always open up the question of "is this checking the file I think it's checking?", a question that will hopefully be trivial in most cases, but certainly not in all.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.