Assembly programming is worth learning?

C language was my favorite programming tool during my undergraduate and postgraduate. I was keen on optimizing c-programs for speed. The quest for speed drove me to the world of assembly programming.

Assembly is the only language that will support to produce highly optimized code. I felt I found the path to attain enlightenment. But assembly programs will be executed only in some machines. That was bit embarrassing and it prevented me from embracing assembly programming.

There was a period of maybe a decade where efficiency was really, really important. I guess it was in the early microprocessor era when memory was still really small and the CPUs were still really slow. We’d get down into assembly language in order to do things like games and music to make it fit and to make it fast. Eventually we got over that, so today we’re writing big applications in JavaScript that run in a browser. – Douglas Crockford in Coders At Work

Those days, I was keeping an eye on computer viruses. Once I came across an interesting book on virus programming by Mark Ludwing. The author was facing a challenge. The people who are interested in virus programming may not know assembly programming and may not have interest to learn it. The author has to convince the readers to be ready to learn assembly programming.

It is just the only way to get exacting control over all the computer system’s resources and use them the way you want to, rather than the way somebody else thinks you should. – Mark Ludwig, The Giant Black Book of Computer Viruses

He succeeded in convincing me and I fell in love with assembly programming!

Assembly programming is time consuming. Readability is poor. Debugging is tedious. Modularity is terrible. Understanding of machine is essential. In a nutshell, you need to give more focus on programming than solving your problem.

In the draft version of The Art of Assembly Language, Randall Hyde refuted all the arguments against assembly language. But His counter arguments were weak. He couldn’t present any facts or statistics to support his claim. And He didn’t include the counter arguments in printed version of that book.

I didn’t require assembly language for any of my problems. No learning will be in vain. It helped me to understand c-language better. compiler classes easier. The most interesting thing I found in assembly language is that C language control statements (loops, if, switch, break, continue, goto) are all just jump instructions!

No longer programs are coded completely in assembly. Machine got better memory, storage and speed. Moreover, compiler became smarter. The modern approach is to code programs in C/C++. If there is any bottleneck, identify the part to be optimized and write only that part in assembly language. There will be some situation to code entirely in assembly language for embedded devices.

Ten years ago I would have said absolutely the first thing you have to do is learn assembly language. You have to learn how the machine actually works. Does that matter any more? I don’t even know. Maybe it does. But possibly not. If the way software is going to be ten years from now is all web applications or a piece of distributed code in some rented computing cluster that’s moving around between a dozen different Google servers and spawning other copies of itself and then merging back together once it’s got results, does anyone need to know assembly language any more? Is that so abstracted away that it doesn’t matter? I don’t know. – Jamie Zawinsk in Coders At Work