Re: [Edu-sig] Design Patterns

2005-08-27 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 accor

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 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 propert

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Scott David Daniels
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 v

[Edu-sig] Design Patterns

2005-08-27 Thread Arthur
>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

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > "Information hiding" means sparing me the details. In an open source > world, > I might be able to see those details if I really cared about them. In the > case of a private bank, fat chance. Yes, we are at the core

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Kirby Urner
> Separating these matters in an educational setting is more than > problematic. > > Art In an educational setting, I use analogies. Think of interacting with a waiter in a restaurant. Your expectation is you name the foods and drinks you want, and after a period of time, those items arrive a

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Arthur
> -Original Message- > From: Laura Creighton [mailto:[EMAIL PROTECTED] > > My guess is that you think that properties violate 'Explicit is better > than implicit.' Not exactly. More like I think that it encourages "theory", and I appreciate Python as a-a-theoretical. The counter argum

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > > > Kirby seems comfortable in the Meyerist camp. > > > > I think you might be reading something too sinister into "information > hiding" and are therefore against it. I did put a ;) after my comment on information hi

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Arthur
> -Original Message- > From: Laura Creighton [mailto:[EMAIL PROTECTED] > One nice thing about overwriting __getattr__ and __setattr__ is > that when you are done you have something that fairly shrieks > 'black magic here'. Properties look innocuous. Some people go quite > nuts with the

Re: [Edu-sig] Design Patterns

2005-08-27 Thread Laura Creighton
In a message of Fri, 26 Aug 2005 18:24:33 EDT, Arthur writes: >And am hoping he is quite wrong in the assessment that "information hiding" >is a base requirement for information science. ;) He is quite correct, but 'hiddenness' is not an infinite human good, such as health. It is quite possible

Re: [Edu-sig] Design Patterns

2005-08-26 Thread Kirby Urner
> Kirby seems comfortable in the Meyerist camp. > I think you might be reading something too sinister into "information hiding" and are therefore against it. The brutal real world truth is the client wants an API that works today, but will complain if it doesn't deliver tomorrow, even if specs s

Re: [Edu-sig] Design Patterns

2005-08-26 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Scott David Daniels > > This is close to what I meant. I dislike properties that don't behave > as if they were attributes. Not exactly sure what that means. Seems there is a lot to this topic.

Re: [Edu-sig] Design Patterns

2005-08-26 Thread Scott David Daniels
Kirby Urner wrote: >>So I find that rejecting it as naïve is fundamentally unresponsive. >>Art > > However in this case I don't think your views were rejected as naïve. On > the contrary, your views permeated a sophisticated discussion of use cases, > and design patterns more generally (s'been a

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > I *enjoy* your exotic other-worldliness. Other than what, I'm wondering ;) Art ___ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-si

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Kirby Urner
Hi Andre -- If you scroll back, you'll see I was specifying a triangle object in which sides a,b,c were passed to a constructor, *and* could be respecified on the fly, thereby changing the triangle. A validator made sure the proposed triangle was legal (triangle inequality not violated). Other

Re: [Edu-sig] Design Patterns

