Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » direct access to swt classes' fields(why most fields of swt classes are accessed directly instead of using getters?)
direct access to swt classes' fields [message #504794] Tue, 22 December 2009 17:24 Go to next message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
Hi,
maybe this is a really trivial question, but I don't understand why most classes of SWT (e.g., Point, Rectangular, PaintEvent,...) provide direct access to their members instead of using getters. While both using getters and direct access provide the same result, making a field public means there will be no way to change the way it is accessed. What is the design choice that lead this?
Re: direct access to swt classes' fields [message #504815 is a reply to message #504794] Tue, 22 December 2009 19:06 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6313
Registered: July 2009
Senior Member
Hi,

Though this might not be an authorotive answer here's my interpreation:
* Point, Rectangular are more like structs to pass a round multiple
values
* SWT tries to be as small as possible so there's no overhead needed
for such often access fields which might not be a problem in
Desktop-Envs but think of a paint event access in a embedded device.

Tom


Am 22.12.09 18:24, schrieb Luca Ferrari:
> Hi,
> maybe this is a really trivial question, but I don't understand why most
> classes of SWT (e.g., Point, Rectangular, PaintEvent,...) provide direct
> access to their members instead of using getters. While both using
> getters and direct access provide the same result, making a field public
> means there will be no way to change the way it is accessed. What is the
> design choice that lead this?
Previous Topic:best way of accessing the size of text between tabs on each line?
Next Topic:how to embed swt shell into native window
Goto Forum:
  


Current Time: Sun May 28 18:40:35 GMT 2017

Powered by FUDForum. Page generated in 0.03083 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software