5 ms·
If you want to "think like a computer" then learn assembly, not C. I'm not joking. In my experience young devs using C get very confused about wtf pointers are
by ChrisSD 9y ago
If you want to "think like a computer" then learn assembly, not C. I'm not joking.
In my experience young devs using C get very confused about wtf pointers are really about and what's the deal with the heap, stack, etc. Whereas they understand the concepts better in assembly despite the verbosity.
I'm not arguing for a deep understanding of assembly but if the goal is to "think like a computer" than at least a basic understanding is incredibly helpful. Or at least less confusing than C.
- notacoward 9y ago> if the goal is to "think like a computer" If the only goal. The OP listed four.
- gerred 9y agoHe stopped reading after one for the sake of sweet karma.
- Avshalom 9y agoI'll give shit about #1 when someone invents a time machine and prevents Java from existing. #2 is a great reason to learn Latin but the "influence of C" is identical to the influence of Fortran or Pascal or Algol and of equivalent magnitude to (what evolved into) Common Lisp or Scheme. And #4 is true eventually but it only matters when the software is broken.
- notacoward 9y agoWell, that's a better answer than I was responding to. I think I disagree a bit on your response to #2, though. Sure, other languages have also contributed mightily to the design of later languages. Some of them might have contributed more than C. OTOH, they haven't contributed nearly as much to the design of libraries and runtimes that are also important for a working engineer to understand. Programs written in any language are loaded into memory in a manner designed to accommodate C. The primary interface between userspace code written in any language and the kernel is via direct syscalls or libc, which were likewise designed with C's needs in mind. When those APIs do change, it's the C definitions that change and other languages are left on their own to parse the new definitions. So it's true that other languages have been just as influential from a computer scientist's perspective, but from a working engineer's perspective no other language comes close.
- marssaxman 9y agoWhen is the software not broken? The software is always broken while we're working on it, or we'd have shipped it already, and moved on to the next thing we need to break so we can improve on it - that's the nature of the job.
- Avshalom 9y agoOn one hand yes on the other hand in interest of being pithy I did not say: even when software written in C is broken you're going to need more than a couple semesters of class or a couple months of use to actually fix the C underpinnings of pygtk.
- banku_brougham 9y agoHey! FORTRAN isnt bad at all so...
- jftuga 9y agoYes, because that's what I am going to do when/if I build a time machine.
- ChrisSD 9y agoTo be honest of the four listed reasons I only found the last to be compelling. I did however think the third point was worth commenting on as I don't think C is a good way to achieve that goal.
- waynecochran 9y agoLearn ARM or some other RISC architecture and not x86/amd64 if you want to learn assembly. x86 and its forever backwards compatable Segmented Memory/CISC architecture makes asm programming painful (not to mention I have learned at least three different syntaxes for x86 asm : (1) MASM/BASM/TASM/NASM, (2) GNU AS (gas), (3) Amsterdam Compiler Kit -- the last two are meant for compiler backends and not human programmers). I actually cut my teeth on TI's TMS34010 asm. Simple RISC (lot's of registers), flat address space, and bit addressable. I loved it.
- kqr 9y agoI can recommend MIPS assembly. It has been the only assembly I've used that actually felt like it was intended for human consumption.
- userbinator 9y agoMy experience with MIPS is the complete opposite --- simple things like loading a single constant into a register require two instructions, and the lack of addressing modes is also a bit annoying. Breaking dords into bytes and vice-versa involves long sequences of shifts and logical operations, the branch delay slot is confusing to say the least, and the plentiful-yet-unhelpfully-named registers don't really make things any easier. At least ARM's conditional execution and barrel shifter are more interesting and versatile. Then again, I admittedly learned 8080 and then Z80 and x86 first, so any RISC feels too simple; but those who learned any RISC first probably feel the exact opposite.
- nbsd4lyfe 9y ago> Breaking dords into bytes and vice-versa involves long sequences of shifts and logical operations modern MIPS has "ext" and "ins", which are probably an improvement in that regard. > plentiful-yet-unhelpfully-named registers what's wrong with MIPS register names? my only comparison is x86 and that has been awful. I'm constantly looking up which registers are what.
- 9y ago
- kahlonel 9y agoI partly agree with you. But its a fact that you can't just start learning assembly if you have never learned C in the first place. So, young devs, please start learning C first.
- mettamage 9y agoThis is false. I have learned the basics of assembly without knowing C first. My experience before learning assembly was: Java, Python and some Objective-C (without knowing pointers). So if your point is that you need to learn programming first, then maybe that is true but I highly doubt it. But I can't refute that with my own experience. Here wa my roadmap: (1) I first learned assembly by learning computer architecture from Tanenbaum's book -- Structured Computer Organization -- and related course at the Vrije Universiteit Amsterdam. This taught me a toy architecture (Mic1) but it give me a rough idea of how assembly worked. (2) Then, later I took a course in binary and malware analysis and all that we were required to do was to read x86 assembly in IDA and interact with it via GDB -- and using the command: layout asm, which gives a layout for all the register values and upcoming instructions. And once I have a debugger available and understand it well enough, I can learn quite well since I can make little predictions and check if they are right or wrong, and so on.
- Santosh83 9y agoI learned assembly as my first ever programming language and it was just fine. Assembly tends to be simple and can get you coding quickly and understanding the machine as well. It's of course an awfully inefficient way to code in general and that's why we have HLLs but its not true that you need to learn at least one HLL before learning assembler.
- lttlrck 9y agoThat’s simply untrue. Start with a small micro controller, a Microchip PIC for example and you’ll quickly find C is complete overkill.
- turbohz 9y agoForgot the /s?
- imron 9y agoAgreed. When I did my undergrad, Ada was the primary language of instruction for first year, with x86 assembler taught as a subject in the second semester. The idea being to get us thinking about programming correctness from the beginning, then to teach how the machine worked once we had a good foundation. By second year we were just expected to know C, and coming from assembler, things like pointers were something I never had a problem understanding. Start high to get a good grounding, go low to understand how everything works, then return high to write code that has a good grounding in how it will be executed on the machine.