Live data from Hacker News

Should every programmer learn C as their first programming language?

guidena2codes.com

41–50 of 67 posts

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

#41

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…

> It's async unlike JS which makes what you learn more transferable to other languages.

Isn’t that backwards or I am missing something?

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

#42
I would say: every programmer should learn to talk to low level devices first.

For example when you use an Arduino you program in a stripped down Java language, but you will learn a ton about how computers work because you learn about I/O. You will learn about bit swapping, shifting, and what not.

I don't think programming is about a language. It's about how you think about computers.

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

#43
post #9

Earlier quoted context omitted.

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

Depends on the type of thinker someone is. Everyone thinks best at a particular level. While a certain data structure might be complex, it’s use might be simple.

If I show someone a list of lists in C# the semantics of that will be very easy for them to grasp. The same data structure in C might defeat them altogether.

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

#44

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…

Maybe its just that the Java+Haskell one was simply a good teacher. Imagine you had them switched, so you would've had a bad teacher showing you how to program in Haskell and Java at the same time. Still to this day, your worst nightmares would be slow to load and express in terms of monads.

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

#45
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.

I've mostly learned programming in Turbo Pascal (I programmed a little in C64 and Turbo Basic before, but I haven't really understood programming at that point yet).

I think Pascal is a good compromise between Python and C - it's compiled, low-level and statically typed, but has a reasonable string type and operations included out of the box, and much less quirks than C.

It's a shame Pascal is so outdated by now.

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

#46
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 definitely agree. I took C first then Python. Where I took the courses, the C course was an intermediate programming course while the Python course was an introductory to programming course (I think this the case for many colleges, not entirely certain). Python, personally, seems like such a good introduction to programming language because the syntax seems so English-like. But otherwise, at my community college, after one takes the C course they usually go on to take a C++ course then a Data Structures course where the majority, if not all, the students use C++. All these courses being lower division.

I find it's a good skillset to have: Python for scripting, backend, and frontend with Django. C/C++ for other purposes I'm not entirely aware of, maybe if you like working with video games, browsers, operating systems, etc. Then a proficient understanding of HTML/CSS doesn't hurt, and anyways web development is pretty darn fun since designing and playing with things is cool. Those are my tools, or at least I like to think those are my tools: Python, C/C++, HTML/CSS.

Given what I mentioned above and the courses I have taken, I still don't feel like a programmer though. I mean you could give me a basic problem and I can probably write a simple, elegant solution in five hours or so but I'm going to have to look at the documentation or Google how to do some specific task. It might be that I've only taken lower division courses or only built stuff following tutorials online (Treehouse, etc), but I still don't feel competent and because of this, I've been thinking about finishing my degree in computer science but moving into product management as a professional job. I'm definitely going to try to program daily though.

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

#47
post #42

I would say: every programmer should learn to talk to low level devices first. For example when you use an Arduino you program in a stripped down Java language, but you will learn a ton about how computers work because you learn about I/O. You will learn about bit swapping, shifting, and what not. I don't think programming is about a language. It's about how you think about computers.

But Arduino use a C/C++ language?

https://www.arduino.cc/en/Main/FAQ#toc13

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

#48
Nah. I started with Flash and would never have had a programming career if I had to start with C, gcc, make and all that bullshit.

Learning C by itself is interesting because obviously a professional programmer needs to know how memory is managed and laid out at a lower level in a computer, and how higher programming languages themselves are implemented.

But you don't need to start with C to actually teach programming, what is a function, what is a loop or a variable, or to teach algorithms, data structure, or problem solving.

People often complain about "the lack of diversity" in tech, well I can tell you people who think C should be the first programming language of any CS student are a severe hindrance to bring that diversity to tech.

Teach Processing or Python, make students create interactive apps on mobile phones with a visual or audio feedback thanks to a simple environment or language. They will be no less of a programmer if they succeed in creating a multiplayer mobile game in the space of a few month because you didn't burden them with malloc, pointers or null terminated strings and macros.

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

#49
post #41

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…

> It's async unlike JS which makes what you learn more transferable to other languages. Isn’t that backwards or I am missing something?

You're right. I made an edit.

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

#50
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 definitely agree. I took C first then Python. Where I took the courses, the C course was an intermediate programming course while the Python course was an introductory to programming course (I think this the case for many colleges, not entirely certain). Python, personally, seems like such a good introduction to programming language because the syntax seems so English-like. But otherwise, at my community college, a…

> [...] I still don't feel like a programmer though. I mean you could give me a basic problem and I can probably write a simple, elegant solution in five hours or so but I'm going to have to look at the documentation or Google how to do some specific task. It might be that I've only taken lower division courses or only built stuff following tutorials online (Treehouse, etc), but I still don't feel competent [...]

What's wrong with that? If you are able to develop working stuff by yourself, with help of documentation and WWW, it's perfectly alright - those are the tools you will usually have in the real world anyway. You can't keep all the details for various topics, or different library APIs in your head anyway.

Post reply on HN