Re: Mixing OO and DB

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Thu, 6 Mar 2008 01:32:59 -0600
Message-ID: <2008030601325960298-unclebob_at_objectmentorcom>


On 2008-03-05 00:35:16 -0600, Marshall <marshall.spight_at_gmail.com> said:

> On Mar 4, 9:56 pm, Robert Martin <uncle..._at_objectmentor.com> wrote:

>> 1. We don't need a class for each, we need a method for each.

>
> What columns of the Employees table does Employees.find("Bob")
> fill in for the Employee class? If the table has ten columns, there
> are 1024 possibilities. Which one of them will you pick?

Which ever ones we need. I'm quite certain it will be fewer than 1024.

>> 2. We never need more methods than SQL statements.

>
> If the relationship is so close, then in what sense is any decoupling
> taking place?

A function has a name.
A function can be polymorphically dispatched.

-- 
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 Thu Mar 06 2008 - 08:32:59 CET

Original text of this message