Subject: Re: HW2 Question
From: Nicole and Paul Freeman (freeberm@earthlink.net)
Date: Thu Oct 10 2002 - 08:08:35 EDT
Hi Sergei,
(Karl - Sergei had a question regarding local calls and static methods.
I was wondering if you would comment on my answer.)
First off, I'm not sure which part of homework 2 this question applies
to, but if it is part 2 we are not concerned with local calls to static
methods, only local calls to immediate part objects, i.e. instance
variables.
If you are asking how static methods are treated in general by the LoD:
I agree with what you wrote below that a call in method M1 (non static
method = M) of object O to method M2 of object O should definately be
treated as a local call. But where static methods (static method = SM)
are concerned, I think there are a couple of cases:
call from M1 in object O to SM1 in object O // seems to be ok
cal from SM1 in object O to M1 in object O // seems to be ok
call from SM1 in object O to SM2 in object O //again would seem to be
ok since it is in the same object (or class if using class form)
I think the question rises when we try to determine how we treat calls
from SM1 in object O1 to calls in SM3 of object O2. I would argue that
this is acceptable on the basis that static methods could be considered
"global" methods, as there is no need to instantiate an object to have
access to them. Since the spirit of the law is that we restrict our
knowledge of the structure of classes we don't need to directly know
about, I don't see a violation occurring when we are calling a method
that is designed to be globally known.
Karl, would you comment on this?
Thanks,
Paul
Kojarski Sergei wrote:
> Hi Paul,
>
> I just want to feel sure about "local call".
> I believe it is only a call from an
> object method to the method of the same object and NOT
> call of a static method from other static method.
> Is it true?
>
> Thanks,
> Sergei
This archive was generated by hypermail 2b28 : Thu Oct 10 2002 - 08:44:08 EDT