[comp.unix.questions] Piles of plusses

gph@hpsemc.HP.COM (Paul Houtz) (04/26/89)

crewman@bucsb.UUCP (JJS) writes:
In a business which so sorely "needs professionals", why are we bending over 
backwards to make our programs easier to read for amateurs?


   Henry, you were honest enough to state your opinion (and brave,too),
so I won't flame you for it.  I will as you a question, though:

   You state that the business needs professionals.  How is making your
code less readable going to help produce more professionals?

   An "amateur" is someone who does a job for fun and does not get paid.
 
   A professional is someone who gets paid to do a job.   A professional
basketball player gets paid to play basketball.

   Now, there is another context to professionalism.  A professional is 
supposedly someone with more responsibility and pride in their work than
a non-professional.

   Most architects work that I have seen is so clearly produced that even
a non-architect can understand their output.   I think this is a noble
goal for a programmer.

   As an employer, I would consider an engineer or programmer who takes 
pride in the readability of his code to be a "professional".  I really
don't think that elegance is as important for it's own sake.  If a routine
needs to be short (like microcode) and it needs to be fast, then that is
part of the task.

   Now, as far as your opinion about what features to use and what not
to use, I agree with you.  C should not look like Pascal.   If an employer
wants C programs to look like Pascal, then he should have is programmers
write in Pascal.   I don't see anything wrong with using most of the 
availiable syntax of C, although you must admit that there are certain 
constructs in many languages that should be avoided, e.g., "goto" type
statements should be used as a last resort.

   I will make a further argument in favor of the proposition that any
feature available in a language should be fair game:

   In COBOL, there is a feature called the ALTER statment that alters
the destination of all GO TO statements in a program.  This is the sickest
feature I have ever seen in a language, and has finally be removed from
the COBOL 85 standard.

   In FORTRAN it is STILL allowed to use variables that have not been 
declared.   This is a practise that should be eliminated from all serious
programming languages, due to the ease with which bugs can be created.
In fact, there is a famous story about a multi-million dollar space 
vehicle that went off into the universe due to a bug created by this 
feature

mcdonald@uxe.cso.uiuc.edu (04/28/89)

>   In FORTRAN it is STILL allowed to use variables that have not been 
>declared.   This is a practise that should be eliminated from all serious
>programming languages, due to the ease with which bugs can be created.

It is not a matter of "being still allowed" --it is that automatic
generation of variable is the heart and soul of Fortran. Many,
many supposedly "more advanced" languages such as Pascal and C
STILL require you to declare all variables - just like assembly
language. Fortran and Basic, apparently alone, have the computer
do the work for you (in the most common cases) [although C 
will in some cases allow you to do without declaring some things
to be int, the most common being functions].

Doug McDonald

guy@auspex.auspex.com (Guy Harris) (05/02/89)

>>   In FORTRAN it is STILL allowed to use variables that have not been 
>>declared.   This is a practise that should be eliminated from all serious
>>programming languages, due to the ease with which bugs can be created.
>
>It is not a matter of "being still allowed" --it is that automatic
>generation of variable is the heart and soul of Fortran.

Geez.  Sounds like it's time for a heart transplant....

>Many, many supposedly "more advanced" languages such as Pascal and C
>STILL require you to declare all variables - just like assembly
>language. Fortran and Basic, apparently alone, have the computer
>do the work for you (in the most common cases) [although C 
>will in some cases allow you to do without declaring some things
>to be int, the most common being functions].

Sorry, but I don't think computers are smart enough to "do the work for
me", given that they have a habit of blithely allowing me to write code
that attempts to refer to a variable named "foobar" but says "foobra"
instead.  I'd rather computers were *less* likely to assume I know what
I'm doing when my fingers exchange two letters, since I usually *don't*
intend to do so.

Yes, believe it or not, there are reasons why some of us find it better
to work with languages that do not automatically declare variables - we
make fewer errors that way.  Was your posting just intended to provoke
controversy, or do you really have evidence to show that people are more
productive - counting time tracking down errors caused by unproductive
typos - with languages that automatically declare objects?

eirik@lurch.stanford.edu (05/02/89)

) Yes, believe it or not, there are reasons why some of us find it better
) to work with languages that do not automatically declare variables - we
) make fewer errors that way.

If it's a good thing in a language to declare all variables, to avoid
problems with typos, and if it's a good thing not to place this burden
on the programmer ... these might seem like conflicting factors, but
in fact they don't conflict if the interface, rather than the
compiler, is what declares variables for the programmer.

This isn't a new idea; smalltalk has done it for years.  It is
completely unobtrusive, in that a programmer who declares everything
up front never sees it except when he wants to, i.e. for typos.

gph@hpsemc.HP.COM (Paul Houtz) (05/03/89)

mcdonald@uxe.cso.uiuc.edu /  7:24 am  Apr 28, 1989 /

I wrote:

>>   In FORTRAN it is STILL allowed to use variables that have not been 
>>declared.   This is a practise that should be eliminated from all serious
>>programming languages, due to the ease with which bugs can be created.

Doug wrotes:

>It is not a matter of "being still allowed" --it is that automatic
>generation of variable is the heart and soul of Fortran. Many,
>many supposedly "more advanced" languages such as Pascal and C
>STILL require you to declare all variables - just like assembly
>language. Fortran and Basic, apparently alone, have the computer
>do the work for you (in the most common cases) [although C 
>will in some cases allow you to do without declaring some things
>to be int, the most common being functions].

   I program in fortran too, and I have NEVER allowed Fortran to generate
variables for me.

   I like to think that there is such a thing as progress in the software
development industry.   The biggest step I have yet seen that I would 
categorize as forward, was the development of structured programming
techniques.   It is generally recognized that two of the cornerstones
of structured programming is the avoidance of "go to's" and the declaration
of all variables.   It seems to me that the industry generally recognizes
that allowing undeclared variables is a step backward for a compiler,
not a step forward.

guy@auspex.auspex.com (Guy Harris) (05/03/89)

>If it's a good thing in a language to declare all variables, to avoid
>problems with typos, and if it's a good thing not to place this burden
>on the programmer ... these might seem like conflicting factors, but
>in fact they don't conflict if the interface, rather than the
>compiler, is what declares variables for the programmer.

Yes, but the posting to which I was replying was touting Fortran as
being wonderful because it automatically declared things; perhaps there
are Fortran interfaces that will do so and catch typos, but I've not
seen one.  I don't think of the requirement to declare things as being
*ipso facto* a good thing, but I *do* think of the ability to have the
system catch certain errors before I start running my code as *ipso
facto* a good thing; requiring me to declare things does help the system
catch certain errors, and I'm willing to pay what is for me a small
price for that.