On 1 Apr 2010, at 15:04, Jeff Schnitzer wrote:

or you've somehow registered a mapping (typically from Kind, but it
could be any synthetic field) to the java class ahead of time.  This
means that

You are making a classic premature optimization mistake.

Twig is built on the principal that it should work out of the box with *zero* configuration and then allow optimizations to increase performance after the application is up and running. According to this principal safe defaults are needed for many settings: all fields are indexed by default, all fields are stored by default and all references are stored as independent entities (c.f. embedded, parent or child entities).

The only String value that can uniquely identify a class with no "registration" is its fully qualified type name. I see no problem using that kind name as a sensible default. There is nothing special about it - its just a default that can be changed later. In fact I recommend defining a shorter name as an optimisation to save datastore space.

If you rename your class and want to keep the same data you will need to explicitly define the kind name for the class.

Your framework can't perform magic.

Actually it does contain a small bit of magic but it's not well documented.

A truly polymorphic query (of
which ancestor queries are one flavor) doesn't know the concrete type
of the object until it's fetched from the datastore.  If you don't
understand this, you haven't thought about the problem enough.

Chill Jeff... I've thought about the problem and so has Yasuo. I imagine this sensible default will eventually make its way into Objectify once you think about it some more :)

Now lets keep this in perspective: on my mac mini I can run about 3 million reflective calls to get a constructor in a second. I do not claim that enforced registration is bad for startup times - it is almost insignificant. Its just a pain in the ass when a default can handle it for you out-of-the-box.

John

--
You received this message because you are subscribed to the Google Groups "Google 
App Engine for Java" 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-java?hl=en.

Reply via email to