Ruby vs JavaScript as a first programming language

Dmitri Grabov
Constructor Labs
Published in
4 min readNov 30, 2017

One popular question from folks looking to get started with software development is which language to choose. Two great choices are Ruby and JavaScript. Both languages have a dynamic type system and automatic memory management which make them convenient choices. Both languages were also born around the same time in 1995, but that is where they begin to diverge. Yukihiro “Matz” Matsumoto designed Ruby to “help every programmer in the world to be productive, and to enjoy programming, and to be happy”. Brendan Eich designed JavaScript to run in the browser and wrote it in 10 days.

https://twitter.com/anler/status/627601099097251840

Consequences of JavaScript’s chaotic origins are illustrated by the fact that the most famous book on the language, called “JavaScript: The Good Parts”, is one of the shortest programming books with just 172 pages. Conversely, “JavaScript: The Definitive Guide” is a chunky tome weighing in at 1096 pages.

Ruby syntax is concise and easy to read, whereas JavaScript borrows heavily from Java and C with its use of curly braces as block delimiters. Whereas Ruby is quite opinionated with one “correct way” to perform each task, JavaScript really does not come with any particular recommendations. That part is left up to each developer’s discretion and preference, which can leave beginners somewhat lost and confused. JavaScript has a multitude of ways to do something as trivial as iterating over an array, which as a result, can make it can be tricky to teach. Students can learn one or two ways to do something only to discover examples on StackOverflow doing the same thing only in completely different, yet equally correct ways.

So, after all this, why would anyone choose to learn JavaScript over Ruby as a first language? The answer lies in what you want to build. While Ruby is a great way to learn to code, JavaScript is great for getting started quickly and seeing immediate results. All you need is a browser and text editor to start adding some interaction to a web page. Most folks don’t start out “wanting to learn to code”, they have an idea for a web page or a site they wish to create and JavaScript makes that very easy. Most browsers now come with great developer tools built-in that make it easy to see what’s going on inside your code and be able to step through it.

While JavaScript started out as the language that runs in the browser, it can now also be used to write server-side code using Node.js or even native mobile apps using React Native. You can now create a full-stack application using a single language. That is an incredibly powerful concept. Not only does it save you a considerable amount of brain power required to switch context between two different languages, you can also now write libraries for your application that you can share across each platform your code runs on.

JavaScript is also an ideal choice for people looking to get their first job within the industry. According to ITJobsWatch there are currently 31,847 job adverts citing JavaScript (17.7% of all tech jobs in the UK) as opposed to 5,784 (3.2%) citing Ruby. However, that 5.5 times difference in demand does not tell the full story. The key factor is that the rate of adoption of JavaScript in the industry has rapidly outpaced the rate at which JavaScript developers enter the market. That mismatch between the demand for JS developers and the supply available has created a tremendous opportunity for developers to join the industry. That is also apparent at the top of the market here in London, where the day rate for top developers two years ago was around £550 and has now risen to £800.

Another great advantage for beginner JavaScript developers is that this language offers a convenient on-boarding route for new starters. Whereas, back-end code tends to be fairly stable over time, front-end code is frequently updated or rewritten to accommodate new designs or user journeys. It can be daunting for a beginner to get started with a large mature codebase, with front-end development a new joiner can be given some HTML or CSS tasks to get started and then can slowly start adding interaction to elements they are familiar with.

The majority of developer bootcamps in London are focused on Ruby, which makes sense considering it was the most exciting language in 2012 when many of them of them started. In 2017, it is JavaScript that tech companies simply cannot get enough of. This seismic shift in demand has created an incredible opportunity for new JavaScript developers to get started in the industry and we are here to make it happen.

Constructor Labs runs a 12 week course teaching full-stack web development with JavaScript. Classes start on 22nd January and fees are reduced to £3,000 for the first cohort. Applications are open now and places will be allocated on a first come, first served basis.

--

--

Dmitri Grabov
Constructor Labs

Founder and JavaScript instructor at http://constructorlabs.com/. Teaching the next generation of software developers