Re: Mixing OO and DB
Date: Thu, 6 Mar 2008 01:51:53 -0600
Message-ID: <2008030601515328635-unclebob_at_objectmentorcom>
On 2008-03-05 01:16:34 -0600, topmind <topmind_at_technologist.com> said:
>
>
> Robert Martin wrote:
>>
>> I think that this:
>>
>> // Calculate Pay
>> Money pay = hours * rate;
>> int overtime = max(0, hours-40);
>> pay += overtime * overtimeRate;
>> if (flags && 0x02 == 1)
>> pay *= 1.02; // bump for union dues.
>>
>> is a lot hard to read than this:
>>
>> Money pay = calculatePay();
>>
> > No, because like a good newspaper you have the general idea after > reading the headline what's in the details. If you want to skip to the > next article you can.
I don't even want to *see* the details here. I only want to see them
lower down. What I want to see is the *essence* of the current
function, not all it's little fiddelty-bits.
A newspaper article does not make you skip over the details, it hides
>>> >>> The second often requires a lot of parameter maintenance
>>
>> No it doesn't because the second is inside an object where all the
>> variables are fields. That's one of the benefits of having objects.
>
> That has nothing to do with "objects".
So what? It's still true that all OO languages make this kind of thing simple. And it completely invalidates your point. You do not need lots of parameter maintenance if you are using objects.
>> So you simply don't believe in partitioning code at all. You'd rather
>> have one big monolith. Come now.
>
> No. I like a compromise.
There's no compromise in a function that's 50 lines long and indented 4 or 5 levels. A function like that *is* a monolith.
>> Dictated by a sense of discipline and professionalism. If we claim to
>> be professionals, we need to show it by being _neat_.
> Now you are going too far: it's a goddam PERSONAL PREFERENCE. Get off > your high horse!
I suppose some doctors personally prefer to not wash their hands before surgery. Their preferences are overridden by their professionalism, and by the needs of their patients.
-- 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:51:53 CET