Categories
Books JavaScript

Douglas Crockford’s Good Parts of JavaScript

Recovered from the Wayback Machine.

My editor at O’Reilly sent me a copy of Douglas Crockford’s JavaScript: The Good Parts, which I found to be both interesting and useful. The volume is slim, 153 pages in all, but packed full of information about JavaScript—the good parts and the bad.

I found myself nodding more than once, raising my eyebrow a couple of times, and chuckling a time or two, especially when reading about the equality operators, those “evil twins” of JavaScript, according to Crockford.

The book is not intended for neophyte developers, or even those new to JavaScript. It does, however, give you insight into the mind of a very experienced JavaScript developer. Such insight can provide the information necessary to take you from being familiar with JavaScript to being experienced with JavaScript. In particular, the book’s fourth chapter on Functions is, by itself, worth the price of the book.

Crockford writes clearly and without pretension, which I found refreshing. His aim is to clarify, but without pandering. He doesn’t hold you by the hand, and don’t expect him to explain every last bit of the subjects introduced. However, reading through his material is a nice confirmation as to whether your understanding of JavaScript is comprehensive, or if you’re missing out on some of the bits. I particularly liked his chapter on regular expressions, because I suck at regular expressions.

You’ll also be served a hefty dose of Crockford’s opinions on the JavaScript language, which is no bad thing. I didn’t necessarily agree with all of his opinions, such as avoiding the use of new, but I liked reading the opinions because they help me question my own use of the JavaScript language: is this necessary? Could this be improved? Why am I doing this?

I don’t usually have opinions, good or bad, about components of a language. I either like the language, and learn to adapt to the awkward pieces; or I don’t like the language at all. I like JavaScript, so I tend to like all of JavaScript, even the grungy parts. If there’s one thing I consider to be a “bad” part of JavaScript, it is the experts in JavaScript who tell us not to do this or that, but either give no reason for their opinion, or the reason they give borders on the obtuse and cryptic—assuming that we, of course, know exactly what they’re talking about (if we’re worth anything as programmers, goes the implication).

Reading Crockford laying out his opinion as to what he considers “bad” in JavaScript, and why, in clear, unambiguous terms—with examples—is like a breath of fresh air. His doing so is also worth the price of the book (leaving me to wonder whether I should, in all fairness, pay twice). I can only hope other experts, in whatever language, follow his lead.

My only quibble with the book is one paragraph in the chapter on Objects, and that’s because I’m still puzzled by what I read. Crockford writes:

The simple types of JavaScript are numbers, strings, booleans (true and false), null, and undefined. All other values are objects. Numbers, strings, and booleans are object-like in that they have methods, but they are immutable. Objects in JavaScript are mutable keyed collections.

My understanding of immutable objects is that these are objects, not some form of pseudo-object, or second class object. If I had been a tech reviewer for this book, I would have asked for additional clarification of this paragraph in the text.

Other than this relatively minor quibble, though, I really enjoyed this book. It is a nice read, and invaluable for any JavaScript developer.

Categories
Books

Nick Carr’s The Big Switch

Not long ago Nicholas Carr posted a note on his weblog: the first 150 webloggers who left a note would receive an advance copy of his new book, The Big Switch: Rewiring the World, From Edison to Google. I received mine last week, and just finished reading it today.

If you expect to pick up a book like The Big Switch, and feel fired up and inspired, think again. The same goes if you expect to come away feeling pessimistic or gloomy about our prospects for the future. Carr somehow manages to celebrate a new way of global computing at the same time reminding us that such will probably add to the continuing decline in privacy, not to mention erosion of barriers between man and machine. It is both history lesson and prophesy: looking at what we can expect in the future by examining what happened in the past. It is not meant to stop our progress, but slow us down before we fall off a cliff in our blind enthusiastic race for the Next Best Thing.

The central thesis is technology’s impact on society, describing both the intentional and unintentional effects. Equal parts anecdote and thoughtful analysis, Carr takes the reader from the industrial revolution, to the wonders of electricity, Ford’s assembly lines, and even into the home. He focuses mainly, though, on the history of computing devices, from earliest machines to today’s cloud-based ‘utility’ computing, which will, eventually banish the traditional client-server computing model in favor of some vast network of utility servers networked via fast and cheap broadband access.

