[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: PUBLIC POLL: final static VARIABLE

From: Florin Iucha <florin_at_iucha.net>
Date: 2001-11-30 19:11:50 CET

On Fri, Nov 30, 2001 at 11:24:34AM -0600, Ben Collins-Sussman wrote:
>
> +1 direct variable access.
>
> Even though I'm only 28 years old, I feel like an ancient curmudgeon.
> I learned C++ ten years ago, and in those days we thought of instance
> objects as "structures with methods".

You thought it wrong. Take that book and quietly burn it before the OO
police knocks on your door.

"structures with methods" were a convenience ment to lure away people from
C into C++...

> But a class instance is still a
> *structure*.

No, it's not a structure. It's an opaque object that exhibits certain
behaviors.

> Why can't you look at the structure's fields? Why do we
> need to create the extra distance through accessor methods? I mean,
> if you don't want your fields mucked with, that's why we have
> 'private' variables in a class.

He was specifically refering to having "private" attributes that he
wanted to make public...

> Accessors are for returning
> information about private variables, or so I thought.

No! Accessors return the values of "properties". If it happens that the
property is implemented _now_ as an atribute, that's an implementation artifact
that might not be valid next year, when you need to look that up somewhere...

> But maybe Ruby and Java have done away with all that. I'm not up on
> the latest philosophies anymore. It seems that the extra formality
> would just get in the way.
>
> All I know is: in my day, we used class variables directly... and we
> LIKED it! ;-)

Did you mother know? :)

Public attributes would not pass through a code review in any organisation
I have been so far...

In our latest project we have adopted the Sun patterns for the XML parser
package: declare the interfaces for everything then write implementations for
them and provide access to the implementations via factory objects, so we can
replace implementations at any time. Just a thought...

florin

-- 
"If it's not broken, let's fix it till it is."
41A9 2BDE 8E11 F1C5 87A6  03EE 34B3 E075 3B90 DFE4

  • application/pgp-signature attachment: stored
Received on Sat Oct 21 14:36:50 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.