The Artima Developer Community
Sponsored Link

Python Buzz Forum
Kid 0.2 and a note on Template Design

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ryan Tomayko

Posts: 408
Nickname: rtomayko
Registered: Nov, 2004

Ryan Tomayko is an instance of a human being...
Kid 0.2 and a note on Template Design Posted: Dec 2, 2004 2:51 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ryan Tomayko.
Original Post: Kid 0.2 and a note on Template Design
Feed Title: Ryan Tomayko (weblog/python)
Feed URL: http://tomayko.com/feed/
Feed Description: Entries classified under Python.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ryan Tomayko
Latest Posts From Ryan Tomayko (weblog/python)

Advertisement

I pushed up a much needed 0.2 release of Kid today. I hadn't meant for my previous post to be an announcement but I got quite a few comments showing interest and was surprised to see some people actually grabbing the 0.1.1 release. As it was, for all intents and purposes, not a release at all. The 0.2 release should be somewhat more stable. At least enough to dive in and play around.

I usually don't enjoy documentation but for the most part, the doc has been writing itself on this project. I think the key is making sure you are concentrating on something small enough that you can see the end of the documentation.

When you're documenting a year's worth of coding - you've lost. It just isn't going happen.

One of the topics that has come up in comments and email is the ability to embed blocks of Python code in the XML template, much like you would with PHP, JSP, ASP, etc. but actually not like those at all because it's not useful for controlling output, only for priming the context for template execution.

But code in templates is generally considered bad form as it can lead to a mash of concerns. I agree with this as a best practice and subscribe to something pretty close to a standard MVC design pattern myself. However, my experience with TAL, which allows only Python expressions, and those only in controlled circumstances when you have no other choice, was that I often wanted to just drop a couple of quick formatting-specific functions somewhere. Instead of putting them in the template, I was forced to pile them into a cruft module that just pissed me off every time I had to use it.

One of the reasons I'm so attracted to Python is that there's very little "saving people from themselves." Whether it be the liberal take on private attributes in classes, the ability to modify an objects member __dict__, the disregard for interface as contract, or a myriad of other aspects of the language, Python's utter disrespect for all things sacred and holy in protecting machines from the idiot programmers that abuse them really flipped a switch for me.

I've grown to expect this from my tools and libraries. The "force them to be good and proper programmers" attitude around Java programming has become a drag.

But I still program like that in Java because it makes sense in Java, which is even more puzzling. One might assume that upon appreciating the ability to get at pseudo-private members in Python that the practice would transfer to other languages. My Java classes instance variables should be at the very most protected, right? It doesn't work that way. The concepts aren't portable between languages.

This goes for other aspects of the language as well. Unchecked Exception's immediately come to mind as something I value tremendously but cannot, even though technical feasible, bring myself to advocate seriously on the Java side.

I'm rambling now so I'm going to end this with a bit I finished up on tonight from the Kid Tutorial, where an attempt is made to convince the programmer that there is rarely, if ever, a situation where making blanket rules about what types of ways you might allow yourself to manipulate a machine is in your best interest. You can always refrain from doing something you're able to do, but you can never do something you're not able to. That's not to say a system should not have constraints, just that it should not be constrained needlessly.

And of course, the following references to the Worse is Better mindfck is attributed to the masterful Richard Gabriel (or whatever his real name is).

Read: Kid 0.2 and a note on Template Design

Topic: 18 Nov 2004 Previous Topic   Next Topic Topic: 14 Nov 2004

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use