rubyhacker / gmail.com wrote: > George Moschovitis wrote: >>Why is Og intrusive? can you elaborate? > > > This is only my opinion. > > I dislike putting the metadata for my objects into the objects > themselves. > > As someone pointed out, if I "reopen" the class, it is a little > better, but I am still unconfortable this way. Here's a Devil's Advocate argument. It may have actual merit; I'm not entirely convinced. There was a time when people believed you could create distributed objects that would let you code as if all code was local, and move objects to different machines at will. You, the coder, did not have to do anything special when dealing with such objects. Just create an instance and invoke methods. But the reality is that sending message over the wire has a cost, and one really does need to keep this in mind when designing and working with distributed objects. Likewise for autopersisted objects. It might be nice if one could just use objects and have them magically saved/loaded with no special consideration from the coder, but since it has a real cost, the coder benefits from having at least some indication that this is what is happening. So, putting the metadata in the class definition is Good and Helpful because it alerts the coder to special conditions. It also makes more clear when some attributes are to be saved and others are transient. > > In addition, my memory of Og is that it encourages thinking in > database terms (like "has_many") -- true or not? Interesting. I don't see "has_many" as being database-centric, just a means for referring to some form of a relationship that can occur with or without any persistence mechanism. But maybe I've just become immune to the effects of certain words and phrases. > > What I want is: > > 1. To think in object (and persistence) terms, not database terms. > 2. To specify the minimum information necessary in order to marshal > each of my types. > 3. To store the metadata separately from my classes/objects so as to > minimize impact on them. (But probably not in a separate file.) > > Does that make any sense? It does, and this is one of the reasons I prefer Og to ActiveRecord. I can just code my objects without thinking in terms of a database, and migrate to a persistence mechanism, if and when I need one, with a few minor class-code annotations. That my class has explicit indicators of storage metadata is less of an issue for me, and is arguably a feature. James Britt -- http://www.ruby-doc.org - The Ruby Documentation Site http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys