Practical Programming in Tcl & Tk

Author: Brent Welch
Publisher: Prentice Hall
E-mail: sales@prenhall.com
URL: http://www.prenhall.com/
Price: $42 US
ISBN: 0136168302
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 johnmcl@sr.hp.com.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




3 hours 29 min ago
3 hours 30 min ago
5 hours 30 min ago
14 hours 15 min ago
14 hours 49 min ago
15 hours 48 min ago
16 hours 38 min ago
20 hours 40 min ago
1 day 27 min ago
1 day 35 min ago