Re: What databases have taught me
Date: Sun, 2 Jul 2006 18:50:42 -0500
Message-ID: <2006070218504217709-unclebob_at_objectmentorcom>
On 2006-06-30 20:44:16 -0500, Chris Smith <cdsmith_at_twu.net> said:
> Robert Martin <unclebob_at_objectmentor.com> wrote:
>> I've looked over the thread you referenced above. You asked whether
>> 'this' and 'self' were kind of like fields in OO languages. I refuted
>> this by saying that, at least in C++, 'this' is not like a field,
>> because it's value depends on the method being called. If the method
>> of a base class is called then 'this' will point to the base class and
>> not to the class of the object itself. (This only matters in cases of
>> multiple inheritance). You then asked me for the definition of
>> "field", and I did not answer that (yet).
>
> I suppose they say "fools rush in...", so I'll prove that about myself
> now. :) (By which I mean, PMFJI.)
>
> I don't find it particularly compelling to distinguish this/self from
> instance fields in that way, especially since the distinction appeals
> primarily to implementation rather than the actual meaning of what's
> going on. I could very easily implement C++ in such a way that 'this'
> remains constant regardless of its static type in terms of the
> inheritance hierarchy. The only thing I'd lose is a bit of performance
> in metghod dispatch.
>> So, in OO, a field is more often known as an instance variable.
>
> Wouldn't it be quite the opposite? I've never heard a Smalltalker go
> on about instance variables.
-- 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 Mon Jul 03 2006 - 01:50:42 CEST