Re: Mixing OO and DB
Date: Tue, 04 Mar 2008 10:14:32 -0400
> Robert Martin wrote:
>>On 2008-03-03 06:59:57 -0600, "David Cressey" <cressey73_at_verizon.net> said: >> >> >>>"Bob Bad Odor" <bbadour_at_pei.sympatico.ca> wrote in message >>>news:47cb2504$0$4034$9a566e8b_at_news.aliant.net.. >> >>>>>>Not if they are explanatory. Employee.find("Bob") is a lot easier to >>>>>>understand than Select * from Employee_Table where Name = 'Bob'; >>>> >>>>How exactly does Employee.find(string) inform the reader that the method >>>>will return a single employee with a matching name? People understand >>>>things better when they are informed. >> >>Well, if you think 'find' is not evocative enough, then you could call >>the function find_single_employee_matching_name("bob");
> Um, like what if there are zero Bob's or 200 Bob's in the actual
> system? Are you gonna arbitrarily pick one? If one does not
> understand what the data is, they may end up with such arbitrary
> decisions, driving the user nuts. (I think Microsoft Outlook has such
> logic *cough* in it.)
> Such issues tend to be situation-specific such that its not likely to
> be reusable as-is.
What's even more informative is to look at the verbiage. "Find" evokes images of movement going from place to place until one finds what one is looking for. Frankly, "finding" is not an important concept from either the problem domain or the solution domain and is all about "how" to do something.
A relational predicate on the other hand specifies "what" not "how". It's a much higher-level construct that is closer to the level of intent. In the end, it requires one only specify what is important in the problem domain and the solution domain. Received on Tue Mar 04 2008 - 15:14:32 CET