JavaScript: The new lingua franca of the internet

Posted: February 16th, 2011 | Author: | Filed under: Javascript, programming | 1 Comment »

&yet has a great post today which is beginning to outline the the framework of a “Javascript” ecosystem for a complete web application written all the way through the stack with Javascript. The server-side models and DB structure usually have strong relations to the content being displayed in the browser. For a web store the item has a title, description, price, related items, etc. You have one application model written in one language, displayed in the browser in HTML with some fancy JavaScript to model the object again and handle all the changes. Why duplicate all this code over and over, in different languages? Write it once in backbone and be done.

&yet has taken the stack of

If you are looking at a seamless JavaScript stack, and already are using CouchDB you should also take a look at backbone-couchdb which is taking a different approach to the same complete JavaScript stack concept.


CoffeeScript: Why I’m never writing Javascript again

Posted: February 14th, 2011 | Author: | Filed under: CoffeeScript, Javascript, programming | 17 Comments »

If you program in Javascript and haven’t heard of CoffeeScript yet, you are missing out. I’m not going to talk about installing it or the basic usage of it as the original documentation and a few blogs already have talked about it.

What I want to talk about is why it’s so amazing and why I can never write Javascript again. I’ve been programming Python for quite a while now and when  you do work on the web (like with Django) you will eventually have to deal with the browser and if you want to do anything beyond basic form processing you’ll need to deal with Javascript.

The maturation of libraries like jQuery has made life, infinitely easier but, Javascript itself is still a strange little language. It’s actually deceptively simple, it that any decent programmer can probably trial and error his/her way through a simple Javascript feature pretty quickly. This is actually one of the strongest features of the language, most people can write Javascript without actually knowing Javascript but, this lack of structure and ease of use is apart of it’s tricky nature. Once you begin to do complicated things the quirks of the language start to arise: undefined oddities, antiquated array manipulation, limited standard library, strange object models, and for me personally as a Python programmer the mess of braces and semi-colons peppering my code with distracting syntax.

CoffeeScript is essentially a combination of a Ruby-esque syntax and a healthy dose of just the good parts from Javascript. What you get is a fairly clean language that always “compiles” into very readable and workable Javascript. Which means anywhere you need to use Javascript: in the browser, in node.js, on the iPhone; you can use CoffeeScript.

I’m going to be writing a few posts playing with CoffeeScript in the future but, right now I’ll give you a few “out-of-the-box” examples of CoffeScript that isn’t just a basic example

Node.js chat server in CoffeeScript

Appcelerator iPhone Application in CoffeeScript