Johnny's Software Saloon

Weblog where I discuss things that really interest me. Things like Java software development, Ruby, Ruby on Rails, Macintosh software, Cocoa, Eclipse IDE, OOP, content management, XML technologies, CSS and XSLT document styling, artificial intelligence, standard document formats, and cool non-computing technologies.

My Photo
Name:
Location: Germantown, Maryland, United States

I like writing software, listening to music (mostly country and rock but a little of everything), walking around outside, reading (when I have the time), relaxing in front of my TV watching my TiVo, playing with my cat, and riding around in my hybrid gas/electric car.

Friday, August 25, 2006

JavaScript is not so bad

I am starting to gain a lot of respect for JavaScript.

For over a decade I thought JavaScript was only a week little language, that got what little popularity it had not by being good, but by being created by the makers of the most successful web browser - and stuck in there.

I really enjoy having a compiler find my spelling errors, typos, syntax errors, undeclared variables, and so forth. Doing it myself is a pain. It slows me down, no question.

I love the fact Java fully supports OOP (encapsulation, inheritance, polymorphism) as well as a separation between type and state. I actually kind of prefer a language that is strongly typed ...most of the time.

However, I found a new function in JavaScript that I had never used or noticed before. I wrote a longer, more sophisticated program in it than I had ever written before. I bought a more comprehensive book on it than I had ever had before. I studied AJAX and I used more sophisticated JavaScript libraries than I had ever used before.

I noticed programmers were really making use of its lambda-like function called function. I decided that the .prototype trick was not so bad after all. I found I sort of could create classes with it, after all.

Now, I have to say - it is a powerful little language. And, it is not so little after all. Its libraries are not so bad either. Nothing compared to the giant class libraries you get with JavaScript and C# but JavaScript comes with a decent number of them.

I do look forward to the up-coming features of declarative type-checking and some other things like that.

However, in the meantime, JavaScript can be used for so much. XML, SVG, Canvas Element, HTML/XHTML, data structures (DOM or regular) - there are a lot of things that JavaScript can be brought to bear on.

I got David Flanagan's JavaScript: The Definitive Guide, Fifth Edition (ISBN 0596101996) last night and started to read it, as well as look at the new examples that are online.

JavaScript is a cool language!

Yup, almost 11 years after I wrote my first JavaScript program, JavaScript has finally turned my head.

As for the book, I have to say I recommend it. I already found the 4th edition very helpful. It paid for itself rather quickly.

The new edition documents the cool things you can control with JavaScript: SVG (you can even create a functioning SVG element with the createElementNS method), Canvas element, XML (using E4X), invoke XSLT stylesheets, and so on. The 5th edition of the book finally exposes, explores, and explains all that.

Unless your browser is some stale, old thing from the 1990s, if you are are a web programmer in this decade - you really should by this book's 5th edition. Even if you already have the 4th edition on your bookshelf, you should get this new one. It really is good.

0 Comments:

Post a Comment

<< Home

Related pages & news