Practical Programming in Tcl & Tk
Author: Brent Welch
Publisher: Prentice Hall
Price: $42 US
Reviewer: John McLaughlin
If you are a Linux user, you have most likely used a Tcl/Tk application. A large number of the applications under Linux use Tcl/Tk (here after referred to as “Tcl applications”) as the GUI front end. Tcl has become popular under Linux for a variety of reasons: flexibility, ease of use, availability of source code, liberal license policy and the gorgeous look to the Tk widget set. If you're curious and want to learn more about Tcl or if you just want to become more comfortable with the language, Practical Programming in Tcl & Tk by Brent B. Welch is a book you'll want to read and refer to often.
A member of the development team for Tcl at Sun, Mr. Welch is perhaps best known to the Linux community for his work developing EXMH, the best mail reader under Linux (small personal bias inserted). In this 2nd revision of his book, he uses 613 pages to lead the user from the fundamental paradigm of Tcl scripts, to using Tk and writing extensions in C.
The book is divided into seven sections covering Tcl Basics, Advanced Tcl, Tk Basics, Tk Widgets, Tk Details, Tcl and C, and Changes. Each chapter begins first with a short paragraph introducing the subject, followed by detailed discussions, tables and a plethora of examples. A helpful feature of this book is the “Hot Tips” marked in the margins, these indicate something particularly useful, tricky or non-obvious.
The section on the Tcl language pleased me immensely; often books fly through the fundamentals of Tcl in order to get to the more “glamorous” Tk section. Tcl is powerful and rich, but can sometimes be a confusing language especially if you don't fully understand the fundamentals. The author's thorough explanation of the basic constructs and group-substitute-evaluate paradigm of the Tcl language was nicely done and clarified my understanding. Anyone who writes Tcl scripts would benefit from reading the first section a few times.
The sections on Tk widgets clearly explain not only the syntax and use of the widgets, but through the extensive use of examples really drive home how to most effectively use them. The book also discusses techniques on how to solve, in a simple manner, problems that face many Tk programmers (such as having a scroll bar attached to two listboxes).
The sections on the Tcl C API are very well done and excellent reading for anyone who is trying to integrate Tcl into a larger application. Not only does the author give a nice overview of the API from a task perspective; he also provides several tricks. My favorite is Tcl_Invoke a C procedure that allows the invocation of Tcl commands without the overhead of substations that come with Tcl_Eval.
Included with the book is a CD-ROM containing all of the examples from the book and a small browser application to help access and run the examples. Perhaps I am being a bit overly critical, but I was a little disappointed with the included browser application. It would have been nice to include a really glitzy Tcl browser to really show off the strengths of the language. Sadly, the included application, although usable, was a little stark and would certainly not inspire a new user of Tcl to get excited about the language. Also included were a collection of Tcl scripts and extensions from the various FTP sites; again it would have been nice if a few more of them had been unpacked and ready to run off the CD.
Although this book is described as being useful for the beginner, as well as expert Tcl user, it really shines for people with at least a little programming knowledge. In some ways the breadth and detail of the book (not to mention its weight) could be a little intimidating for a newcomer. For the true beginner I still like John Ousterhout's Tcl and the Tk Toolkit (although it's getting a bit dated).
Throughout the book the author pulls no punches. Covering the language in great detail and providing many useful tricks, he is equally quick to point out potential pitfalls, inefficient commands and constructs that although legal “probably aren't a good idea”.
A great amount of attention is spent throughout the book delineating features that apply to a specific release of Tcl or a specific computer platform (Unix, Windows, Mac). This is particularly helpful if you are interested in writing truly cross-platform scripts. Whenever possible, attention is given to writing code that will work across multiple platforms and revisions of Tcl. Because the author is part of the design team at Sun, he was able to cover some of the new features introduced in Tcl 8.0 including namespaces, binary string support and the on-the-fly compiler.
Without a doubt this book lives up to its name. It provides an extremely practical view of Tcl and Tk, pointing out its features and flaws while focusing on writing scripts that “get the job done.” Mr. Welch has written a book that is essential reading and reference material for anyone who writes Tcl code or integrates it into a larger application.
John McLaughlin is a project manager at Hewlett Packard working on test equipment for wireless chipsets. A Linux user since 0.99.13, he lives in the San Francisco Bay area with his wife Noel and enjoys traveling, diving, skiing, hacking with Tcl and writing EXMH extensions (under Linux of course). He can be reached at email@example.com.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Back to Backups
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- A New Version of Rust Hits the Streets
- Google's Abacus Project: It's All about Trust
- Secure Desktops with Qubes: Introduction
- Seeing Red and Getting Sleep
- Fancy Tricks for Changing Numeric Base
- Secure Desktops with Qubes: Installation
- Working with Command Arguments
- Linux Mint 18
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide