473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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).

Jul 26 '06 #1
3 1517

<fa**********@yahoo.comwrote in message
news:11*********************@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...?
Jul 26 '06 #2

Howard wrote:
<fa**********@yahoo.comwrote in message
news:11*********************@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.

Jul 26 '06 #3
fa**********@yahoo.com wrote:

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

*plonk*


Brian
Jul 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Roger Leigh | last post by:
I'm developing a library to allow interaction with an SQL database. Rows in the database are represented with by a user-defined row class with the following inheritance hierarchy: SigC::Object ...
2
by: Calvin | last post by:
I'm fairly new to programming, that said, I know how to 'program', but my question is about design. How big and what sort of objects should be stored in Session. I'm doing an e-commerce...
3
by: Crirus | last post by:
Hello again I have this issue. I need to design a game weapon. I made a base class Weapon Each weapon have: - range(max 1-16), - ToHit array of values that gives percent that should be...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
2
by: Simon Woods | last post by:
Hi I'm just working through (and learning) the standard GoF Design Pattern and the example of the Bridge pattern on http://www.dofactory.com/Patterns/PatternBridge.aspx#_self2 I notice at the...
1
by: dbarmer | last post by:
I have a unix database system that hold three tables, 254, 255, 256, and all are linked together by WO, CUST NO, LOC NO. This is for Unix Program Purposes Only. Duplication here is by design. So...
4
by: andrew.smith.cpp | last post by:
Whts the Design pattern of the Classes?
1
by: alipark | last post by:
hi, I am fairly newb to mysql, so excuse my silly question. I am working on a vbmysql application for a warehouse. Here I am importing an excel sheet to mysql which has weekly status of the...
1
by: rsmlmlb | last post by:
I need to create a query from 3 tables (client, work and accts recv). The client table has the unique id. The work table has wrkdte and the accounts receiveable has ardte. How can I pull the work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.