Eloquent JavaScript

Once upon a time, every PC had a BASIC interpreter on it and an entire generation of programmers was spawned due to kids playing around with BASIC. My first experience with programming was in high school and it was with BASIC too! In the school library I discovered books written by David H. Ahl and others which had listings of simple BASIC games. Since those books were not lent out, I would write down the code listings onto paper and then type them in during computer class. The code I copied would inevitably have errors and it took a while to find and fix them. Much joy was had when the code executed and a simple game materialized on the screen.

Marijn Haverbeke, the author of Eloquent JavaScript fervently believes that JavaScript is the BASIC of today. It is indeed true, since every computing device today has a browser with a JavaScript interpreter cranking beneath it. With this motivation, Marijn has written this as a book for anyone who wants to learn programming.

I picked up this book to see what lay behind this language which is all pervasive and yet highly misunderstood and frowned upon. JavaScript was pushed out through the backdoor into the Netscape Navigator browser at the same time Sun Microsystems launched Java with much fanfare onto the world. Other than the 4 letters they both share, there is absolutely nothing in common between these languages! The book reveals that JavaScript is a badly designed, but highly powerful dynamically typed functional programming language hiding in C-like syntax! 馃榾

Writing some JavaScript code is easy, but writing good code in it is hard. This is not entirely the programmer’s fault, since the language has some seriously confusing features. For example, there are no classes in JavaScript, instead objects are created from constructors which have an underlying prototype. Properties and methods can be appended at will to both the objects and their prototypes. The book tries quite well to demystify such difficult concepts, but I still came away quite confused.

Functions are first class types in JavaScript, I was totally shocked to realize that we have a functional programming language throbbing underneath all our browsers! It was refreshing to see this introductory book treat functional programming as de riguer in JavaScript. All code examples in the book create and pass around functions whenever appropriate. I am still not familiar with functional programming, but this book gave me the most gentle introduction yet to this paradigm.

Programming the browser is not touched until the last 4 chapters. These chapters run through quickly showing examples of how to use JavaScript to read and modify the various web page elements. These are accessible through the Document Object Model (DOM) that the browser exposes to JavaScript. This too was quite an eye opener since I have not done any web programming other than some Perl and CGI in a former life.

Eloquent JavaScript is a good introduction to the language that can be easily finished over a weekend. The book is also available online here, where all its code examples can be edited and executed right inside the browser. I found most code examples useful, except for the grand Game of Life (Terrarium) example which is used throughout the chapter on Object-Oriented Programming. That example was just too big and was not instructive.

The book does enough to stoke the reader’s interest to program in JavaScript. I am looking around the JavaScript tool landscape and am pretty disappointed by the lack of standalone JavaScript interpreters or compilers, editors with code completion and IDEs with debugging capability. Easy availability of such tools and the ability to run standalone JavaScript programs would do wonders for this language! 馃檪

The Seven Year Itch

Though I had seen the scene of Marilyn Monroe‘s dress billowing over a subway grate a countless times, I had no idea about its origin. I recently discovered that Bisi Bisi, a Kannada movie was adapted from The Seven Year Itch, the movie which spawned this iconic scene of Marilyn Monroe. It is based on a play and stars Tom Ewell opposite Monroe.

Tom Ewell is a book publisher in New York who sends off his wife and kid to Maine for the summer. Reminiscing over their seven year marriage during his lonely evenings at home, he starts to day dream about the irritability of his wife. A voluptuous young model (Marilyn Monroe) moves in as his neighbour and an accident brings them together. The summer heat starts to get to his head and he starts to plot to have an affair with the model.

It might sound unbelievable, but even the gorgeous Marilyn Monroe does not make this movie watchable. The plot is soporific and is complemented by equally lame acting from Monroe and Ewell. The Seven Year Itch is definitely not worth scratching. 馃榾

Bisi Bisi (嗖部嗖膏部 嗖部嗖膏部)

Bisi Bisi (嗖部嗖膏部 嗖部嗖膏部) is a romantic comedy starring Ramesh, Anu Prabhakar and Madhuri Bhattacharya. It is based on the movie The Seven Year Itch, famous for its scene of Marilyn Monroe’s dress billowing over a subway grate. Seven years into his marriage to Anu Prabhakar, Ramesh starts to feel a bit of irritation in their relationship. After packing her and his daughter off to their native place for the Dasara vacation, Ramesh starts to flirt with a toothpaste model (Madhuri Bhattacharya) who moves in as a new neighbour.

The plot is familiar territory for a Ramesh romantic comedy and is nothing to write home about. Curious about the original, I watched the The Seven Year Itch for comparison. Bisi Bisi is easily a big improvement over that soporific drama! The plot has been reinterpreted well for Kannada and there are a few genuinely funny or emotional nuggets in the movie. The music is crappy and is better ignored. Bisi Bisi is pretty entertaining to watch once, but nothing more.