Hacker News new | past | comments | ask | show | jobs | submit login
Respect C Programmers (kontsevoy.blogspot.com)
38 points by tx on Oct 24, 2007 | hide | past | favorite | 62 comments



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.


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++.


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 ;)


I used Pascal in high school, which was over 10 years ago. We did searching and sorting algorithms, linked lists, queues, and some other stuff I don't remember too well. Then I did it all again in college because they didn't accept AP credit unless you specifically complained and demanded to skip the introductory class. (Which wasn't a 6.001 equivalent)


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.


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.


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


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.


Don't be fooled, high schools int he US are pretty terrible in general. Most of the math and science I covered in high school in the US I learned through 8th grade in Romania. But the AP level courses are great. The high school I attended taught C++ as the AP course (switched to Java the year after I took the course).


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.


Excellent examples of C annoyances.


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.


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.


I think C is pretty good as a first language. It's not fraught with too many concepts and the few concepts it has are essential for many kinds of programming. If people use languages with mutable variables they have to know how pointers work. C makes that very explicit. You can't use it without understanding pointers and that's a good thing.

I'm not saying C is the best language to learn how to program, but it's definately better than Java, C++, Ruby or JavaScript. I can't tell how Lisp would work as a first language because I haven't seen anyone try to learn or teach it.


"If people use languages with mutable variables they have to know how pointers work" -> wrong. They don't. That's the idea of a high-level language, to hide how the computer interprets your instructions so you can focus on giving instructions.

Now, understanding pointer would help a lot, but that's a different argument.


I don't agree. The difference between copying a thing and referring to a thing is not some low level technical detail that you can abstract from. It's a fundamental structure of any system, not just computer systems.


I have no strong opinion about whether C is a good learning language or not. I'd tend to say no.

However, if I was designing a practical college curriculum, I would require a course early-on that involved detailed instruction on how C actually works, as well as extensive practice using it and exploring its tricky areas. It might correspond with an introduction to assemblers, computer architecture, or operating systems. The catch is having an instructor that actually knows C well enough to teach it.


Agreed. I think one of the easiest languages to learn at first would be Python. I unfortunately took the path of Basic, Pascal, Visual Basic, C++, Java, Python, Lisp and I wish I would have run across Python much sooner.


I learned in Pascal too. It's not bad.


Why?


There's too much to worry about; besides, being efficient isn't an issue when you are a beginner. Better to learn with a language that hides the low-level details so you can focus on actual programming.

In other words, I think that you should learn first how to teach the computer to do stuff and only after having done that for a while should you try to understand how the computer interprets the instructions you give it. Of course, you could take the very first steps in any language (except maybe Intercal), but once you get to strings and the like, C is more likely to make it more difficult instead of easier.


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'"?


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


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.


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.


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.


the problem is that the layers aren't very connected or related. in particular the higher-level languages essentially stand on their own by their altitude, and the lower-level languages likewise by their ties to machinery


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


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 ;-)


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.


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.


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


I think of a list just as "a list". An ordered collection of anything.

"Linked list" is not an abstraction (at least, not in Python), it's an implementation detail. And IIRC, Python lists are not actually implemented as linked cells, so they have different performance characteristics.


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.


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

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


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.


Lisp compiles to machine code.

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

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


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.


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.


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.


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


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.


Languages as products rings a bell:

http://www.welton.it/articles/programming_language_economics...

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.


"A lot of the 'value' in a language is its network of users."

I wish Common Lisp programmers would realize that. Many are outwardly hostile to the very idea of their language becoming popular with the barbaric hordes of uncivilized Java and C# and PHP programmers.

Well, those that post on comp.lang.lisp that is. I suspect the Common Lisp "community" is one of the reasons pg is developing Arc.


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.


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...


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.


> 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.


Marketplace popularity is often the product of luck and first mover's advantage rather than evolution (examples that come to mind: Windows, MySpace, etc.).

By the way, I like C.


There's no denying that timing, momentum and markets can sometimes conspire to propel less than optimum products to an undeserved position of dominance. The C language just might be an example of that.

However, I think the author's most most salient argument could be summed up as: "before claiming to be David slaying Goliath, make certain you're not really a dwarf standing on the giant's shoulders."


If you're counting results, it might be worthwile to consider the loads absolute garbage written in C and C++.


Goladus, thats why we have this wonderful concept called iterative development...or whatever you want to call it. If something is good, you iterate on it, otherwise no one will use it.


Sure. Emacs, for example.


  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";}
  


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.


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.


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


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.


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.


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


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/


Lousy troll.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: