JavaScript is Not Assembly!

Jun 15, 2012 | JavaScript, Programming, Web

There is a growing idea on the web that JavaScript is somehow the assembly language of web. This is a horrible analogy for a number of reasons: it shows a misunderstanding of what assembly language is, implies that JavaScript is not a human readable language, and it  suggests that JavaScript is a far lower level language than it is.

According to Wikipedia, “An assembly language is a low-level programming language for computers, microprocessors,microcontrollers, and other programmable devices in which each statement corresponds to a single machine language instruction.” That doesn’t sound like JavaScript to me. Let’s keep reading and see what else Wikipedia has to say about assembly: “ An assembly language is specific to a certain computer architecture, in contrast to most high-level programming languages, which may be more portable.” Therefore for JavaScript to be considered an assembly language wouldn’t it have to target a specific computer architecture (such as i386 or ARM). Taking this to its logical conclusion, that would mean that for the JS == assembly relationship to work, you would also have to think of different browsers and JavaScript runtimes as different architectures. If that sounds crazy to you, that’s because it is. The analogy is broken just based on the definitions and essence of what assembly and JavaScript are respectively.

JavaScript gets messy. There is no doubt about it. Due to years of abuse by sloppy “devs” (who probably were more closely related to what today would be called an “Interactive Designer”) who didn’t treat it as a proper programming language but rather a little hack to get some fancy animation on a web-page. What does that have to do with assembly? Well, assembly is known to be very hard for humans to read; yes, I am fully aware that there are a number of hardcore individuals who can read and write assembly, but on the whole they are the exception not the rule. Guess what! JavaScript isn’t inherently hard to read. All this complaining about it being a tangled mess of crap is not the fault of the language but the fault of the dev and trying to force some analogous relationship with assembly onto it does not give you some sort of excuse for writing unmaintainable and hacky code.

Did I mention that assembly is low level  “down to the metal” sort of language? Guess what JavaScript isn’t? Ding ding! Well, done! JavaScript is not low level. While your C++ code is compiled to assembly and ran on your iPhone’s lovely ARM processor, your JavaScript is run in a JavaScript engine such as V8 in your web browser. Looks like JavaScript is running at something of a higher level.

My purpose here is not to beat up on the JavaScript detractors. The language (like all languages) could use some work, but adding an unneeded layer of abstraction over it is not going to bring the change the language needs. Standards bodies are slow, but you can “be the change you want to see” (Gandhi). Instead of abandoning it for some questionable layer of abstraction, use the great features in JavaScript, ignore the bad, and write maintainable code. If we all did this we’d find that over time the web would be a better place to work and JavaScript would be a better language to work in.  Not sure what the good parts are? Check out JavaScript the Good Parts. Got some feedback for me? Find me on Twitter or Google+. Also, check out my show Coder Radio on Jupiter Broadcasting. It is a weekly show on the art and business of software development.

More from Mike:

About Me

Hi! I’m Mike! I’m a software engineer who codes at The Mad Botter INC. You might know me from Coder Radio or The Mike Dominick Show.  Drop me a line if you’re interested in having some custom mobile or web development done.

Follow Me

© 2024 Copyright Michael Dominick | All rights reserved