
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

Arthur wrote:
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 .... Am I - in fact - violating the Uniform Access Principal. If I am, am I violating good programming practice?
OK, my take is no -- you are choosing an API. My strongest reaction has to do with your wish to deny me the ability to make another choice; API design is an art, not a science, and not engineering. The whole API is what you should evaluate. I am certain we cannot produce a set of rules that guarantee a good API, not can we provide rules to avoid a bad API.
If I am not violating the Uniform Access Principal how do we express on what basis I am not?
This to me has to do with the set of calls in your API. It is hard to say with a coordinates and length API, it is easier with something richer like triangles, rectangles, and polygons. The length of the sides of all of those things should show up the same way; either as attributes or method calls. Variations between polygons and triangles, for example, would make me think you are letting your implementation show through too much. --Scott David Daniels Scott.Daniels@Acm.Org

-----Original Message----- From: edu-sig-bounces@python.org [mailto:edu-sig-bounces@python.org] On Behalf Of Scott David Daniels
My strongest reaction has to do with your wish to deny me the ability to make another choice
If that is a reference to my opinion about the visibility of the built-in property function, and its real world impact... if I thought my opinion had would likely have impact, I would likely think about it harder ;) Art

-----Original Message----- From: edu-sig-bounces@python.org [mailto:edu-sig-bounces@python.org] On Behalf Of Scott David Daniels
If I am not violating the Uniform Access Principal how do we express on what basis I am not?
This to me has to do with the set of calls in your API.
Yes but according to the Uniform Access Principle: "All services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation." My API is designed exactly and explicitly to betray this. That *is* my API. Art
participants (2)
-
Arthur
-
Scott David Daniels