[Twisted-Python] web widgets

Sean Riley sean at ninjaneering.com
Sun Jan 13 18:29:25 EST 2002


some observations of web widgets..

the "page" variable of the Gadget class was confusing to me.. I initially
assumed that it was an instance of a Page object - rather than a class
object. Maybe renaming it to something like "pageClass" would be more
explicit?

"Gadget" is also pretty ambiguous before it is placed in context. I would
maybe prefer GadgetResource to make the context of it explicit - but i know
how glyph dislikes compound class names. This would impress the standard
twisted.web terminology on the naming within web.widgets...  GadgetResource
would be symetrical to "WidgetResource" which does exist - although i am not
sure if it is used?

"Page" is derived from Resource also which suggests to me it could be called
"PageResource".

User classes inheriting from both Gadget and Widget seems to be a very
common pattern - such as all the classes in both twisted.forum.gadgets and
twisted.metrics.gadgets. This would suggest another class in the framework
that fills this niche. This could also refactor all the "if isinstance(self,
widget)" code which is polluting Gadget into this new class. This would
become a convenient place for users to simply derive classes from.. I don't
know what to call it - GadgetWidget or WidgetGadget are just too
meaningless. It is really a renderable collection of widgets.. any ideas?
WidgetResource? WidgetGadgetResource? GadgetWidgetResource? Wadget? Gidget?
Watchamacallit?


attached is a class diagram for web widgets done in dia :)


----
"If it's not running programs or fusing atoms, it's just bending space.",
Ken Macleod
"That's it, I'm outta here.", Homer Simpson's Brain
Sean Riley
sean at ninjaneering.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: widgets.dia
Type: application/octet-stream
Size: 1886 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20020113/b9dae726/attachment.obj 


More information about the Twisted-Python mailing list