I was a bit suprised when a representative of Packt asked me to review
a new Tcl/Tk book: A new Tcl/Tk book? A book about a language that
gets much less attention nowadays than Ruby, Clojure, Python, C#, and
even Java? Yes, it's really true.
There are quite some books on Tcl/Tk, albeit that most are already
aging. One of the well-known books is Practical Programming with
Tcl/Tk by Brent Welch that's now in it's 4th edition. So it's
quite obvious that any other book shall compete with this book on the
shelf about Tcl/Tk programming.
But even with all those new languages, Tcl/Tk doesn't really get the
credit it deserves: It's not a web-oriented language (initial attempts to
run Tcl/Tk in the browser failed to catch much popularity). But it's
still strong as scripting language and as language to make user
interfaces, without having to learn a new framework or a new
programming language. In that sense, Tcl/Tk is an Agile language that
you can pick up and extend your knowledge as you go.
The book is, as the name suggests, written in the Cookbook-style: Easy
to distinguish topics with examples and simple answers. I like the
style as it's both useful as tutorial book, to read from front to end,
as for reference book where you can skip to the topic or issue and read it.
The books starts with the Tcl shell syntax, then it describes the
standard control structures, error handling, and then continues to the
various variable types of the language, such as strings, lists and
dictionaries. After discussing the core Tcl features, the books moves
on to the Tk-part of Tcl/Tk, the user interface. The different
standard components are discussed, at the end of the book an example
is given of an address book application.
Although the book, in essence, can be a good addition to what's
available, when I first browsed through it, I got a bit of saddened
feeling: There were some typos and errors (e.g. TCL_interactive
instead of tcl_interactive), and more important: the code indentation
is broken throughout the whole book: I know you can have different
opinions on this subject, but I cannot believe the author applies it
as it is done in the book. I sincerely hope these layout problems and
some errata's will trigger a second edition release.
There are also some other issues that I noticed related to the order:
For instance, first regular expressions are discussed. A view pages
later, the simple string search is discussed. If you're reading the
book as tutorial, you might this order a bit unnatural. I also miss a
discussion of the namespace functionality in Tcl/Tk: if you want to
write larger applications, it prevents serious scaling problems and
the use of global variables.
The Tk-part of the book is not complete, some important (advanced)
techniques are missing. For instance, to control the input of a entry
widget, or handle the scrollbar with the -xscrollcommand and
-yscrollcommand (the scrollbar isn't even mentioned). In that sense,
if you do not consider it an advanced Tcl/Tk book, it's allright, but
you might miss out these important topics otherwise.
The address book application is a section of the book I find a bit
misplaced: it looks like it's just a listing of a (long) application,
that is described afterwards. Although I like long examples
discussing more complex issues with the language or see the topics
combined in one example, I doubt this example will be encouraging
enough for the reader. A reference to where the source code can be
found would be more than sufficient, and it would leave room to
discuss the important decisions made in this application.
Concluding, I must say that for an entry-level Tcl/Tk book it's a good
and easy accessible book. But if you intend to get a full
understanding of the language, you will require at least one
additional book (or read a lot of internet or manual pages). And some
issues, especially the indentation, must be taken care of in a reprint
before I can give a positive recommendation.