On 2007-01-11, Rob Hudson <treborhudson-> wrote: > > 2. The argument against #1 that I've seen is usually that you can > subclass Something and write your own output. But in some ways, this > violates the DRY principle. The code to output a form widget, for > example, is already written, and in looking at what it would take, the > only change in the render() method would be the change of the HTML > itself. > > 3. Better "updatability": If there is a bug in Select(Widget) that was > fixed but I have MySelect(Widget) which is mostly the same except for > the HTML, I wouldn't get the fix unless I noticed and updated my code > as well. Whereas if Select(Widget) pulled in a template and I overrode > that template, the fix would come down just fine across all my > projects.
Yes, in more general terms, this design violates the Single Responsibility Principle [1]; the method designed to be overridden has more than one reason to change: framework driven fixes/enhancements, and user level changes to the details of the presentation (e.g. markup type) Conveniently, templatizing the markup is a readily available design alternative which cleanly separates the responsiblities. > 4. One of the reasons I've seen touted for the template system not > having access to Python methods and having it's own language is the > benefit of separating the programmer from the designer and that > designers shouldn't need to know Python to create templates in Django. > But they would if they want to manipulate forms or form error feedback. > This should be consistent. I think this point also has significant merit. Steve [1] http://en.wikipedia.org/wiki/Single_responsibility_principle --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---