Live data from Hacker News

Should every programmer learn C as their first programming language?

guidena2codes.com

31–40 of 67 posts

Re: Should every programmer learn C as their first programming language?

#31
post #9

Earlier quoted context omitted.

C is a very simple language. much simpler than js you can write a C compiler in just a few thousand lines.

C is also a terrible learning language, much harder to reach the "get things done" stage than most other languages. You can spend weeks segfaulting in C before you get things actually working, and for a beginner — especially self-teaching/unsupervised — it's extremely easy to rely on compiler-specific behaviour in the face of UBs. When learning, if the only choice were C or assembly I'd actually recommend assembly.

> You can spend weeks segfaulting in C before you get things actually working

This seems like an overstatement. The first programming class I ever took was "Introduction to Programming with C" where the textbook was K&R and we were writing and compiling programs from day one.

If you can't figure out how to manage memory (one dimensional data structure) in C jumping into a language that immediately allows you to abstractly manipulate complex multi-dimensional data structures will certainly not make your life easier.

Re: Should every programmer learn C as their first programming language?

#32
post #14

What a ridiculous premise. > Should every programmer learn C as their first programming language? > ... > It depend on what are your position in Web development, are you a front-end web developer? Or you are a back-end? If this is your first programming language, why are you worried about being a front-end or back-end developer at all? If you're learning programming for the sake of learning programming, we can have a…

I'm self-teaching in my late 20s after dropping out of a philosophy degree several times in a row. I hope you'll permit me to rant a bit, it's related to your comment and the article: the sheer amount of jank is absolutely unbelievable. The vast majority of it is written with selfish careerism in mind, not generous pedagogy. Much of it is vapourware advertisement for a paid course. Plenty of it ends up on the front page here nowadays which is a bit of a shame. Related: https://meaningness.com/geeks-mops-sociopaths

I've wasted about 6 months on distractions from following fashions and persuasive writing/videos, and now know a little bit of a bunch of popular languages and some CS and IT and already feel a bit burned out (as I'm stretched in so many directions - sorry for the mixed metaphor!).

In the past couple of weeks I've nuked my windows installation and have an Arch+i3 setup where I try to use CLI wherever I can. I've limited myself to following CS61A (the famous SICP course), HtDP, and I leaf through a book I have on Rust, typing out examples and steeping my brain in healthy confusion. The difference in my rate of learning is astounding: not because I'm suddenly better at research, but because I'm better at filtering. What an age to live in!

Re: Should every programmer learn C as their first programming language?

#33
post #15
post #13

It has a relatively simple (and lacking) syntax, but a language is much more than its syntax. Compare to Python, Go or Rust and you'll see the following: 1. Infrastructure - C has no package repository, no standard build system. When you receive a C program, you need to know a dozen of build systems (autoconf + automake? scons? qmake?) and ways of getting packages (git? distro packages? some obscure website?) that so…

> yeah, there are standards, but they're actually ignored. There's lots of comments stories on HN about how C committee specified things that are unrealistic or outright impossible. Any examples? It sounds ridiculous, perhaps you were speaking about C++? But then again I can't think of anything but "export templates" that were finally dropped from the standard.

MSVC doesn't implement C99. A lot of platforms only have C89.

Re: Should every programmer learn C as their first programming language?

#34
post #24
post #21

Earlier quoted context omitted.

Is that really true though? Looking at performance optimizations that people do, understanding C is a minimal part of understanding how computers work. It's sort of a codified fiction masking a much more complex reality. C ignores the complexities of the cache hierarchy and register allocation and IPC extraction. If I code in a garbage collected language I can ignore one more complexity. But C is closer to Java than…

For the 25-50% that need it, sure, those would make good third or fourth languages. My point is that Python and C should be the first two, not the only two languages they learn in college. My reason for recommending C is to get an overview of what "writing for the computer" feels like with complex data structures, not memorizing the Intel x86_64 manual. Would you expect 100% of CS students to be prepared to learn cac…

Im sorry but if someone graduated with a CS degree and can't write an if-else, the teaching was not the problem. I knew a few people like this, but they had to cheat their way through & do 0 work on team assignments.

Students need curiosity & motivation to get to the fiz buzz level, not a specific intro language

Re: Should every programmer learn C as their first programming language?

#35
post #11
post #6

i learnt most about computers programming C and assembly, its very interesting and helps me every day not only in programming but in any computer related issues or quetions. It was a tip to learn it someone gave me a long time ago and i am still grateful they did it. It has also taught me a lot about debugging and memory inspecting due to the issus you will surely encounter :D (fun fun!) The fact that learning C is g…

C is definitely a language that also teaches a lot (but not everything) about how computers work. I wonder of languages like Pascal or Modula-2/Modula-3 would be equally suited, but with less quirks and pitfalls.

aren't the quircks and pitfalls what you learn from? :D As soon as you learn these things exist, you have learnt a lot about the tediousness of programming and computers =D

Re: Should every programmer learn C as their first programming language?

#36
C has quirks that can make beginners conflate separate concepts into one - for example pointers==arrays, expressions can be used as instructions, there's nonobvious automatic type conversion going on. It's not a big deal, but why complicate things more than necessary?

I think Pascal is still a better first language than C, even if it's less useful in real life.

Re: Should every programmer learn C as their first programming language?

#37
post #34
post #24

Earlier quoted context omitted.

For the 25-50% that need it, sure, those would make good third or fourth languages. My point is that Python and C should be the first two, not the only two languages they learn in college. My reason for recommending C is to get an overview of what "writing for the computer" feels like with complex data structures, not memorizing the Intel x86_64 manual. Would you expect 100% of CS students to be prepared to learn cac…

Im sorry but if someone graduated with a CS degree and can't write an if-else, the teaching was not the problem. I knew a few people like this, but they had to cheat their way through & do 0 work on team assignments. Students need curiosity & motivation to get to the fiz buzz level, not a specific intro language

And then there are those that legitimately try really hard but still have difficulty with control flow logic and algorithms in their second year, so this is what they should be taught. You can't just ignore them. Skipping ahead to cache access, instructions, and registers in just their second year leaves them behind. There's tons to learn about programming in two years for even the best students that doesn't require intricate knowledge of the machine. Assembly is just not realistic for the majority of sophomores. Additionally, it would be a disservice to teach languages that don't align with industry attention. C is used perhaps 4 orders of magnitude more than LLVM IR.

Re: Should every programmer learn C as their first programming language?

#39
post #8

Earlier quoted context omitted.

C is a very simple language. much simpler than js you can write a C compiler in just a few thousand lines.

C with its unsafe pointers, unsafe memory management and unsafe types is the worst language to learn for the beginning. It's good to know and learn as 2nd language, but for the beginning you need to learn proper concepts, not broken concepts. Lisp is still the best language to learn, but any proper scripting language will do also. PS: "proper scripting language" of course excludes PHP and JavaScript. Dart is fine.

C is hard to create complex programs but for learning simple things pointers are much more simple to understand then say Rust or other abstractions, a programmer will have to understand what it happens under the abstractions.

I understand the point that C is not the best choice this days to do big projects but for learning it seems a good idea, even to learn what segfaults are and buffer overflows are.

Post reply on HN