Today, it’s hard to imagine computer owners in the United States and other developed countries abandoning their PCs for thin clients. Many of us, after all, have dozens or even hundreds of gigabytes of data on our personal hard drives, including hefty music and video files. But once utility services mature, the idea of getting rid of your PC will become much more attractive. At that point, each of us will have access to virtually unlimited online storage as well as a rich array of software services. We’ll also be tapping into the Net through many different devices, from mobile phones to televisions, and we’ll want to have all of them share our data and applications. Having our files and sofware locked into our PC’s hard drives will be an unnecessary nuisance. Companies like Google and Yahoo will likely be eager to supply us with all-purpose utility services, possibly including thin-client devices, for free–in return for the privilege of showing us advertisements. We may find, twenty or so years from now, that the personal computer has become a museum piece, a reminder of a curious time when all of us are forced to be amateur computer technicians.

At the same time that Carr lays out this new global data hive, he also reminds us of the costs associated with all this nifty, cool, technological innovation. He recounts stories of Yahoo’s interaction with China; the continuing concerns about Google and it’s lack of transparency regarding privacy; and corporate profiting from the so-called ‘crowdsourcing’ that takes advantage of unpaid labor to fuel much of this new internet-based ‘boom’.

As for the brave new world of the future, where barriers fall, and all races, religions, and peoples mix into the great utopian society all thinkers in the past have always proposed was just around the corner, Carr sees a possible darker outcome.

Not only will the process of polarization tend to play out in virtual communities in the same way it does in neighborhoods, but it seems likely to proceed much more quickly online. In the real world, with its mortgages and schools and jobs, the mechanical forces of segregation move slowly. There are brakes on the speed with which we pull up stakes and move to a new house. Internet communities have no such constraints. Making a community-defining decision is as simple as clicking a link. Every time we subscribe to a blog, add a friend to our social network, categorize an email message as spam, or even choose a site from a list of search results, we are making a decision that defines, in a small way, whom we associate with and what information we pay attention to. Given the presence of even a slight bias to be connected with people similar to ourselves–ones who share, say, our political views or our cultural preferences–we would, like Schelling’s hypothetical homeowners, end up in ever more polarized and homogeneous communities. We would click our way to a fractured society.

In many ways, Carr’s hypothesis of a ‘fractured society’ is born out in his own writing. As I read, I was impressed with both the quality of writing, and the depth of the research. However, I also experienced a sense of alienation as I progressed–a feeling that this book was written by one member of a group for other people within that group and that I was, more or less, an intruder being allowed a glimpse into a world not necessarily denied entry, but not allowed until I figured out the secret handshake.

I’ve been criticized in the past for bringing the ‘woman issue’ into supposedly unrelated topics, and most likely will be chastised again, but I came away from Carr’s book feeling like the book was written for an audience composed of people like Carr: white, upper class, well educated (or well read), affluent or semi-affluent, wired Euro-Oceanic-American men. The one time when a more feminine perspective on the coming new revolution in computing was addressed focused on the impact of electrical appliances in the home earlier in the last century. Rather than free women up to pursue other interests, Carr writes, what happened is that as more time was freed up, standards of cleanliness increased, until women were finding that we were spending the same amount of time on these household chores, regardless of helpful devices. More significantly, our measure of worth became intertwined with these tasks–an unfortunate artifact that still exists today. With women’s increasing identification with homework as a measure of worth, we became isolated from each other, as tasks that used to be completed together, in cooperation, were transformed by machines into tasks that drove us into competition–who has the cleanest house, best apple pie, and so on. From competition is a short step to isolation.

The psychic price of the new tools and the new roles they engendered was sometimes high, however. Women labored under escalating pressures: to meet the higher expectations for cleanliness and order, to purchase the latest “must have” appliance, to learn how to operate all of the new machines and keep them in working order. And, for many, electrification brought a new sense of alienation and loneliness into the house. As women took over the work required to keep house, they often found themselves spending more of their time alone, isolated in their suburban residences. They may have had their young children to keep them company, but adult companionship was usually rarer than it had been in the past when homemaking was more of a communal activity.

I expected this theme to be carried through into other discussions in the books, especially considering the ‘isolation’ of women in an environment where, supposedly, we constitute half the audience. However, we were dropped after this one section. It was both confusing and a little frustrating, and added an ironic element to the book, especially when you read Nick’s coverage of Google’s ‘personalized’ search efforts.

By filtering out “the detritus” and delivering only “the good stuff” they allow us to combine fragments of unbundled information into new bundles, tailor-made for audiences of one. They impose homogeneity on the Internet’s wild heterogeneity. As the tools and algorithms become more sophisticated and our online profiles more refined, the Internet will act increasingly as an incredibly sensitive feedback loop, constantly playing back to us, in amplified form, our existing preferences.

The increasing filtering of the ‘detritus’, as Carr so eloquently puts it, is born out in a recent discussion via email with Techmeme’s Gabe Rivera where, in a fit of pique, Rivera wrote:

You know, if a gender-neutral (i.e. gender-rigged) version of Techmeme were possible and prudent (most women I’ve talked to feel otherwise) I bet it would still link very infrequently to your blogs.

a gender-neutral (i.e. gender-rigged) version of Techmeme…

It is the insularity of Carr’s viewpoint, reflected strongly in his coverage of the topics that tempers my view of his predictions regarding the direction, and impact, of future happenings in regards to utility computing and the internet. I came away with a feeling that Carr may yet be surprised at what the future brings.

My only other quibble with the book reflects somewhat the same concerns I had with David Weinberger’s Everything is Miscellaneous: the coverage of the topics could have been more comprehensive if the books weren’t so small. I think, though, this reflects humanity’s growing inability to focus more than a certain period of time on a topic. If both Carr and Weinberger had created larger books, their audiences would have been, conversely, smaller. Carr touches on this, himself, in one of his last chapters, on a merge of man and machine through the use of AI.

The printed page, the dominant information medium of the past 500 years, molded our thinking through, as Neil Postman has written, “its emphasis on logic, sequence, history, exposition, objectivity, detachment, and discipline.” The emphasis of the Internet, our new universal medium, is altogether different. It stressed immediacy, simultaneity, contingency, subjectivity, disposability, and, above all, speed. The Net provides no incentive to stop and think deeply about anything, to construct in our memory that “dense respository” of knowledge that Foreman cherishes. It’s easier, as Kelly says, “to Google something a second or third time rather than remember it ourselves.” On the Internet, we seem impelled to glide across the slick surface of the data, as we make our rushed passage from link to link.

Perhaps Doris Lessing was right, after all. Perhaps, not.

Neither Carr’s filtered viewpoint nor the brevity of the coverage of some topics adversely impacts my appreciation of his excellent writing, and fascinating mix of historical perspective and future view. I can recommend The Big Switch: Rewiring the World, From Edison to Google. Buy it as a gift for the A-list “everything is bright, everything is beautiful, the Semantic Web 2.0 rocks” pundit in your life. Oh, and make sure they actually read it.

Categories
Books Writing

Moving On

As much as I would like to continue writing about standards and networks, ‘open’ or otherwise, out here in the weblogging wasteland (Hark! Was that a cricket I heard?) I have to return to the book writing.

I debated whether to include a link to the Gallery album I set up for the figures and illustrations for the new book, as well as a link to the ongoing example development. On the one hand, you might be interested in following the progress, or trying out the examples (sans accompanying text). On the other hand, you won’t be interested, which means posting a link or not is moot.

Book figures

Book Examples

The figures will undergo cleanup and adjustment over time. I’ll probably be replacing some. I thought the links might be interesting for those of you who are curious about books ‘on the hoof’.

I also use my del.icio.us account to link to resource and reference sites and am building up a nice library of web graphics links. Well, in and among the political, climate, and diversity links.

Offline until I’m finished. Ta.

Categories
Books

Writing hacks: desist

The book progresses, but not quickly enough. I’ll have to reach to meet my deadline. My biggest challenge from a time perspective is trying to find relatively fresh, fun ways of looking at topics, which have been discussed to death online and in other books. Especially since I’m not known to be either a great photographer or graphics artist.

No, this isn’t fishing for compliments, or reassurances. I have no wish to be a great photographer or a great graphics artist. I enjoy the world of web graphics because, unlike my programming, I’m not dependent on any of it for a living. I’m free to try new things, to tinker around on my own, and just generally have a lot of fun. That’s actually the whole point of the book: having fun.

We don’t seem to have fun with our use of web graphics, and I include photography in this. We’re all too damn earnest. We’re passionate about everything we do, and there’s few things that will destroy fun and a sense of personal exploration more than being both earnest and passionate. I’m rather hoping my book will stand out because it is neither earnest nor passionate on the topic of web graphics.

Oh my, I sound like Jeff Atwood and his don’t buy my book refrain, don’t I?

In his latest, Atwood–after having gone through one book writing process and looking back on the whole thing like the wise old gray beard that he is–writes how tech books are nothing more than dead trees. Don’t buy them, don’t write them, he exclaims.

I particularly liked the part where he states how anyone can be an author:

Even if books make no financial sense, perhaps the ancillary benefits can make the effort worthwhile. I won’t lie: you’ll get a little thrill the first time you ego-search Amazon and see your book in the results. There is a certain prestige factor associated with being published; people are impressed by authors. To me, these are ultimately empty accolades. Anybody can write a book. The bar to publishing a book is nonexistent; with sufficient desire, any would-be author can get published. Just because you’ve published doesn’t mean your book is worth reading. It doesn’t mean your book matters. It just means your book exists. Far from being impressive, that’s barely meaningful at all.

Just to be sure that he hasn’t convinced you enough that all book writers are hacks Atwood re-emphasizes:

In short, do not write a book. You’ll put in mountains of effort for precious little reward, tangible or intangible. In the end, all you will have to show for it is an out-of-print dead tree tombstone. The only people who will be impressed by that are the clueless and the irrelevant.

There is some truth in what Atwood writes. A lot of books don’t earn out their advances in order to get post-publication royalties. Unless you’re one of the few to have a huge best seller in the tech business, you’re not going to make any serious money; you’re barely going to break even with the hourly rate paid babysitters.

Some truth, too, with Atwood’s note about people no longer being impressed with book authors. Too many of us weblog–the old saw about familiarity breeding puppies, or some such thing. He even goes so far as to ensure you’re careful not to exhibit any respect for book authors by stating that those pitiful few who might give respect to authors are both irrelevant and clueless.

Marketing’s the thing, now. Marketing and attention. Don’t have to take my word for it: look at that the so-called Techmeme ‘leaderboard’ and you’ll quickly find that no amount of hard work, quality, or interest can compete with middle aged men having petty temper tantrums because they’re not getting their share of the lollies.

Books that are how-tos, help, or guides just don’t hack it today. Many of the better selling so-called ‘tech’ books don’t offer any practical advice. Most are formed from rants, both for and against, the technology many of the authors don’t even understand. Books have become more clan entry than helpful guide; you share your affiliations by the reviews you write.

Why do those of us who write tech books continue, then? That is the question, isn’t it?

One must, however, take Atwood’s rant with a little salt. After all what better way to generate noise about a book on a subject where too many books exist than to write something controversial at the same time you begin to promote the book. It’s just unfortunate that Atwood has chosen to promote his work by throwing those of us who have written tech books–for whatever reason–under the bus.

Categories
Books Photography Writing

Lessons from the book

Lessons learned so far from the book:

  • Photoshop, still king. After working with several photo and graphics editors, I can say with a great deal of certainty that Photoshop really does deserve the respect it’s been given. Adobe’s habit of re-arranging its products with every release, paranoia about stolen software (somewhat justified) and high price tags aside, the product is the best.
  • There are other good photo editing tools. Having said that Photoshop is the best, there are other excellent photo editing tools, including GIMP. I tried out the new GIMP 2.4 and was very impressed with the application. What’s important to remember about GIMP is that it’s one of the few that isn’t claiming to be a “Photoshop killer”. It considers itself to be a unique photo editing product.
  • Of the other products I explored, Paint Shop Pro has gotten a lot of flack for only being 8-bit, and deservedly. It still has an extraordinary number of photo effects, though. Paint.NET is not–not ready for prime time, that is.
  • Photoshop Elements is fun Elements is more than Photoshop with much of the guts torn out. Elements really is focused at a different audience. It doesn’t have much of the fine control that Photoshop provides, true. It does, however, support what most people want from a photo editor, and a whole lot of new functionality that most people would find fun. Since I have my TV hooked up to my computer, I adored Element’s ability to generate a widescreen HD-compatible slideshow movie with music of a folder of photos.
  • The next Photoshop will be an online tool. I’m amazed at the number of online photo editors. I’m doubly amazed with all the hyperbole surrounding them. These tools are described variously as the next Photoshop Killer or the next Photoshop, period. Even Adobe is coming out with an online tool. My first test for each of the online photo editors I looked at? Uploading and opening a RAW image file. Puts the whole ‘online’ photo editor thing into perspective.
  • Colorful black and whites. I don’t think I’ve realized how colorful black and white photos really are until I started exploring, in depth, the many ways one can convert a color photo into a black & white. This exercise should be a requirement for every class teaching black & white photography.
  • Snag-It is great for screen captures and Skitch has an interesting social network facility, but my favorite screen capture tool ended up being Faststone’s Fast Capture. I found it more comfortable to use then the other two products.
  • I will accept software that dynamically resizes my photos for online display, only if you let me use my new Grease Monkey script that removes all the conjunctions from your writing.
  • Most important graphics tools. The most important tool both for editing photos and creating graphics is the Gaussian Blur. You can do without most other things, but you can’t do without the Gaussian Blur.