3 ms·
If part of a CS course I think C is an excellent first language. Perhaps not for someone wanting to learn about software development on their own though. It se
by satysin 10y ago
If part of a CS course I think C is an excellent first language. Perhaps not for someone wanting to learn about software development on their own though.
It seems to me that while we know how to teach C properly today not many places do because they don't do as they say.
- jandrese 10y agoOne thing C does is force you to think about how the computer actually uses memory. So many languages abstract away the memory management and you end up with stuff like java programs that constantly and aggressively thrash the hell out of the processor cache by creating and (later) destroying objects for everything they do. Cache misses are one of the biggest performance killers on modern CPUs. You also see programmers do stuff like add characters to a string one at a time, even though each addition creates a whole new string and discards the old one. If you do stuff like that a lot you can easily end up wondering why your program is so slow even though the profiler says that there are no standout slow parts. Everything is just uniformly slow because their coding style doesn't consider the amount of work each statement maps to at the machine level.
- _ph_ 10y agoThere are plenty statically compiled languages which don't abstract away the memory management, and are still way more robust to use than C, just start looking at Modula-2. Programming in C makes a lot of sense in many situations compared to C++ or Python or Javascript, just to name a variety, but not so much when compared to many other languages, which really compete in the same space as C, but did not catch the same attention.
- jandrese 10y agoLearning C has the advantage of opening up a ton of Unix software for you. Modula-2 not so much.
- deathanatos 10y agoI was a TA for a CS program that taught C-with-classes C++, and I have to disagree. C was far too low-level for the students. In a course where you're just trying to teach the basics of flow control and translating a program into code, the foibles of C — from what a segfault is to trying to explain why you must read past the end of the file to get an EOF — just get in the way. Since someone always brings it up — I do believe as some point students should be exposed to a low-level language that doesn't to GC to expose them to memory management. Just not as a first language. I'd rather give them Python to start, let them get their feet on the ground and somewhat comfortable with it — give them success to start and hook their interest. C just tended to defeat the students, and needlessly. I spent so much time explaining things that to them must have felt like a rocket scientist telling them why their water bottle rocket exploded into flames on the pad.