A necessary evil

Javascript is everywhere. It’s embedded into the internet so deeply that even people that have no idea about coding have probably heard of it. It’s everywhere you go online. It’s pretty much inescapable at this point.

This means it’s something any person who wants to communicate with machines needs to learn to do so. If coding is how we talk to computers Javascript is the best way to talk to web pages. Unfortunately Javascript is an entirely different beast than our beloved Ruby.

I’ve spent a lot of time gushing on Ruby and Rails because, why not? They are great communication tools. Javascript is also a great tool but it’s not nearly as intuitive as lots of either of those two.

Or is it?

While Ruby seems easy to read that’s more so due to the fact that someone purposely designed it that way. A lot of thought went into making Ruby a really readable form of code. Any time someone sits down with the express function of designing a really easy to read and useful langauge they are going to labor over it until it meets the vision they have. That’s how Matz wrote Ruby. That’s how Hickey came up with Clojure. So why is Javascript any different?

Javascript was developed by Brendon Elch at Netscape in 1995 to be a middleman between users and the internet. As the internet was taking off he took it upon himself to built “the assembly language of the web”. I really doubt that in 1996 Mr. Elch thought he was going to make the foundation for virtually all web pages that would exist after that but, hey, that’s software right?

So Brendon coded JavaScript in a mere 10 days. Not a lot of time to sit and think about the future of coding or what is going to happen down the road. However it was the perfect amount of time to make a language that works and works well. If that wasn’t the case we wouldn’t be talking about it right now.

As a result of these things Javascript is radically different than Ruby. For one Ruby is object oriented, which is moreso a way of thought and organization, as opposed to JS’ Dynamic programming, which means breaking things down to smaller sub problems and going through them one at a time. One isn’t better than the other per se but going from one language to another takes some getting used to.

In JS classes aren’t a thing. The way things get their properties is much more direct. Each function is a self contained world that is on it’s own. So no classes. Also no methods. JS has functions and functions are our “verbs” but they are really self contained and work different than methods do.

They will either sound confusing or make sense to you depending upon your background in computer programming.

Also no ends. Or we have endings but not actual “end”s and now they are semicolons. So yes. Semicolons everywhere!

I could go on and on about the differences and pick apart all the things that challenge my thoughts but I don’t really gain much from that. I’d rather focus on similarities. For a very funny take on programming language quirks I suggest this talk https://www.destroyallsoftware.com/talks/wat. It brings up a lot of JavaScript’s “features”.

Let’s talk about Abstraction. Good code should rely on it. The language you choose shouldn’t make a huge difference as long as it gives you the tools to use abstraction and JS does a good job of insuring you can.

That brings me to the actual words in the language. JS has a really similar set of words it uses to solve the same problems all other languages face. It maps, reduces, it does all kinds of stuff.

So in the end there are some differences but there’s also a lot of similarities. So conceptually they have similar end games it’s just the routes they take to get there that are different.