I think there are times when dynamic is great and when dynamic is not so great. In fc2 there are currently some basic models like Rectangle which holds a size. Now say a user has a House object. The House object has a my_size member. You want to have a view for this house so that the view draws the house as a rectangle as seen from the sky. Now you can do three things:
1) Create an fc Rectangle object from the House object
2) Write your own HouseView which is basically the same as a RectangleView
why not subclass House from Rectangle, or use a Rectangle view for the House class's view, or use mixins?
Maybe I need to see a code example to see what you are getting at.
3) You write an adaptor which takes a House object and adapts it to an IRectangle interface which can be used with the default RectangleView
This sounds awkward to me, but even so, couldn't you write an adapter without format interfaces?
Of course, writing documentation also documents what we are expecting from the user. In the article Chris linked to, that's basically what the author says -
though he does say:
"""
if you're creating a framework, the situation is different. A framework is a library that calls the framework user's code. Now, somebody will be writing code that -- in effect -- is part of your library, and they need to know things about how their code will be called.
"""
I think FC may fall into the framework category, so there is something to be said for a formal specification.
One of the shortcomings of the current FC is that folks didn't seem to know that that could create their own drawobjects, and how easy it was. I've chalked that up to a lack of docs, and maybe interfaces would help, but as many Python programmers have never seen interfaces, we'd still need to document how to use the (PJE's point about the PEPs)
That being said, I think enthought traits could be useful.
Correct me if I'm wrong, but I thought this would be an even larger dependency.
Well, yes. though Enthought is working hard to re-factor their stuff so that pieces can be used independently more, like traits. it still may be big, though.
Plus I really dislike the fact that in the tutorial, it shows examples that make the view a property of the model.
Well, does that tell us anything about how traits can be used? or just that the tutorial writer didn't get MVC?
I'm attracted to traits because is seems to fit this use case well, and I like that we could use traits.ui to build a GUI to edit DrawObjects. I'm not looking forward to writing a bunch of dialogs, and why write a dialog generator, when that's what traits.ui already is? (the answer may be dependencies-- sigh)
Yes. Things like zope.interface can probably be compied directly into the FloatCanvas source tree, so there is no user-visible dependency.
Actually, if we do bundle it, I think we ought to expose it to users. The reason not to bundle it is added maintenance. When zope.interface gets updated, do we update ours? Who will keep track of bug fixes, etc.? Also, if we end up modifying it for some reason, how do we handle merging? So it's not really just a drop it in and forget it sort of thing.
I agree, bundling may be better than an external dependency, but it's still taking on substantial overhead.
BTW, I'm sorry to say the MVC SOC project has been dropped,
Darn, but maybe that means you'll have a bit more time to chime in on the other SoC projects!
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov