Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Absurd OO Design Practice: Query Classes (http://www.velocityreviews.com/forums/t455657-absurd-oo-design-practice-query-classes.html)

faceman28208@yahoo.com 07-26-2006 08:05 PM

Absurd OO Design Practice: Query Classes
 
Over the past few years I have consulted on six large projects that all
independently arrived at the same moronic design desision: The use of
SQL query classes.

No, I don't mean a class hierararchy like:
SQL Query
UpdateQuery
SelectQuery
Where you hide the details of the underlying database API. (Along the
lines of what Rogue Wave does.)

I mean a system where there is a sepate and distinct class used for
every query in the system. [What next, have employee virtual classes
from which you derive a separate class for each employee?????]

All of these have systems employed home-brew code generators. You give
it a query and it generates a class with a bunch of set and get
members. None of these code generators were very sophisticated (e.g.
all used hand coded recursive-descent parsers). They varied in their
levels of capability. One of them could support joins but it took great
effort. Another supported joins but only inner joins. One was database
independent. The others were not.

The obvious theoretical problem from such an approach is the number of
possible queries is potentially [nearly] infinite. Thus, the number of
potential classes in the system is nearly infinite.

The obvious practical problems resulting from this approach included:
1. On all of these systems, most of the code was query classes. One
system had so many of them that it took two days to rebuild the
systems.
2. Each time the system needed a query, the developer either had to
concocted a new query class from the code generator or (even worse -
but more likely) they would piece together existing query classes to
get what they needed. Instead of one query with joins, you have nested
queries in the appllication. In investigating a performance problem in
one of these systems, it turned out the application was executing
400,000 queries where one would have sufficed. In several cases I found
code that walked through and counted rows in select queries rather than
doing "Count(*)".

Of course the "architects" for all of these systems were long gone
before the problems showed up.

So here's my question: Is there some source (book, magazine, etc.)
advocating such an approach to databases? It would strike me as an
unusual coincidence for so many projects at different companies to
independently arrive at the same stupid idea (and suffer the same
brutal consequences).


Howard 07-26-2006 08:08 PM

Re: Absurd OO Design Practice: Query Classes
 

<faceman28208@yahoo.com> wrote in message
news:1153944325.605719.99890@s13g2000cwa.googlegro ups.com...
> Over the past few years I have consulted on six large projects that all
> independently arrived at the same moronic design desision: The use of
> SQL query classes.


<snip>

And your C++ language question is...?



faceman28208@yahoo.com 07-26-2006 08:35 PM

Re: Absurd OO Design Practice: Query Classes
 

Howard wrote:
> <faceman28208@yahoo.com> wrote in message
> news:1153944325.605719.99890@s13g2000cwa.googlegro ups.com...
> > Over the past few years I have consulted on six large projects that all
> > independently arrived at the same moronic design desision: The use of
> > SQL query classes.

>
> <snip>
>


Pardon me, I just thought I heard a fart in the wind.


Default User 07-26-2006 09:23 PM

Re: Absurd OO Design Practice: Query Classes
 
faceman28208@yahoo.com wrote:


> Pardon me, I just thought I heard a fart in the wind.



*plonk*




Brian


All times are GMT. The time now is 07:25 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.