Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
News Books Media Book Reviews

Effective Tcl/Tk Programming 28

Lo, the reviewing hero has returned: Jason Bennett has returned with a review of Mark Harrison and Michael McLennan's effort Effective Tcl/Tk Programming. Designed as a book for those going deeper with their Tcl/Tk knowledge, this book works for those of you beyond the introductory page. Click below for more information.
Effective Tcl/Tk Programming
author Mark Harrison and Michael McLennan
pages
publisher Addison Wesley Publishing Company, Inc.
rating 8/10
reviewer Jason Bennett
ISBN 0-201-63474-0
summary A book for advanced Tcl/Tk programmers with thorough examples and good tips. As with most advanced books, it's probably better as a reference book than for pure reading, but its coverage is thorough enough to teach most Tclites a few tricks.

Background

Greetings, all, I'm back once again. After my travels into the world of Tk a few weeks ago, I've branched out to include its sibling, Tcl, in all its glory. Tcl, I have to say, reminds me a lot of Lisp, at least in its typelessness and fondness for lists. I do miss all the (()), though :-).

What's the book about?

Generally speaking, it is designed as a sequel to any and all introductory Tcl books with a view toward more advanced and narrow concepts. The authors go through various parts of Tcl that the novice programmer might not use frequently, but the advanced programmer will find quite useful. The geometry managers are all covered in detail, so the advanced programmer can select the best one. The canvas widget, that all-purpose blank slate, is given quite a bit of room. The book even covers communicating with other programs on the same machine and through sockets. Most all aspects of Tcl and Tk are addressed to some extent, leaving few stones unturned. Of course, programmers on different levels and with different experiences will find different nuggets in here. Personally, I was well acquainted with the text widget, making chapter five somehwat redundant, but needed some help with communicating with other processes. YMMV. Generally, the book is composed of several large examples, with new features added in each chapter. There certainly is a great deal of code, relative to the amount of explanation, so a good grasp of Tcl is required. In addition, the final chapters deal with delivering a complete, cross-platform Tcl application to the marketplace, in terms of packaging and cross-platform compatability. There's a nice install program example, and plenty of cross-platform minefields mentioned.

What's Good?

This book is excellent for any Tcl programmer who's looking to add one of the skills covered in this book to his bag o'tricks. If you want to know more about text widgets, or using Tcl as a front-end to other programs, there's plenty of explanation and example to glean from this book. If you want to know more about general Tcl concepts like the event loop or the geometry manager, there's still more for you. There are also plenty of concepts addressed that could be applied to other GUI efforts outside of pure Tcl/Tk. I wouldn't necessarily read the book just for those, but they are a welcome addition. The examples in particular are quite thorough, with extra code available that is not printed in the book. There's even an entire calander manager written that's quite full-featured. Any topic covered comes with not only text but plenty of code. Commercial Tcl developers will especially appreciate the emphasis on professional Tcl libraries and delivery. If you do Tcl for a living, you'll appreciate this book.

What's Bad?

If you don't want to delve deep into Tcl, don't bother with this book. You'll end up having to deal with areas of the language you never wanted to know, and you'll end up frustrated. Similarly, I wouldn't recommend reading this from beginning to end unless you love Tcl. There are plenty of parts where the flow is bogged down by the endless obscure code, and if you aren't interested, you'll end up skipping it anyways. Skim the parts that you don't need now, and come back to them.

What's In It For Us?

Since I know there are plenty of Tcl fans out there, I'm sure there will be plenty of interest in this book. As I said, if you're just starting with Tcl, hold off on this one. If, however, you've honed your Tcl skills, but need some extra help in some areas, this book is for you. Whether you're into sockets with Tcl or just want to use that text widget more effectively, you will find this book useful. I'm sure it will be coming off the shelf for reference much in the future.

To purchase this book, head over to FatBrain.com, and pick it up.
This discussion has been archived. No new comments can be posted.

Effective Tcl/Tk Programming

