[Sarnold] ''March 2005'' Purpose of this page : tell how different programming styles are possible with Tcl, and how it saves headaches, rather than just tell someone : ''Tcling'' is fun, because you won't be believed until you show what makes it possible. And IMHO, programming is too serious to be fun, even if the programmer often searches the ''Holy Grail of the languages''. The discussion is open. ---- [Functional Programming] Tcl makes it possible, with a common style, and even with some [Radical Language Modification]s. It is well known to reduce side-effects. Maybe would it reduce the size of your scripts. Every Tcler has had to deal with FP-like structured programming, with or without the help of [Tail call optimization], [RPN] or wathsoever. ''TODO : explain where functional programming is obviously needed or wished'' ---- [Object Orientation] The choice is here : many OO extensions are available. It helps you to structure your code , and doesn't need wasteful learning. There are good tutorials, and it is, in most cases, not boring to write some classes. When you have lots of business logic, OOP will be a strong choice. ''TODO : add links to OOP on the wiki'' ---- [Regular Tcl Style] After all, you can get the job done with the basic style, with the help of [Introspection]. For small scripts, you won't need a complete knowledge of the commands (memoizing manual pages). You can write GUI programs quickly, with patterns that split the view from the data model, even with plain namespaces. You can test your program interactively, with [tclsh] or other tools. Separating blocks of code and testing it is easy ; you do not need to remember all commands' manuals, because you can always test a more or less sophisticated bit of code. An aphorism : "Write code so simple so that bugs just can't happen." (Well, you wouldn't believe me, but this simplicity exists) As you won't need to know the complete Java API, you won't need to know all the core Tcl documentation to write maintainable scripts. Many patterns are done by using small procedures which encapsulate data, and are used in a [foreach] control structure. ''TODO : explain why scripts written in a regular style are easy to understand, and finally to maintain.'' ---- [Dynamic language] There are many ways to do things dynamically, creating [proc]s at runtime, treating variables as strings, and so on. You may realize that a functionality is done in 10 lines, where in imperative programming it would take ten times more. ---- '''More than one way to do that !''' This is common in many languages, but much more in Tcl. ---- [Fun with Chinese Characters] [JimG] I have tried some languages before I started to learn TCL recently and I find it's fun to program Tcl in Chinese. ---- [Category Advocacy] | [Category Discussion]