Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT Event class design


SWT's mission was to expose features of the OS in a cross-platform way while keeping the code as small and simple as possible.

The Event class is an example of a typical SWT "data" class, and it resembles the "struct" data type used in the OS code.
You can see examples in org.eclipse.swt.custom (which only uses SWT API calls) where Event fields are set, for example the event type is often set to SWT.None in order to stop further propagation of the event.

Other examples of this type of "data" class in SWT are FontData, ImageData, PaletteData, RGB, ...

Hope this helps,
Carolyn


From: petru lincu <gotopetru@xxxxxxxxx>
To: "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
Date: 31/01/2011 09:34 AM
Subject: Re: [platform-swt-dev] SWT Event class design
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx





I'm not referring to those brainless getters and setters that do nothing but expose the private member variables.
What I would like to know is why isn't there any consistency check for e.g. negative heights and wights or a diposed widget or invalid thread access, etc.

--- On Sun, 1/30/11, Jacob <doobnet@xxxxxxxxx> wrote:


From: Jacob <doobnet@xxxxxxxxx>
Subject: Re: [platform-swt-dev] SWT Event class design
To: "Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
Date: Sunday, January 30, 2011, 2:55 AM

Yes, but that would be the case if you had setters as well. If you only have getters then I see your point.

/Jacob Carlborg

On 28 jan 2011, at 23:36, Greg Brown wrote:

The fact that they are public fields means that anyone can modify them and change the nature of the event. Seems like an odd design to me, but maybe there is a reason for it.

On Jan 28, 2011, at 4:13 PM, Jacob wrote:

What would be the point to have methods if they just forward to the instance variables?

/Jacob Carlborg

On 28 jan 2011, at 11:21, petru lincu wrote:

Hi,

I would like to know what is the reason why Event class is designed with public fields instead of private with getters and setters methods.

Thanks and Best Regards,
Iulian


_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


-----Inline Attachment Follows-----

_______________________________________________
platform-swt-dev mailing list

platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top