View Single Post
  #60   Report Post  
Posted to rec.crafts.metalworking
Gary A. Gorgen Gary A. Gorgen is offline
external usenet poster
 
Posts: 32
Default Beginning programming question

Jon Elson wrote:
Ed Huntress wrote:

I know, I should ask this somewhere else, but I don't trust somewhere
else...

My son is an economics researcher for a think tank, and he uses statistics
programs -- SAS, SPSS, and SDATA -- all day long. He took it upon himself
to learn scripting for all three, an he's become pretty facile at writing
scripts in their dedicated scripting languages. Now he wants to learn
something about programming.

He has no interest in becoming a programmer, but he'd like to know
something that may be useful in his work (he had a math minor, and he's
now going for a Masters in applied mathematics). I used to dabble in C and
Assembly, so he's asked me what he should learn. I have no clue.


Unless he wants to know how computers REALLY work, avoid assembly language.
Knowing how computer work CAN be quite useful, and the knowledge can help
you avoid or at least understand really oddball problems from time to time,
but as you have programmed in it, you will already know it is NOT a quick
way to get a job done.

C is really a CRAPPY language, and has a number of syntactic "features" that
make it VERY easy to make hard-to-find mistakes. The meanings of = and ==
is a good example.

if (a==b) { do something}
is the normal conditional statement.
However :
if (a=b) {do something}


gcc will spit out a warning:
"do you mean a==b".

If you want to talk about hard to find bugs, try this one in Fortran:

subroutine x(j)
if( j .ne. 0 )
j = 3
end

call x(1)

You now have 1 == 3.
This makes even more fun, when you don't have access to subroutine X.

not only does the "something" based only on the value of b, it assigns the
value of b to a. In a couple dozen pages of code, I defy anyone to find
such a bug in less than a few hours. There are dozens more like this I
know about.

One time at a Usenix conference, we were talking about C, I made the
comment, "C is just a portable assembly language". Denis Richie said,
"I've never thought of it in that context, but yeh".

C comes from BCPL, which comes from SYMPLE, which is a portable
assembly language.

On the other hand, C generally produces efficient code, and is portable to
hundreds of different platforms. C++ adds a number of advanced features
that make it possible to create functions that perform operations not built
into the language, but I don't use them enough to be really comfortable with
them.

Jon



--
Gary A. Gorgen | "From ideas to PRODUCTS"
| Tunxis Design Inc.
| Cupertino, Ca. 95014