Re: What databases have taught me

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Fri, 30 Jun 2006 19:59:22 -0500
Message-ID: <2006063019592243658-unclebob_at_objectmentorcom>


On 2006-06-24 11:08:24 -0500, frebe73_at_gmail.com said:

> The main problem in OO enterprise applications is the desire to
> decouple SQL statements. This causes code bloats.

In those cases where it causes code bloat, it should not be done. In most cases that I have experience with, decoupling SQL causes a *reduction* in code.

> Another disadvantage is the fact that the number
> SQL statements should be limited and the the same statement should be
> reused in different contexts. This does not only creates problem
> writing the code, it causes performance problems.

I'm not sure I understand this. Typically one constructs an SQL statement from the arguments of some method call. Such construction is pretty simple.

> The fact that the
> result from the SQL query has to be mapped to a "domain object" also
> introduces numerous problems.

It can also solve some. Indeed, there is no rule that the result of a query must be mapped to an domain object. We do it when it makes sense.

-- 
Robert C. Martin (Uncle Bob)  | email: unclebob_at_objectmentor.com
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716                  |
Received on Sat Jul 01 2006 - 02:59:22 CEST

Original text of this message