[Edu-sig] Design Patterns
Arthur
ajsiegel at optonline.net
Sat Aug 27 18:31:13 CEST 2005
>In my MVC example, the Viewer expected a 'shape' object to support a
>specific API: verts and edges needed to be available as attributes.
Let me try to practice better what I think I am preaching and follow your
lead in making the discussion more concrete and less theoretical.
I have a line segment - defined as the segment connecting 2 points. The
interface allows the points to be picked and moved.
The line segment has a length. I choose line.getLength() as my API which I
feel idiomatically expresses in Python that we are calculating the length as
it happens to be when the call is made. I could quite easily wrap it in a
property function and have a line.length attribute - but find it less
expressive.
Am I - in fact - violating the Uniform Access Principal.
If I am, am I violating good programming practice?
If I am in violation of the UAP principal, but not in violation of good
programming practice - what are the bounds of the UAP principal. And how do
we teach that?
If I am not violating the Uniform Access Principal how do we express on what
basis I am not?
Art
More information about the Edu-sig
mailing list