Live data from Hacker News

Learn C, Then Learn Computer Science

qrohlf.com

91–100 of 134 posts

Re: Learn C, Then Learn Computer Science

#91
post #23

Earlier 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,…

Could you name some of the subsets of C? I know of several in C++ (exceptions, templates, multiple inheritance, smart structures) but even after programming in C for twenty years, can I come up with any number of subsets of C (okay, maybe one---function pointers).

Re: Learn C, Then Learn Computer Science

#92
post #79

Lots 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…

To elaborate on this... malloc and free aren't even a part of C itself. Other than static (globals and "static" the keyword) and automatic (stack) allocation there isn't any memory management in C itself. malloc and free are library functions wrapping system calls. That's something to do with the operating system - the machine itself has NOTHING like malloc and free. I and many people know C but know fuck all about a…

malloc() and free() (not to mention realloc() and calloc()) are part of the Standard C Library, and must be provided for a C compiler to be certified as ANSI compliant. Granted, you don't have to use any Standard C Library functions, but a C compiler must have them (or else, it can't claim ANSI compliance).

Re: Learn C, Then Learn Computer Science

#93
You're essentially advocating for a bottoms up approach as opposed to a top down approach (albeit in a pretty confusing manner). Both work for different people and circumstances. Personally, I think C is a bit high level for a true bottoms up approach which is more inline with a computer engineering education as opposed to a CS program from a liberal arts college. A good approach is one I experienced while attending a tier 1 eng school over a decade ago: using ASM of a simple simulated cpu with a small instruction set(risc or cisc doesn't really matter although imo risc is by far easier to pick up for less experienced individuals).

Re: Learn C, Then Learn Computer Science

#94
post #4

Lean C when you need to grok how memory works in computing. Learn Scheme to grok the science of computing. Learn BSD when you want to understand operating systems and the network stack. Grok engineering when you write a scheme->c translator running on BSD.

Could you elaborate more or give some references on the second and third part? I am done with the first. I seriously need some profound knowledge on second and third, which a lot of people like you talk about. I need to put a plan to get there too. Scheme to C looks fun though :-) . Where should I start first with?

If you want to implement Scheme in C, I'd take a look at Scheme From Scratch (http://michaux.ca/articles/scheme-from-scratch-bootstrap-v0_...)

It's pretty excellent for learning how to implement a simple language in C.

Re: Learn C, Then Learn Computer Science

#96
post #36

Learn 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…

"The whole language is a hack." 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?

Python is growing in importance in scientific computing, displacing languages like R, MATLAB, and Fortran (yes, Fortran). There's a pretty good chance it will still be in wide use in science in 10-15 years.

Ruby is harder to predict. It seems like a lot of the web developers who would have used Rails a few years ago are now opting for server-side javascript, based in node.js.

Re: Learn C, Then Learn Computer Science

#97
post #61

I would argue C is a difficult first language. It's even a difficult 2nd or 3rd language. I would start people off programming at a higher level of abstraction and once they can do that dive into how things work. You could start the other way but it may be too theoretical and discouraging. Pascal used to be the language of choice and IMO can still work well. Things got more complicated when we got all those competing…

IMO, C in a unix context is an excellent first language. It is useful in many contexts to learn to look for all the compiler warnings available :). Once you find them I don't think it is particularly hard. I agree about assembler, although I think just learning system calls and C is a good start. "See MIPS Run" is a great way to learn assembler IMO.

I first learned Pascal and was very relieved to move to C. I don't think such limited languages are good for much of anything. They just frustrate users.

I don't know Python but from what I know of it it seems like it would be a fine first language too. Anything else I know of seems like it has significantly wose issues than C IMO.

Re: Learn C, Then Learn Computer Science

#98
post #23

Earlier 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,…

Pointers, raw arrays, manual memory management... So, really, you were teaching C. Now, I'm all for teaching beginners the basics, but don't pretend you were actually teaching C++ as it would be used in the real world.

Re: Learn C, Then Learn Computer Science

#99
post #23

Earlier 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,…

> 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.

Then why are you teaching C++ like you are teaching C?

Re: Learn C, Then Learn Computer Science

#100
I find the notion of syscalls as the interface to an OS more intriguing than the world according to C. C as it stands may be ubiquitous, but other languages can conceivably be implemented as peers to it (rather than on top of it - it took me far too long to realise that). It's fundamental neither on bare metal nor in the presence of an OS.
Post reply on HN