Tcl HomeTcl Home hosted by

Google SiteSearch

It's important when choosing a programming language to choose the right language for the job. While there are many factors involved, one of the most important is certainly the fit of the tool to the project at hand.

Tcl and Tk aren't the perfect tool for everything, but they do work well for a surprisingly large number of projects. Here are some things to consider when trying to decide if Tcl and Tk might be a good fit as one of the languages for your next project.

Dynamic Languages vs. System Programming Languages

Tcl is a dynamic programming language, along with other languages like Perl, Python, Ruby, etc. (these are also referred to using the slightly older term scripting languages). This is in contrast to system programming languages, of which C++ and Java are the most common examples.

Dynamic languages are complementary to system programming languages, and designed to solve different problems. You'll find features in system programming languages that help in creating complex data structures and algorithms, worry about compile-time type safety, and so on. Dynamic languages make it easy to quickly manipulate data, often pulled from networks, user interfaces and devices. Typing, where present, is usually less rigidly defined, and determined at runtime. Dynamic languages are typically interpreted, highly introspective, and emphasize integration and extension to add new capabilities.

As a result, dynamic languages tend to be "higher level". With less static code in place to satisfy a compiler, programs are shorter (often 5-10x), and because they are interpreted and open to introspection, much, much faster to develop. Having said that, facilities exist in most modern dynamic languages (e.g. objects, namespaces) to develop often spectacularly large applications.

Dynamic languages aren't right for everything though, and many projects in fact combine both dynamic and system programming languages, using each where appropriate. For a longer discussion on this topic, see John Ousterhout's article Scripting: Higher Level Programming for the 21st Century.

Choosing a Dynamic Language

In recent years, there has been a real surge in the availability and popularity of high quality dynamic languages, particularly in the open source world. While this website is obviously about Tcl, other languages like Perl, Python, Ruby, and PHP (to name but a few) are also excellent tools, and each has their own unique advantages, features, and style. All have as many similarities as differences, and the features of one often migrate to others; for example, Tk is the default GUI for most open source dynamic languages today.

So then, why Tcl? The Features and Benefits and Highlights pages describe many of the areas where Tcl is particularly strong. A few particular strengths worth emphasizing here:

  • a rich deployment model that is second to none, including support for protecting commercial applications
  • Tk is designed explicitly for Tcl; while it works well with other languages, the API is both more natural, more current, and better documented
  • built-in event-driven programming model for networks, GUI's, and more
  • supports a wide variety of programming styles, including procedural, several styles of object-oriented, and others, and is great for building domain specific languages
  • excellent internationalization support

Of course, for many people, Tcl as a programming language is just more enjoyable to use and feels right for them. Who can argue with that?