Monthly Archives: February 2014

Why JavaScript?

I was a PHP programmer and I liked PHP frameworks and MySQL. It was before I knew Node.js and MongoDB. JavaScript is a programming language in which you can program server side applications (Node.js), client side applications, mobile applications (cordova/phonegap), windows 8 applications and maybe more. IMO JavaScript is universal language. I love it.

I will focus on web applications. I’m sure you made some PHP application and tried to write some JavaScript which would load some dynamic data (AJAX maybe). Yeah, now imagine you write some code in PHP for a long time and then switch to JavaScript. Different syntax, right? You are confused with JavaScript syntax because you spent too much time writing PHP code. You don’t know how to concatenate string in JavaScript, because you think you are still in PHP and you try to do things in PHP way. WRONG! What if we could write whole application in JavaScript and beware this context switching? We CAN! Node.js is the way. There is a lot of frameworks based on Node.js (ExpressJS, SailsJS, GeddyJS, MeteorJS,…).

The advantage of pure JavaScript applications is you just need to know ONE language. No more context switching between PHP/JavaScript or whatever/JavaScript. Another advantage is that you can share objects, functions and variables between server and client. Write once, use everywhere.

Nowadays developers can be divided into backend and frontend developers. But with Node.js they can be frontend and backend developers simultaneously. It sounds easy. It is easy. Just use JavaScript on the server and you will be happy.