Courting Javascript as a Rubyist

Six weeks into the Web Development Immersive program at the Flatiron School and I’m smitten with Ruby. It’s hard to not be charmed by a programming language that provides flexibility, finesse, and a lovely library of methods. I often heard people exclaim that programming in Ruby could turn code into poetry.

However, next up is JavaScript. During my time learning HTML and CSS, I’d been introduced to JS through the safety of JQuery. I’ve worked with developers that strummed up custom JavaScript to layer over forms to make them more dynamic.

I was concerned with understanding the major similarities and differences between the two languages. So, I scoured the Internet and Google to collect tidbits of information to assist me in this transition over to JS.

Here’s a collection of those tools and resources.

A Brief History of JavaScript

Javascript first came into the scene in 1995 when Netscape, a leading web browser at the time, hired Brandan Eich to create a new programming language. Netscape wanted something they could layer on HTML to make the web more dynamic. The rumor is that ten days later Eich delivered with JavaScript.

JavaScript’s reach spread as more websites began to use it. Major web browsers incorporated it into their tools without requiring add-ons. With the widespread use of JS libraries such as JQuery and front-end frameworks like React and Angular, pretty much every website uses JS in some shape or form.

JS stayed mostly in the front-end until about ten years ago when AJAX came onto the scene. AJAX stands for Asynchronous JavaScript And XML. Basically, AJAX allowed you to create dynamic web applications with JS that would make requests, receive, and work with server data without reloading the web page. JS back-end frameworks such as Node and Express, continue to advance JS into full-stack usage.

OOP and Same, Same but Different

Both Ruby and JS are Object Oriented Programming languages. This term should already be quite familiar to you if you have already learned Ruby.

Here’s a great OOP description which I came across in my early Flatiron Ruby lessons:

“An object-oriented approach to application development makes programs more intuitive to design, faster to develop, more amenable to modification, and easier to understand…….
As humans, we’re constantly faced with myriad facts and impressions that we must make sense of. To do so, we must abstract underlying structure away from surface details and discover the fundamental relations at work. Abstractions reveal causes and effects, expose patterns and frameworks, and separate what’s important from what’s not. Object orientation provides an abstraction of the data on which you operate; moreover, it provides a concrete grouping between the data and the operations you can perform with the data — in effect giving the data behavior.”
Object-Oriented Programming with Objective-C, Apple Inc.

Need a quick primer on OOP? Check out this five minute video:

Again, since Ruby and JS already have this basic structure in common, you will be happy to find out that many of the same concepts you learned for Ruby will exist and be applicable in JS. Elements such as variables, hashes, arrays, methods, loops, classes, and conditionals exist in JS. The major differences between the two may come down to syntax and some logic.

Luckily, this path has already been paved before you. Here are a few articles I found that outline this topic:

Flatiron School Blog:
JavaScript and Ruby: 10 Differences You Need to Know

Edozié Izegbu:
Ruby vs JavaScript: A Quick Overview

Ruby vs JavaScript: functions, Procs, blocks and lambdas

Rapid Programming:
Difference between Ruby and Javascript

Agent Cooper: 
Side-by-Side Comparison (**very helpful)

Error Messages are still your frenemies

By now, you’ve learned to expect a barrage of error messages to flash on your screen whenever you attempt to run your Ruby programs. Many of them you recognize and receive again and again so converting them over to green is not a problem. There’s always a few that keep you up at night but, eventually, you conquer them.

Ruby error messages are descriptive. With tools such as Pry and Byebug, you are able to better understand what is going on with each line of code.

I had been warned several times not to get too comfortable with this as the troubleshooting world changes a little bit when you move over to JavaScript. The common consensus I’ve found online is that bug and error handling may be a test of one’s patience and sanity at times.

Here are a few resources to review to get you started on the right foot. Of course, if you still hit a wall you can always copy/paste it into a Google search.

Eliot Sykes:
JavaScript Debugging for Rubyists

Debugging JavaScript: Understanding JavaScript Error Messages

Eloquent JavaScript: 
Bugs and Error Handling (Chapter 8)


In this video, the dean of Flatiron School, Avi Flombaum, explains why it’s good to learn both Ruby and JavaScript:

As nervous as you might be to learn another language, you’ve already got the knowledge and skills to take on this challenge. Just now that tactics you already learned by this point are still going to serve you well: persistence, creativity, Stack Overflow, and Google.

Good luck with JavaScript, although I doubt you will need it. ;)

Got comments, other helpful links/resources, or feedback for me? Please feel free to leave them below. Thanks for reading.