Dave Cole
djc at object-craft.com.au
Sat Jun 7 13:27:12 EST 2003
> On Fri, 6 Jun 2003, Michael C. Neel wrote: > > > I'll take a moment in this thread to plug Albatross > > (http://www.object-craft.com.au/projects/albatross/) as the > > "killer" template system for python, or at least a strong > > contender. > > The problem with Albatross for me is the same one with all the > others - it is yet another language to learn: > > <al-for iter="name" expr="keys"> > <tr> > <td><al-value expr="name.value()"></td> > <td><al-value expr="environ[name.value()]"></td> > <tr> > </al-for> > > This is not Python. Nor is it HTML. That is true. If you restrict yourself to Python and HTML you are forced to do something like this: for name in keys: print '<tr>' print ' <td>%s</td>' % name print ' <td>%s</td>' % environ[name] print '<tr>' That does not look bad until you build a semi-complex application. You find yourself in the situation where you cannot change the HTML presentation without refactoring the surrounding Python application logic. Likewise you find it next to impossible to change the application structure without breaking the presentation. The above approach leads to the escalating difficulty and cost (in time and/or money) of enhancements. The introduction of a mechanism (or third "language") that allows and/or imposes a clear interface between the presentation and implementation increases the ability to change one without major impact on the other. This is a huge win for applications that will change over time. In the world of GUI application development the model-view-controller approach has proven itself as a mechanism to manage the same complexity. It provides a clear separation of the GUI, the business logic, and the code that glues them together. Before the adoption of MVC (and related patterns), applications tended to be an undisciplined mixture of GUI and application code. Over time companies that were not able to enhance or evolve their products could not compete and went out of business. The approach to web applications encouraged PHP (and similar approaches) is reminiscent of GUI application development before MVC. The Albatross approach to the "third" language is not perfect. I am not sure that any approach to achieving this separation is perfect. In my opinion, if there was a perfect approach we would not be having this discussion, we would all just use the perfect approach. - Dave -- http://www.object-craft.com.au
|