Saturday, December 15, 2007

Book Review: Making Things Talk

Making Things Talk by Tom Igoe is a book in a growing series from O'Reilly and MAKE magazine.  Similar to MAKE magazine, the book is about DIY technology.  Specifically, Making Things Talk is about "physical computing" projects that involve two or more devices "talking" (communicating is a variety of ways).  Physical computing is mostly about embedding electronics within objects that we interact with.  It should be required reading for just about any reader of MAKE (and many readers of MAKE's sister publication, CRAFT).

Although the book does not claim to be a primer on microcontrollers, physical computing, embedded devices, communication protocols, or embedded software development,  I found that it does a terrific job of providing the background necessary to build the projects and understand how they work.   The author provides some references for further background in these areas, but I never found myself at a point where I needed to pursue those other sources, even though I have virtually no experience in electronics or embedded computing.

The preface and the first chapter of the book get the reader familiarized with the software and tools used throughout the book.   The technology used in the book's projects are mostly implemented using a microcontroller hardware platform called "Arduino".  Arduino is an open-sourced hardware design available from multiple vendors that is built around AtMel's ATmega microcontroller.   The Arduino toolchain includes an IDE for developing Arduino programs in a language based on the Processing language and downloading them to the hardware.  Programs running on a PC or Mac that interact with Arduino(s) are mostly implemented in Processing.  I was surprised by how accessible the technology is.  Working with the hardware components feels very software-like - independent modules that communicate with others using simple, well defined protocols - even for what seems like pretty complex functionality like Bluetooth or WiFi. Once you have a basic understanding of communicating with one type module, you are on your way to knowing how to deal with many others. The software side of things is also very nicely evolved - no assembler or proprietary C libraries required.

The latter portions of the book is project-oriented.  The projects make use of a variety of hardware sensors such as proximity sensors, force sensors, flex and sensors.  In addition, the projects demonstrate the use of communication modules that enable communications between multiple devices using wired and wireless protocols such as Ethernet, Bluetooth, ZigBee, and others.  Some of the projects are more fun and whimisical than useful (such as the stuffed monkey pong controller and the cat bed monitoring system), but all of the projects illustrate some useful aspect of physical computing that could easily be applied for other purposes. 

This is the first book I have read on this topic, but it has provided me with more than enough to get started building interesting and useful networked physical computing projects with microcontrollers, sensors, and communication modules.  I think this book would help many people with sufficient interest and moderate technical skills get into working with this stuff too.  In fact, Processing is intended to be used for creative and artistic projects more than a general purpose programming language.  There are many examples of artists and other creative types who have used the tools described in the book to make interactive installations and objects.  Afte reading this book, I am looking forward to ordering a few Arduinos, some sensors and getting started on some projects. This is a terrific book and I highly recommend it to anyone who has an interest in this area.

Blogged with Flock

Tuesday, December 11, 2007

Book Review: Adding Ajax

Adding Ajax by Shelley Powers takes a unique approach to its discussion of Ajax in that it focuses on techniques for adding Ajax capabilities to existing web sites or applications. This is a useful perspective, since there are loads of sites and apps out there that can benefit from usability or esthetic improvements enabled by Ajax.

The first chapter of the book lays the groundwork for the projects and examples later on.  The book introduces the technologies we now commonly refer to as Ajax including its origins as a single proprietary extension to Microsoft Internet Explorer.  Early on, it also discusses the merits of "starting clean" prior to attempting to introduce Ajax to an existing site (or any site for that matter).  "Starting clean" in this context refers to use of CSS and well-formed XHTML rather than HTML tables and invalid HTML, of which many sites are guilty.  The point here is that Ajax applications commonly manipulate page contents via CSS and DOM, which may not work reliably unless the content is properly structured and styled.  This is good advice, regardless.

Following the background discussions, the book dives into a simple example web app illustrating the basic steps and issues involved in "Ajaxifying" an application.  Although the example is simple (a cocktail recipe viewing application), it actually provides a pretty good glimpse into the things one needs to think about and deal with when working with Ajax.  Next is a chapter focusing on a number of available Ajax/JavaScript frameworks such as Prototype, Dojo,, Rico and others.  The discussion of the frameworks provide examples of their use built upon the cocktail example. 

The next six chapters each discuss a particular type of functionality one might want to add using Ajax and provide examples of doing so.  Specifically, visual effects, different ui structures (accordion, tabs), dynamic data (in-place editing, validation, etc.), paging (and a discussion of issues around navigation and history), advanced visual effects such as SVG and the Canvas object, and implementing mashup sites.

Examples are provided for each of the concepts as they are discussed, mostly building upon previous examples.  Server-side elements of the examples are largely implemented as PHP pages.  The client  side  Ajax portions are demonstrated using either the author's custom JavaScript/CSS/(X)HTML or one of the discussed Ajax toolkits.  As the book progresses, reusable portions of the custom bits are incorporated into a bit of a
framework that is used in multiple places throughout the book.  In my opinion, the author seems to somewhat shy away from the use of Ajax frameworks in favour of using custom-code, at least for simpler scenarios.  This may be appropriate, but it's a bit of a slippery slope and can lead to "reinventing the wheel".

My overall impression of the book is fairly positive.  I did find myself skipping  large sections of it as I was going through it, as this type of book isn't the best "cover to cover reading", especially since there are some pretty large code listings.  Also, as a Java developer, this would not be the first book I would buy if I were working with Ajax and Java.  While many of the client-side discussions are still relevant, the server-side techniques and examples are of comparatively less value.  There is a least another book  needed to get one's head around the range of Java toolkits for dealing with Ajax on the server side.  Some of the implementation techniques used in the examples would not be advisable for enterprise applications, or for those concerned with elegant software architecture.  I can forgive these points, however, since they are not the focus of the book.  I anticipate referring to this book now and again when I am looking for techniques to enhance an existing application's interface with some Ajax bling without affecting the underlying infrastructure.

Blogged with Flock

About the wombat

Victoria, BC, Canada
This is our travel blog for our summer 2010 trip to France and the UK.