A few months ago, I had mentioned the idea of writing a couple of Javascript articles/tutorials. This, being my first article on the series about this powerful language, will begin with an overview for those of you who are new to the subject, and will become more complex as I progress through this series.

What really is Javascript, and how does it differ from other languages?

Javascript is a client side language, which means it runs on the end user’s computer rather than on a remote computer/ server somewhere else. This is both cool and useful, as it allows developers and web designers to create a website which truly interacts with the user. A server side language like PHP or Ruby on the other hand instead interacts with the server, but not directly with you.

If you are wondering what it means to say that the server side language does not interact with you, this is the paragraph to read. Everytime you click a link, or a submit button, you have most likely noticed your browser stops to load a new page. This lag between the current page and the next, is called a server request. In this request your browser is speaking to the server, requesting it to send a new page. In fact, each page can have many extra server requests for any images, audio and anything else required to build and display the page you requested.

server requests

This is important to understand for the sake of optimizing your websites. As the server keeps receiving requests to “send image a, send image b, send image c…”, it will take the server time to send them, which makes up your page load time. While you could say you are interacting with the page, what really is happening is that your browser is interacting with the server.
The level of interaction between the user and a server side language is pretty much non-existent, however, this does not make server side languages useless. A lot of stuff also happens in the server which becomes obvious when thinking of a large scale website application. A website with thousands of users for example, does NOT store thousands of webpages (one for each user). Instead, it stores the user’s data separately and when a page is requested, it inserts the data into a template on the fly. This template is then the website you see on your browser. It is really nothing more than an html file that was generated on the fly.
Not running on the server, Javascript on its own is severely limited, but wonderful when used along server side languages. You can have video games running on your browser, and just about anything which requires (seemingly) latency free interaction. Things like drag and drop, touchscreen swiping and just about any modern techniques can be done manipulating that which you see on the screen in real time. Also, running on the user’s device you can program smart interfaces that can detect and respond to the user’s screen size, as well as other input devices such as the keyboard, mouse, touchscreen etc.M ost websites today don’t really exploit the possibilities of Javascript, but this is sure to change as smart and interactive devices such as tablets and smartphones become more and more popular.

I have focused on the capabilities Javascript brings for interactivity; however, its versatility goes far beyond that. In the last few years it has become great for optimizing websites. Used along server side technology, you can make server requests without the need to completely reload the page. If you have used facebook, or google, you have surely seen this. One example of this is google’s search engine, which while running on your machine interacts with the keys you type. This is how google provides you with suggestions before you have even finished typing the text. At each key you enter in google’s search engine, the webpage communicates with the server in the background so your page does not load. Once google’s server has analyzed the data Javascript has sent, it returns a list of words that are suitable suggestions. With this new data available on the client side, Javascript can grab that information and render it into html allowing you to see it in the form of google’s search suggestions. This technology of communication between server and javascript is called Ajax. Ajax used to be a scary technology to me, but as I began using it, it became obvious that it is actually rather simple to use, and extremely effective.

As I write more of these articles I will explain more on how to actually use these technologies. To get a better idea as to where I should start, comment or email me.

Share this:

Share this page via Email Share this page via Stumble Upon Share this page via Digg this Share this page via Facebook Share this page via Twitter
If you enjoyed this post, make sure you subscribe to my RSS feed!

Comments RSS and TrackBack Identifier URI ?
Do you want to comment?

One response


Comment now!
















Trackbacks