Live data from Hacker News

Should every programmer learn C as their first programming language?

guidena2codes.com

21–30 of 67 posts

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

#21
post #7

I 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…

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 to the ALU.

Maybe learning LLVM IR would be more useful than either, as it will me allow to debug/reason about the performance impact of the abstractions of many languages backed by LLVM.

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

#22
post #7

I 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…

I like your reasoning - as an old Smalltalk hand I'd love to replace Python with Smalltalk, but Smalltalk's shrinking ecosystem is making it too niche

I use and enjoy dozens of scripting languages including Smalltalk and Python, but colleges need objective reasons to teach a certain language, and the popularity and applications of Python can't be beat.

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

#24
post #21
post #7

I 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…

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 cache hierarchy and register allocation in their second year? I know a few CS graduates that somehow didn't manage to learn single a programming language (to fizz-buzz level), even in state universities, not talking about community colleges. I think we should step back and look at what all students need, not only the advanced ones.

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

#25
When I started programming, in the 80’s, it was first Basic then Assembler. Not because we wanted, but because we had no choice. My first computer was a ZX-81 and believe me, without asm, everything was toooooo slow.

So when it came to C, it was an ‘easy’ step.

But now, you have the choice not to program on low level.

I asked my business associate not so long ago what he thought a good starting language will be for starting programming lessons to my 8yo kids.

He also told me « C ».

And here we go on the state of development nowadays.

With all high levels languages, there is a lot of people starting programming stuff, and often successfully.

But is assembling libraries/brick making you a good developer ? Is not understanding how stuff works underneath making you a bad developer ?

I seriously have no idea. Is the fact that we, as « old » persons, had to work low level, helped us to better understand ?

Or is it really useful nowadays ?

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

#26
My first language was Basic on Commodore64 at 6 years old. Second was Visual Basic with some HTML done in FrontPage. After that came high school where we had Assembler, C, C++, Prolog, Java, Pascal, and Delphi. At the college, there was more of the same + Javascript + a bit of Lisp + some obscure and specific ones like CLIPS. On my own, I worked with several others for example Python, C#, a bit of Elixir and Ruby and PHP and Kotlin and Objective C.

Point being made that first language is largely irrelevant if you are really interested in the craft you will eventually get exposed to many languages and paradigms and learn to choose what best suits the problem and in which you want to get the most expertise. It`s not like you would shoot yourself in the foot if you learn C first instead of Python or the other way around.

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

#27
post #20
post #17

Earlier quoted context omitted.

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…

C is a good enough approximation to the level students need. Many will never use or even think about assembly again, especially on the architecture they happen to be taught, but most will use some derivative of C syntax and semantics. For the 25-50% that will, sure, that'll be a good third language, but remember that most will develop web frontends or industrial logic for the rest of their life.

> Many will never use or even think about assembly again, especially on the architecture they happen to be taught, but most will use some derivative of C syntax and semantics.

This is deems true in my case. At my community college, I took a lower division Computer Architecture course, also known as Computer Organization and Assembly Language, a year or two ago and I recall little from it unfortunately. Yet, I still go back to the practices I learned from taking a course in C.

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

#28
post #7

I 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…

I think a good exercise is to build a CPU/Micro simulator in a more modern language. Followed by writing a compiler (for an uncomplicated language) to target that CPU. Should teach you most of what you need to know.

I remain reasonably agnostic to what language people should learn first, whether it be C / Java / C# / Python / .

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

#29
C was the first language I learnt when I was at university. Honestly the teacher was bad and I found it difficult. It almost put me off programming.

Fortunately, I later took a mandatory course in Java and Haskell. We learnt both languages in parallel to learn the difference between OO and FP. We were set tasks where we had to write programs in both languages. I loved this course and the lecturers were amazing.

I am against beginners learning C as it's too low level and you can get stuck easily. I would recommend Python as it's widely used for web dev and data analytics. It's linear [edit - correction as I had written "async"] unlike JS which makes what you learn more transferable to other languages.

Post reply on HN