Should I Learn to Program in JavaScript

Over the past few months, there has been a heated debate about whether everyone should learn to code or if it’s a specialized skill that should be left to the professionals. Software developer Jeff Atwood from StackOverflow/Coding Horror stirred up a hornet’s nest when he wrote an article titled ‘Please Don’t Learn to Code‘, inviting the wrath of the opposing team by suggesting that coding wasn’t something that everyone should seek to understand. Within hours there were fierce rebuttals flying around the blogosphere, and the aftermath of that firestorm is still smoldering away.

Today, however, I’m going to assume 3 things;

  1. Everyone should learn to program.
  2. You’ve dipped your toes into the water by learning HTML and CSS.
  3. Now you’re wondering which dynamic language to learn.

Just like there are two opposing camps in the ‘to code or not to code’ battle, doing a little bit of research on the net will soon reveal that 50% of the people out there will adamantly recommend that you learn PHP first, while the other 50% will beg you to learn anything but PHP! There are also some that will swear that you need to learn a server-side language first, while others will urge you to learn a client-side language like JavaScript before moving onto the other side of the fence.

Hopefully this article will clear this conundrum up for you, but first, some clarification is needed so that you understand the difference between client-side and server-side languages.

Both Sides of the Fence

Every website that you interact with is a complex blend of technologies that can be understood more simply by dividing them into client-side and server-side scripting.

Server-side scripting is a technique whereby your request to a website is processed by running a script on the web-server, and then the finished result is sent back to your browser (i.e. Chrome or Firefox). Server-side scripting languages include: PHP, Python, Ruby on Rails and Perl (among many others).

Client-side scripting enables your own computer to perform operations on a web-page without having to send the information back to a server, so that things like interactive menus, special effects and other actions can be performed on the web page (in the browser) without having to refresh the page or wait for the server to send through the results (which makes for a much more enjoyable user experience). Client-side scripting languages include: JavaScript, CoffeeScript, Dart, VBScript (IE only) and PerlScript, although realistically JavaScript is the most viable option for learning client-side scripting at the moment.

Server-side and client-side languages are made to do totally different things, so instead of asking whether you should learn PHP or JavaScript first, you should be asking whether you want to learn server-side or client-side first. The answer to that will then inform you as to whether you should be considering PHP or JavaScript.

Reasons to Learn PHP (or Not!)

Now you know that PHP is a server-side scripting language, meaning that it is excellent for certain tasks and totally inappropriate for others, we can go into some reasons why you should consider learning it if you’ve decided to go for a server-side language:

  • It’s one of the most widely used languages in the world, powers everything from Facebook to WordPress, and has a large community built around it that are happy to share tips and techniques with you.
  • It’s relatively easy to deploy, it works on virtually every server known to humankind, and it’s free to get going (especially with an open-source stack like LAMP).
  • There are numerous free tutorials that will take you from scratch to a high-level within a year.

You should keep in mind, however, that PHP is widely criticised for being messy, inconsistent and maddeningly illogical at times. There are also many, many other options for server-side scripting languages, so you should research Python, Ruby, ASP.NET, Perl and others before you make the decision about which one to learn.

Javascript Programming

Why You Should Learn JavaScript First

There are several reasons why I would suggest that you learn JavaScript first (before moving on to a server-side language):

  • The language has long been known as the ‘dynamic’ compliment to the ubiquitous HTML, meaning that learning JavaScript will enable you to combine JavaScript with HTML and CSS to start crafting solid, highly usable front-ends. By understanding those 3 technologies you will also be able to begin work as a front-end developer (although really that’s only the tip of a very large iceberg).
  • The widespread use of AJAX (Asynchronous JavaScript and XML) in the web 2.0 revolution gave us a way of dynamically updating web pages without having to execute the dreaded refresh button, and as a result Google has put a lot of effort into creating blazingly fast JavaScript engines that can handle more and more client-side scripting within the browser, forcing the other browsers to keep up in a win for users.
  • The introduction of libraries such as jQuery and Dojo, as well as systems like Node.js for writing server-side applications in JavaScript have all contributed to the renaissance of JavaScript as a go-to language. With Node.js you can also shift from client-side programming to server-side while still using a language you know.
  • The syntax of JavaScript is very similar to PHP, meaning that you can make the switch from one to the other without a huge shock (if you decide to go with PHP for you server-side language).
  • Finally, learning JavaScript will make you employable and in demand. Over the coming years, you can expect the need for JavaScript developers only to increase, and while there is a surfeit of PHP developers, JavaScript ninjas are much harder to find.

All of the above reasons have ensured that JavaScript is one of the most widely used programming languages in the world, and there are plenty of tutorials and guides to help you begin writing JavaScript straight-away. I believe that if you have learned HTML and CSS (as you should), you should learn JavaScript next, then once you have a grasp of that you should move onto MySQL and a server-side programming language.

That’s just my opinion, and I’m sure that many of you out there will vehemently disagree with this stance (I’m aware of Hadoop, jumping straight into C, the NoSQL movement, learning a functional language, etc). I’d love to hear your comments – should people learn JavaScript before PHP? Should people learn PHP at all? Which server-side languages do you have experience with and would recommend? Let us know your thoughts in the comments!

Higginbotham Drummond

I am Higginbotham who has always loved expressing himself and wished to reach out to the masses by expressing my opinions. My aim is to educate the people about the most popular page builders which they can use to build beautiful WordPress based websites and landing pages. I share my experience and knowledge about WordPress on MegaBlogging.

Leave a Comment