Home » Archive by category 'Programming'
Node.js the future

A web that is not a global digital library, but a global digital nervous system

After nearly a two years gap i am filling up my blog with something for my readers who have been disappointed with no updates at all. Recently i was sitting with my friend Nandan and discussing some core concepts of programming and where would the web end up totally. I had discussion with ma amigos and my big brother over this, but eventually he is a management guy who just worries about the sales. But it’s a lot of work to rewrite everything in sight and I suppose managers are reluctant to invest in that just because something or other is cool.

LAMP, DOT NET and Java is DEAD or would eventually die someday

LAMP architectures are dead because few web applications want to ship full payloads of markup to the client in response to a small event; they want to update just a fragment of the DOM, using Javascript. AJAX achieved this, but when your server-side LAMP templates are 10% HTML and 90% Javascript, it’s clear that you’re doing it wrong. Since the birth which happened two decades ago, there has been fundamental shifts in the web with content, protocols, servers and clients. Together we can mark as three ages of the web.

It seems that every few years a new technology comes along which gets a bunch of people excited and they want to rewrite the world in this new thing because it’s so cool. But it’s a lot of work to rewrite everything in sight and I suppose managers are reluctant to invest in that just because something or other is cool. On the other hand the LAMP stack has serious architectural problems and PHP is a horrible language. There are a few things which event driven servers do a zillion times better than LAMP – research the beginnings of COMET and you see people describing a need for which Node.js is the perfect solution.

What is Node.js?

Basically, it is a lightweight framework wrapped around Google’s V8 JavaScript Engine. V8 is the JavaScript engine that powers Google Chrome, their open source Web Browser. Another part of Node.JS is that it is event based, which can make is very quick and efficient.
I’ve been tinkering with Node.JS for a couple of weeks, and it is very interesting and has a lot of potential. It’s unique scoping with JavaScript and event-based methodology makes certain things easy to accomplish that are more difficult in other traditional tools. There are some pretty cool libraries for Node.JS like Socket.IO, a library to support multiple transports using feature detection. So if your browser supports WebSocket or Adobe Flash Socket, it will use that, or AJAX long polling and multipart streaming, or even the Forever Iframe technique. So your application will use which ever type of communication is most efficient.

Node.js – the Future

The JavaScript age is about event streams. Modern web pages are not pages, they are event-driven applications through which information moves. The core content vessel of the web — the document object model — still exists, but not as HTML markup. The DOM is an in-memory, efficiently-encoded data structure generated by JavaScript.

The one thing that worries me about Node.JS is that even though you’re locked in this jail with no easily available blocking operations, you still need to know (arguably advanced) knowledge regarding how to debug race conditions and how an event loop works (and even how a call stack works due to recursive callbacks smashing the stack). Because of that, the control flow is very strange and mind-bending to people that have been writing C for 20 years, and even junior engineers that are just getting into programming (unless they are web-focused engineers that are used to jQuery-esque continuation passing style). This is pretty much proven by all of the arguments and libraries popping out of the woodworks to deal with control flow in some elegant way (fibers, chaining, etc).

UPDATE and INSERT differences in syntax is an inconvenience

An associative array is the conventional workaround of the coding world.. In an associative array, we can associate any key or index we want with each value. (more…)

Linklist and ArrayList

Today i was turning back towards Linklist and a question dropped in my mind is when to use Linklist and When to use ArrayList. (more…)