I'm not convinced that these things need to be mutually exclusive. In the CS department at my university, the only language used for the first 3 years is C. But all of the courses are split in to a "lecture" and "lab" component. In lecture you learn about Computer Science; you learn data structures, algorithms, computational complexity, graph theory, proofs, summations, stats, combinatorics, etc. In lab you learn Pro…
And how did that work? I'm just trying to imagine those first year students staring at those segmentation faults or trying to decipher some other non-intuitive C behaviour (promotion rules, = vs. ==, pointer arithmetics, various implicit rules). Talk about being thrown into the deep end of the pool to swim... When a language like Pascal is taught as a first language students can focus on the mechanics of their algori…
Learn C, Then Learn Computer Science
121–130 of 134 posts
Re: Learn C, Then Learn Computer Science
#122Earlier quoted context omitted.
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).
I know gcc provides them for you if you don't specify the right includes, but that's gcc, like.
I think I'm going to go on considering them not technically part of C itself, until I have more information.
Thanks.
Re: Learn C, Then Learn Computer Science
#123Lots 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…
ufo got my point. the modern microprocessor is vastly different than the view of the world that is exposed through C. The fact that C still works is more of a testament to hardware designers than it is something "intrinsically true" about C and its design decisions.
Re: Learn C, Then Learn Computer Science
#124Lots 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…
At this point, the only thing that still keeps C close to the hardware is that they need to keep the hardware close to C model because of all the legacy code in the world. Most recent hardware innovations, like pipelining, speculative code execution, SIMD, etc are not easily expressed in C. Additionally, C was written in a time where accessing the memory was cheap and had a uniform cost - nowadays memory access times…
Re: Learn C, Then Learn Computer Science
#125I 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.
With UNIXs spread into the enterprise, C started to gain weight.
If UNIX hadn't been successful, it would just be yet another language.
Re: Learn C, Then Learn Computer Science
#126Earlier quoted context omitted.
"I think they are both valid approaches." For limited ranges of valid. If you are implementing a low performance requirement CRUD app, certainly you can become an effective programmer without knowing the low level details. But if you want to be an engineer? Good luck. I've worked with people that didn't know the stuff behind C, and they are pretty useless as soon as performance matters, or you need to talk to hardwar…
There are advantages to the other side. Many fascinating developments were made possible by those who prefer to think functionally, as opposed to imperatively. Modern relational database engines are fairly easy to implement once you understand set theory. Lambda calculus has taught me how to create a linked list using nothing but partially applied higher order functions. Software transactional memory was invented in…
I'd be willing to bet that the people that came up with software transactional memory were comfortable in C and assembly as well as Haskell, and hadn't bottlenecked themselves with the false dichotomy of thinking functionally vs thinking imperatively.
The world needs people who think mechanically AND at a high level of abstraction at at the same time.
Re: Learn C, Then Learn Computer Science
#127Earlier quoted context omitted.
I have a similar experience, and agree with your sentiment. 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…
I agree. I think the ideal is something like 6 months Python/Ruby, 1 year C, then one OOP and one functional language.
I appreciate C, but wish I learned more high level languages to be more prepared come graduation. C is important to know, but it can also be overemphasized in some colleges.
Re: Learn C, Then Learn Computer Science
#128Earlier quoted context omitted.
Ah may I ask which university? Mine also did Ada, then Unix in C, also Scheme thrown in there. Awesome progression, having learned Ada is really nice, it made me aware that there is a better way to do things, even if I never get to use that better way in real life!
That's the thing, many that learn only C think it is the only way to do system level programming.
The last team I was on held regular classes on F#, I'm sad the team got disbanded before I picked up a significant chunk of the language.
Re: Learn C, Then Learn Computer Science
#129Earlier 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.…
I'd say this is an extremely important part of a data structures course.
Say we have an array of integers and a linked list of integers. Which will take less time to iterate through? We all know it's the array, but you have to be aware of how caching works to know that that's the case. Which takes less space in memory? Again, we know it's the array, but you have to understand pointers to know why that's the case. If you only know what a linked list is in the abstract, then you'll have a hard time reasoning about space usage when compared to an array.
These are just a few examples, but there are countless more. It's hard to reason about how the different data structures work in the real world if you don't know how the computer works.
> The reality is that the way computers work "under the hood" is counterintuitive in an extreme sense.
Since when was CS about teaching only what's intuitive?
Re: Learn C, Then Learn Computer Science
#130Earlier quoted context omitted.
Ada's powerful. The typing system is the best of the mainstream imperative languages. You can write good cross-platform code without thinking about endian issues. Almost as fast as C, strong gcc support. It's a shame it's so damn verbose. A fortnight ago I was trying to brainstorm how I could put a tighter syntax on it, possibly with some kind of pre-processor. Ideas welcome!
> It's a shame it's so damn verbose. When a big part of your job is to read the code from others of various skill levels, one learns to have a soft spot for verbosity.
More words do not necessarily lead to clearer, more understandable code.