5 ms·
C should be the defacto language for 1st year CS students. It is not highly abstracted from hardware, and much easier to grasp Assembly knowing basic C. The syn
by blueatlas 10y ago
C should be the defacto language for 1st year CS students. It is not highly abstracted from hardware, and much easier to grasp Assembly knowing basic C. The syntax uptake is pretty quick, and would allow students to focus on the problem at hand (e.g. algorithms) rather than language nuance. Not to mention the advantages to the graduate starting their career in software development.
It's also easier to go up the stack to object oriented languages, particularly Java. The second chapter, first edition, of David Flanagan's Java in a Nutshell is still, in my opinion, the best intro to Java after having some experience with C.
- feklar 10y agoIt is as some schools, Harvard (CS50) and CMU (15-122) both cover C in first year.
- kuschku 10y ago(Scheme, ASM), (C, Java), (), (Haskell) is the usual I heard of (seperated by semester).
- nightcracker 10y agoI think people should learn Scheme or Python to learn programming, and C to learn our architecture.
- IndianAstronaut 10y agoDefinitely. Beginner programmers are struggling with for loop syntax. You really don't need to start them on pointers.
- pcwalton 10y ago> The syntax uptake is pretty quick, and would allow students to focus on the problem at hand (e.g. algorithms) rather than language nuance. I don't agree. What's the benefit in having to painstakingly write trivial string operations using string.h and manually allocated buffers? What's the benefit in learning the ins and outs of undefined behavior?
- guyzero 10y ago"What's the benefit in learning the ins and outs of undefined behavior?" To force people to learn that making assumptions based on undefined behaviour is dangerous and that computers are not mind-readers. And you force people to write buffer manipulation code so they realize how good people using other languages have it.
- pcwalton 10y ago> To force people to learn that making assumptions based on undefined behaviour is dangerous and that computers are not mind-readers. You can do that in a lot less time with, say, Array.sort in JavaScript. Explaining that signed overflow is undefined, and why it's undefined, is a whole lot of digression for little gain. > And you force people to write buffer manipulation code so they realize how good people using other languages have it. Seems like a lot of time to spend to make a point that would have been a lot more relevant in 1990 than in 2016.
- CJefferson 10y agoExcept, undefined behaviour seems like mostly a C, and C derivates, concept. I teach C, and every year I have a number of students nearly in tears, because somewhere in the huge program they accidentally malloced sizeof(T*) instead of sizeof(T), but of course that causes a crash 10 minutes later in a totally different piece of the code base. My hope (it's not quite there yet, but getting closer) is that things like clang's sanitize modes will reach a point where any undefined behaviour immediately causes an abort. Then students can still figure out what they did wrong, but have a chance of finding the source of their bug.
- mdergosits 10y agoSometimes I use something like: #define ALLOC(n, type) (type)malloc(n sizeof(type)) which makes it harder to have those types of bugs, though not impossible.
- 9248 10y agoSpeaking as a past student I'm really glad I started with C. In the beginning, the fear of getting some random Segmentation fault out of nowhere actually taught me more than any textbook, school or best practices blog could ever do. It also forced me to learn how to use debuggers :)
- nickpsecurity 10y agoThey get way better results learning Pascal or Oberon first if we're talking imperative languages. They do common stuff like problem-solving, get in habit of using typing, and don't worry about memory errors as much or undefined behavior. Then, they can start working with pointers and UNSAFE modules to see how they can shoot selves in foot but do low-level or high-performance stuff. They can learn to avoid pitfalls. Only then should they learn C and its horrors.
- minionslave 10y agoI agree. In 2011, my first programming course in college( computing 1), was taught in C using a plain text editor on a Unix-terminal. I'm so glad it was in C , it allowed me to understand how the computer works better.
- joslin01 10y agoIt was the first language taught at my university and I wholeheartedly agree. Java was actually more confusing because I couldn't comprehend what the classes/objects things were at first. I just knew functions.
- khedoros 10y agoJava was the first OOP language that I learned. We started with some unexplained boilerplate "class Blah, public static void main", and learned the basic syntax of the language by building functions. OO concepts were introduced after that, and the boilerplate code was explained. I'd done Basic, VB5, and what I'd call "C with iostreams" before college, and it felt like a fairly gentle exposure to classes and objects. Recursion took me longer to get a handle on, actually.