Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Marker Interfaces

 
Mouli Velu
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why should we have the marker interfaces?
For example, we have 'Serializable' interface.
The object will be serialized only if the class is implementing serializable.
Why they have implemented in such a way that all the objects are not serializable.
Please give me an answer.
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is a little vague, so I'll make some assumptions.
Why "should" we have them? Quite simply, we shouldn't.
Why "do" we have them? Not all developers are of an expected level of competence, not even at Sun, not even JSR teams.
When will they go away? Sun has implemented annotations in the 1.5 language specification. Although this does not solve them problem of existing APIs that have purported this atrocity, it is at least an acknowledgement (even if inadvertant) of the issue. Prior to 1.5, metadata is best specified using contractual specification in English, or simply, javadoc.
e.g.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic