Official announcement of Java and the GPL
Shane Hathaway
shane at hathawaymix.org
Tue Nov 14 01:44:31 MST 2006
Michael Torrie wrote:
> Notice in C# to add a callback to an event, we use the following syntax:
> /* Connect the "clicked" signal of the button to our callback */
> button.Clicked += new EventHandler (callback);
>
> In Java it is:
> checkButton1.addListener(new ToggleListener() {
> public void toggleEvent(ToggleEvent event) {
> if (checkButton1.getState())
> checkButton3.setSensitive(false);
> else
> checkButton3.setSensitive(true);
> }
> });
FWIW, this illustrates why Java frequently turns out verbose.
("Noun-orientedness" is not it.) In Java it is necessary to assign a
name to concepts that need no name at all in more dynamic languages.
Here addListener is replaced with an operator in C#, ToggleListener is
represented by the function signature, and the use of the ToggleEvent is
probably optional. The current Java model frequently requires the
programmer to express things in an awkward way compared with other
languages.
However, with Sun's Java implementation going GPL, there's finally hope
for solving this stuff. Coders who want to improve Java no longer have
to feel like they're working for Sun without wages; now they can be part
of the established free software community and work toward a common
good. Very cool.
Shane
More information about the PLUG
mailing list