Earlier quoted context omitted.
The thing that makes C a good candidate is that it's a very very small language. Yes there are plenty of strange quirks that the experts need to deal with but you can come up with an elegant and compact implementation of every standard data structure. High level languages tend to favor one data structure over another. Starting with those languages can give students the "hammer syndrome" w.r.t. that structure.
I see this a lot with functional programmers and linked lists. Yeah you can derive a lot of data structures from a list, but sometimes it's like putting a square peg into a round hole, and a custom data structure would be more efficient.
Learn C, Then Learn Computer Science
31–40 of 134 posts
Re: Learn C, Then Learn Computer Science
#32This article resonated deeply with my own experience. Like Rohlf, I learned to program TI-Basic in middle school, and like him, I've had the ability to see several different teaching paradigms when it comes to computer science. In the high school computer science courses I was able to take, the programs were relatively simple with an, in my opinion, too-overt emphasis on object oriented programming. It was in java, a…
I taught myself TI-Basic in the 7th grade. Then when I was really fluent in it and started hitting its limits around the 9th grade (I was mostly interesting in writing real time games), I picked up z80 assembly. Later (10th grade) I wanted to write programs on my computer, I installed Linux and learned C (not that they're related, but the hacker world really intrigued me. It also means that I spent my first "real" programming years as a member of the broad Linux community; I even submitted patches to large FOSS projects like Gnome, which still shapes me as an engineer to this day).
Then in university we used Ada for algorithms/application programming the first semester (partly because I'm French, and French professors love the fact that Ada is French; and partly for the reasons parent poster mentioned), before transitioning to C (at first for Unix programming, and then more general programming), and finally doing C++/Java in our final year (we also had a few domain specific classes where we used a different language: SQL for databases, assembly for electrical engineering, PHP for webdev, etc.).
I really like the progression I followed, as I feel like it was logically consistent, exposed me to a lot of different aspects of computer science, and forged me into a fairly solid programmer. I've tutored students whose first language was Java, and their mental model of programming/computer science was a big mess. The best of them figured things out a year or so in, but a lot of them remained confused throughout their college years.
Now I volunteer with a program that teaches kids how to program, and we use Ruby. I think Ruby/Python are great for giving beginners a taste of programming; and it's enough for the kids who don't fall in love with it. But with the kids for whom programming just clicks and is clearly going to be their field of predilection as a teenarger/college student, I'm starting to believe that C (ideally on an Unix system) is the way to go.
Re: Learn C, Then Learn Computer Science
#33Does any one know of any good self study resources (or online courses) on this subject?
Re: Learn C, Then Learn Computer Science
#34Re: Learn C, Then Learn Computer Science
#35Lots of people confuse learning to code in C with learning how hardware works. Its close in some ways but not all. EDIT: WOW. I'm amazed at how many people think that C is "how memory works". Just wow. This is one of those things where you're confusing the map for the territory and ascribing value to something because its "hard". C is a fairly high level abstraction for interacting with a computer...i know that every…
Re: Learn C, Then Learn Computer Science
#36Learn C and learn computer science. Let's get away from subjective "shoulds" and talk about practical stuff. You want to learn things, as much as possible, that (a) are likely to remain useful in 15 years and (b) are going to qualify you for the highest quality of jobs. C, as a language, passes this test. So do the fundamentals of computer science; they may not bring you quantity in job opportunities, but they'll giv…
Interesting enough that it is a must for the web development although it's lacking the structure definition from CS point of view.
How about other scripting languages, such as Python or Ruby?
Re: Learn C, Then Learn Computer Science
#37> This semester I used function pointers in an assignment and later heard them described as “Quinn’s magic C voodoo”. I still think I have to polish up on 'em: #include #include // int chk_arg(char *s, int (*f)(int)) { while(*s) if(!(f(*s))) return 1; else ++s; return 0; } // char *s[]= { "1048leet576", "numbers only pls\n" }; if(chk_arg(*s, isdigit)) printf(*(s+1)); > This was confusing - my classmates were juniors…
Re: Learn C, Then Learn Computer Science
#38To truly appreciate C I think having to program in assembly first helps. I say learn assembly first, then learn C. Then do whatever you want.
Re: Learn C, Then Learn Computer Science
#39Personally I take a different view: learn a high-level language, use it to study computer science, and if you feel like writing some low-level code go ahead and learn C (though even then, you could probably do better by bootstrapping a compiler for your favorite high-level language and adding some extensions for low-level operations). C is not the best or even a particularly good language to try to learn abstract CS…
C++ and C are completely different beasts. C is an elegant clean small language with few distracting elements, making it very suitable for a teaching language. C++ is a grotesquerie more suitable for a carnival horror show than something you want to introduce to new programmers. Unfortunately at some point, teaching OOP became all the rage in schools, and so C++ is chosen instead. That's a mistake, Java or C# should…
In my experience TAing an undergrad course that used C++, almost all of the things that left students scratching their heads were things that are present in C. No garbage collector, no built-in way to determine array sizes at runtime, no way to determine if a pointer has already been deallocated, no requirement that non-void functions actually return a value on all control paths, etc. The worst thing C++ does is to amplify these problems (particularly that last one -- yes, I know, use -Wall, but someone who is just starting to use a language would not know that, and having to teach compiler flags is an even worse distraction from the subject matter of the course).
Really the problem is not language size at all. Python is a big language too, but it does not have the above problems. Common Lisp is just as big as C++ (in terms of the number of pages in the standard), yet these are not problems Lispers have. Scheme is a small language, like C, yet the elegance and expressive power of Scheme is on a completely different level from C.
The problem is that the few abstractions C presents are hard to deal with, especially for beginners, and the abstractions that C could present are sorely missed. Even the abstractions C presents are unreliable, with loads of undefined behavior and plenty of ways to break the abstractions.
Really, the fact that real-world C programmers have to pick a subset of the language and enforce various style standards and coding conventions speaks volumes about the suitability of C for beginners. If we were going to require students to use a specific subset of C, why not just write a compiler for that subset and use that to teach? The answer is pretty clear: if we were going to write a compiler for a new language that was suitable for teaching students, we would write something better. Why bother when we already have better languages to choose from? Save C for the OS course, and only as long as it remains relevant there.
Re: Learn C, Then Learn Computer Science
#40Lots of people confuse learning to code in C with learning how hardware works. Its close in some ways but not all. EDIT: WOW. I'm amazed at how many people think that C is "how memory works". Just wow. This is one of those things where you're confusing the map for the territory and ascribing value to something because its "hard". C is a fairly high level abstraction for interacting with a computer...i know that every…