Re: Mixing OO and DB
Date: Wed, 5 Mar 2008 23:58:54 -0800 (PST)
On Mar 5, 11:32 pm, Robert Martin <uncle..._at_objectmentor.com> wrote:
> On 2008-03-05 00:35:16 -0600, Marshall <marshall.spi..._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.
Or, we could just use straight SQL and not have to pick. And not have to write out all this code. The fact that you might not hit the upper bound of 1024 doesn't affect the fact that even having to address this issue at all is symptomatic of a problem.
> >> 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.
Oh, so you're going to have to write this plethora of methods *many* times each instead of just once. I forgot about that point: good one.
Marshall Received on Thu Mar 06 2008 - 08:58:54 CET