Category: Books

Book reviews

Book Review: The Principles Of Object-Oriented JavaScript

TLDR: If you want to understand how OOP works in JavaScript, read this book. It’s that simple. Read on if you want to hear me wax poetic, as this book certainly deserves the praise.

After Eloquent JavaScript rekindled my fascination with programming, dispelled my irrational fears of JS and dissolved my anger, I was still unsure about the way OOP worked with JavaScript. That’s not to say the author didn’t explain it: the topic is definitely covered, and I had some understanding of how it was supposed to work, but I still didn’t feel comfortable with it. I kept asking myself “Why can’t JavaScript just have classes like other languages?” My goal has been to be able to write professional-grade JavaScript, and I knew I couldn’t do that without using objects properly. I tried re-reading JavaScript: The Good Parts, but that didn’t really help. I was about to give up and put JavaScript on the shelf again when I got the press release for The Principles Of Object-Oriented JavaScript by Nicholas C. Zakas, in my inbox. The timing couldn’t have been better.

The best part of this book is that the author is able to pack so much useful information into 100 or so pages, without being cryptic. I was afraid when I got the review copy that I’d be dealing with “The Sutras of JS OOP”, a collection of JavaScript related aphorisms that would need to be unpacked by a guru in order to bring to light their true meaning. Luckily, Nicholas has mastered the art of being concise yet clear. I’d compare the book to a short and elegant function as opposed to a terse one-liner.

The Principles Of Object-Oriented JavaScript isn’t an introduction to JS, nor is it an intro to OOP. I wouldn’t recommend it if you’re just starting out with either, but you shouldn’t be scared to pick it up if you’re a JavaScript novice who’s read at least 1 other book on the topic. I’ve had years of programming-for-fun experience, and a couple of years of professional software engineering under my belt, but I lacked any real understanding of the way OOP worked in JavaScript, so this book suited me perfectly.

The book’s 6 chapters progress from an introduction of JavaScript’s types to a short discussion about popular patterns for working with objects. Each chapter builds on the material covered before it, and I’d recommend reading it in order, from cover to cover. There is enough sample code to demonstrate the concepts, and some helpful notes along the way as well. In some programming books the examples are so contrived that you lose sight of any real practical use of the features they’re intended to describe, but The Principles Of Object-Oriented JavaScript manages to avoid this for the most part. There are instances where a JS feature is explained and demonstrated with a sample followed by a warning to the reader to “not try this at home”, but I found those snippets to be more helpful than distracting.

Another reason I love this book is that somehow the author finds a way to pull back the curtain and let us peer into the world of JavaScript internals, without leaving us drowning in the deep end. He mentions internal methods that JavaScript calls when you work with objects, but is careful not to go off on what could be a very confusing tangent. It’s somehow just enough of a peek behind the scenes to whet your appetite to learn more about JavaScript and how it handles OOP. Of course the whole truth is that now I’m curious about what else the JS engine is doing when I’m not looking, but I’ve got to be careful or else I’ll lose sight of my goal which is to have no second thoughts about picking up a front-end heavy card off of my team’s story wall.

In closing, I highly recommend this book to anyone who is not quite sure of how object oriented programming is meant to be done using JavaScript. It’s my opinion that you couldn’t find a better book about the topic right now. It’s well written, concise, and packed full of great information. I’m going to read it again before letting anyone else have it 🙂

Book Review: Eloquent JavaScript

I was a JavaScript hater.

I hated JavaScript for poor cross-browser support. I hated JavaScript because it was only used for useless effects in web pages. I hated JavaScript because I could write it easily but get nowhere fast. I hated JavaScript because OOP is supposed to use classes, right? I hated JavaScript because JavaScript: The Definitive Guide was 1000 pages long and JavaScript: The Good Parts was 172 pages. I hated JavaScript because I didn’t understand it.

In a quest to be more useful to my team at work, I’ve been wanting to stop avoiding the “front-endy” cards on our story wall and the JavaScript that goes with them. It’s been difficult, but for no good reason. I kept trying to learn pro JS but couldn’t get past my fears and preconceptions. In order to get past all of that, I realized I’d need a fresh perspective, and that’s where Eloquent JavaScript, by Marijn Haverbeke came in and changed my life.

The book’s subtitle is “A Modern Introduction to Programming”, and so initially I was afraid that it would be too basic for me. I didn’t need to learn how to program, after all – I needed to learn how to program with JavaScript. I thought I’d give it a go anyway, since I’d tried other books that were meant for intermediate level readers and gotten basically nowhere with those. It turns out that after reading the introduction that I had discovered the fresh perspective I’d needed. What better a way to look at a programming language with a “fresh set of eyes” than to put aside my preconceptions about programming entirely?

