Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: On programming



At 05:42 PM 5/16/99 +0100, Ludwik Kowalski wrote:

today procedural languages,
such as fortran or pascal, are no longer promoted by physics
teachers. Is this a correct assessment? Is it good or bad?

Regarding procedural languages in general, I hope it's not correct. Note
that C and C++ are procedural languages. It would be a great handicap
these days to try to do physics research without knowing how to program.

Regarding the two specific examples you cited, nobody needs to know Pascal
anymore, and given the choice of teaching fortran versus C++, the C++ is
more useful and no harder to learn.

I am not familiar with an "object-oriented" language. Are C++
or Java suitable for "learning physics via creative programming"?
Are such languages better or worse than those which were so
popular two decades ago? ... If it was up to me
I would promote True Basic as a common language all kids
know how to program with, from elementary schools up to
the university level. Just like fortran is a common language
among scientists (and probably among many engineers).

The space of all possible tasks is highly multi-dimensional, which makes it
impossible to rate languages as "better" or "worse". It all depends on the
intended application. For example:

* If you have a simple task that requires a moderately-fancy user
interface, and you need to get it up quickly, Visual Basic has many
attractions.

*) By the way, if you're on a budget and can't afford the Visual Basic
package, and you don't need a whizzy user interface, here's a cute trick:
there is a perfecty reasonable basic interpreter hiding inside Excel, which
comes with the "office" package and is likely to be already installed on
your microsoft system.

* If you have a smallish task that does lots of string-munging, and you
need to get it up quickly, Perl is probably the way to go. It's free, and
Perl programs are reasonably portable. The language itself is twisted, and
the examples in the documentation tend to foster poor programming
techniques, so I really can't recommend it as a first programming language.

* If you have a task that is medium-small or larger (300 lines or more),
you might as well use C++ from the beginning. There are many other
starting places that look tempting, but you'll probably regret it. And
note that I didn't say Visual C++; IMHO that's a stinker, which shares
nothing but the name with Visual Basic. In the hands of a non-expert, it's
usable for writing 10-line demos and not much more. On a microsoft
platform, grab the MINGW32 C++ package (free) and cruise onward. Or just
install Linux on your PC and leave microsoft bloatware and unreliability
behind forever.

* Java is a reasonable programming language. It's more modern in some ways
that C++, but it's not noticeably easier to learn or to use. The AWT
windowing toolkit is twisted. The vaunted portability is greatly
exaggerated; the real motto should be "write once, debug everywhere".

=======================

Another take on the "better" versus "worse" issue:

I like to draw a graph of what you get out, versus what you put in. Basic
has the nice property of a small x-intercept: simple things are easy. The
problem is that complex tasks become difficult out of proportion to the
true complexity of the task. C++ is just the opposite: writing the
simplest possible C++ program takes a certain investment. The advantage is
that you can attack more complex tasks, even extremely complex tasks. The
language doesn't get in your way, and helps you out in ways that Basic won't.

| /
| /
| / (c)
results | (b)____ /
out | __/ /
| _/ /
|_/________/_______
effort in