2005-08-25 Thread André Roberge
Disclaimer: I haven't followed this thread as closely as I should. Picking up on a few words from the discussion (namely "triangle" and "properties"). When I think of a real life triangle, I can describe it in terms of various "properties", such as: the length of each of its three sides, its area

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Kirby Urner
> So I don't feel as off topic or off base as perhaps I should. > > Apologies. > > Art I don't feel you've been off topic or off base at all in this thread (nor really that much in general). The considerations you have about properties were worth raising. My point is I don't think your contrib

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Kirby Urner
> So I find that rejecting it as naïve is fundamentally unresponsive. > > Art > However in this case I don't think your views were rejected as naïve. On the contrary, your views permeated a sophisticated discussion of use cases, and design patterns more generally (s'been a rich thread) plus Sco

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Arthur
> -Original Message- > From: Arthur [mailto:[EMAIL PROTECTED] > > So I find that rejecting it as naïve is fundamentally unresponsive. Just to add - I would feel my approach - no question - more misplaced most other places. But think Guido's ability to retain a sense of naivety in th

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Arthur
> From: Kirby Urner [mailto:[EMAIL PROTECTED] > You're welcome to your opinions. Sometimes you whine when it seems your > opinions are taken for what they're worth though, which *sometimes* (not > all > the time) ain't much in my book. We are in agreement. That is precisely when I whine. Bu

Re: [Edu-sig] Design Patterns

2005-08-25 Thread Kirby Urner
> >I think use cases were described, and demonstrated, in which the property > >feature made sense, e.g. we wanted an attributes-based API into our > >triangle object, but sometimes the results were computed on the fly. > > And I notice that without the use of properties, that which is computed o

Re: [Edu-sig] Design patterns

2005-08-24 Thread Kirby Urner
> Here's some code, which as yet doesn't actually make use of VPython -- but > that's where it's going. > And here's where it (the code) went. Very minimal, at this point but enough to get VPython actually doing something with the triangle. A student could start with this code and start add

Re: [Edu-sig] Design patterns

2005-08-24 Thread Kirby Urner
> I might be a dead horse who is dead wrong, but the issue about how > properties fit into Python is certainly not straightforward in the least, > and responding as if it were is grossly unfair - to the question raised. > > Art I think use cases were described, and demonstrated, in which the prop

Re: [Edu-sig] Design patterns

2005-08-24 Thread Kirby Urner
> -Original Message- > From: [EMAIL PROTECTED] [mailto:edu-sig- > [EMAIL PROTECTED] On Behalf Of Chuck Allison > Sent: Tuesday, August 23, 2005 6:19 PM > To: Kirby Urner > Cc: edu-sig@python.org > Subject: Re: [Edu-sig] Design patterns > > Hello Kirby, > >

Re: [Edu-sig] Design patterns

2005-08-24 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Scott David Daniels > Arthur wrote: > > ... more to my point is the fact that I don't expect my programming > language > > to solve the problem of decoupling my API from my code. Because I don't > >

Re: [Edu-sig] Design patterns

2005-08-23 Thread Scott David Daniels
Chuck Allison wrote: > My syllabus is at http://uvsc.freshsources.com/html/cns_439r.html. > One thing I've always wanted to see if the class is small enough: Groups shuffling other group's previous layers, and providing feedback (but not grades) to the original group. It is always

Re: [Edu-sig] Design patterns

2005-08-23 Thread Scott David Daniels
Arthur wrote: > ... more to my point is the fact that I don't expect my programming language > to solve the problem of decoupling my API from my code. Because I don't > expect it to be a solvable problem. I don't know if I'm beating a dead horse, but I don't claim properties solves the problem of

Re: [Edu-sig] Design patterns

2005-08-23 Thread Chuck Allison
Urner >> Cc: 'Arthur'; 'Scott David Daniels'; edu-sig@python.org >> Subject: Re[2]: [Edu-sig] Design patterns >> >> Hello Kirby, >> >> Since this discussion has swerved a little, I'd like to pose a query. >> I've been using

Re: [Edu-sig] Design patterns

2005-08-23 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > They're not here to whine about not being mere "math notations" as if that > would be an improvement. That's one way to attempt to characterize my point - or Graham's point, for that matter. Except that it of course

Re: [Edu-sig] Design patterns

2005-08-23 Thread Kirby Urner
> In his mind, (and I think in yours as well) computer languages are more > like mathematical notation than a form of technology. And as such, > evolution is slower - not at the pace of the changes in the underlying > technology. However I'm sometimes in the mood to not draw this line between

Re: [Edu-sig] Design patterns

2005-08-23 Thread Kirby Urner
> -Original Message- > From: Chuck Allison [mailto:[EMAIL PROTECTED] > Sent: Monday, August 22, 2005 12:43 PM > To: Kirby Urner > Cc: 'Arthur'; 'Scott David Daniels'; edu-sig@python.org > Subject: Re[2]: [Edu-sig] Design patterns > > Hello Kir

Re: [Edu-sig] Design patterns

2005-08-23 Thread ajsiegel
- Original Message - From: Scott David Daniels <[EMAIL PROTECTED]> > If I wait until I have actual users, I can get > real statistics on how the use the API. We decouple our work this > way. But in my look of it, properties are a "solution" to one of a nearly infinite set of these k

Re: [Edu-sig] Design patterns

2005-08-23 Thread Scott David Daniels
Chuck Allison wrote: > Since this discussion has swerved a little, I'd like to pose a query. > I've been using patterns since 1995 and am teaching a course starting > Wednesday (a full semester course) on Design Patterns using the Heads > First book. My query: do you have any ideas you might proffe

Re: [Edu-sig] Design patterns

2005-08-23 Thread Scott David Daniels
Arthur wrote: > If I am understanding "properties" mostly correctly, and in fact their > reason for being is to allow for a fundamental midstream redesign of a > program without alteration of that program's API, I am thinking something to > the effect that it is only possible to do the impossible i

[Edu-sig] Design patterns

2005-08-23 Thread Arthur
>> I guess. >> >> Though I can't say I find there to be much consensus out there about what >> language features truly make for robust software development from group >> or community efforts. >There's a long history of coders seeking consensus, but not arriving at any >set in stone answers (no

Re: [Edu-sig] Design patterns

2005-08-22 Thread Chuck Allison
Hello Kirby, Since this discussion has swerved a little, I'd like to pose a query. I've been using patterns since 1995 and am teaching a course starting Wednesday (a full semester course) on Design Patterns using the Heads First book. My query: do you have any ideas you might proffer for programmi

Re: [Edu-sig] Design patterns

2005-08-22 Thread Kirby Urner
> I guess. > > Though I can't say I find there to be much consensus out there about what > language features truly make for robust software development from group or > community efforts. There's a long history of coders seeking consensus, but not arriving at any set in stone answers (no carve

Re: [Edu-sig] Design patterns

2005-08-21 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > > A lot of these lessons about robust software development come from group > or > community efforts. Some aspects of Python maybe don't much excite you > because you're primarily a solo coder (as am I much of the time)

Re: [Edu-sig] Design patterns

2005-08-21 Thread Kirby Urner
> Why do I find this unsatisfying? > I think part of the picture is you're coding for yourself i.e. your APIs are used internally by your own code. Refactoring *everything* is always a possibility. Suppose you'd already published a Triangle class API and then discovered you needed more dynamism

Re: [Edu-sig] Design patterns

2005-08-21 Thread Kirby Urner
> Though when we add another dimension, all tetras are projectively > equivalent. Part of why I can't adjust to a focus on a tetra that happens > to be regular in some way. > > Art > Well, another way of putting it is: all tetrahedra are the same regular one, except not because of viewpoints.

Re: [Edu-sig] Design patterns

2005-08-21 Thread Scott David Daniels
Arthur wrote: > > As an API matter, I find myself liking the clue that "()" provides as to > whether one is accessing something designed be determined dynamically. In general I agree with that sentiment. > I find myself leaning towards the option of making the use of properties go > away in Py

Re: [Edu-sig] Design patterns

2005-08-21 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > > Good point about all triangles being equivalent given projection. In > nailing down the angles, we've inadvertently defined a fourth vertex: the > point of view. Given we're talking four vertices, we should maybe r

Re: [Edu-sig] Design patterns

2005-08-21 Thread Kirby Urner
> PyGeo has a Triangle object, inherited from the Plane object. It exists > mostly for drawing purposes, as the portion of the plane enclosed by the > infinite lines connecting any 3 points. Since all Triangles are > projectively equivalent, in the context of PyGeo there is little to be > gained

Re: [Edu-sig] Design patterns

2005-08-21 Thread Arthur
> -Original Message- > From: Kirby Urner [mailto:[EMAIL PROTECTED] > A weakness in the above design: we only check for violations of triangle > inequality in the constructor, yet allow changes to a,b,c through the API. Among my list of unsupportable theories is one to the effect that an

Re: [Edu-sig] Design patterns

2005-08-21 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Scott David Daniels > > I'd propose two reasons why properties are so successful. > > The first explanation comes from eXtreme Programming. One big goal of > XP is to stop wasting time doing "big de

Re: [Edu-sig] Design patterns

2005-08-21 Thread Kirby Urner
Scott: > def writeprop(viewvar): > '''decorator makes a property from access and a write method''' > def view(self): > return getattr(self, viewvar) > def buildprop(writemethod): > return property(view, writemethod) > return buildprop > Pretty fancy Scott and

Re: [Edu-sig] Design patterns

2005-08-21 Thread Scott David Daniels
Arthur wrote: >>What beyond sugar for leaving off a "()" when trying to retrieve a value >>from a method are we accomplishing by using properties? I have tended to >>look at properties mostly an accommodation to those coming from other >>languages which have something similar, but never as somethi

Re: [Edu-sig] Design patterns

2005-08-21 Thread Kirby Urner
Hi Arthur -- Yes, decorator syntax isn't designed to integrate with properties quite the same way. All a decorator does is run the subsequently defined function f2 through the f1 in @f1, rebinding f2 to the returned output of f1. E.g. 'f2 = f1(f2)' and '@f1; def f2(): pass' amount to the same

Re: [Edu-sig] Design patterns

2005-08-21 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Arthur > > What beyond sugar for leaving off a "()" when trying to retrieve a value > from a method are we accomplishing by using properties? I have tended to > look at properties mostly an accommoda

Re: [Edu-sig] Design patterns

2005-08-21 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Scott David Daniels > > Here's how to do the angles in 2.4 w/ properties: > > > @property > def A(self): > return math.acos((-self.a**2 + self.b**2 + self.c**2) >

Re: [Edu-sig] Design patterns

2005-08-19 Thread Kirby Urner
> Now you can do: > > t = Triangle(3,4,5) > t.c, math.degrees(t.C) > t.a/math.sin(t.A), t.b/math.sin(t.B), t.c/math.sin(t.C) > t.b = t.c = 3 > t.c, math.degrees(t.C) > t.a/math.sin(t.A), t.b/math.sin(t.B), t.c/math.sin(t.C) > > This takes advantage of the fact that

Re: [Edu-sig] Design patterns

2005-08-19 Thread Scott David Daniels
Kirby Urner wrote: > I’ve been thinking that a good way to introduce program design might involve > objects of type Triangle, i.e. instances of the Triangle class. > Anyway, here's a design question: do we want to compute the angles and > store them as properties at the time of construction, i.e.

Re: [Edu-sig] Design patterns

2005-08-19 Thread Arthur
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Kirby Urner > Sent: Friday, August 19, 2005 8:30 PM > To: edu-sig@python.org > Subject: [Edu-sig] Design patterns > > Anyway, here's a design question: do we want to c

[Edu-sig] Design patterns

2005-08-19 Thread Kirby Urner
I’ve been thinking that a good way to introduce program design might involve objects of type Triangle, i.e. instances of the Triangle class. >>> mytri = Triangle(3,4,5) >>> mytri.area 6.0 >>> mytri.C 90.0 Now isn’t it true that 3 sides uniquely determine a triangle *except* some triangles have ha