On Nov 23, 9:35 am, Joseph LeBlanc <
cont...@jlleblanc.com> wrote:
> AFAIK, the query classes are there so that a) Joomla can be ported to other DBs in the future b) queries for things like pagination can be generated more easily.
Thank you for the answer, Joe. I don't yet know enough to speak
meaningfully about point #b, but I don't see how it accomplishes point
#a at all.
This is probably too late to matter, but doing query objects first
seems like it's the wrong way round if the goal is db portability. I
would have thought implementing PDO or something (anything!) similar
would have been first steps, sending the usual SQL queries to that,
and only *after* that is working start worrying about divergences from
normal SQL (which to my mind is the only reason for going in the
direction of query objects) and how to interface with the db layer.
(Implicit in this is the assumption that it's a waste of time and
energy for Joomla to build its own db transparency layer. Other people
get paid to do that, and doing it is *their* prime function, not
Joomla's, so we should leverage their work, rather than arrogantly
assume we can do their job for their db better than they can. We can
climb farther if we start by standing on their shoulders.) That way,
db portability for a large set of db's that use standard SQL gets
accomplished quickly, and the non-standard dbs are added later, after
the exceptions are known. It seems to me that until you know where the
exceptions are (which can only be found reliably by experimentation)
you can't begin to know what kind of special handling you'll need to
give query processing, and without that knowledge, any decisions made
about query processing are bound to be suboptimal.
The query methods contain no divergences from SQL, and significantly,
no provision for knowing where or if they must diverge, so the plan
must be to treat them as base objects, and extend them as necessary
for each db. Right? (Are there really that many dbs that diverge from
the SQL standard so much that this sort of elaborate structure is
necessary? It just seems like overkill in an already complex system to
build a class structure for which little if any need has been
demonstrated.)
I confess I've not been as deep in this for as long as most of you, so
I could be missing the point completely, but this seems to me like an
example of YAGNI (You Ain't Gonna Need It).
(In case you haven't noticed, I have a strong bias towards simplicity.
Complex systems designed as complex systems always fail, the more
complex the system the larger percentage of its time is spent in
failure mode instead of useful work. Successful complex systems were
designed as simple systems and grew to be complex. Reducing complexity
in systems increases their maintainability and usable life span;
increasing complexity almost always decreases both. I say "almost"
because there may possibly exist exceptions to that rule, but none
come to mind.)