More design problems with the Android framework
I already blogged about the problems I encounter when programming for the Android plateform.
Well, my list gets is little bigger now!
Method names made by incompetents
Ce qui se conçoit bien s’énonce clairement;
et les mots pour le dire arrivent aisément. — Nicolas Boileau
And I think many programmers in the Android team don’t understand what they do when I see method or class names such as:
- interface OnErrorListener. The implenting class is a Listener for sure, but it is a listener of errors not a listener of onerrors. The interface should be called ErrorListener and have a method called onError(…) (the method is named correctly).
- methods getIsSyncable() and setIsSyncable. To Android developers: sure, automatic getter/setter generation saves time, but when you develop a public API, you should be careful about methods name. The getter/setter for boolean « is syncable » should be called isSyncable() and setSyncable(…).
MediaPlayer state is inaccessible
If you use MediaPlayer, you must follow meticulously its internal state, accordingly to the documented state machine. If you don’t, you’ll get an IllegalStateException.
That’s already a pain in the a$$ to pay attention to a state, but it is even worse when there is no way to get the state of the player! Your application need to maintain the MediaPlayer’s state by implementing various listeners…;