Re: [PW-dev] Properties - object variables vs. accessors
Status: Alpha
Brought to you by:
spadkins
From: James G S. <JG...@TA...> - 2001-06-11 17:20:12
|
Stephen Adkins <ste...@of...> wrote: >At 10:52 AM 6/11/2001 -0400, you wrote: >>I truly believe that we will end up going back and making all code use >>accessor functions. > >All code *outside* the class should *always* use accessor functions. >The only question to be resolved is whether code *inside* the class >(i.e. in other methods of the class) must obey this rule also. >In other words, we treat each attribute as though it is "private". Whether to use the direct hash value or the accessor function depends on a few things: (1) Is this the accessor function? Don't want too deep a recursion. (2) Do we want to value in the hash or the value of the attribute as seen by external objects? The default accessor might have some nice things like checking the state object or bounds checking that we may not want to maintain in multiple places. >I think that we leave the choice to whomever codes the class. Agreed. The internals of the class are not important as long as it behaves in the proper fashion (thinking as an end user here) -- that's what OOP is all about (kindof). -- James Smith <JG...@TA...>, 979-862-3725 Texas A&M CIS Operating Systems Group, Unix |