Live data from Hacker News

Why Learn to Program in C?

philipbuuck.com

1–10 of 123 posts

Re: Why Learn to Program in C?

#2
I'm surprised that people have managed to get through a CS program without learning C (or, at least, C++)! It seems to me that programming should be taught simultaneously in Haskell (or Lisp?) and C.

- C teaches you how computers work.

- Haskell teaches you how programming logic works.

Re: Why Learn to Program in C?

#3
I am a strong believer in learning C as your first language. Why? Well a number of reasons but the two main ones are 1) it teaches you about what is happening at a lower level so you have some idea about what is happening behind the scenes of that Java code you wrote or whatever and 2) it makes you appreciate just how lucky you have it in higher level languages.

However I don't think you should start writing all your programs in C! Use the right tool for the job. If that job is something C makes sense for then go for it but if you are writing a webapp I wouldn't recommend you use C (although I would if you needed a fast, native library to call from your webapp).

Re: Why Learn to Program in C?

#4
post #2

I'm surprised that people have managed to get through a CS program without learning C (or, at least, C++)! It seems to me that programming should be taught simultaneously in Haskell (or Lisp?) and C. - C teaches you how computers work. - Haskell teaches you how programming logic works.

Probably because some modern CS programs use Python for their intro courses and Java for the advanced ones.

Re: Why Learn to Program in C?

#5
post #2

I'm surprised that people have managed to get through a CS program without learning C (or, at least, C++)! It seems to me that programming should be taught simultaneously in Haskell (or Lisp?) and C. - C teaches you how computers work. - Haskell teaches you how programming logic works.

C doesn't really tell you how computers work, a healthy dose of Hennessy's book and an accompanying lecture works much better than learning C.

But C has immense cultural value. Lots and lots of extant source code, important source code: Linux. The BSDs. PostgreSQL, SQLite, whatever.

C is the lingua franca. "Everybody" speaks at least a little C, so it can be used as pseudocode notation (without learning some specific, maybe even ad-hoc, pseudo language).

Re: Why Learn to Program in C?

#6
Until not too long ago, De Anza College still taught C as an introductory programming language (I think because some recently retired instructors wrote a textbook on it). Even now, from what I've seen of the syllabi online, their C++ course that replaced it is still mostly C with some sprinkling of classes added on.

I thought it was a horrible idea, and I had a pretty miserable experience at De Anza. If you're just starting out programming, you should simply get used to writing code, and not fighting low level details of the language. C is the kind of thing that is useful, perhaps only as an advanced undergraduate course. Most beginning programmers need to start writing code, not get bogged down in pointer hell. And obviously most beginning programmers aren't going to be hacking away at *nix kernels or anything advanced like that.

Re: Why Learn to Program in C?

#7
The whole handmade thing seems kind of silly. Yes, understanding what's beneath abstractions is important, but if you want to build software well, you should use your abstractions well, because not every piece of software needs lightning speed.

Re: Why Learn to Program in C?

#8
post #2

I'm surprised that people have managed to get through a CS program without learning C (or, at least, C++)! It seems to me that programming should be taught simultaneously in Haskell (or Lisp?) and C. - C teaches you how computers work. - Haskell teaches you how programming logic works.

C was the first official language I learned in school. It was very hard at first, mainly because I couldn't see how everything (memory management, pointers, references, data structures, etc.) would fit in a real world scenario. We didn't learn about Make and building automation until 3 months in the course. `gcc myfile.c -o myfile` was all we did, one concept at a time.

Maybe programming 101 should start with a higher level language and dive slowly on "how does that work?".

Re: Why Learn to Program in C?

#9

Until not too long ago, De Anza College still taught C as an introductory programming language (I think because some recently retired instructors wrote a textbook on it). Even now, from what I've seen of the syllabi online, their C++ course that replaced it is still mostly C with some sprinkling of classes added on. I thought it was a horrible idea, and I had a pretty miserable experience at De Anza. If you're just s…

I agree. When starting out with programming, the most important aspect to learn about is the program logic. Syntax and implementation details that are not strictly necessary just get in the way and are likely to confuse students. Once you're comfortable writing algorithms, then you can move onto languages with more complex syntax and features.

That said, you could do a lot worse than C for an introductory programming language.

Re: Why Learn to Program in C?

#10
While I agree with this in theory, I can't help but imagine that 20-30 years ago you could take this post, replace every instance of "C" with "assembly" and it would relate to a lot of developers at the time.

The march of technology (and knowledge in general) is one of constant abstraction. We figure out ways to do more with less so we have more capacity left over for further advancement. You don't know 10x10=100 because your brain derives it every single time, you just memorize the fact, hopefully with understanding. In software terms that means higher level languages with sophisticated libraries, and languages like C are relegated to more of an infrastructure role.

This isn't necessarily bad. If the technology is more capable then everybody wins at the end of the day. As the author points out there will always be a niche of enthusiasts/zealots who will lead the charge and further the field. The remaining 99% will learn what those people come up with and apply it. To the best of my knowledge that's how it's always been, and it's worked pretty well so far. So I'd say let people start off with high level languages if they want, but expose them to lower level languages and let them choose which demographic they end up joining.

Post reply on HN