Please don't! Learn Delphi/Object Pascal, Ada, Modula-2, Rust and discover control over memory managerment doesn't require throwing safety out of the window. Performance can be fine-tuned to the 1% hotspots that really require playing dirty tricks. That there are modular systems programming languages with compile times times that leave C to shame. Then cry as you are forced to adopt C to be understood by the rest of…
The problem being, if you show up and all you know is Delphi / Pascal / Ada, you're going to be unemployable. [I'm a veteran of a ton of Object Pascal, btw. Done some Delphi, too -- it was nice. But.] In general, pushing a niche language as The One does not do a beginner a service. Delphi has never been more than a niche. We had a guy at Apple decide to do his project in Oberon. Super smart guy who pretty good work.…
Learn C, Then Learn Computer Science
41–50 of 134 posts
Re: Learn C, Then Learn Computer Science
#42Personally 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 is about as close to teaching the mechanics of the computer as you can get while staying portable. I've found that my ISA knowledge "just works" on any architecture though, so I would feel okay teaching something like C-- or LLVM IR along with an arbitrary ISA to allow the mind to have a lowest-common denominator. CS is to CE as Chemistry is to Physics. Chemistry lets you do a lot with less, but Physics is where yo…
Why is it important to teach the underlying mechanics of a computer in a data structures course, or an algorithms course, or really anything beyond OS or computer architecture courses (and perhaps a compilers course)? The reality is that the way computers work "under the hood" is counterintuitive in an extreme sense. Pointers are a counterintuitive abstraction. Fixed-width arithmetic is counterintuitive, as is having integer division always round down, as is using floating pointer numbers to represent fractions. Yes, eventually a CS student should learn about these things -- but an introductory course is the wrong place, as is basically anything that deals with purely abstract notions (data structures, algorithms, cryptography, etc.).
Re: Learn C, Then Learn Computer Science
#43Earlier quoted context omitted.
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…
"C++ is a grotesquerie more suitable for a carnival horror show than something you want to introduce to new programmers." 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,…
The undefined behaviour is particularly bad. Its hard to tell if a wrong result is coming from a wrong algorithm or from some undefined behaviour that is silently messing up your results and this only serves to confuse students. Its also a PITA to debuig segfaults - even just getting a stack trace means that you need to use a separate debugger tool.
Another thing you didn't mention about the garbage collection is that it makes it much harder to do string handling. For example, the simple task of reading a name from standard input has multiple solutions and but all the simple ones (scanf and gets) are potentially dangerous. And this is not counting the off-by one erros in allocation because of forgetting to account for the null terminator.
Re: Learn C, Then Learn Computer Science
#44Earlier quoted context omitted.
C is about as close to teaching the mechanics of the computer as you can get while staying portable. I've found that my ISA knowledge "just works" on any architecture though, so I would feel okay teaching something like C-- or LLVM IR along with an arbitrary ISA to allow the mind to have a lowest-common denominator. CS is to CE as Chemistry is to Physics. Chemistry lets you do a lot with less, but Physics is where yo…
"C is about as close to teaching the mechanics of the computer as you can get while staying portable" Why is it important to teach the underlying mechanics of a computer in a data structures course, or an algorithms course, or really anything beyond OS or computer architecture courses (and perhaps a compilers course)? The reality is that the way computers work "under the hood" is counterintuitive in an extreme sense.…
"...an introductory course is the wrong place"
I'm glad we're in agreement.
Re: Learn C, Then Learn Computer Science
#45Earlier quoted context omitted.
"C is about as close to teaching the mechanics of the computer as you can get while staying portable" Why is it important to teach the underlying mechanics of a computer in a data structures course, or an algorithms course, or really anything beyond OS or computer architecture courses (and perhaps a compilers course)? The reality is that the way computers work "under the hood" is counterintuitive in an extreme sense.…
"The guts of CS are a great place to expand after a certain point ." "...an introductory course is the wrong place" I'm glad we're in agreement.
Re: Learn C, Then Learn Computer Science
#46> 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…
I am positive that 95% of the CS students with a BSc. degree in my college haven't even seen function pointers. We learn the basics of C then OOP in C++ and the rest of the study will be Java. It's a farce and as an employer I wouldn't even care whether my employee has a fancy degree. You won't find real coders if you choose them by their degree. At least in Germany it's like that. I am not sure of it's different in…
I get the impression it is the same situation in the UK. It's nice knowing I can do a dozen rounds with a CS graduate.
Re: Learn C, Then Learn Computer Science
#47Personally 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…
eyeroll
Re: Learn C, Then Learn Computer Science
#48Earlier quoted context omitted.
C is about as close to teaching the mechanics of the computer as you can get while staying portable. I've found that my ISA knowledge "just works" on any architecture though, so I would feel okay teaching something like C-- or LLVM IR along with an arbitrary ISA to allow the mind to have a lowest-common denominator. CS is to CE as Chemistry is to Physics. Chemistry lets you do a lot with less, but Physics is where yo…
"C is about as close to teaching the mechanics of the computer as you can get while staying portable" Why is it important to teach the underlying mechanics of a computer in a data structures course, or an algorithms course, or really anything beyond OS or computer architecture courses (and perhaps a compilers course)? The reality is that the way computers work "under the hood" is counterintuitive in an extreme sense.…
Any course on crypto needs to address both algorithms in the abstract and the particularities of how they're implemented in the real world.
Re: Learn C, Then Learn Computer Science
#491) Computer Science, which is, in my opinion, entirely a subset of mathematics, and should be taught as such.
2) Coding, which is the ability to break a problem down and describe it in a series of simple steps.
3) Craft and application, which is everything about how to use tools, best practices for code architecture, and everything else that every new graduate is usually terrible at.
I think we could satisfy most of the world's need for "programmers" by teaching #2 and #3 in a trade school model.
Re: Learn C, Then Learn Computer Science
#50* Turing machine -- just the tape and making it do the equivalent of procedures so that we can compose things. Brainfuck is a valid homework medium.
* A relevant ISA such as ARM -- We can let Thumb/2 be bonus points, but the real goal is just to convey that ISA's are usually written to take the most generally abstractable things you would do with a Turing machine and do it more succinctly and faster in hardware.
* Build a function stack with the goal of understanding how procedures become generalized by calling conventions or optimized by inlining. The lesson is that we stay pure for flexibility and get dirty for raw speed.
* Introduce Scheme and tail recursion optimization. Now the whole of functional programming and the abstractions -- and their optimizations -- are opened up with a firm footing in the machine.
Turing and Church probably did write most of CS, so it's obvious that you want to relate the two to create the most generally useful bridge concepts for the rest of the long life of a programmer, that if they never let up, will inevitably touch both high-level and low-level languages.
OS's are the final frontier here, but cannot possibly be squeezed down due to things like MMU functionality totally clouding up what is what. Making a machine look like it belongs to the program is what OS's are good at, and this is a different kind of abstraction to grok than the relationship between the machine and the programmer.