This thread is going to be a flame war ;-)
This IS a matter of feeling, taste, habit, etc... And of course
applications.
You won't use C for tasks usually done in awk or python, for example.
But programming discipline has nothing to do with the language. If you
really
like the hard way, write your GUI apps in assembly ! Some people do that,
I've seen some web sites... very impressive, indeed, but is it really a good
idea ?
As evidenced by all the robust, secure, reliable, and maintainable code
out there right now?
I thought OpenBSD was robust, secure and maintainable
And it's not the
only one...
"Better programming discipline" is built by following best practices,
not by restricting yourself to the most primitive tools available.
But "restricting" to "primitive" tools is not forbidden ;-) And, who says
C is primitive ?
I suppose all home builders should throw away their table saws and
pnuematic hammers and laser levels and prefab trusses; using nothing
but a hand saw and claw hammer should enforce better building
discipline needed for bigger projects.
To complete the joke: Amish farms are said to be among the most productive.
But you still have the opportunity to buy seeds to Monsanto ;-)
Sorry, it's just that my personal experience with the whole "let's do
it the hard way, because it'll make us better programmers" attitude has
resulted in redundant, buggy code and missed deadlines.
And is the attitude of a wannabe "real programmer"
But it doesn't
necessarily mean that C is obsolete ! No need to become a C guru, you
can still write great programs with it.
You suggest that C is the "hard way". I'm sorry to inform you that
I program more easily in C than in any other language. I can compare with
BASIC, Pascal, Java, C++ and Fortran... I definitely prefer C. Some are
better for really simple tasks, but when I need full control over my
program, I use C, or sometimes assembly. Just try to check or change IEEE
flags
in Java... Hey, you can't !!!
There are times C just isn't the right answer.
I agree !
Why write 50 lines of code when
you can accomplish the same thing in 10?
Maybe it is faster, or more elegant, or more readable, etc...
Why roll your own library to
do something that's already supported at the language level in Java or
C#? Why not use tools that come with blade guards already attached?
Mmmm. Why reimplement in Java code already available for years in C.
This argument is pointless: you have only two "choices" (if you can choose
!)
when you decide to learn a new language: reuse existing code "as is" and
link,
or rewrite it. Both choices have drawbacks.
Depends on what you mean by "serious".
Would you suggest that C is not serious ?
Just have a look at the
number of open source projects written in C... I wouldn't say they are
not serious.
There are some domains where it
would not be my first choice.
Here again, I agree
Anything that requires a heavy GUI front
end, for example, would be better served with a language that provides
high-level support for widgets and graphics (Java, or C# with the .Net
framework, etc.).
Well... Java is sometimes considered as a "toy" language, and it has many
many
drawbacks: subject to Sun will, have poor support for IEEE floating point,
is not as portable as claimed, etc. About portability: you first need a VM
on your OS. Try to run Java code on OpenBSD/macppc ! And it's not the most
uncommon. Even if you have a VM, there are differences, at least in
pathnames.
If you consider floating point, William Kahan has written a great paper on
this subject, I couldn't do better
If you need a GUI, you can still use C: X11 or Carbon are easily accessible
in C.
But a simpler way is using Python and/or TclTk for GUI, and C for all
computations.
Linking C in Python is very easy, and made even easier by SWIG.
Oh, and if you really like Object-Oriented programming, you can do that in C
as well.
It's not immediate, but not very hard either.
String handling isn't exactly a happy proposition, either.
In Java it's not perfect, but probably better. Nevertheless, string
handling is not a problem in C.
But there are times when code size or execution speed trump
everything else, and in those cases it's either C or assembler.
Oh, not necessarily either. Many scientific codes are written in Fortran,
and compiled functionnal languages can be very fast. Objective Caml is
said to be faster than C++.
C was state of the art 30 years ago. The art has advanced somewhat
since then. I would expect to see C used for new development less and
less as time goes on. I expect the last holdouts to be in domains
where code must compile to as small a footprint as possible, yet still
remain portable; games, device drivers, OS kernels, etc.
It's funny to note that almost all interpreters and compilers are
written in C. One remarkable exception is Octave, but it's also remarkably
slow ;-)
And BTW, many people criticize C++, for some good reasons. It's only an
hybrid
OO language, and Objective C may be considered much better. In fact, the
best OO language
may be the oldest, smalltalk. Perhaps too old for you
But I don't think
old means
obsolete. UNIX is old, and MacOS X is built on a UNIX base... C is old, but
many
projects are still written in C. Why stop ? Only because someone has said
it's *too* old ?
Hey, a good task for Java is GUI, as you said before: MATLAB's GUI is
written in Java,
but you bet the computation core isn't !!! :-D