

Respect C Programmers - tx
http://kontsevoy.blogspot.com/2007/10/respect-c-programmers.html
Recently I just got fed up with unfair criticism of C...
======
geebee
I haven't noticed as much C-bashing. It always seemed to me that people
recognize that C programming is pretty damn hardcore, and that the people who
have mastered it are accomplished programmers. I still see quite a bit of
reverence for kernel programmers. Yeah, there's some C bashing, everything
gets bashed. But Java has taken much more of a beating lately than C.

Otherwise, I largely agree with the article (although I don't actually think C
particularly needs defending right now). The only point I disagree with in
this article is the exclusion of server-side web applications when he says
"show me the code." Server side web apps aren't the dull, stateless things
they used to be - trememdous innovation is taking place here.

~~~
cstejerean
One of the big reasons a lot of code is written in C is because a lot of
schools, especially in Europe and Asia teach C/C++ starting at the high school
level. Even US schools used to do this until recently (a lot have switched to
Java now). So it makes sense that a large percent of the open source software
is written in C/C++.

~~~
michaelneale
By "school" you mean College or University I presume? (which is what most of
the english speaking world calls them). Otherwise highschools are far more
advanced in the US then I am led to believe ;)

~~~
rms
My relatively well-off public high school had an elective year long
programming sequence that was half Pascal and the second half C++. Then, AP
Computer Science was taught in C++.

Right after I graduated, AP Computer Science switched to Java and my school
started teaching C++ as the first programming language, then Java, then Java
again for AP CS.

~~~
michaelneale
Wow, that is impressive. Although, when I went to high school there was no
Java (barely was C++, actually there was but no one really used it yet as it
was a wacky pre processor for C). Pascal baby !

Interesting how pascal kind of quietly disappeared. It has the closest
resemblence to the algol heritage that it came from.

~~~
rms
Yeah... hopefully there will eventually be a pedagogical movement to switch to
python as a first language, C++ is definitely a little rough.

~~~
michaelneale
I agree. Python certainly has its quirks. But what I like about it is that it
doesn't force OO or functional styles. You can "ease" into them. I like
writing non OO python. Also with the significant whitespace, its great for
teaching as it makes the code clear without syntactic noise.

the only thing I find confusing is forgetting that there may be a global
function to do what I want. eg len(array) as opposed to list.length (ruby).
But that probably doesn't hurt in reality at all.

The few books I have read on python are also excellent and approachable.

Also you can do fun stuff with python (build GUIs etc) and do tangible stuff
that makes teaching it more fun.

------
Goladus
Some things I like about C:

'void' means an empty parameter list, a function that returns no result, or a
pointer to anything.

There is an array type, which you declare with brackets[10]. It's a real type
on par with all the other real types in the language. Yet, accessing the
values in an array is done exclusively via pointer arithmetic.

int foo(); declares a function with unspecified parameters, unless it is C++
where it means no parameters.

    
    
           char x[5] = "Hello"; //Is an array of 5 chars, and has no string-terminator
           char x[] = "Hello"; //Is an array of 6 chars, with string terminator.
    

You can declare functions that take matrices of variable size, but only in one
dimension. int bar(char mat[][4][5]); Unless you're using variable-length
arrays which were added to C in 1999, but aren't widely supported in
compilers.

~~~
MuddyMo
Excellent examples of C annoyances.

------
mojuba
C is as essential as electronic engineering. More generally, a programmer's
learning path should go through (a) understanding how machines work (b)
understanding C and (c) understanding the rest. You will never truly get the
idea of Lisp or Python unless you know the lower levels, including the
intermediate ones, which is C in particular.

~~~
ptn
I totally disagree. C is definitely *not a good language to learn to program
in. I actually think that programming should be learned the other way around.

~~~
mojuba
Why?

~~~
cstejerean
It's interesting trying to watch a non-programmer try to learn a language like
C, C++ or Java and try to figure out the reason for all the boiler plate code
to get something simple done. They ask questions like: Why does printing
"hello, world" require more code than "print 'hello, world'"?

~~~
tokipin
i once let a friend use my TI-89 for a couple of minutes. he wanted to program
a game for it. when i checked to see what he had written so far, it said
"there is a ball"

although hilarious, it's an ideal that shouldn't be laughed at

~~~
ptn
See? At first you just want a simple language to give instructions to the
computer, so you can worry about learning how to come up with the algorithms
that you need to translate.

