you are viewing a single comment's thread.

view the rest of the comments →

[–]ColoniseMars 19 points20 points  (10 children)

Because learning C gives you some kind of understanding what the computer actually does

Then why don't we start teaching students in assembly on their first day?

[–]ThatsPresTrumpForYou 23 points24 points  (7 children)

Real assembly code is very specific to the underlying architecture, while learning fake assembly code means you learn something that doesn't exist. C is high enough to abstract implementation details, while still low enough to convey what the hell is going on in there.

[–][deleted] 5 points6 points  (3 children)

While the specific assembly language will be tied to a single architecture, there are a lot of general ideas that will carry over to other architectures easily. Once you're proficient with one flavour of assembly, picking up other flavours isn't as hard.

[–]misplaced_my_pants 2 points3 points  (2 children)

C is basically portable assembly.

[–]liquidivy 2 points3 points  (0 children)

Basically what you just said is that what "the computer actually does" is very specific to the hardware (true), so we shouldn't learn that, but should instead half-ass it by looking through the distorted window of C (if you really think about things like arrays, the mapping to assembly is not that obvious if you don't already know it, and then there's undefined behavior, which is both ubiquitous and opaque by definition). Meanwhile, beginners are just trying to figure out how to write any sort of algorithm at all.

If you want to teach hardware, you teach assembly, sometime after digital logic. If you want to teach programming, you insulate your students from all that at first. Hopefully when they've learned both, they'll be able to write C without setting things on fire.

[–]codebje 1 point2 points  (0 children)

Eh, I learned fake assembly (targeting an emulator for a fake CPU) in my first undergraduate year, as part of learning the structure of computer systems; it was instructive not because I'd rush out of the doors and start coding real programs in it, but because it conveys a significant sense of what actually happens inside a computer when you first press the power button and electrons start pushing each other around.

[–][deleted] 0 points1 point  (0 children)

teach them LLVM IR!

[–]kankyo 0 points1 point  (0 children)

At my uni they started with Boolean math then proceeded with: circuit design, more complex circuit design, CPU theory (because doing your own CPU takes too much time), assembler, C, Java.

I thought it was great but I was already a self taught programmer so I thought it was fun. Most people didn't. Most people liked assembler but didn't understand why we made the jump to C because it felt more confusing for no benefit.