At first that was difficult – trying to read the book through the eyes of someone who’d never written a program before – but after a few chapters I found myself feeling something I hadn’t felt in a while, a sort of fascination with this “programming stuff.” That’s not to say that after a couple of years as a software engineer I’ve already burned myself out. Still, in reading the first few chapters of Eloquent JavaScript and re-learning what variables are and what loops are for, I got thrown back to my childhood and the feelings of amazement I’d get after getting my first BASIC programs to run.

As the book progresses into more advanced concepts, Marijn’s tone is conversational but instructive. About halfway through the book I felt more confident in my understanding of the language, and eager to learn more. I never got bored, and while it continued to be a challenge to put aside what I already knew (or thought I already knew) I found myself gaining a deeper understanding of JavaScript and of computer programming in general. Each chapter teaches enough to get you started, but as it’s a small book, the chapters are necessarily concise. This isn’t a incredibly comprehensive book, it’s certainly not JavaScript: The Definitive Guide, but that’s a feature, not a bug. I’d say the book’s enough to get you started if you want to dive into JS and start doing useful work straight away.

I can’t stress enough the fact that this book has not only changed my mind about JavaScript, but has also renewed my love for programming. It’s amazing what a few anecdotes and a helpful examples can do when combined with a willingness to put aside your preconceptions. It’s been said that the surest way to prevent learning about something is to know about it. The mind seemingly has an automatic cutoff that prevents you from gaining new knowledge once it’s convinced it knows all it needs to know. If you are like I was, fearing JavaScript because I didn’t understand it, hating JavaScript because it’s different, avoiding JavaScript because someone else was around to do the work, I appeal to you: STOP! Get yourself a copy of Eloquent JavaScript, put your preconceived notions about it (and if you can, about programming, too), and open your mind. If you’re new to programming, start with this book. You’ll be getting perhaps the best introduction to programming available today.

Wicked Cool Ruby Scripts

Having fun and solving problems can be mutually exclusive. Even for professional programmers and system administrators who chose their career because they enjoy problem solving, there can be times when finding a solution is an exercise in the mundane. Luckily, there are tools designed to ease the pain and frustration faced by programmers and admins. Ruby is a programming language that was designed from the start to not only provide a means of solving problems, but also to be inherently intuitive and fun to use. Wicked Cool Ruby Scripts, by Steve Pugh, is a book aimed to bring to light the fact that you can use Ruby to write concise yet useful scripts that solve difficult problems.

If you’re a fan of the “Wicked Cool” books from No Starch Press, you’ll find the format of this book familiar. It’s not a hefty tome complete with syntax and “hello world” introductory lessons, rather it’s almost a recipe book of sorts, divided into sections of problems and chock full of immediately useful Ruby code. This is the “Wicked Cool” book I’ve been waiting for, because although I write PHP and shell scripts (not so much Java and Perl, other topics covered in the series), I’ve always thought Ruby was the coolest of all. Right from the start, you can tell that Steve Pugh agrees with me. His tone throughout the book is that of a friend who has something fun to share, never browbeating or lecturing. He’s not simply writing to show us that he knows how to write Ruby well, he’s really trying to help us out.

Honestly, some of the examples in Wicked Cool Ruby Scripts might leave you wondering why you’d use such a powerful language like Ruby for such seemingly simple things. What Steve Pugh tries (and succeeds!) to show us is that Ruby isn’t just for writing massive web applications, but it can also handle tasks often relegated to the ubiquitous, but cryptic Awk or shell languages. Perhaps you still wonder why you’d want to? “Just because you can doesn’t mean you should”, right? So why bother? Because Ruby is “Wicked Cool”, that’s why.

So what’s cool? How about a simple file alteration monitor to help you see what’s changed on your system? Not cool enough? How about a web based photo gallery in about 50 lines of code? Still not impressed? How about writing a Metasploit module to attack one Windows machine from another? From general purpose utilities to system security and yes, even some games, Wicked Cool Ruby Scripts has enough in it to pique the interest of just about any programmer or sysadmin. I for one am finding it hard to concentrate on this review because I want to get back to writing Ruby. If you’re a programmer waiting for a good excuse to try Ruby, or a Windows sysadmin wondering what an open source programming language can do for you, you’ll find Wicked Cool Ruby Scripts enlightening, inspiring, and of course… cool.

Do Androids Dream Of Electric Sheep?

This book is based in the future (of course) and deals with some serious issues. You see during the mass migration to Mars, certain people were left behind. These people were exposed to radiation, and thus deemed dangerous. The story takes place on Earth, and the main character is a chickenhead. A chickenhead is someone who’s mind was affected by the radiation and is mentally retarded.

I’m not going to tell you more, you’ll have to read it yourself. But if you like books set in a dystopia, you’ll probably enjoy this one 🙂

Oh, on a scale of “eeew” to “oh yeah!”, this book gets a “yeah, it’s pretty hot”.