martes, 15 de marzo de 2011

Why do I like Javascript?

Like most of the people I starting copying&pasting&hating javascript code (this was more than ten years ago :-(), but then I read somewhere that Javascript was a real programming language and I was socked.   I started to read a great book [1] and watch great presentations [2] and it made me start falling in love with this language.

I'm going to try to organize those feelings and explain why am I liking it so much these days.

- No building/compilation process required
- Ad-hoc objects creation: No need to create a class to pass an list of properties to a function
- Anonymous functions and closures: Functions can be declared where needed and have access to the surrounding context
- Duck typing: I can pass a function any object as long as it has just the properties/methods required in that furnction
- Reduced number of concepts: For objects, arrays, hash tables, functions and namespaces you just need the basic object concept (f.e. you can do object.var = f, array.var = f, hash.var = f, function.var = f, namespace.var = f)

Obviously there are also some points that I would like to be improved, but that could be a topic for a future post.

[1] http://www.amazon.com/JavaScript-Definitive-Guide-David-Flanagan/dp/0596101996
[2] http://video.yahoo.com/watch/111585/1027823

No hay comentarios:

Publicar un comentario