Tcl and the Tk Toolkit
Author: John K. Osterhout
Reviewer: Phil Hughes
Tcl and Tk are receiving a lot of press. They offer a quick way to develop X applications or add a graphical front-end to existing code (see Linux Journal #8). Plus John Osterhout, the author of Tcl, is now working for Sun—and Sun is talking about turning Tcl into a serious product. In this book, Osterhout offers an introduction and overview of Tcl and Tk to get you started and continues on to the serious stuff.
The first part of the book following the introduction covers the Tcl language itself—chapters include syntax, variables, expressions, lists, flow of control, procedures, string manipulation, file access, processes and error handling—and ends with chapters on tcl internals and the history mechanism.
Next, the book covers the Tk toolkit for writing X-Windows applications. Again, there are a lot of chapters covering widgets, geometry managers, bindings, focus, window managers, communications between applications and invocation of procedures by real-world events. The final chapters discuss configuration, assorted commands and concepts that don't fit elsewhere and also give two applications examples.
The end of the book covers working with Tcl and C, and working with Tk and C. The Tcl chapters first tell you why you may want to combine Tcl with C and then explain how the interface works and how to develop code using it. There are a liberal number of examples. The Tk and C chapters thoroughly cover the nitty-gritty of the Tk/X interface. If you are not familiar with X-Windows programming, this looks a little scary, but it isn't the fault of Tcl/Tk.
The book ends with an appendix that points you at ftp sites where you can get software and a brief description of how to get it running. There are 450 pages of information contained in the book.
I am not a Tcl/Tk programmer and got the book to start from scratch. When I first looked at the book it reminded me a lot of The C Programming Language written by Kernighan and Ritchie (K&R), who also wrote the C language. Osterhout's book, like K&R's, begins with an overview and then continues by showing the reader all the details. A “hello world” program is used early on as a programming example and this illustrates that both Tcl and C are relatively simple languages. Also of note, is that Brian Kernighan is Addison-Wesley's consulting editor for a series of books.
I remember reading K&R, writing some C code, being a little frustrated, going back, learning more and eventually learning C. When I was learning C (1980) K&R was the only book out there. Today, even though there are hundreds of books on C, I still use K&R for reference and don't look in other C texts for information.
I have played a little with Tcl/Tk using this book and have felt more than a little frustrated. After looking over the book again, my conclusion is that it covers the language in detail as a tutorial, but it is not a good reference book. In the case of C, I use SSC's C Library Reference (a pocket-sized guide that I wrote) as a quick reference. Then I use K&R for additional reference, if needed, because it offers information in an easy-to-find format.
Osterhout's book isn't going to be the book you use when you are writing code and need to look something up. I see it as one of the tools you utilize to get started with Tcl/Tk, but a second, smaller book or pocket guide is necessary to help you with the nuts and bolts as you actually do development. Is it worth buying? Yes. But life will be easier when a reference exists that will complement this book.
Phil Hughes is the publisher of Linux Journal.
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!
- Petros Koutoupis' RapidDisk
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- Oracle vs. Google: Round 2
- The FBI and the Mozilla Foundation Lock Horns over Known Security Hole
- Varnish Software's Varnish Massive Storage Engine
- Privacy and the New Math
- Firefox 46.0 Released
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