Question:
Is assembly language even worth learning?
anonymous
2018-02-16 05:48:46 UTC
I know how to code in Python, and a bit of C & C++, but is assembly language worth learning? I've heard the programmer has more control over the hardware with assembly, although I know that assembly varies form computer to computer. I've also heard many highly successful people know assembly such as Paul Allen, Bill Gates, and Elon musk (I'm not sure if this was because computers were "newer" back then).
Nine answers:
?
2018-02-16 21:01:18 UTC
There are many different assembly languages. It is probably not worth learning any assembly language unless you are low level coding for an specific type of machine, such as a specific games console, and you need to write extremely efficient code that can take full advantage of the specific computer's instruction set and hardware features.



Try porting a Python program into C. For a processor intensive program, the C version can easily be 100 times faster than the Python version. For specific types of problem, assembler can produce perhaps 10 times faster processing than C.



In the early 1980s, I wanted to produce the answer to 1000! (1000 factorial). This was a long time before Python, but I used Basic, which like Python is an interpreted language. It took half an hour to write and debug the Basic program and 5.5 hours for it to run.



As an experiment it took nearly six hours to write and debug an assembler version, which ran in just a few minutes. In both cases, the total time was around 6 hours. This might seem slow, but in the early 1980s, an 8 bit 8085 CPU was quite fast at the time.



Unless you are developing code to be run many times, assembler probably won't help much. Also, unlike higher level languages such as C, assembler code tends not to be portable between different platforms.



I hope this helps.
VP
2018-02-16 20:55:24 UTC
I agree with Mr. J. If it's interesting to you -- learn it. Might come a day when someone on the crew needs to do something in Assembler and you'd be somewhat familiar with the language. As a mainframe systems programmer, we often had to create and maintain various application exits that were written in Assembler. It was just enough work to keep us sharp.
Kaydell
2018-02-16 17:16:16 UTC
I had to learn assembly language to get my bachelor's degree in computer science. Knowing assembly is good to understand deep down how computer software works. Every interpreter and compiler translates source code to machine code which can best be understood by humans as assembly language.



As far as debugging goes, even in a high level language, in addition to using the source-level debugger, very occasionally, I have used the object debugger to view the assembly-level code to see what's going on "under the covers".
?
2018-02-16 14:46:40 UTC
Yes, if you are a systems programmer and work with devices like micro-controllers.
husoski
2018-02-16 13:53:30 UTC
The same questions were being asked about assembly on mainframe computers in 1971, when languages like FORTRAN, PL/I and COBOL were powerful enough to write all applications on mainframes. I learned it because I was curious, not because I was looking for a job. The class I took "because it might lead to a job someday" was RPG programming. (That's IBM's "Report Program Generator", not "Rocket-Propelled Grenade.")



I ended up doing a lot of assembly from mid '70s to mid '90s, but never wrote a single line of RPG professionally.



My advice is to skip assembly if you're not interested. You probably won't need it for large-scale applications. Some variant may become useful again if "wearables" ever really take off. Simpler processors with smaller memories and very low power consumption might have a practical advantage there.



Plan to learn how to learn, and find those areas where you are curious enough to learn them very well. Over my stretch, programming has been a career of life-long learning. What you need to know can change from project to project; and some of what you'll need to know hasn't been invented yet.
?
2018-02-16 10:02:39 UTC
I have programmed TONS of "machines" in Assembler.

For the Army, the initial program of a remote controller was using C, but the hardware was limited, and we could not add any function: the code from C fillet up the 12Mb of memory.

I re-wrote the whole program in assembler... and got it in less than 2Mb! Plenty of room. This to say that C/C++ is not bad, but extremely inefficient at compiling! And I am back now with assembler on Arduino: small processor... but very powerful if coded in assembler!
Andy T
2018-02-16 08:48:20 UTC
Computers were "new" back then so you hit it right in the money. I doubt even Windows drivers are still done by Assembly even however small a submodule we dug. It would still be good if you intend to be Kirby engineers or one of those electronic toys with an 8008 MCU inside. But otherwise assembly language will get you nowhere, or might even detrimental.
Robert J
2018-02-16 06:11:33 UTC
It may occasionally be useful. It comes in to its own when you need to do really time-critical stuff or low-level manipulation of i/o in embedded systems.



If you are working in C, in some way you can almost consider that a higher-level assembly tool; when you get to really know a particular compiler & CPU combination, you can just about predict what assembly code each operation will produce.



Most compilers have an option to produce an assembly listing - it's worth studying the output with some simple programs using combinations of built-in functions like integer maths and bit shifts / bit logic to get an idea how the compiler deals with them.





Overall, I'd say if you are going to work with small MCUs and embedded systems, assembly is far more likely to be useful than if you only ever work with programs that run on existing operating systems.
Joe
2018-02-16 06:00:46 UTC
You can have a really nice career without Assembly Language.



But, if you really want to understand how computers work, or program "right down to the bare metal", you'll have to learn at least a little assembly.



Maybe someday, learn enough to play around with it a bit. But I don't see it as a priority, these days.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...