Live data from Hacker News

Should every programmer learn C as their first programming language?

guidena2codes.com

61–67 of 67 posts

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

#61
I have asked HN the very pertinent question albeit in a different manner after doing some homework myself[0].

This was me 8 months back- Freshman Year | Autodictact | Non-CS Major |Knew no programming language.

In my experience C is better off learnt by textbook approach i.e. modules of theory+problem sets. The chapter end problem sets must test accumulated knowledge of the previous chapters. This boosted by problem solving skills, algorithmic thinking skills, understanding deep internals, their working and memory layout.

I recommend postponing learn-by-building-fun&real-projects approach as I hold that as a culprit for many people who get discouraged or worse, turn away forever. That approach is something brash, confident, and experienced people should be doing (like fcking with Brainfck language, haha!), not amateur innocent kids like me who feel the immense pain and frustration of shooting oneself in the foot. I've doubted on me creativity in building the project more than my ability to do abstract thinking through the language( or...I am not able to express myself clearly on this but then again, its better to suppress depressing memories). There is frustration in both the approaches but the immensity of the later(most) is nowhere comparable to former(least).

I cut through 80% of Cormen's problems with C like hot knife in a block of butter. I prefer C for the immense pleasure it gives that I don't prefer python for Cormen. I am now planning to build something with C with the Computer-networking theory I am learning. I am still wary of touching Linux though I can understand and take pleasure in reading its highly optimized code. Linus and his world wide team is a genius.

Coming to python, I started learning it once I completed Linked lists and Files chapter in Noel Kalicharan's book. Thereon, I took advantage of MOOCs and started out building projects (GUI apps in Linux) at a blazing fast speed. Quickly I turned into web development. It wasn't even 2 weeks and I could take everything swinged at me.

Now the comment pertinent to the article, I do recommend learning C first even after I have budding-experience with Java, Javascript and Python. I don't like being a magician without knowing on how-s and why-s of my own tricks. This gave me power to tweak and god did I twerk every time I tweaked! Had I started out with any other language,I would have been left hungry and dissatisfied in its richness of mental exertion and incompleteness in operating that language as well as no appreciation of the power of jumping miles( without knowing how to run). C hits the sweet spot that neither assembly nor Java can. I can see why C is still recommended and relevant today.

I am one of the few who is wanted in a company I am interning in, because of my in-depth understanding. Many fellow interns come to me whenever they are stuck in all those higher-level abstracted languages( Thank you for letting me brag on this humble achievement).

My routine during these 8 months - 6 to 8 hours a day of programming with a lot of intermittent breaks. Lots of StackOverflow, rubber duck talking, writing code and test cases out on papers, hair pulling, banging keyboard, and Coffee. My relationship with programming was that push-pull/love-hate one with a stronger desire of pull/love than push/hate.

[0]https://news.ycombinator.com/item?id=15471223

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

#62
Should everyone learn C? Yes. Should it be taught as the first language? Nope.

First of all, the quality of C learning material is abysmal. Most of the literature has been written before the era of C99 and encourages bad practices such as useless casting, single-letter variables, variable declarations separate from assignment and so on. At least some of this bad literature will inevitably find its way into the hands of newcomers.

That said, too many books also teach C as if it was the reader's first language. Were we not looking for a book for newcomers? Great! Now our glorious ANSI C book will be mostly about basic programming concepts and language constructs. The last chapter is most probably named "Advanced features" and this is where pointers are first introduced. In reality C is all about pointers and they should be taught as soon as the programmer knows how to write and call functions.

Learning C is also hard and requires shaolin monk-like self discipline. The Zen of C is satisfying but the path there is paved with segmentation faults, bus errors and endless hours of watching Valgrind logs. If anyone claims they've never had similar problems, they haven't really grasped the essentials of the language - see the previous paragraph.

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

#63
Introduction should be about making people feel that they progress, learn something useful and enjoy what they are doing. C is not good for that, unless you do introduction to robotics. Something like Python, JavaScript or even PHP is better for that. Go straight into interesting, useful applications like scripting, games, websites. Don't make people think that they need to memorize how to implement stacks, queues or heaps in C and actually implement them each time before they get to resize a photos collection from vacations. This can be done in 5 line python script and feels good.

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

#64

Should everyone learn C? Yes. Should it be taught as the first language? Nope. First of all, the quality of C learning material is abysmal. Most of the literature has been written before the era of C99 and encourages bad practices such as useless casting, single-letter variables, variable declarations separate from assignment and so on. At least some of this bad literature will inevitably find its way into the hands…

> That said, too many books also teach C as if it was the reader's first language.

I feel that's quite a general problem with programming languages. Many languages could actually profit from books that assume that the reader knows a couple of mainstream languages and explain the respective language's intricacies from that perspective -- also in a much smaller format.

I'd buy a small book (say the size of K&R or "the AWK programming language") for many interesting languages in a heartbeat.

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

#65
post #43

Earlier quoted context omitted.

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.

> The same data structure in C might defeat them altogether I agree with this, but my point is that to get started in C all you need to work with is strings/arrays. > While a certain data structure might be complex, it’s use might be simple I would argue that in most cases the use only appears to be simple and in reality the correct use is just as complex as the data structure.

> I agree with this, but my point is that to get started in C all you need to work with is strings/arrays.

Which are both absolute shit, that's not exactly a ringing endorsement.

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

#66
post #37
post #34

Earlier quoted context omitted.

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…

I never argued for learning llvm, the comment I replied to mentioned CS grads that could not write fiz buz in ANY language. I would never suggest going 0 to 100 like that

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

#67
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 for utter beginners is probably like being tossed into a tsunami for swimming lessons.

"Okay, now this is how you float on your back; but watch your head: there a protrusion of iron rebar sticking out of a broken concrete bridge support, and you're heading straight for it! We call that 'uncomfortable behavior'."

Post reply on HN