Saturday, September 19, 2009

What I like to happen in GWT APIs

In my year and half experience with GWT, one thing that constantly worrying me is the number of deprecated classes and methods. Below are few exmaples that I encountered in my GWT development experience.



Deprecated methods in FocusWidget :

addClickListener, addFocusListener, addKeyboardListener, addMouseListener, addMouseWheelListener, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener

Deprecated methods in FormPanel class :

addFormHandler, removeFormHandler

Deprecated Classes :

ClickListener, FocusListener, KeyboardListener, MouseListener, MouseWheelListener, FormHandler



Some times deprecated method is not just replaced by a new method. But in certain cases, the deprecated method is replaced by two or more methods.


For example, consider the addFormHandler() method of FormPanel. Now it is split into the below two methods.

* addSubmitCompleteHandler
* addSubmitHandler

This obviously paves path to the replacement of removeFormHandler method of FormPanel, by the following two methods.

* removeSubmitCompleteHandler
* removeSubmitHandler



Though there is that backward compatibility, so I don't need to replace the deprecated methods or classes immediately, I still don't want to see the name of the method, struck in the IDE. More over, in some cases, it becomes essential to replace the deprecated methods, because the new methods fix certain javascript issues caused by the deprecated methods. Though I'm still a huge fan and very passionate about GWT, I still wish a more solid persistent methods and classnames.