Marker Interface

A synonym for TagInterface.

An idiom used in Java, and possibly other languages. It's an interface that indicates the class is meant or allowed to be used for a particular purpose. A classic example is the cloneable interface in Java. Classes that "implement Cloneable" (see below) can be copied using the clone() method.

 class Example implements Cloneable

There may be legitimate uses of this idiom, but treat it with caution. The use of a marker interface may well be a CodeSmell. (Evidence in favor: to detect a MarkerInterface, you must use Java's instanceof keyword, which is definitely a CodeSmell.)
Seems like MicroSoft DotNet has an IClonable interface which is never used. What's the point if I still have to use a method on the default interface? -- ThomasEyde


View edit of November 7, 2014 or FindPage with title or text search