View Single Post
  #54   Report Post  
Posted to rec.crafts.metalworking
Karl Townsend Karl Townsend is offline
external usenet poster
 
Posts: 3,286
Default Beginning programming question

On Sat, 05 Mar 2011 23:47:21 -0600, 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}
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.

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


At least with C you don't crash a CNC machine. I had my first crash in
quite some time with this one yesterday:

M3
G00 Z0
GO1 Z-.5 F2.0
X16.5

I didn't catch it with the high speed run through while cutting air.


P.S. If you don't see it, caps lock was on and I hit the O insted of
the 0, right beside each other on the keyboard. So, the control stayed
in G00 mode. Try to find that in a long program.

Karl