Comments Filter:
  • I do believe that both Perl/Tk and Python/Tkinter still use a Tcl interpreter to drive the Tk GUI. The Perl or Python interp is interfaced to the Tcl Interp. This is why these approaches are no more responsive (even slower?) from a UI standpoint, even though Perl and Python are generally faster languages than Tcl.

    I believe that someone was working on a Tcl-less version of Tk, but that's not the one that everyone uses.

    Someone correct me if I'm wrong...
  • I have both but only use each for reference - i.e haven't read them cover to cover.

    They're both good books. Welch's is the expansive, complete reference.

    Harrison/McLennan is more like the hot-insider-tips kind of book. It points out a lot of cool, but inobvious, things.
  • ...for OO, GUI and Client/Server stuff in Tcl/Tk. If you need to do any of the previous, then read his stuff!

    He created the [Incr Tcl] and derivative extensions. And in addition to the above book, he contributed a couple of good chapters to O'Reilly's excellent "Tcl/Tk Tools" - a compendium of Tcl/Tk extensions - which Harrison edited.
  • Python/Tk (called Tkinter) makes for a nice combination. You get Tk with the benefit of an OO language with real dynamic typing. Unfortunately it's no faster than Tcl/Tk. Here's a nice intro. [pythonware.com]

    If your UI does not need to be crossplatform, pygtk [daa.com.au] may be a an even better choice. It has more widgets, is fast, and you can also write GNOME apps with the companion pygnome modules. (The pygnome package includes pygtk.)
  • I was involved in a commercial project that used Tcl. The experience says: use perl. You will regret using Tcl. You will hate it. You will fail deadlines over and over again. The system will be sluggish, and you can't do a thing about it, because it's Tcl's fault.

    I mean, what do you expect from a language designer who distinguishes between untyped and statically typed languages? And either has never heard of dynamic typing or chooses to ignore it? Who thinks that "all the world is a string"?

    Do yourself, your employer, and your customers a favor, and stay away from Tcl.
  • If you're interested in a language as fast as C++, but as nice as Python or perl, check out Dylan. A Gtk+ wrapper is under development. Gwydion Dylan [gwydiondylan.org] is even written in itself, you can't say this about Tcl, perl or Python.
  • Actually a lot of people like Tk and don't like Tcl, and that's why you can do neat things like using Perl/Tk instead of Tcl/Tk. Check out the O'Reilly books for more info, ie "Advanced Perl Programming"
  • I'm not an expert in how these languages are implemented, so I could be wrong, but anyway, here is a quote from the O'Reilly Book "Advanced Perl Programming" chapter 14 "User Interfaces with Tk", "Nick Ing-Simmons tried a more ambitious approach: he purged Tk of all embedded Tcl code and gave it a generic porting layer to make it easy to add other scripting languages; this effort is called pTk (portable Tk). To this, he added a Perl5 wrapper (with the intention of adding other language wrappers in the future)."
  • How does the book compare with the standard Tcl/Tk book, Practical Programming in Tcl/Tk (2nd edition)?
  • How does the book compare with the standard Tcl/Tk book, Practical Programming in Tcl/Tk

    (2nd edition)?

    I own both books. I find the Welch book to be a very good primer on using the language. McClennan/Harrison is a good book once you are up to speed on the basics. It covers a set of best practices from some guys who have written a lot of tcl code and in the process developed a set of useful techniques for Tcl programmers.
  • Alpha??? It's in production, v.1.2 already.
  • I took a tutorial from McClennan at last years Tcl/Tk conference that covered client/server apps in Tcl. It was the single most useful aspect of that whole conference. The tutorial was designed around the client/server chapter of the book and I bought the book as a result. The best Tcl/Tk book I've seen.

    McClennan (author of [incr Tcl], founder of Tcl Consortium) was one of the most highly motivated and driven people I met at the conference. He ran more tutorials (one for each session) than anyone else there, ran the "Game Show" (including writing the software for it), and was also a conference co-chair.

    He nows his stuff and, just as important, he know how to explain it.
  • First, it sounds like you were still using Tcl 7, not Tcl 8 (which no longer thinks the whole world is a string).

    Second, there seems to be a great deal of evidence that Tcl/Tk can handle its own in the real world. Scriptics ( www.scriptics.com [scriptics.com]) maintains a collection of success stories.

    Tcl's main advantage is the ability to prototype extremely quickly. It was originally designed as a "glue" language, but has been far more useful than just that. If you find some aspect that is too slow, you can recode that module into C or C++ (or even java for cross-platform purposes) and link it in.

    Tcl is also widely used in QA test automation. Many web sites use it as a back end. NBC presented a paper at the Tcl/Tk conference detailing how they use Tcl/Tk to deliver satellite feeds to affiliates (they originally planned to just do the prototype in Tcl and recode later, but found that they only had to replace a small number of modules).

  • There are at least two debuggers for Tcl. One is from Don Libes, and comes as part of his Expect extension (although usable separately). See the Expect home page [nist.gov] for more info.

    The other is the commercial offering from Scriptics [scriptics.com], John Ousterhout's company.

    I'm sure if you check the Tcl FAQ you can find more. Check comp.lang.tcl.announce for the weekly summary postings, it will contain a link to the FAQ.


  • I believe Scriptics is coming out with a Debugger.. The alpha version is even out for free trial (last I checked). Check out Scriptics [scriptics.com]. (btw - Scriptics is the company Ousterhout founded to further his Tcl work.
  • The review is alright, but it doesn't really tell my how the book stacks up to the other Tcl/Tk offerings out there.

    Also - Tcl is not Tk's "brother" or whatever it was the reviewer put. Tcl is a scripting language and Tk was an extension made to that for GUI pruposes. Tcl is the important piece and without it, Tk doesn't exist. I think the reviewer needs some more Tcl experience before he can give an informed opinion on what was important and what wasn't. Generally, most people are fairly ignorant about the power of Tcl, though..
  • Gosh, how about that FUD there? The last project I worked on, I used ISO C to collect data, perl for preliminary postprocessing, and Tcl/Tk for interactive final processing and display.
    • Would I want to use ISO C to do heavy string handling?
    • Would I want to use Tcl for batch-mode report summarizing?
    • Would I want to use perl for an interactive data viewer. (nb: perl/Tk is a bit hard to get installed on various random systems. The syntax is also not to my taste.
    The chief point in all that appears above isn't that the answer is uniformly no; it is that the answer is a personal preference. What I'm most productive with is a function of my skill set and tastes. There isn't any data in what I'm replying to, just a lot of dire warnings. Bigotry over technology never got anyone anywhere.

    Tcl might not have worked for this guy in this project. He hasn't given any real reasons why, though. Knowing how and why Tcl didn't work out might be interesting and useful.

    -BJK

  • Doesn't include any information on how to debug the lanuage perchance. I have spent long pleasure filled hours resorting to the good ole reliable puts (printf for those of the C clan)to debug it.

    I would sell my soul and carpent lint for a decent debugger. Still though not as bad as the days when I was writting speech systems in TCL. Had to spent several weeks in a padded romm after that

After Goliath's defeat, giants ceased to command respect. - Freeman Dyson

Working...