Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: What databases have taught me

Re: What databases have taught me

From: Keith H Duggar <duggar_at_alum.mit.edu>
Date: 30 Jun 2006 18:18:37 -0700
Message-ID: <1151716717.626787.218710@b68g2000cwa.googlegroups.com>


Robert Martin wrote:
> 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 ... You then
> asked me for the definition of "field", and I did not
> answer that (yet).
>
> So, in OO, a field is more often known as an instance
> variable. It is a variable within the data structure that
> holds the state of the object. When you copy an object,
> all it's fields get copied. When you store an object all
> of it's fields get stored. When you copy an object, 'this'
> is not copied. When you store an object 'this' is not
> stored.

Thanks for finally answering this. Now I understand why you hold that the behavior of 'this' is not field like. It just waan't clear to me what you meant originally. Had you said "the value of 'this' changes depending on function call /even when the object's state doesn't change/" then it would have made sense to me.

> When you copy an object, all it's fields get copied. When
> you store an object all of it's fields get stored.

Not necessarily. You can define copy behavior as you wish, at least in C++. For example, maybe part of the objects state is a temporary buffer that you don't want to share with another instance. Then when you copy the object you will allocate a new temporary buffer and thus the buffer pointer, for example, would not be copied.

Received on Fri Jun 30 2006 - 20:18:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US