Summary of ATWF presentation About 3 years ago I collected ideas for a Tcl web framework inspired by some discussion on c.l.t and the tcl chat on the need for a web framework. As I also wanted to have such a tool written in Tcl I started the „ToW Tcl on WebFreeWay“ page and I got a lot of feedback and ideas. The most interesting part for me was a „substify“ procedure submitted by Jean-Claude Wippler, which allowed to have Tcl code with some escape character in front to be mixed with html or xml code in templates which could be converted to the final page using that „substify“ procedure. As I had no idea on how to structure the other parts at that time and I was engaged with the itcl-ng implementation, there was no progress on the ideas for about 2 years. Then in payed work we were looking for a web framework and Tcl was not an option because of not enough people in the project environment were familiar with Tcl. So we choose PHP's Zend framework, as the tool, as one colleague had already experience with it in other projects and others did at least know PHP. Looking at that I found a lot of features there were very interesting i.e. MVC paradigm, possibility to overwrite all the defaults provided by the framework, big flexibility in processing a request etc. I first had the idea of only using some ideas from Zend and building my own framework completely from ground up. But very soon I detected that I was always adding very similar code to my version from the Zend code and on the other side there were already a lot of interesting features for driving the handling of a request ready in Zend framework. PHP code with the use of PHP class system and objects looked very similar to Tcl when using Itcl as object system. So I decided to use the original code and to convert it very close to the original into Tcl. Doing that I would be able to use all the features, Zend framework had already tested and found to be useful during their development phase. There were only 4 places, where I wanted to use a different approach. 1) Database adapters: as I just had experimented with Kevin Kennys tdbc I found that tdbc is a suitable replacement for the pdo db adapters of Zend framework. 2) Arrays: all the Zend classes are dervied from an array class and nearly all collections of variables are based on PHP arrays. I found the equivalent in Tcl are dicts, which Donal Fellows has provided. As most of the array uses in Zend are key/value pairs, dicts are optimal for that part, 3) Views: Generating html or xml code using PHP code parser in the view part, which could also handle html/xml code intermixed with escaped PHP code was not possible for the equivalent Tcl part. But for that I had already a replacment the „substify“ procedure from Jean-Claude Wippler. It was eays to replace that part of the view mechanism with the „substify“ proc call and some additonal code. 4) Namespaces: Zend framework uses a 1:1 relationship between directory stucture and class name architecture. Class names are built from directory path names by replacing the path delimiter (normally a „/“ character) by an underscore („_“) character. That inhibits the use of underscore characters within class name parts. As Tcl has already a namespace feature I replaced the generation of class names with underscores for the directory parts by usage of the „::“ syntax and thereby the normal syntax for Tcl namespaces. So I think the idea of the namespace philosophy is much more visible in the ATWF implementation. ATWF uses - as the Zend framework - the MVC (Model/View/Controller) paradigm. This can also be seen in the directory structure used for a project. A Project for Zend has the following general layout in the file system: application configs controllers models layouts views modules module1 controllers models layouts views : : public URL's for sending a request are built as follows: ......///? the name of the module can be empty the name of the controller (default name index) the name of the action (default name index) A controller has a corresponding Tcl script in the controllers directory with the same name and in that script for every action there must be a method with the name Action i.e. IndexAction for the index action. The models directory normally has a DbTable subdirectory and in that directory a DbTable class for every table in the DB used by the project. The name for a DB Table person is ::Model::Dbtable::Person if no module name is used, otherwise the module name is prepended as namespace in front of that name ::Module1::Model::Dbtable::Person The views directory normally contains a scripts directory, which contains a directory for every controller with the name of that controller and in there a Tcl script for every action for that controller. These scripts are either templates for a html page or for a xml page with mixed in Tcl code, which is executed and replaced when applying the substify procedure on that template. The general workflow is: the controller calls an action, the action uses the models and eventually gets data from the DB using the DbTable class for the needed table(s). It processes the result sets and hands the result over to the view part. Then the view part is called running the rendering code and producing the wanted page and during that part calling the „substify“ procedure for getting the processed html/xml template and producing the response. The dispatcher, which is driving the controller/action/view part, is then sending the response back to the requester. In a first run I converted about 50.000 lines of Zend code to Tcl mostly just converting the original code by hand into the Tcl equivalent using itcl-ng's extendedclass system for the implementation. This work was done within about 3 months starting in mid of February this year to Mai. It is using the same mechanism in the file system layout and in mapping path names to class names. Right now the first requests sent from an apache server using rivet for forwarding a request to ATWF are running and giving back the requested results. An earlier version was also handling wub from CMcC (Colin McCormack) requests, this has to be adapted for the current version again. And I also had a version handling cgi-bin requests, to be adapted too,