Live data from Hacker News

Why Learn to Program in C?

philipbuuck.com

41–50 of 123 posts

Re: Why Learn to Program in C?

#41
post #28
post #20

Earlier quoted context omitted.

Yeah, but why start with an exceedingly painful one except to needlessly inflict pain and suffering on students. Better to lay the groundwork with a friendlier language, learn the basics, and then move on to the more complicated gottchas (at least in my amateur opinion).

What language would you suggest is friendlier, and less rife with gotchas? I find the rules of C fairly reasonable, at least on the surface.

#include

int main(void) {

  (* * * * * * * * * * * * * * * * * * * * printf)("C is awesome\n");

  return 0;

}

Re: Why Learn to Program in C?

#42

C is great. I wouldn't recommend starting programming in C, though. At least not with the standard exercises you see. Get user input, read a file, do this do that with it. Why? the C standard library is full of gotchas and tricks and goofy shit that makes it unsuitable for new programmers. The comp.lang.c FAQ should be standard reading material for anyone taking a C class. Look at all the posts on StackOverflow about…

"Unsuitable" is far too strong a word. It was ok for generations to follow the K&R examples, and now it somehow suddenly became "unsuitable"? I'd say it's just "somewhat more tricky" and "got a slightly steeper learning curve", that's it.

Re: Why Learn to Program in C?

#44
post #36

C is great. I wouldn't recommend starting programming in C, though. At least not with the standard exercises you see. Get user input, read a file, do this do that with it. Why? the C standard library is full of gotchas and tricks and goofy shit that makes it unsuitable for new programmers. The comp.lang.c FAQ should be standard reading material for anyone taking a C class. Look at all the posts on StackOverflow about…

I started with C and it took me 3 good years fooling around with other languages too to get a "good" understanding of C. Better learn with higher level languages indeed...

Which languages ?

How common is it for people to get better understanding by travelling in other programming cultures ? My personal experience goes this way but I rarely hear it.

Re: Why Learn to Program in C?

#45
I liked having Ruby as a first. The REPL made it easy to see what was going on (even if I didn't understand it), the community's like for testing is fabulous, and I became comfortable doing things at the command line.

Re: Why Learn to Program in C?

#46

Ruby, Python, Perl, PHP, Java are all (mostly) built in C ( not to mention most databases ). Why not learn to program in C?

You realize that computers don't literally run C code, don't you? By that argument you should go further and build your own hardware, then write your own OS...you get the point.

Re: Why Learn to Program in C?

#47

C is great. I wouldn't recommend starting programming in C, though. At least not with the standard exercises you see. Get user input, read a file, do this do that with it. Why? the C standard library is full of gotchas and tricks and goofy shit that makes it unsuitable for new programmers. The comp.lang.c FAQ should be standard reading material for anyone taking a C class. Look at all the posts on StackOverflow about…

My first language was C and I loved it. Maybe it takes a certain type of mindset and tenaciousness (madness?) that will put up with the gotchas. It was exactly those gotchas that got me hooked though. It was similar gotchas that made me love Linux the terminal, vi etc ... The argument that one "should study other languages before they're fit to learn C" is terrible IMO and somewhat condescending. It's like saying one…

> The argument that one "should study other languages before they're fit to learn C" is terrible IMO and somewhat condescending.

I think I agree.

> It's like saying one must learn "nedit/pico" before starting with editors like "emacs/vi".

It's very little like that. Other languages have their own strengths in a way that nedit/pico do not.

Re: Why Learn to Program in C?

#48

C is great. I wouldn't recommend starting programming in C, though. At least not with the standard exercises you see. Get user input, read a file, do this do that with it. Why? the C standard library is full of gotchas and tricks and goofy shit that makes it unsuitable for new programmers. The comp.lang.c FAQ should be standard reading material for anyone taking a C class. Look at all the posts on StackOverflow about…

This is a strawman. The author is not advocating this as a first language:

"Learning C is not necessary for everyone, but there are many posts on Reddit and programming forums with authors who feel like they’re missing something, and I wonder if this is part of what they’re looking for."

Re: Why Learn to Program in C?

#49
post #28

Earlier quoted context omitted.

What language would you suggest is friendlier, and less rife with gotchas? I find the rules of C fairly reasonable, at least on the surface.

#include int main(void) { (* * * * * * * * * * * * * * * * * * * * printf)("C is awesome\n"); return 0; }

In C99:

    #include 

    int main(void) {
        (* * & * * * * * & * * * * * * * * * * * * * printf)(&1["C is awesome\n"]-3/2);
    }

Re: Why Learn to Program in C?

#50
post #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…

> a healthy dose of Hennessy's book

Most any CS book seems to have been written in C, Java, C++ and lately, Python. Are there books on computer architecture, algorithms, compilers, whatever written in Scheme?

Post reply on HN