[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: OOP sortof
From: steve donovan <steve.j.donovan () gmail ! com>
Date: 2010-12-30 7:45:26
Message-ID: AANLkTikZsVCbWT7TA_AHx9T1gRHtejUUh2qw1FRhQg8N () mail ! gmail ! com
[Download RAW message or body]
On Thu, Dec 30, 2010 at 9:20 AM, Dirk Laurie <dpl@sun.ac.za> wrote:
> Just why must x and y be private if you plan to provide read and
> write access to them?
Having had this moment with some Java[2] I was charged with sorting
out, I must agree. The classic answer is that a.x confuses
implementation with access, but _if_ a.x needs to invoke some code at
some later date, well then there's always the property pattern.[1]
A much bigger problem than classic privacy/implementation hiding is
not spelling a field name correctly, since this is not a runtime
error.
steve d.
[1] the table doesn't contain 'x', so __index will always fire, and
some code gets called; if we cannot find a field x try to call the
method get_x. Ditto for x/set_x.
[2] in any case with Java the IDEs are so good that you can find all
the references to a field and correct them very quickly. Technology
should trump ideology.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic