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…
Should every programmer learn C as their first programming language?
11–20 of 67 posts
Re: Should every programmer learn C as their first programming language?
#12Earlier 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.
Re: Should every programmer learn C as their first programming language?
#131. 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 sometimes get in each other's way. As a side effect, build process isn't properly documented. Probably the best we have are CI files explaining the environment and maybe Dockerfiles if you're lucky.
2. Standardization - 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. There's lots of important subjects that aren't standardized at all.
3. Intuitiveness - one trivial example is undefined behavior. Due to existence of legacy code, pretty much all compilers default to letting through expressions that end up leading to UB. Ultimately you can't really reason about your code without also knowing how it was compiled.
4. Safety - selling point of Rust and hate it as much as you want, but C makes it way too easy to shoot yourself in the foot for no apparent reason. Do you really expect your student to learn all secrets of OS/C memory allocation plus spend his first half a dozen of hours of debugging because he misused a pointer? In university, it's sometimes easier to rewrite the program than fix the bug if you're only getting started with pointers. Backtraces are useless if your stack is corrupt.
There are probably more reasons why it's a terrible idea, but those are just a few off the top of my head. Consider some of those posters as of examples of C design failures:
Re: Should every programmer learn C as their first programming language?
#14> 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 conversation about what your first language should be, and we'll worry about precise career choices later. If you're learning to fill a position, it's not your choice to make.
Re: Should every programmer learn C as their first programming language?
#15It 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…
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.
Re: Should every programmer learn C as their first programming language?
#16Is C worthwhile learning? sure. Is it worthwhile learning as a first programming language? maybe... what do you want to do?
I've done 30+ years of C programming ( interleaved with other languages ). I've used it mainly for embedded systems, and it works fine. It's easy to go wrong with it and you need to employ a lot of defensive techniques, but with experience, it's good. However it's not a very good language to express abstractions in. You have to be very aware when trying to build a modular systems. I virtually never use it outside of embedded systems as I think other languages work out better. But that's my opinion based on tradeoffs I want to make. Other people make different choices.
The only advice I'd give is try different languages, spend the time getting good at a few, and be very good/productive at at least one.
Re: Should every programmer learn C as their first programming language?
#17I agree with meatbundragon's comment "learn whatever you need first", but for a computer science degree program, I've held the opinion for a decade that students should learn Python first to get a feel of how humans should think and then C in their second year to learn how computers think . Assembly is too niche for all students to learn it, and Java/C# are each too isolated from other environments, whereas C is behi…
(The book "C traps and pitfalls" remains one of the most instructive programming books I've ever read, and more languages could do with one)
Re: Should every programmer learn C as their first programming language?
#18It turns out, in retrospective, that my own snubbiness of preferring Pascal, Modula, Ada, Realbasic, CommonLisp, Racket, Xlisp, and whatnot to C probably got more in my way in the long run than it helped. Even though I do understand low-level details like memory management and C structures, I'm still not proficient with reading arbitrary C code, e.g. with a lot of bit-twiddling in it, and header files, understanding the pre-processor, and so on. However, no matter which language you use daily you really need to have these skills for writing glue code to C libraries, glue code to system APIs, and so forth.
There is just no way around C. So yes, learn C first or at least early, and then whatever high level language you need.
Re: Should every programmer learn C as their first programming language?
#19I agree with meatbundragon's comment "learn whatever you need first", but for a computer science degree program, I've held the opinion for a decade that students should learn Python first to get a feel of how humans should think and then C in their second year to learn how computers think . Assembly is too niche for all students to learn it, and Java/C# are each too isolated from other environments, whereas C is behi…
Re: Should every programmer learn C as their first programming language?
#20I agree with meatbundragon's comment "learn whatever you need first", but for a computer science degree program, I've held the opinion for a decade that students should learn Python first to get a feel of how humans should think and then C in their second year to learn how computers think . Assembly is too niche for all students to learn it, and Java/C# are each too isolated from other environments, whereas C is behi…
Assembly is not that difficult if you pick a suitable target and environment - possibly a virtualised one for early learning. Make sure you can single-step cleanly. And this is really how computers "think", while C is full of traps that fall between the language abstraction and the compiled realisation. (The book "C traps and pitfalls" remains one of the most instructive programming books I've ever read, and more lan…