Re: Decouple SQL queries from class in OOP design
- From: Patrick May <pjm@xxxxxxx>
- Date: 10 Nov 2005 10:48:37 +0000
"Hongyu" <forward@xxxxxxxxxx> writes:
> To my knowledge, in OOP design it's not good to mix SQL queries with
> application codes in classes, because it limits the usability of the
> classes and bound them to the local database schema. But I am not
> sure what the best way is to decouple them.
A "good" OO design will typically focus more on behavior than on
state. Before deciding on a persistence solution, you need the
answers to a number of questions, including:
- How much information do you need to persist?
- What are your performance requirements?
- Do you control the database schema or does the database support
many systems across the enterprise?
- How do you see the persistence requirements changing over the
anticipated lifetime of your system?
> The method that I am using right now is to create a hash to store
> all the SQL statements and prepare them in the main program, then I
> will pass this hash as a variable to all the classes that are going
> to use it.
Have you looked at any existing OO-RDBMS mapping tools
appropriate for your combination of implementation language(s), OS,
and DBMS? Even if your requirements don't currently justify the cost
and expense of such a solution, you will learn how the problem has
been solved by others and can avoid reinventing the wheel.
Regards,
Patrick
------------------------------------------------------------------------
S P Engineering, Inc. | The experts in large scale distributed OO
| systems design and implementation.
pjm@xxxxxxx | (C++, Java, Common Lisp, Jini, CORBA, UML)
.
- References:
- Decouple SQL queries from class in OOP design
- From: Hongyu
- Decouple SQL queries from class in OOP design
- Prev by Date: Re: Decouple SQL queries from class in OOP design
- Next by Date: Re: Small Cohesive Objects - Configuration
- Previous by thread: Re: Decouple SQL queries from class in OOP design
- Next by thread: Re: Decouple SQL queries from class in OOP design
- Index(es):
Relevant Pages
|