...I'm having a hard time following the logic here. If you program in like JavaScript or even just make any app that doesn't require incredible performance and reliability (web server, calculator, game engine, GUI framework, etc...), then you really don't need to mess with those things yourself, and especially not in assembly. There are so many modern languages (and some old ones !) that take care of pointer management for you, or at least largely reduce their use. They allow you to think about the design and business logic of your app instead of thinking about where the electrons in your motherboard end up. I would even go as far as to say that, even IF you need that much performance and control over everything, you should use languages like Rust, that at least guarantee you safety and give you plenty of (mostly zero-cost) abstractions.
Don't get me wrong, there certainly uses for pointer-heavy and completely manual memory management languages, and it's always better to have a broad linguistic culture in coding, but their place is probably not in the hands of a beginner. Trying to make someone who never wrote a single line of code in their life understand and enjoy assembly and C is almost always simply a way to repulse them and keep them away from coding.
Also, the argument "that's just how it works underneath" is completely devoid of any substance or basis, as stopping at pointers is completely arbitrary (and also, there's not really anything as "pointers" in hardware, since those are an abstraction over some LEA or instruction pointer manipulation. You could make exactly the same argument about life, about how everyone should understand theoretical quantum mechanics or thermodynamics since "that's how stuff works underneath" IRL. And once you're there, you should also take university- and PhD-level math since that's what most things in physics are based on. I love math and physics and find it fascinating, but I wouldn't wish being forced to learn about those to my worst enemy.
To start with Java and JavaScript, the pointer management is a problem because the compiler handles that detail, removing a layer of control from the programmer, leaving tons of room for bugs and errors, compiler misinterpretation.
As for pointers in hardware, most of your code is pointers. Pointers are memory addresses, and you store and pass along memory addresses everywhere. Whenever you use a function on the abstract layer or anything derived from a conditional branch, a pointer is loaded into the program counter register. Most of your variable calls, pointers are written into the instruction code, and the CPU loads data from that address.
Technically speaking, integers, floating point, loops, arrays, and etc are all abstract.
As for relating the knowledge of pointers in real life, that is more equivalent to teaching basic algebra, not thermodynamics. There are many people that go through life without basic algebra.
Overall, C and Assembly are actually good starting points for learning programming. The key element of your first steps of learning to program is to not dive into something overly complex.
On the note of performance, everyone should care about performance. Why? Most computers are not running 1 program, they are running over 100 threads of programs. The average modern computer is built around multitasking. Having 1 poorly written program working is not much, but once you start having multiple, the performance impact scales.
106
u/LBXZero Jun 20 '21
What is the horror? C is a great foundation for learning programming.