Why I don't suggest JavaScript as a first programming language

For a career in software, JavaScript shouldn't be your first programming language

A few days ago I wrote a post about what programming language you should learn first for a career in programming. This sparked a lot of conversation (much of it on Google+ submitted without reading the article).

A major caveat to my process of recommending a language is that I do not consider JavaScript as a contender. I didn’t elaborate on the point previously, but many people were quick to suggest that A) JavaScript is the obvious choice, and B) I’m ignorant for leaving it off the list. In this post I’ll go into a little more detail about why I don’t usually consider JavaScript as an option for a first programming language for someone who wants to make a career out of software development. Then I’ll accept your judgement.

JavaScript it’s not a proper foundation

A recurring point that JavaScript evangelists make is that it’s the easiest language to get up and running with for programming. They cite the ability to start developing using nothing more than notepad. They mention the lack of the need for a compiler. They tout the global support for the language (any web browser). Finally, they talk about how easy the language itself is to make progress in for a beginner. All valid points that I agree with 100%.

Imagine you want to be a race car driver and team XYZ is looking for a new driver. It’s much easier to get started by picking up a bicycle to compete in bike races than it is to acquire a race car and get behind the wheel on a track. For the bike the cost is low, the learning curve is very shallow, and you can become proficient with it rather quickly. Let’s say you race that bike for 5 years and become quite good at it. Now you approach team XYZ for a position as a race car driver and cite your 5 years of bicycle racing experience. They are going to hire the person who has less experienced in race car driving than you do in bicycle racing because the foundation is better and they’ll improve in car racing more quickly.

If I’m hiring a software developer and a candidate comes in who says they know JavaScript and has been developing in it for 5 years, that’s a poor start to the interview. That person lacks the foundation necessary to develop a full software solution and their ramp up time will be significantly more than a person who has 2-3 years experience in C, C++, Java, C#, Python, Ruby, PHP, etc.

If I’m hiring a web developer, the JavaScript guys is more appealing. You could also just join a bicycle racing team.

It’s important to note that I’m talking about software development, software engineering, end-to-end systems programming, not solely web development. [Insert rebuttal citing Node.js here]. Yes, Node.js, I know. But an experienced software professional knows several languages and doesn’t need to cram a single language into every scenario. You could cut down a tree with a hammer eventually, but using a chainsaw makes more sense.

JavaScript is a poor example of Object Oriented Programming

I’ll concede that JavaScript can be considered an Object Oriented language, I just don’t think it’s a good example of one. Especially as your first exposure. Most of the ways you program in an object oriented fashion with JavaScript go drastically against the grain of other languages. That’s not a bad thing in itself, I just think you’ll be better served by learning the more common style of OOP first so that you’re set up to learn several of the C based languages (and others) more easily.

It’s important in my opinion to understand classes and class inheritance first[Insert something about CoffeeScript here, yes, i know]. Then when you begin JavaScript development, and you will, you’ll see how JavaScript’s constructors and prototypal inheritance fall into OOP. I also happen to think strongly typed variables are important for software development.

Conclusion: everyone “knows” JavaScript

Regarding the initial arguments used to justify JavaScript as a first programming language, while all true, they are also the cause for legions of amateur “coders”. In that regard, JavaScript is the perfect first language. If you want to get your feet wet with programming, if you want to tweak your Wordpress blog, or program as a hobby, I wholeheartedly recommend JavaScript. That’s not to say JavaScript is easy to master. There are few who have truly mastered JavaScript, and the ones who have likely have a strong background in programming forged from other languages; but there are many who might think they are a developer because they’ve written some stuff in JS. You don’t want to be one of those people.

If you want to make a career out of software development there are a lot of paths to take. There are a lot of good languages to start out with and the decision might be handled for you by a university anyway (and no computer science department I know of starts with JavaScript). For the reasons mentioned in this article I’d advise against starting with JavaScript for someone who wants to be a professional programmer.

This story, "Why I don't suggest JavaScript as a first programming language" was originally published by ITworld.

Copyright © 2014 IDG Communications, Inc.

Shop Tech Products at Amazon