Consider the case where we have two (or more) properties that appear
in a number of classes, such as a Point class:

class Point(db.Model):
  x = db.IntegerProperty()
  y = db.IntegerProperty()

I want a Circle class to have the members "center" and "radius," which
is a point and an integer; Square to have the members "topleft" and
"width", which is a point and an integer; Rectangle to have "topleft"
and "bottomright" which is two points; and so forth.

How should this family of classes be implemented?  It would be
possible to use ReferenceProperty, for example ...

class Circle(db.Model):
  center = db.ReferenceProperty(Point)
  radius = db.IntegerProperty()

... but I imagine there would be severe performance consequences.  It
would also be possible to use inheritance , for example ...

class Circle(Point):
  radius = db.IntegerProperty()

... but that woud confuse IsA and HasA relationships and be a mess for
classes with more than one Point.

With the ReferenceProperty implementation in the current API,
Circle.get() fetches the Point data, but Circle.put() [in my tests]
does not update the Point data.  If the Point data in a Circle object
is changed, I must [in my tests] invoke Point.put().

Is there another way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to