Hehe :) Ok, I'll tell :-) It's attempt to (ab)use deprecated annotation in development process. I have to maintain piece of sh.. I mean, code that's awful -- sometimes I cry when I look at it, sometimes it's just really funny (i've attached sample to the bottom).
I am trying to change at least part of it to maintainable and if possible more efficient form. In process, I analyse code and "annotate" code by TODO comments. So in this context deprecated means "programmers are discouraged from using it, and it should be removed" :-P
If you wish to play with words :-) @Deprecated javadoc says: "
A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. ...so in my case it's bit not
typical usage of deprecated annotation. :-P
Promised piece of ill-defined code:
// Observe superb nameing convetion
/**
* Loads this panel with data
*/
public abstract boolean loadedElement(XMLElement el) throws Exception;
Wonder why it's not
haveHadLoadedElement(XMLElement). Function simply bind xml data to form but plain simple
bind(XMLElement) was too hard to write.
Now observe superless code:
// Should be like
class PropertyPanel {
protected XPDLElementEditor editor;
PropertyPanel(XPDLElementEditor editor) { }
}
But w/o knowledge of
super keyword and inheritance you create something like this:
public class PropertyPanel {
abstract public XPDLElementEditor getEditor();
abstract public void setEditor(XPDLElementEditor editor);
public class ActivityTransactionLink extends PropertyPanel {
private XPDLElementEditor editor;
public class ActivitysParticipant extends PropertyPanel {
private XPDLElementEditor editor;
public class ActualParamsPreviewPanel extends PropertyPanel {
private XPDLElementEditor editor;
public class AttributeActivityLink extends PropertyPanel {
private XPDLElementEditor editor;
public class AttributePreviewPanel extends PropertyPanel {
XPDLElementEditor editor;
public class AttributeTransactionLink extends PropertyPanel {
private XPDLElementEditor editor;
public class DeadlinePreview extends PropertyPanel {
XPDLElementEditor editor;
public class FormalParamsPreviewPanel extends PropertyPanel {
private XPDLElementEditor editor;
public class ProcessGeneralInfo extends PropertyPanel {
private XPDLElementEditor editor;
public class ProcessHeaderProperty extends PropertyPanel {
private XPDLElementEditor editor;
// And all other PropertyPanel childs
Suicide seems like reasonable option...
~~
Adam