~~~
mojuba
A thesis that we want the machines to understand our high-level vision of an
algorithm existed long before computers were invented. However, we failed to
create such a system that would interpret our vision of a program ("there is a
ball") and execute it appropriately. Wish you good luck in inventing such a
system.

The reality is, programmers who don't understand how computers work can write
ridiculously bad code. I saw it a lot. Efficiency does become an issue when a
program is so bad and slow and unreliable that a computer can't execute it in
a reasonably useful way.

I'd never hire a Python programmer who doesn't know what dynamic array is all
about or what CPUs are dealing with when they run a program -- essentially
addresses and numbers.

A recent YCnews post comes to mind: if you want to find a good PHP programmer
you have to announce a C++ vacancy with no single word about PHP.

~~~
DanielBMarkham
I'd take a C++ expert who also knew language X over somebody who just knew
language X any day of the week. Being able to do something hard without
shooting your foot off and understanding how the bits and bytes work make you
better no matter what language you're using.

------
rob
I'm learning to develop OS X apps and have been learning C / Objective-C and
have to say I enjoy it.

~~~
gommm
Objective C is a heck of a sweet language.... It's one of the few C based
object oriented language that feels enough like ruby to make me like it ;-)

------
mynameishere
C and C++ and Java, etc, were written for practical reasons, and they attract
practical followers. When someone writes a blog post about Java, it's rarely
to show a "trick" or to prove superiority, but rather to solve some problem.

If I'm typing away in Java, you KNOW I have an end-goal. No one plays around,
because...it's not a toy.

It's like saying, French is a more beautiful language than English (it is, you
know). But compare the import/export ratio of the film and popular music
industries. I can't recall the last French pop song I heard...

Wait, I do: <http://www.youtube.com/watch?v=2-sUzR71wpQ>

~~~
Zak
Most of the blog posts I've read about Java lately are indeed about solving
some problem. Unfortunately for Java's reputation, the problem is usually the
lack of ability to perform one of those "tricks" that "toy" languages like
Lisp can do.

As for C, I suspect there's more information about C "tricks" online than all
other languages put together. For example: <http://www.ioccc.org/>

