Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: RE: [platform-swt-dev] org.eclipse.swt.SWT

I can live with the facts that constants are used instead of methods
although they are not type safe (you can give any integer values and it
will accept). I think they wanted it because a native widget is created at
the same time we invoke the constructor. These native widgets need to be
initialized with the widget settings that cannot be changed at run-time. So
I guess they had no other options. Otherwise, they would end up duplicating
the same data in the Java side as on the native implementation.

But I still think its better to refactor the SWT now than later. They need
not change the values of the constants. Just move them to corresponding
classes. This would not be that difficult.



                                                                                                                  
                            "Goldbaum, Stephen"                                                                   
                        <Stephen.Goldbaum@lehma           To:  "'platform-swt-dev@xxxxxxxxxxx'"                   
                                         n.com>             <platform-swt-dev@xxxxxxxxxxx>                        
                        Sent by:                          cc:                                                     
                        platform-swt-dev-admin@           Subject:   RE: RE: [platform-swt-dev]                   
                        eclipse.org                         org.eclipse.swt.SWT                                   
                                                                                                                  
                                                                                                                  
                                                                                                                  
                            02/25/2003 10:52 PM                                                                   
                              Please respond to                                                                   
                               platform-swt-dev                                                                   
                                                                                                                  
                                                                                                                  


On the other hand, the whole constants/flag thing is pretty weak.  For one
thing, it's not clear by looking at a component class what properties it
supports.  You have to look at the JavaDocs to find out.  It's just plain
unwieldy trying to track down which SWT constants apply to which
components.
As components get extended and the API grows, this is just going to get
worse.

It would make sense to wrap all of these constants with set/get methods,
ala
JavaBeans.  I realize JavaBeans isn't supported in SWT but having
properties
declared via methods would make the users' lives much easier.  Under the
covers, the SWT programmers can still use the SWT constants to avoid
breaking existing code.


>>>>> Why does SWT class contain constants representing different concepts?
>>>>> SWT has constants for event, color, and even error messages! All
different
>>>>> concepts merged into one monolothic class. What was the design
rationale
>>>>> behind this?

>>I have made exactly the same reflection as yourself. But then I made a
>>second reflection. If you change that now, you break not only SWT itself
>>(the sources refer in million places to these constants) but equally well
>>all code built on top of SWT. We will have to live with this forever, I
>>guess.


------------------------------------------------------------------------------

This message is intended only for the personal and confidential use of the
designated recipient(s) named above.  If you are not the intended recipient
of this message you are hereby notified that any review, dissemination,
distribution or copying of this message is strictly prohibited.  This
communication is for information purposes only and should not be regarded
as an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers.  Email transmission cannot be guaranteed to
be secure or error-free.  Therefore, we do not represent that this
information is complete or accurate and it should not be relied upon as
such.  All information is subject to change without notice.


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









Back to the top