Re: Mixing OO and DB
From: Robert Martin <unclebob_at_objectmentor.com>
Date: Mon, 3 Mar 2008 19:21:17 -0600
Message-ID: <2008030319211770933-unclebob_at_objectmentorcom>
>> On 2008-02-28 10:36:03 -0600, topmind <topmind_at_technologist.com> said:
>>
>>
>> Not if they are explanatory. Employee.find("Bob") is a lot easier to
>> understand than Select * from Employee_Table where Name = 'Bob';
>
> You have to be kidding!
Date: Mon, 3 Mar 2008 19:21:17 -0600
Message-ID: <2008030319211770933-unclebob_at_objectmentorcom>
On 2008-03-02 14:30:45 -0600, "David Cressey" <cressey73_at_verizon.net> said:
> > "Robert Martin" <unclebob_at_objectmentor.com> wrote in message > news:2008030212474116807-unclebob_at_objectmentorcom...
>> On 2008-02-28 10:36:03 -0600, topmind <topmind_at_technologist.com> said:
>>
>>> >>>> >>>> Of course we can implement other kinds of 'find' methods. >>>> find_by_date, find_by_salary, etc, etc. Every different query we use >>>> on a regular basis, we can create a verb for in our DSL. That verb is >>>> a function call of some kind. >>> >>> Such only makes sense if you do the same kind of query in *multiple* >>> spots. One-usage wrappers are a waste of code in my opinion and just >>> creates tedious red-tape accessor clutter.
>>
>> Not if they are explanatory. Employee.find("Bob") is a lot easier to
>> understand than Select * from Employee_Table where Name = 'Bob';
>
> You have to be kidding!
Perhaps you'd rather see: get_employee("Bob"); That's fine with me. It's much easier to read than the corresponding SQL. No kidding.
-- 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 Tue Mar 04 2008 - 02:21:17 CET