[Nitro] OG vs Active Record
Mark Van De Vyver
mvyver at gmail.com
Thu Aug 23 19:42:57 EDT 2007
> > Is my understanding of the OG<->db relationship way off the mark to
> > observe that how much custom code is required will depend on how
> > sophisticated OG is in generating/processing SQL? This of course is a
> > function of how much development is done.
> I tend to see the 'write custom queries' as an optimization. When I
> need more speed, optimization is done.
Definitely. I've only dealt with a one simple type of directed graph,
some recent reading makes me think that SQL can be mapped quite well
(but not always perfectly/optimally) to OO concepts, then I saw the
OG::NestedSets, which I don't understand but am satisfied that OGs
approach makes it a bandwagon worth jumping on :)
> > Or is there something about mapping objects to db's that means it'll
> > never be possible to (efficiently) do the more sophisticated things?
> Well, the ORM can't go around 'guessing' your intentions. There must
> be a clever way to tell the ORM what exactly you need. Best is, for
> one purpose only 1 query, not 250.
Sure, by adopting some conventions the chances that OG 'gets it right'
are better. Correct? - I'm assuming Nitro/OG adopt the preference for
convention over configuration?
> The way on how to 'specify your needs' varies of course. I'm sure
> someone very clever will come up with a way to create a 'auto vew
> creator' using a special DSL and thus make it much more comfortable
> to 'specify your needs'.
> "I want this, then please join that table, add some information from
> "that, aggregrate some information and finally do some calculations
> "based on the results in a subquery."
> For more sophisticated SQL there is just more information needed, and
> where does that information come from if not from the programmer.
I may be wrong but my current understanding is that OG could
eventually 'acquire' some of that information from the database/or OGs
managed objects and their inter-relations. It wouldn't always be
optimal, but it could get quite sophisticated - right?
< snip >
> Sorry for the unhelpfulness of this post, it's really just ideas blabbered
> out loud.
No, this has been very helpful. I'll think a bout views a little more.
> Feel the love
More information about the Nitro-general