View Single Post
  #34   Report Post  
Posted to rec.crafts.metalworking
Joseph Gwinn Joseph Gwinn is offline
external usenet poster
 
Posts: 1,966
Default Beginning programming question

In article ,
Tim Wescott wrote:

On 03/03/2011 08:24 PM, Joseph Gwinn wrote:
In ,
"Ed 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.

Some people he works with have recommended Python. I know nothing about
it.
I suggested C, but I made the mistake to telling him it's like Latin for a
language major, and he hated Latin. He's not going to be doing anything
that
relates to the Web. His interest is mostly in things that will help him
deal
with data.

Any thoughts?


By far and away, plain old C is the most useful and durable, and code
written in C will always be able to find a new home.

C++ is far more complex, so I would not start there. But all C++
compilers will happily compile plain old C, which is by design a subset
of C++. (The development went the other way: C++ is a superset of
vanilla C.)


C isn't an exactly subset of C++. It comes pretty close, and it comes
closer yet if the C code in question is written with good style.
Certainly if you say "All C++ compilers will happily compile C that is
_well written_ to _modern coding standards_", then you'll be much closer
to the mark.

Here's the story from the Stroustrop's mouth, with examples:
http://www2.research.att.com/~bs/bs_...ml#C-is-subset


While this is true, it's far too deep in the details to matter in the
present discussions.

In a sense, and to overstate the case, it's a bit like saying that US
English and UK English are not quite identical, so let's learn Chinese
instead. (Only to later discover that Chinese has hundreds of dialects.)

The newer C and/or C/C++ compilers tend to be more rigorous about
enforcing the rules of the language than in the 1970s, which means that
perfectly functional old code is often rejected by new compilers. There
is a big debate in the programming community on if this is a good thing
or a bad thing. I'm in the just-fix-the-errors-and-get-on-with-it
school, but if the old codebase is valuable and huge, people just
disable the warnings. I think all modern compilers have a single switch
to return to the laxity of yore.

Joe Gwinn