× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



From: Walden H. Leverich

Ah yes, opinion. <grin> Try telling the folks in the SWT development
team about accessing member variables.

Member variables vs. property getter/setter is somewhat opinion, yes.
But since I don't know SWT (and I'm not going to learn it :) why did
they do that? A property getter/setter provides you a _possibility_ of
changing/enhancing the get/set process at a later date, where direct
variable access locks you out of that. The only reason I can think of
for direct access is one of performance, but I'd think that any decent
JIT compiler would optimize out the trivial getters/setters anyway.

Oh no, no, no. They had to do this to reduce the bytecode footprint for
mobile devices (or something like that - after the third go 'round, my eyes
glazed over and I quit trying). Somebody on the list has repeated a quote
about "premature optimization" and that's the case here in spades.


Fair enough. And it is a style difference. The reason* I prefer the
opposite is that is it provides me a option down the line I don't
otherwise have. And actually all our business object property
getters/setters do more than a simple variable read/write anyway, so we
need that functionality.

And I'm not arguing about whether you should or shouldn't access member
variables; I prefer setters and getters myself. And while the getter is
pretty much a spelling issue (x = myvar *VS* x = getMyvar()), the setter is
a philosophical issue as well. Does "myvar = x" really indicate that you
are calling something as well as "setMyvar(x)"? That's up to you.

I guess I'm Old School on that; I like to see the invocation spelled out for
me. But that's purely a personal preference. What I do like is that if I
have to add a second parameter to the setter, I already have the code in
place and I just have to add the variable, whereas if I have to change the
"myvar = x" syntax, it's more of a change.


Brand New 2008 Joe Pluta...

Complete w/leather and that new car smell???? :)

Yeah, that's the smell... new leather... yeah.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.