Monday, September 8, 2014

NodeJS: A Primer For Newbies

Node.js is an excellent server side scripting application.

Node.js was created by striping the V8 javacript engine from chrome and running it as a native application. Thus you can use JavaScript just as you would use java or python or ruby.

The use of JavaScript is really cool because of a concept called platform equalization.
This means using the same language on both the server side and on the client side for data manipulation and presentation. This means that a lot of code can be reused directly, since web browsers come with JavaScript by default, and you gain by using it on the server side as well because data can directly be used with out having to convert it into a variety of formats.

JSON, or JavaScript Object Notation, is a form of serialization that is used to transfer data to and fro between server and client. It is slowly starting to replace XML, because it has a cleaner structure, takes up less characters, and directly integrates with javascript (since its javascript object notation).

JSON follows a structure of a dictionary, or key-value mappings.
eg.   {     "key1":"value1"   ,     "key2":"value2"   }


JavaScript is an asynchronous language. It runs in a single thread, but handles methods asynchronously through callback functions.

A callback function is any function that is to be executed after the completion of something. Usually in JavaScript, we have events that trigger callback functions to be executed. For example, a server waiting for a request from a client will trigger an event that a request has arrived, and will pass on the request to a callback function.
The advantage of this is that the initial method can go back to listening for requests. Thus it doesn't get blocked from executing. 

The disadvantage of JavaScript is again it's single threaded architecture. This means that any computationally intensive task will clog up the execution. Thus javascript should be used for tasks that are more in number, but less expensive, to utilize it's full potential.

For the Node.js official site: http://nodejs.org

For resources on how to start with nodejs, check the following question on StackOverflow: http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js

Have fun JavaScripting!

Sunday, September 7, 2014

Experience: A Biased View Of Life

"Have you done this before? We need you to start working right away, you need prior experience..."

Experience is what lets us do stuff effortlessly. Unfortunately, we might not always be experienced at something.

Fortunately, it can be gained by engaging with stuff that you haven't done yet. New things always give us a new perspective, and that's what experience is all about. The slight problem, though, is you might not always have an opportunity to try out something new. This implies that you do stuff every day over and over again in predefined routine. This is good in a way. If you are, for example, working a job, then even though you might not be doing something new, it will add up to you job experience of having a particular skill.

If you want to try out something new, then you have to find a way to break free from your current routine.

Consider the case of the playing the video games Assassin's Creed 2 (AC2) and Assassin's Creed Brotherhood. As you play the role of Assassin Ezio, you try so hard to become the best assassin that you can be in AC2. But once you complete that game and move on to Brotherhood, all that goes away, Ezio loses his fancy armor and weapons, and you have start over from scratch. But you have experience from playing the first game. And that itself is extremely useful in starting over.

Its kind of like college life. Working so hard to prove yourself to everyone how hard working and dedicated you can be is a daunting task. But once you start employment, or join for higher education in a different university, it starts all over again. But you have experience to help you out.

So the next time someone asks you about experience, don't be afraid. Tell them that experience only comes through practice, and that only comes through first having an opportunity. Ask them for that opportunity if they are in a position to give it.

Cheers!