View Single Post

  #4 (permalink)  
Old 11-10-2003, 10:24 PM
panu
Guest
 
Posts: n/a
Re: Name spaces in Dolphin...

cstb wrote:
>
> (3) In your code, always refer to
> transformer via the local method
>
> (self transformer) selectorWhatever
>



I think I see your point, but I'm not quite
convinced that the added encapsulation is
worth the added complexity (then again I may
not quite get what your example correctly) .

There's some added complexity in the above.
First of all every reference to a global/class
now gets longer (if I get you correctly, right?).

I've tried something similar over the years
but somehow the added encapsulation doesn't
seem to be worth the added complexity.

Whereas the rule "Instead of accessing a class
directly, always call a method that returns it"
seems to be *easy to grasp*, and *easy to remember*.


> ...
> Advantages: Encapsulates further, as client
> doesn't need to know the class
> side methods,


The above seems to indicate that I perhaps
didn't explain my intentions clearly.

I didn't say - nor was it my intention - that
the method should be a "class side" method at
all. Rather, I tried to indicate by the example
that it should be a method that one sends to
'self'. Sending something to self is the closest
thing to "encapsulation" I can think of.

Cheers
-Panu Viljamaa

Reply With Quote