------
ptn
Also, you don't really understand a high-level language unless you understand
C. (I'm mostly talking about Python and Java here.) If you think of Python
lists as dynamic arrays of pointers to void, the world suddenly becomes
easier.

~~~
cstejerean
It does? I think that actually makes it less clear what lists in Python are
actually good or bad for. I think thinking of them in terms of a linked list
in C is a much better abstraction.

~~~
ptn
A linked list in which every node is a void pointer. But that would be kind of
the same.

What I meant is that knowing how you would have to implement each of your
high-level data structures in C helps you understand some of the problems you
encounter when working with them. For example, now I know the difference
between these two Python lists: l = [[1,2] for i in range(6)] and l = [1,2] *
6

------
Zak
A lot of software has a base runtime written in C with much of the higher-
level functionality written in a higher-level language. Firefox does this with
Javascript and Emacs does it with Lisp.

~~~
davidw
"Ousterhout's dichotomy", although I'm sure it predated him:

<http://en.wikipedia.org/wiki/Ousterhout's_dichotomy>

------
far33d
C is the language of the operating system. It's also very portable. It doesn't
require that any other packages be installed - it compiles to machine code.
LISP/Haskell/Python/Java don't have this quality, and so desktop software will
probably always be dominated by C and it's sad offspring C++.

Other "high level" languages are however, becoming increasingly dominant on
server-side or hosted products, since the developers can control the execution
environment closely.

~~~
Goladus
Lisp compiles to machine code.

Here's a page on how to do it with clisp:

<http://clisp.cons.org/impnotes/image.html>

~~~
Zak
Clisp compiles to bytecode, not native machine code. Saving an image with
:executable set bundles a copy of the Clisp runtime and your program's
bytecode in to one file. Most other Common Lisp implementations _do_ compile
to native machine code, but not all can bundle the runtime with an image.

Similar tools exist for other languages which require the language itself to
be present while the program is running.

------
tx
Guys, many of you missed my point. The post was not about C. It wasn't about
the language, it was about people. I wanted to point out that C programmers,
as a group, are getting things done.

I suspect there aren't that many of them, there are fewer people programming C
these days as compared to Java or C#. But they produce spectacular number of
open source products we all use.

Respect them for that. That's all.

------
jey

      char*____="RDCO$Utho{kfah||0R}wq5\x7fy8Z;";int main(int _,
      char**______){return _>!0xBADC0DE?main(!0[______],&____):!
      (-_)[*______]?!putchar(10):putchar((*______)[-_]^-_)?main(
      --_,______):0xDEADBEEF^!!"Valid C89 but not C++ nor C99";}
      
    

------
DanielBMarkham
I gave it some love.

I especially like the part about "You see, most of you Haskell/Lisp/Erlang
gurus are true intellectuals and are very capable. You write very well: many
great 'functional-style programmers' like you have nicely written blogs filled
with sacks of good thoughts and ideas.

However, when I look around I rarely see any results of your work."

It seems his argument is that there is some evolution at work in the
marketplace. Instead of arguing the "bestness" of language X or Y, simply look
around and see what is thriving and what isn't. That would be a great
discussion to have here. I'd add more, but I think I'd sound like a troll.
Good article.

~~~
byrneseyeview
If you're going to decide that an idea is right based on how many people agree
or disagree with it, you have a problem: anyone who creates something new is
tied for wrongest person ever.

Also, <http://www.paulgraham.com/avg.html>

~~~
DanielBMarkham
I wouldn't judge anything by how many people agree or disagree with it. I
would simply acknowledge that a lot of people feel one way or the other.

Why not view programmers as customers, and languages as products? Are the
customers buying the products that provide them the most value? I believe your
argument is that they are not. Then why? Are they dumb? Misled? Controlled by
people who don't know any better?

It just seems like there is some missed communication going on here. I know
I'd like to see somebody who is an expert in both functional programming and
some ornery imperative/OO language, like C++, make some observations. By
expert, I mean several non-trivial deployed production systems in each
language, not somebody who played with language A in college is now infatuated
with language B.

As for me, I'll pick whatever language makes my startup get to market and
adapt to customer's needs the fastest. I hear PG says that's probably one of
the functional languages. I'm game. I can prototype and change a web site very
quickly in several other languages (with the right tools), I'm always willing
to see if something else will work better. But I can certainly also make the
observation that there must be a lot more functional programmers who moved to
imperative programming than the other way around. Surely they all can't have
done so for the reasons I've outlined above.

~~~
davidw
Languages as products rings a bell:

[http://www.welton.it/articles/programming_language_economics...](http://www.welton.it/articles/programming_language_economics.html)

A lot of the 'value' in a language is its network of users. For every X users,
depending on how much your average user is likely to contribute back (some
constant C), there will be Y contributions in terms of libraries, help on
lists, user groups, articles, things like that.

~~~
DanielBMarkham
That was good, although I'm not sure I agree with all of the analysis.

Perhaps there is a difference between "language as a solution" and "language
as a development platform". If you are looking for the best solution to
problem X, choose the language best suited to solve the problem. If you are
looking for the best development platform for problems X1..X1000, then the
calculus comes out differently. Dunno.

~~~
davidw
My thoughts on that are that _most_ developers are not going to be proficient
in more than 2 or 3 "full fledged" languages at a time, with some other things
like SQL thrown in that they're ok at. So a lot of people really are looking
to learn something that does a lot of things pretty well, or that at least
doesn't fail horribly at anything.

More here: [http://journal.dedasys.com/articles/2007/10/09/languages-
wor...](http://journal.dedasys.com/articles/2007/10/09/languages-worst-case-
vs-average)

~~~
DanielBMarkham
Makes sense to me.

I think if you strip aside the emotional reasoning that's going on, some
languages naturally fit with some people more than others. Thinking in terms
of functional decomp and association is just different than thinking in terms
of objects. Some people build their own "language within a language" each time
they solve something. Some people just want a language that is easy to find
help for on the internet. Perhaps the trick is to identify which of those
paradigms best fits your long-term goals for your both you and your problem.

I once interviewed a guy with a bunch of different languages on his resume.
"So which do you like best?" I asked. He responded, "Java". I said, "Why's
that?" He said "Because when I hit the compile button most of the time it just
runs."

I thought that was a good answer.

~~~
davidw
> some languages naturally fit with some people more than others

Precisely! Because, in the end, languages are for people, and people are
fickle and weird, and often irrational.

I think there _are_ some things that make some languages more or less
objectively better for some tasks, but like anything that revolves around
people, it's often not so clear cut.

------
cellis
awesome post. flame me. i think PG is one of the smartest people in Web 2.0,
but I'm not drinking the lisp koolaid. I write in descendants of c - C++, C#
and php.

~~~
brlewis
I won't flame you -- I agree that it's pointless to bash C programmers.
However, you should note that C# is mainly a descendent of Java. When you use
it you've been dragged about halfway to Lisp, even though you get to keep your
curly braces and semicolons.

------
MuddyMo
I wonder why this post isn't getting any love?

~~~
Goladus
I didn't vote it up mostly because I didn't feel strongly one way or the other
about it. It's unclear whether the author really understands why C was chosen
for many of the apps he lists as evidence that C programmers deserve respect.

~~~
DocSavage
This is why I didn't vote it up. The blog post makes a weak argument in
support of C; namely, most foundational code is programmed in it. If you go
back through computer eras, you could craft a similar argument for each of the
dominant languages of the time (including assembly). I agree with Goladus that
the author never says why C is appropriate or best for some of those apps he
cites.

------
henning
Lousy troll.

