Absurd OO Design Practice: Query Classes

Discussion in 'C++' started by faceman28208@yahoo.com, Jul 26, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Howard Guest

    <> wrote in message
    news:...
    > 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...?
     
    Howard, Jul 26, 2006
    #2
    1. Advertising

  3. Guest

    Howard wrote:
    > <> wrote in message
    > news:...
    > > 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, 2006
    #3
  4. Default User Guest

    wrote:


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



    *plonk*




    Brian
     
    Default User, Jul 26, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    344
  2. John Carter
    Replies:
    1
    Views:
    138
  3. Neowulf
    Replies:
    4
    Views:
    126
  4. How absurd is this?

    , Aug 11, 2006, in forum: Ruby
    Replies:
    3
    Views:
    105
  5. Rcmn 73

    ruby sql-query good practice

    Rcmn 73, Feb 1, 2007, in forum: Ruby
    Replies:
    1
    Views:
    167
    Simon Kröger
    Feb 1, 2007
Loading...

Share This Page