3 ms·
Assembly is absolutely not the first language I would teach people. It has several severe flaws from a pedagogical perspective. The first is the number of "mag
by jcranmer 5y ago
Assembly is absolutely not the first language I would teach people. It has several severe flaws from a pedagogical perspective.
The first is the number of "magic things that won't be explained until later." Want to output a string to the console? That requires a magic mechanism (syscall) which isn't going to be covered until later. Doing almost anything with strings involves going through function calls (and the concomitant need to put things in specific registers). Mixed code and data? Here's some magic assembly directives! Get it wrong, and your program breaks in really non-obvious ways [1]. (To be fair, Java also scores pretty poor on this metric; a language like Python scores much higher)
The second problem with assembly is that there's a lot of busy work you have to do yourself that serves no functional value. You have to manually allocate registers to variables (which means remembering what r3 means in this section of code); you have to give a unique name to the target of every jump for every if/then/else statement, or loop, or whatnot. Depending on your assembly variant, even "set this register to a large constant" can be a nontrivial undertaking. This severely limits what problems you can assign to students.
[1] I've TA'd intro-to-assembly several times, and I can attest there's quite a few people who struggle with "no, you can't put your data before your code because the OS will try to execute the data as code."